zhangdan 3 năm trước cách đây
mục cha
commit
bf832de785
1 tập tin đã thay đổi với 70 bổ sung65 xóa
  1. 70 65
      src/views/reportData/chainStockReport/list.vue

+ 70 - 65
src/views/reportData/chainStockReport/list.vue

@@ -139,9 +139,9 @@
         bordered>
         <!-- 直销天数 -->
         <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">
@@ -180,9 +180,9 @@ export default {
         productBrandSn: undefined, //  产品品牌
         productTypeSn1: '', //  产品分类1
         productTypeSn2: '', //  产品分类2
-        productTypeSn3: '' ,//  产品分类3
-        minUnsalableDays:undefined, //滞销天数最小值
-        maxUnsalableDays:undefined, //滞销天数最大值
+        productTypeSn3: '', //  产品分类3
+        minUnsalableDays: undefined, // 滞销天数最小值
+        maxUnsalableDays: undefined // 滞销天数最大值
       },
       labelCol: { span: 8 },
       wrapperCol: { span: 16 },
@@ -198,7 +198,7 @@ export default {
         { title: '原厂编码', dataIndex: 'productOrigCode', width: '16%', align: 'center', customRender: function (text) { return text || '--' } },
         { title: '可用库存数量(个)', dataIndex: 'currentStockQty', width: '14%', align: 'center', sorter: true, customRender: function (text) { return ((text || text == 0) ? text : '--') } },
         { title: '可用库存成本(¥)', dataIndex: 'currentStockCost', width: '14%', 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: '5%', align: 'center' }
       ],
       // 加载数据方法 必须为 Promise 对象
@@ -208,32 +208,37 @@ export default {
         this.spinning = true
         if (params.tenantId) {
           if (this.checkValueRange()) {
-          return reportStockList(params).then(res => {
-            let data
-            if (res.status == 200) {
-              data = res.data
-              // 总计
-              this.getCount(params)
-              const no = (data.pageNo - 1) * data.pageSize
-              for (var i = 0; i < data.list.length; i++) {
-                data.list[i].no = no + i + 1
+            console.log('====通过')
+            return reportStockList(params).then(res => {
+              let data
+              if (res.status == 200) {
+                data = res.data
+                // 总计
+                this.getCount(params)
+                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.disabled = false
-            }
-            this.spinning = false
-            return data
-          })
-        }else{
-           const _this = this
-          _this.disabled = false
-          _this.spinning = false
-          const data = {
-            pageNo: 1,
-            pageSize: 10,
-            list: [],
-            count: 0
+              this.spinning = false
+              return data
+            })
+          } else {
+            console.log('=======未登录')
+            const _this = this
+            return new Promise(function (resolve, reject) {
+              const data = {
+                pageNo: 1,
+                pageSize: 10,
+                list: [],
+                count: 0
+              }
+              _this.disabled = false
+              _this.spinning = false
+              resolve(data)
+            })
           }
-        }
         } else {
           const _this = this
           return new Promise(function (resolve, reject) {
@@ -289,25 +294,25 @@ export default {
       this.queryParam.maxUnsalableDays = this.queryParam.maxUnsalableDays > 999999999 ? 999999999 : this.queryParam.maxUnsalableDays
       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) {
+        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, '天数')
     },
     // 合计
     getCount (params) {
@@ -341,8 +346,8 @@ export default {
       this.queryParam.productTypeSn1 = ''
       this.queryParam.productTypeSn2 = ''
       this.queryParam.productTypeSn3 = ''
-      this.queryParam.minUnsalableDays=undefined, //滞销天数最小值
-      this.queryParam.maxUnsalableDays=undefined, //滞销天数最大值
+      this.queryParam.minUnsalableDays = undefined, // 滞销天数最小值
+      this.queryParam.maxUnsalableDays = undefined, // 滞销天数最大值
       this.productType = []
       this.$refs.ruleForm.resetFields()
       this.totalData = null
@@ -355,28 +360,28 @@ export default {
       if (params.tenantId) {
         this.exportLoading = true
         _this.spinning = true
-      stockExport(params).then(res => {
-        this.exportLoading = false
-        _this.spinning = false
-        if (res.type == 'application/json') {
-          var reader = new FileReader()
-          reader.addEventListener('loadend', function () {
-            const obj = JSON.parse(reader.result)
-            _this.$notification.error({
-              message: '提示',
-              description: obj.message
+        stockExport(params).then(res => {
+          this.exportLoading = false
+          _this.spinning = false
+          if (res.type == 'application/json') {
+            var reader = new FileReader()
+            reader.addEventListener('loadend', function () {
+              const obj = JSON.parse(reader.result)
+              _this.$notification.error({
+                message: '提示',
+                description: obj.message
+              })
             })
-          })
-          reader.readAsText(res)
-        } else {
-      downloadExcel(res, '连锁库存总表')
-        }
-      })}else{
+            reader.readAsText(res)
+          } else {
+            downloadExcel(res, '连锁库存总表')
+          }
+        })
+      } else {
         this.exportLoading = false
         _this.spinning = false
         this.$message.info('请选择连锁店')
         return false
-        
       }
     },
     //  详情