Просмотр исходного кода

解决钢材报表卡顿问题

luobang 2 лет назад
Родитель
Сommit
7f15a9e3c0

+ 1 - 1
build/utils.js

@@ -15,7 +15,7 @@ const devPathSrc = path.resolve(__dirname, '../../../src') // node_modules应用
 // ['index','appoint','configManager','homepage',''inward,'queue','RMS','sale','serviceManager','SporadicManage'
 //       统计报表       组织机构/系统管理 采购  仓储
 //  'statisticalReport','systemConfig','TMS','WMS','workFlow','ADMINISTRATORS']
-// let devModules = ['index', 'statisticalReport', 'inward']
+// let devModules = ['index', 'statisticalReport']
 let devModules = ['all']
 if (pathSrc.indexOf('node_modules') > -1) {
   devModules = require('../../../cors.js').devModules

+ 1 - 1
config/index.js

@@ -73,7 +73,7 @@ let proxyTable = {
   // 所有数据的请求域名地址
   '/api/v1': {
     target: 'http://172.16.33.166:80',
-    //target: 'http://localhost:8080',
+    // target: 'http://localhost:8080',
     // target: 'http://192.168.1.102:8080',
     ws: true,
     pathRewrite: {

+ 38 - 40
src/views/appoint/components/saleContract/saleOrderSteel.vue

@@ -50,14 +50,14 @@
           >
             <i class="upload2"></i>批量上传
           </el-button>
-           <el-button
+          <el-button
             type="primary"
             @click="batchDeleteFirst"
             v-if="activeName == 'first'"
           >
             <i class="upload2"></i>批量删除
           </el-button>
-           <el-button
+          <el-button
             type="primary"
             @click="batchDeleteSecond"
             v-if="activeName == 'second'"
@@ -359,7 +359,7 @@ export default {
       matSum1: null,
       matSum2: null,
       tableData: [],
-      secondList:[],
+      secondList: [],
       saleDateOfReceipt: null,
       //销售订单主表数据
       saleOrderList: [
@@ -819,10 +819,10 @@ export default {
         .post('/api/v1/ams/addSteelSaleOrderList', saleOrderListMap)
         .then(res => {
           if (res.data.code == '200') {
-            loading.close()
             this.getRequestUrl()
-            this.$message.success('新增销售订单成功!')
             this.tableData = []
+            loading.close()
+            this.$message.success('新增销售订单成功!')
           } else {
             this.$message.error(res.data.data)
             this.getRequestUrl()
@@ -1093,8 +1093,8 @@ export default {
         .then(res => {
           if (res.data.code == '200') {
             this.$message.success('上传成功')
-            loading.close()
             this.getRequestUrl()
+            loading.close()
           } else {
             this.$message.error('上传失败')
             loading.close()
@@ -1109,13 +1109,13 @@ export default {
       console.log(selection)
       this.batchReportList = []
       this.batchReportList = selection
-      console.log("firstList:",this.batchReportList)
+      console.log('firstList:', this.batchReportList)
     },
-    selectionChange2(selection){
+    selectionChange2(selection) {
       console.log(selection)
       this.secondList = []
       this.secondList = selection
-      console.log("secondList:",this.secondList)
+      console.log('secondList:', this.secondList)
     },
     refresh() {
       this.getRequestUrl()
@@ -1301,9 +1301,9 @@ export default {
         center: true
       })
         .then(() => {
-         let rows=[];
-         rows.push(scope);
-         this.batchDelete(rows);
+          let rows = []
+          rows.push(scope)
+          this.batchDelete(rows)
         })
         .catch(() => {
           this.$message({
@@ -1312,12 +1312,12 @@ export default {
           })
         })
     },
-    batchDeleteFirst(){
-      let rows=this.batchReportList;
-      console.log("rows:",rows);
-      if(!rows || rows.length<=0){
-        this.$message.warning("请选中订单!");
-        return;
+    batchDeleteFirst() {
+      let rows = this.batchReportList
+      console.log('rows:', rows)
+      if (!rows || rows.length <= 0) {
+        this.$message.warning('请选中订单!')
+        return
       }
       this.$confirm('是否删除', '提示', {
         confirmButtonText: '确定',
@@ -1326,7 +1326,7 @@ export default {
         center: true
       })
         .then(() => {
-         this.batchDelete(rows);
+          this.batchDelete(rows)
         })
         .catch(() => {
           this.$message({
@@ -1335,12 +1335,12 @@ export default {
           })
         })
     },
-    batchDeleteSecond(){
-      let rows=this.secondList;
-      console.log("rows:",rows);
-      if(!rows || rows.length<=0){
-        this.$message.warning("请选中订单!");
-        return;
+    batchDeleteSecond() {
+      let rows = this.secondList
+      console.log('rows:', rows)
+      if (!rows || rows.length <= 0) {
+        this.$message.warning('请选中订单!')
+        return
       }
       this.$confirm('是否删除', '提示', {
         confirmButtonText: '确定',
@@ -1349,7 +1349,7 @@ export default {
         center: true
       })
         .then(() => {
-         this.batchDelete(rows);
+          this.batchDelete(rows)
         })
         .catch(() => {
           this.$message({
@@ -1358,20 +1358,18 @@ export default {
           })
         })
     },
-    batchDelete(rows){
-       this.axios
-            .post(
-              '/api/v1/ams/deleteAmsSaleOrderBySaleOrderId',rows
-            )
-            .then(res => {
-              if (res.data.code == '200') {
-                this.$message.success('删除成功')
-                this.getRequestUrl()
-              } else {
-                this.$message.success('删除失败')
-                this.getRequestUrl()
-              }
-            })
+    batchDelete(rows) {
+      this.axios
+        .post('/api/v1/ams/deleteAmsSaleOrderBySaleOrderId', rows)
+        .then(res => {
+          if (res.data.code == '200') {
+            this.$message.success('删除成功')
+            this.getRequestUrl()
+          } else {
+            this.$message.success('删除失败')
+            this.getRequestUrl()
+          }
+        })
     }
   }
 }

+ 3 - 3
src/views/index/components/login.vue

@@ -227,9 +227,9 @@ export default {
                 })
               }
               this.loginBtnLoading = false
-              // setTimeout(() => {
-              //   this.$router.go(0);
-              // }, 2000);
+              setTimeout(() => {
+                this.$router.go(0)
+              }, 50)
             })
             .catch(() => {
               this.loginBtnLoading = false

+ 43 - 14
src/views/statisticalReport/components/salesLogisticsStatistics/saleSteelReports.vue

@@ -107,10 +107,11 @@
           >
         </el-form-item>
         <el-form-item>
-          <span style="margin-left: 1rem;font-size:16px">车数/件数:</span>
-          <span style="font-size:16px"
-            >{{ totalCapacity }}/{{ totalNumber }}</span
-          >
+          <label
+            class="el-form-item__label"
+            style="width: auto;font-size: 16px;line-height: auto;"
+            >车数/件数: {{ totalCapacity }}/{{ totalNumber }}
+          </label>
         </el-form-item>
       </el-form>
     </div>
@@ -125,8 +126,8 @@
         :height="maxHeight"
         :row-class-name="tableRowClassName"
         @cell-click="cellClik"
-        @cell-mouse-enter="cellMouse"
-        @cell-mouse-leave="cellLeave"
+        @cell-mouse-enter="cellMouse1"
+        @cell-mouse-leave="cellLeave1"
         @row-click="rowClick"
         :cell-style="cellStyle"
         @filter-change="filterChange"
@@ -637,7 +638,7 @@
             </div>
           </div>
         </div>
-        <div class="table">
+        <div class="table1">
           <el-table
             :data="steelMap.mapList"
             border
@@ -1229,6 +1230,12 @@ export default {
     this.updateTruckCarrierDebounce = this.debounce(() => {
       this.updateTruckCarrier()
     }, 3000)
+    this.cellMouse1 = this.debounce((row, column, cell) => {
+      this.cellMouse(row, column, cell)
+    }, 100)
+    this.cellLeave1 = this.debounce((row, column, cell) => {
+      this.cellLeave(row, column, cell)
+    }, 100)
     this.getSteelReport()
   },
   watch: {
@@ -1283,7 +1290,7 @@ export default {
       this.scrollTop = e.target.scrollTop
       setTimeout(() => {
         this.debounceS = false
-      }, 50)
+      }, 100)
     })
   },
   activated() {
@@ -1671,6 +1678,7 @@ export default {
       }
     },
     cellMouse(row, column, cell, event) {
+      console.log(row)
       if (this.isRowClick == 0) {
         this.tableRowIndex = row.group
       }
@@ -2409,10 +2417,6 @@ export default {
             data[i].group = data[i - 1].group + 1
           }
         }
-        this.totalCapacity = data[data.length - 1].group + 1
-        this.totalNumber = data.reduce(function(prev, item) {
-          return prev + item.materialNum
-        }, 0)
       }
     },
     objectSpanMethod({ row, column, rowIndex, columnIndex }) {
@@ -2425,6 +2429,18 @@ export default {
         }
       }
     },
+    //计算总件数和总车数
+    getTotalNum(data) {
+      //通过车序号的个数来计算车数
+      let arr = []
+      arr = data.map(e => {
+        return e.saleOrderMaterialId
+      })
+      this.totalCapacity = Array.from(new Set(arr)).length
+      this.totalNumber = data.reduce(function(prev, item) {
+        return prev + item.materialNum
+      }, 0)
+    },
     //减少物资件数
     updateBillOrder(row) {
       const loading = this.$loading({
@@ -2600,6 +2616,7 @@ export default {
             Math.floor(this.maxHeight / this.itemHeight) + 1
           )
           this.getSpanArr(this.visibleList)
+          this.getTotalNum(this.tableData)
           loading.close()
         })
     },
@@ -2688,6 +2705,7 @@ export default {
             Math.floor(this.maxHeight / this.itemHeight) + 1
           )
           this.getSpanArr(this.visibleList)
+          this.getTotalNum(this.tableData)
           loading.close()
         })
         .catch(() => {
@@ -2710,6 +2728,10 @@ export default {
     .el-tooltip {
       width: auto !important;
     }
+    /deep/ .el-table__body {
+      overflow-y: auto;
+      position: absolute !important;
+    }
     ::-webkit-scrollbar {
       // width: 20px;
       height: 20px;
@@ -2814,6 +2836,13 @@ export default {
         }
       }
     }
+    .table1 {
+      margin-left: 20px;
+      margin-top: 20px;
+      .el-tooltip {
+        width: auto !important;
+      }
+    }
   }
   .address {
     .button-box {
@@ -2824,11 +2853,11 @@ export default {
   }
 }
 </style>
-<style lang="scss">
+<!-- <style lang="scss">
 .el-table__body-wrapper {
   overflow-y: auto;
   .el-table__body {
     position: absolute;
   }
 }
-</style>
+</style> -->

+ 76 - 3
src/views/statisticalReport/components/salesLogisticsStatistics/unloadingSteelReports.vue

@@ -58,6 +58,20 @@
             >重新生成计划</el-button
           >
         </el-form-item>
+        <el-form-item>
+          <el-upload
+            class="upload-excel"
+            action=""
+            :on-change="exportEasEntry"
+            :show-file-list="false"
+            accept=".csv, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet, application/vnd.ms-excel"
+            :auto-upload="false"
+          >
+            <el-button type="primary" icon="el-icon-upload"
+              >导入金蝶分录查询</el-button
+            >
+          </el-upload>
+        </el-form-item>
         <el-form-item>
           <el-button type="primary" @click="refresh">
             <i class="el-icon-refresh"></i>
@@ -461,7 +475,8 @@ export default {
       ],
       saleDateOfReceipt: null,
       remarkDateNew: null,
-      remarkDateOld: null
+      remarkDateOld: null,
+      entryIdList: []
     }
   },
   created() {
@@ -482,10 +497,18 @@ export default {
     this.remarkDateOld = this.getRemarkDateOld()
     this.addSaleOrder1 = this.debounce(() => {
       this.addSaleOrder()
-    }, 3000)
+    }, 2000)
     this.getSteelReport()
   },
-  watch: {},
+  watch: {
+    tableData: {
+      handler(oldVal, newVal) {
+        this.filterListChange()
+      },
+      deep: true,
+      immediate: true
+    }
+  },
   computed: {},
   mounted() {
     this.$nextTick(() => {
@@ -513,6 +536,7 @@ export default {
         }, delay)
       }
     },
+    handleSelectionChange() {},
     //记录每一行的合并数
     getSpanArr(data) {
       //每次调用方法初始化
@@ -550,6 +574,55 @@ export default {
         }
       }
     },
+    exportEasEntry(file) {
+      let that = this
+      that.entryIdList = []
+      if (!file) {
+        that.$message({
+          message: '文件错误!',
+          type: 'warning'
+        })
+        return
+      }
+      this.entryIdList = []
+      var reader = new FileReader()
+      var data = null
+      var workbook = null
+      //设置读取操作
+      reader.onload = function(e) {
+        data = e.target.result
+        workbook = XLSX.read(data, {
+          type: 'binary'
+        })
+        let rows = XLSX.utils.sheet_to_json(
+          workbook.Sheets[workbook.SheetNames[0]]
+        ) //只取第一页
+        let arr = []
+        Array.from(rows).forEach(e => {
+          let map = {}
+          Object.keys(e).forEach(e1 => {
+            if (e1.includes('金蝶分录ID')) {
+              map.entryId = e[e1]
+              arr.push(map)
+            }
+          })
+        })
+        that.entryIdList = Array.from(
+          new Set(
+            arr.map(e => {
+              return e.entryId
+            })
+          )
+        )
+        console.log(that.entryIdList)
+        if (that.entryIdList.length > 0) {
+          let obj = {}
+          obj.entryIdList = that.entryIdList
+          that.onclick(obj)
+        }
+      }
+      reader.readAsBinaryString(file.raw) //以二进制方式读取
+    },
     addSaleOrder() {
       this.$confirm(
         `确定将所选${this.$refs.tableRef.selection.length}条分录重新上传金蝶?`,