Переглянути джерело

1.优化机器设备测算表批量赋值时不触发@change事件导致无法自动计算

GouGengquan 5 місяців тому
батько
коміт
5c1f5f7b40

+ 18 - 0
src/router/index.js

@@ -272,6 +272,24 @@ const routes = [
                 },
               },
             ]
+          },
+          {
+            path: 'workbench/cr/calculate',
+            component: AssetsCRCalculateWorkbench,
+            name: 'assetsCRCalculateWorkbench',
+            meta: {
+              title: '文件夹'
+            },
+            children: [
+              {
+                path: 'baseInfo',
+                component: AssetsCRCalculateBaseInfo,
+                name: 'assetsCRCalculateBaseInfo',
+                meta: {
+                  title: '测算表基本信息'
+                },
+              }
+            ]
           }
         ],
       }

+ 1 - 1
src/views/assets/folder/child.vue

@@ -104,7 +104,7 @@ export default {
       if (this.projectStore.projectInfo.projectTypeName === '机器设备') {
         this.$router.push({ path: '/home/assets/workbench/eqpt/calculate/baseInfo', query: { projectId: this.projectInfo.projectId } })
       } else if (this.projectStore.projectInfo.projectTypeName === '债权') {
-        this.$router.push('/home/assets/workbench/cr/calculate/baseInfo')
+        console.log('跳转债权')
       }
     },
     createNewReport() {

+ 61 - 32
src/views/assets/workbench/eqpt/calculate/importInfo.vue

@@ -1258,7 +1258,7 @@ export default {
       handler() {
         // 数组变化开启自动保存
         this.startAutoSave()
-      }
+      },
     },
     // 监听 eqptImpPageData 的变化
     eqptImpPageData: {
@@ -1266,7 +1266,7 @@ export default {
       handler() {
         // 数组变化开启自动保存
         this.startAutoSaveImp()
-      }
+      },
     },
     // 监听 eqptNonSPageData 的变化
     eqptNonSPageData: {
@@ -1274,8 +1274,8 @@ export default {
       handler() {
         // 数组变化开启自动保存
         this.startAutoSaveNonS()
-      }
-    }
+      },
+    },
   },
   created() {
     this.getBaseInfo()
@@ -1292,8 +1292,8 @@ export default {
         // 激活倒计时
         this.autoSaveTimer = setTimeout(() => {
           // 倒计时结束,执行方法
-          this.autoSaveTimer = null;
-          this.autoSaveBatch();
+          this.autoSaveTimer = null
+          this.autoSaveBatch()
         }, this.countdownDuration)
       }
     },
@@ -1306,8 +1306,8 @@ export default {
         // 激活倒计时
         this.autoSaveImpTimer = setTimeout(() => {
           // 倒计时结束,执行方法
-          this.autoSaveImpTimer = null;
-          this.autoSaveBatchImp();
+          this.autoSaveImpTimer = null
+          this.autoSaveBatchImp()
         }, this.countdownDuration)
       }
     },
@@ -1320,8 +1320,8 @@ export default {
         // 激活倒计时
         this.autoSaveNonSTimer = setTimeout(() => {
           // 倒计时结束,执行方法
-          this.autoSaveNonSTimer = null;
-          this.autoSaveBatchNonS();
+          this.autoSaveNonSTimer = null
+          this.autoSaveBatchNonS()
         }, this.countdownDuration)
       }
     },
@@ -1368,30 +1368,30 @@ export default {
       // tab切换时保存测算信息销毁计时器
       if (this.activeName === 'all') {
         this.getEqptDataPage()
-        clearTimeout(this.autoSaveImpTimer);
-        this.autoSaveImpTimer = null;
-        clearTimeout(this.autoSaveNonSTimer);
-        this.autoSaveNonSTimer = null;
-        this.autoSaveBatchImp();
-        this.autoSaveBatchNonS();
+        clearTimeout(this.autoSaveImpTimer)
+        this.autoSaveImpTimer = null
+        clearTimeout(this.autoSaveNonSTimer)
+        this.autoSaveNonSTimer = null
+        this.autoSaveBatchImp()
+        this.autoSaveBatchNonS()
       }
       if (this.activeName === 'imported') {
         this.getImpEqptDataPage()
-        clearTimeout(this.autoSaveTimer);
-        this.autoSaveTimer = null;
-        clearTimeout(this.autoSaveNonSTimer);
-        this.autoSaveNonSTimer = null;
-        this.autoSaveBatch();
-        this.autoSaveBatchNonS();
+        clearTimeout(this.autoSaveTimer)
+        this.autoSaveTimer = null
+        clearTimeout(this.autoSaveNonSTimer)
+        this.autoSaveNonSTimer = null
+        this.autoSaveBatch()
+        this.autoSaveBatchNonS()
       }
       if (this.activeName === 'nonStandard') {
         this.getNonSEqptDataPage()
-        clearTimeout(this.autoSaveImpTimer);
-        this.autoSaveImpTimer = null;
-        clearTimeout(this.autoSaveTimer);
-        this.autoSaveTimer = null;
-        this.autoSaveBatchImp();
-        this.autoSaveBatch();
+        clearTimeout(this.autoSaveImpTimer)
+        this.autoSaveImpTimer = null
+        clearTimeout(this.autoSaveTimer)
+        this.autoSaveTimer = null
+        this.autoSaveBatchImp()
+        this.autoSaveBatch()
       }
     },
     // 新增机器设备信息
@@ -1523,10 +1523,10 @@ export default {
               message: '数据载入成功!',
               type: 'success',
             })
-            this.autoSaveAtive = true;
+            this.autoSaveAtive = true
           })
         }
-        this.getEqptLifeIfrRefs();
+        this.getEqptLifeIfrRefs()
       })
     },
     // 分页查询进口设备信息
@@ -1548,7 +1548,7 @@ export default {
               message: '数据载入成功!',
               type: 'success',
             })
-            this.autoSaveImpAtive = true;
+            this.autoSaveImpAtive = true
           })
         }
       })
@@ -1572,7 +1572,7 @@ export default {
               message: '数据载入成功!',
               type: 'success',
             })
-            this.autoSaveNonSAtive = true;
+            this.autoSaveNonSAtive = true
           })
         }
         this.getEqptGnEvpList()
@@ -2041,6 +2041,35 @@ export default {
           // 动态赋值,属性名由变量 propName 指定
           item[propName] = value
         })
+        // 主要是解决批量赋值时对应的@change事件不触发
+        switch (propName) {
+          // 批量赋值给作价方法的特殊处理
+          case 'valuationMethod':
+            if (value === '物价指数调整法') {
+              this.eqptPageData.forEach((item) => {
+                // 动态赋值,属性名由变量 propName 指定
+                const date = new Date(item.purchaseDate)
+                let year = date.getFullYear().toString()
+                const params = { ppiName: null, ppiType: null }
+                params.ppiName = year
+                params.ppiType = '通用设备制造业'
+                getPPIByNameType(params).then((res) => {
+                  if (res.data && res.data.ppi) {
+                    item.inquiryBasis = '(' + res.data.id + ')' + res.data.ppiName + '年:' + res.data.ppi
+                    this.countPrice(item)
+                  }
+                })
+              })
+            }
+            break
+          // 经济使用年限和尚可使用年限
+          case 'economicServiceLife':
+          case 'remainingUsefulLife':
+            this.eqptPageData.forEach((item) => {
+              this.countDepreciationRate(item);
+            })
+            break
+        }
       }
       if (this.activeName === 'imported') {
         this.eqptImpPageData.forEach((item) => {