lilei 3 年之前
父節點
當前提交
4d8cc8f397
共有 1 個文件被更改,包括 64 次插入64 次删除
  1. 64 64
      src/views/inventoryManagement/inventoryQuery/list.vue

+ 64 - 64
src/views/inventoryManagement/inventoryQuery/list.vue

@@ -128,9 +128,9 @@
         </template>
         <!-- 直销天数 -->
         <template slot="unsalableDays" slot-scope="text, record" >
-          <span v-if="record.unsalableDays>=180&&record.unsalableDays<=360" style="color:#FF9900">{{num(record.unsalableDays)}}</span>
-          <span v-else-if="record.unsalableDays>360" style="color:#FF0000">{{num(record.unsalableDays)}}</span>
-          <span v-else >{{num(record.unsalableDays) }}</span>
+          <span v-if="record.unsalableDays>=180&&record.unsalableDays<=360" style="color:#FF9900">{{ num(record.unsalableDays) }}</span>
+          <span v-else-if="record.unsalableDays>360" style="color:#FF0000">{{ num(record.unsalableDays) }}</span>
+          <span v-else >{{ num(record.unsalableDays) }}</span>
         </template>
         <!-- 操作 -->
         <template slot="action" slot-scope="text, record">
@@ -182,9 +182,9 @@ export default {
         productTypeSn1: '', //  产品分类1
         productTypeSn2: '', //  产品分类2
         productTypeSn3: '', //  产品分类3
-        zeroQtyFlag: false ,//  库存情况
-        minUnsalableDays:undefined, //滞销天数最小值
-        maxUnsalableDays:undefined, //滞销天数最大值
+        zeroQtyFlag: false, //  库存情况
+        minUnsalableDays: undefined, // 滞销天数最小值
+        maxUnsalableDays: undefined // 滞销天数最大值
       },
       productTypeSn: [],
       exportLoading: false, // 导出loading
@@ -204,54 +204,54 @@ export default {
         { title: '产品分类', scopedSlots: { customRender: 'productTypeName' }, width: '13%', align: 'center' },
         { title: '可用库存数量(个)', dataIndex: 'currentStockQty', width: '8%', align: 'center', sorter: true, customRender: function (text) { return ((text || text == 0) ? text : '--') } },
         { title: '可用库存成本(¥)', dataIndex: 'currentStockCost', width: '8%', align: 'center', sorter: true, customRender: function (text) { return ((text || text == 0) ? text : '--') } },
-        { title: <div><a-tooltip placement='top' title='1:产品距离最近一次销售的时间,30天算一个月 2:采购退货,调拨等不算销售,不用来计算滞销天数'><a-icon type="question-circle" /></a-tooltip>&nbsp;滞销天数</div>, width: '10%', align: 'center', scopedSlots: { customRender: 'unsalableDays' },sorter: true,   },
+        { title: <div><a-tooltip placement='top' title='1:产品距离最近一次销售的时间,30天算一个月 2:采购退货,调拨等不算销售,不用来计算滞销天数'><a-icon type="question-circle" /></a-tooltip>&nbsp;滞销天数</div>, width: '10%', align: 'center', scopedSlots: { customRender: 'unsalableDays' }, sorter: true },
         { title: '操作', scopedSlots: { customRender: 'action' }, width: '10%', align: 'center' }
       ],
       // 加载数据方法 必须为 Promise 对象
       loadData: parameter => {
         // 查询条件有直销天数先校验滞销天数
         if (this.checkValueRange()) {
-        this.disabled = true
-        this.spinning = true
-        // 排序
-        if (parameter.sortField == 'currentStockQty') {
-          parameter.sortField = 'currentStockQty'
-          parameter.sortAlias = ''
-        }
-        if (parameter.sortField == 'currentStockCost') {
-          parameter.sortField = 'currentStockCost'
-          parameter.sortAlias = 'stock'
-        }
-        const params = Object.assign(parameter, this.queryParam)
-        if (params.zeroQtyFlag) {
-          params.zeroQtyFlag = '0'
-        } else {
-          params.zeroQtyFlag = ''
-        }
-        return stockList(params).then(res => {
-          let data
-          if (res.status == 200) {
-            data = res.data
-            const no = (data.pageNo - 1) * data.pageSize
-            for (var i = 0; i < data.list.length; i++) {
-              data.list[i].no = no + i + 1
-            }
-            this.disabled = false
-            // 总计
-            this.getTotal(params)
-            // 产品分类
-            if (this.typeData.length == 0) {
-              this.getProductType()
-            }
-            // 产品品牌
-            if (this.brandData.length == 0) {
-              this.getProductBrand()
-            }
+          this.disabled = true
+          this.spinning = true
+          // 排序
+          if (parameter.sortField == 'currentStockQty') {
+            parameter.sortField = 'currentStockQty'
+            parameter.sortAlias = ''
           }
-          this.spinning = false
-          return data
-        })
-        }else{
+          if (parameter.sortField == 'currentStockCost') {
+            parameter.sortField = 'currentStockCost'
+            parameter.sortAlias = 'stock'
+          }
+          const params = Object.assign(parameter, this.queryParam)
+          if (params.zeroQtyFlag) {
+            params.zeroQtyFlag = '0'
+          } else {
+            params.zeroQtyFlag = ''
+          }
+          return stockList(params).then(res => {
+            let data
+            if (res.status == 200) {
+              data = res.data
+              const no = (data.pageNo - 1) * data.pageSize
+              for (var i = 0; i < data.list.length; i++) {
+                data.list[i].no = no + i + 1
+              }
+              this.disabled = false
+              // 总计
+              this.getTotal(params)
+              // 产品分类
+              if (this.typeData.length == 0) {
+                this.getProductType()
+              }
+              // 产品品牌
+              if (this.brandData.length == 0) {
+                this.getProductBrand()
+              }
+            }
+            this.spinning = false
+            return data
+          })
+        } else {
           const _this = this
           this.disabled = true
           this.spinning = true
@@ -297,25 +297,25 @@ export default {
       return true
     },
     // 格式化滞销天数为几个月零几天
-    num(val){
+    num (val) {
       let days
-      if(val){
-        if(val>=30){
-          const a=Math.floor(val/30)
-            const b=val-a*30
-            if(b>0){
-              days=a+'个月'+b+'天'
-            }else{
-              days=a+'个月'
-            }
-          }else{
-            days=val+'天'
+      if (val != null && val != undefined) {
+        if (val >= 30) {
+          const a = Math.floor(val / 30)
+          const b = val - a * 30
+          if (b > 0) {
+            days = a + '个月' + b + '天'
+          } else {
+            days = a + '个月'
           }
-        }else{
-          days='--'
+        } else {
+          days = val + '天'
         }
+      } else {
+        days = '--'
+      }
       return days
-      console.log(days,'天数')
+      console.log(days, '天数')
     },
     //  重置
     resetSearchForm () {
@@ -330,8 +330,8 @@ export default {
       this.queryParam.productTypeName = undefined
       this.queryParam.zeroQtyFlag = false
       this.productTypeSn = []
-      this.queryParam.minUnsalableDays=undefined, //滞销天数最小值
-      this.queryParam.maxUnsalableDays=undefined, //滞销天数最大值
+      this.queryParam.minUnsalableDays = undefined, // 滞销天数最小值
+      this.queryParam.maxUnsalableDays = undefined, // 滞销天数最大值
       this.$refs.table.refresh(true)
     },
     // 合计