Browse Source

bug 修复

lilei 3 years ago
parent
commit
4d07ec9979
2 changed files with 37 additions and 13 deletions
  1. 7 0
      src/components/Table/index.js
  2. 30 13
      src/views/reportData/chainStockReport/list.vue

+ 7 - 0
src/components/Table/index.js

@@ -145,6 +145,13 @@ export default {
       }))
       this.loadData()
     },
+    // 重置表格为空
+    clearTable(){
+      this.localDataSource = []
+      this.localPagination = Object.assign({}, {
+        current: 1, pageSize: this.pageSize, total: 0
+      })
+    },
     /**
      * 加载数据方法
      * @param {Object} pagination 分页选项器

+ 30 - 13
src/views/reportData/chainStockReport/list.vue

@@ -163,18 +163,35 @@ export default {
         this.disabled = true
         const params = Object.assign(parameter, this.queryParam)
         this.spinning = true
-        return reportStockList(params).then(res => {
-          // 总计
-          this.getCount(params)
-          const 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.spinning = false
-          return data
-        })
+        console.log(params, 'paramsparams')
+        if (params.targetName) {
+          return reportStockList(params).then(res => {
+            // 总计
+            this.getCount(params)
+            const 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.spinning = false
+            return data
+          })
+        } else {
+          const _this = this
+          return new Promise(function (resolve, reject) {
+            const data = {
+              pageNo: 1,
+              pageSize: 10,
+              list: [],
+              count: 0
+            }
+            _this.disabled = false
+            _this.spinning = false
+            _this.$message.info('请选择连锁店')
+            resolve(data)
+          })
+        }
       },
       productType: [],
       productBrandList: [], //  品牌下拉数据
@@ -220,7 +237,7 @@ export default {
       this.queryParam.productTypeSn3 = ''
       this.productType = []
       this.$refs.ruleForm.resetFields()
-      // this.$refs.table.refresh(true)
+      this.$refs.table.clearTable()
     },
     //  详情
     goDetail (row) {