فهرست منبع

修改接口缓存问题

achao 3 سال پیش
والد
کامیت
0fe39d1f57

+ 1 - 1
src/App.vue

@@ -1,6 +1,6 @@
 <template>
   <div id="app">
-    <router-view/>
+    <router-view v-if="isRouterAlive"/>
     <ws-common-loading v-if="isLoadding"></ws-common-loading>
     <!-- <rookie-training v-if="roles && roles.length"></rookie-training> -->
   </div>

+ 3 - 3
src/views/houseSelfCollect/component/routers/route.js

@@ -109,7 +109,7 @@ const houseSelfCollectRouter = {
         shortcutEntrance: 'houseSelfCollect',
         module: 'acquisitionManagement.acquisitionQuality.view',
         permissicon: [],
-        keepAlive:true
+        // keepAlive:true
       }
     },
     // // 检斤管理
@@ -137,7 +137,7 @@ const houseSelfCollectRouter = {
         shortcutEntrance: 'houseSelfCollect',
         module: 'acquisitionManagement.acquisitionWeight.view',
         permissicon: [],
-        keepAlive: true
+        // keepAlive: true
       }
     },
     // 付款管理
@@ -210,7 +210,7 @@ const houseSelfCollectRouter = {
       },
       hidden: true
     },
-   
+
     // 记录
     {
       path: 'weightCheckRecord',

+ 11 - 8
src/views/houseSelfCollect/inspectionManagementNew.vue

@@ -633,7 +633,7 @@
         value1:false,
       }
     },
-    activated() {
+    mounted() {
       this.selectWarehouse()
       var _saomaData = JSON.parse(localStorage.getItem('saoma_data'))
       if (_saomaData) { //缓存中有值,证明扫码进来的
@@ -659,12 +659,15 @@
         }
       }
     },
+    // activated() {
+
+    // },
     beforeDestroy() {
       if (this.timer) { //如果定时器还在运行 或者直接关闭,不用判断
         clearInterval(this.timer); //关闭
       }
     },
-    mounted() {},
+    // mounted() {},
     methods: {
       refreshClick(type) {
         let that = this
@@ -1712,7 +1715,7 @@
             })
             return
           }
-        
+
         //杂质
         this.deptBudgetList.warehouseInOutDetail.impurity =
           this.deptBudgetList.impurity
@@ -1744,7 +1747,7 @@
             })
             return
           }
-        
+
         //霉变
         this.deptBudgetList.warehouseInOutDetail.mildewGrain =
           this.deptBudgetList.mildewGrain
@@ -1776,7 +1779,7 @@
             })
             return
           }
-        
+
         this.deptBudgetList.warehouseInOutDetail.jiaorenli =
           this.deptBudgetList.jiaorenli
         //热损伤
@@ -1809,7 +1812,7 @@
             })
             return
           }
-        
+
         this.deptBudgetList.warehouseInOutDetail.imperfectGrain =
           this.deptBudgetList.imperfectGrain
         //不完善粒(%)
@@ -1841,7 +1844,7 @@
             })
             return
           }
-        
+
         //容重
         this.deptBudgetList.warehouseInOutDetail.bulkDensity =
           this.deptBudgetList.bulkDensity
@@ -1874,7 +1877,7 @@
             })
             return
           }
-        
+
       }
         this.deptBudgetList.warehouseInOutDetail.reWaterContent = this.deptBudgetList.reWaterContent
         if (this.deptBudgetList.reWaterContent) {

+ 87 - 86
src/views/houseSelfCollect/newWeighingManagement.vue

@@ -293,78 +293,77 @@
       BalanceAlert,
     },
     watch: {
-      // '$route'(to, from) {debugger
-      //   if (to.name == 'newWeighingManagement') {
-      //     debugger
-      //     this.isShowBalance = true
-      //     var _saomaData = JSON.parse(localStorage.getItem('saoma_data')) //判断是否扫码进来的
-      //     // }
-      //     //仓库
-      //     selectWarehouseSelf({
-      //         compId: localStorage.getItem('ws-pf_compId'),
-      //       })
-      //       .toPromise()
-      //       .then((response) => {
-      //         this.warehouseList = response
-      //         if (_saomaData) { //缓存中有值,证明扫码进来的
-      //           this.warehouseName = _saomaData.warehouseName
-      //           this.cangid = _saomaData.cangid
-      //           this.monitorUrl1 = _saomaData.monitorUrl1
-      //           this.monitorUrl2 = _saomaData.monitorUrl2
-      //           this.allowEdit = _saomaData.allowEdit
-      //           this.id = _saomaData.id
-      //           this.tpyeNo = _saomaData.typeNo
-      //           if (_saomaData.managementType) {
-      //             this.inWarehouseType = _saomaData.managementType
-      //           }
-
-      //           localStorage.removeItem('saoma_data'); //第一次进来结束后清除缓存
-      //         } else if (localStorage.getItem('houseSelfCollect_house1')) {
-      //           this.warehouseName = JSON.parse(localStorage.getItem('houseSelfCollect_house1')).value
-      //           for (var i = 0; i < response.length; i++) {
-      //             if (this.warehouseName == this.warehouseList[i].warehouseName) {
-      //               this.cangid = this.warehouseList[i].id
-      //               this.monitorUrl1 = this.warehouseList[i].monitorUrl1
-      //               this.monitorUrl2 = this.warehouseList[i].monitorUrl2
-      //               this.allowEdit = this.warehouseList[i].allowEdit
-      //               break
-      //             }
-      //           }
-      //         } else {
-      //           localStorage.setItem('houseSelfCollect_house1', JSON.stringify({
-      //             value: this.warehouseList[0].warehouseName,
-      //             warehouseId: this.warehouseList[0].id,
-      //             count: this.warehouseList[0].count,
-      //             No: this.warehouseList[0].commonWarehouseNo,
-      //             allowEdit: this.warehouseList[0].allowEdit,
-      //             compId: localStorage.getItem('ws-pf_compId')
-      //           }))
-      //           this.warehouseName = this.warehouseList[0].warehouseName
-      //           localStorage.setItem('ck', this.warehouseName)
-      //           this.cangid = this.warehouseList[0].id
-      //           this.allowEdit = this.warehouseList[0].allowEdit
-      //           this.monitorUrl1 = this.warehouseList[0].monitorUrl1
-      //           this.monitorUrl2 = this.warehouseList[0].monitorUrl2
-      //         }
-
-      //         this.deptBudgetList.warehouseName = this.warehouseName
-      //         if (this.allowEdit == 0) {
-      //           this.disabled = true
-      //         } else if (this.allowEdit == 1) {
-      //           this.disabled = false
-      //         }
-      //         if (this.tpyeNo == 1) {
-      //           this.information = '毛重'
-      //           this.weighingList.tare = 0
-      //         } else if (this.tpyeNo == 2) {
-      //           this.information = '皮重'
-      //         }
-      //         this.getList()
-      //       })
-
-      //   }
-
-      // },
+      '$route'(to, from) {
+        if (to.name == 'newWeighingManagement') {
+          this.isShowBalance = true
+          var _saomaData = JSON.parse(localStorage.getItem('saoma_data')) //判断是否扫码进来的
+          // }
+          //仓库
+          selectWarehouseSelf({
+              compId: localStorage.getItem('ws-pf_compId'),
+            })
+            .toPromise()
+            .then((response) => {
+              this.warehouseList = response
+              if (_saomaData) { //缓存中有值,证明扫码进来的
+                this.warehouseName = _saomaData.warehouseName
+                this.cangid = _saomaData.cangid
+                this.monitorUrl1 = _saomaData.monitorUrl1
+                this.monitorUrl2 = _saomaData.monitorUrl2
+                this.allowEdit = _saomaData.allowEdit
+                this.id = _saomaData.id
+                this.tpyeNo = _saomaData.typeNo
+                if (_saomaData.managementType) {
+                  this.inWarehouseType = _saomaData.managementType
+                }
+
+                localStorage.removeItem('saoma_data'); //第一次进来结束后清除缓存
+              } else if (localStorage.getItem('houseSelfCollect_house1')) {
+                this.warehouseName = JSON.parse(localStorage.getItem('houseSelfCollect_house1')).value
+                for (var i = 0; i < response.length; i++) {
+                  if (this.warehouseName == this.warehouseList[i].warehouseName) {
+                    this.cangid = this.warehouseList[i].id
+                    this.monitorUrl1 = this.warehouseList[i].monitorUrl1
+                    this.monitorUrl2 = this.warehouseList[i].monitorUrl2
+                    this.allowEdit = this.warehouseList[i].allowEdit
+                    break
+                  }
+                }
+              } else {
+                localStorage.setItem('houseSelfCollect_house1', JSON.stringify({
+                  value: this.warehouseList[0].warehouseName,
+                  warehouseId: this.warehouseList[0].id,
+                  count: this.warehouseList[0].count,
+                  No: this.warehouseList[0].commonWarehouseNo,
+                  allowEdit: this.warehouseList[0].allowEdit,
+                  compId: localStorage.getItem('ws-pf_compId')
+                }))
+                this.warehouseName = this.warehouseList[0].warehouseName
+                localStorage.setItem('ck', this.warehouseName)
+                this.cangid = this.warehouseList[0].id
+                this.allowEdit = this.warehouseList[0].allowEdit
+                this.monitorUrl1 = this.warehouseList[0].monitorUrl1
+                this.monitorUrl2 = this.warehouseList[0].monitorUrl2
+              }
+
+              this.deptBudgetList.warehouseName = this.warehouseName
+              if (this.allowEdit == 0) {
+                this.disabled = true
+              } else if (this.allowEdit == 1) {
+                this.disabled = false
+              }
+              if (this.tpyeNo == 1) {
+                this.information = '毛重'
+                this.weighingList.tare = 0
+              } else if (this.tpyeNo == 2) {
+                this.information = '皮重'
+              }
+              this.getList()
+            })
+
+        }
+
+      },
       weighingList: {
         //深度监听,可监听到对象、数组的变化
         handler(val, oldVal) {
@@ -498,19 +497,7 @@
         clearInterval(this.timer); //关闭
       }
     },
-    activated() {debugger
-      // if (!this.$route.query.grossWeight) {
-      //   this.$route.query.grossWeight = 0
-      // } else {
-      //   this.weighingList.grossWeight = this.$route.query.grossWeight
-      // }
-      // this.allowEdit = this.$route.query.allowEdit
-      // this.$route.query.automaticWeightAcquisition = 0
-      // if(this.$route.query.automaticWeightAcquisition == '1'){
-      // this.openPort()
-      // this.isShowBalance = true
-      // }
-      //  if (this.$route.query.automaticWeightAcquisition == '1') {
+    mounted() {
       this.isShowBalance = true
       var _saomaData = JSON.parse(localStorage.getItem('saoma_data')) //判断是否扫码进来的
       // }
@@ -576,6 +563,21 @@
           }
           this.getList()
         })
+    },
+    activated() {
+      // if (!this.$route.query.grossWeight) {
+      //   this.$route.query.grossWeight = 0
+      // } else {
+      //   this.weighingList.grossWeight = this.$route.query.grossWeight
+      // }
+      // this.allowEdit = this.$route.query.allowEdit
+      // this.$route.query.automaticWeightAcquisition = 0
+      // if(this.$route.query.automaticWeightAcquisition == '1'){
+      // this.openPort()
+      // this.isShowBalance = true
+      // }
+      //  if (this.$route.query.automaticWeightAcquisition == '1') {
+
 
 
     },
@@ -830,7 +832,6 @@
           .then((response) => {
             this.purchasePriceList = response
           })
-        debugger
         this.refreshClick(1)
         // getweighingList({
         //     compId: localStorage.getItem('ws-pf_compId'),