ソースを参照

报销bug修复

lizhenhao 2 年 前
コミット
01382fb9b1

+ 70 - 39
src/views/modules/cw/reimbursementApproval/info/ReimbursementForm.vue

@@ -508,6 +508,7 @@
           :data="inputForm.amountInfos"
           style="margin-left: 5em"
           @cell-click=""
+          :key="amountKey"
           @edit-closed=""
           highlight-current-row
           :edit-config="{trigger: 'click', mode: 'row', showStatus: true, autoClear: true, icon:'_'}"
@@ -667,7 +668,8 @@
           purchaseId: '',
           departmentName: ''
         },
-        keyWatch: ''
+        keyWatch: '',
+        amountKey: ''
       }
     },
     ReimbursementApprovalService: null,
@@ -883,54 +885,83 @@
       // 新增
       async insertEvent (type) {
         if (type === 'detail') {
-          await this.$refs.detailTable.insert().then((data) => {
-            data.userName = JSON.parse(localStorage.getItem('user')).name
-            data.deptName = this.officeName
-            data.userId = JSON.parse(localStorage.getItem('user')).id
-            data.deptId = JSON.parse(localStorage.getItem('user')).officeDTO.id
-            this.inputForm.detailInfos.push(data)
-          })
+          let d = {
+            userName: JSON.parse(localStorage.getItem('user')).name,
+            deptName: JSON.parse(localStorage.getItem('user')).officeDTO.name,
+            userId: JSON.parse(localStorage.getItem('user')).id,
+            deptId: JSON.parse(localStorage.getItem('user')).officeDTO.id
+          }
+          if (this.commonJS.isEmpty(this.inputForm.detailInfos)) {
+            this.inputForm.detailInfos = []
+          }
+          this.$refs.detailTable.insertAt(d)
+          this.inputForm.detailInfos.push(d)
+          this.detailKey = Math.random()
         }
         if (type === 'amount') {
-          await this.$refs.amountTable.insert().then((data) => {
-            this.inputForm.amountInfos.push(data)
-          })
+          let d = {}
+          if (this.commonJS.isEmpty(this.inputForm.amountInfos)) {
+            this.inputForm.amountInfos = []
+          }
+          this.$refs.amountTable.insertAt(d)
+          this.inputForm.amountInfos.push(d)
+          this.amountKey = Math.random()
         }
         if (type === 'contract_detail') {
-          await this.$refs.detailTableContract.insert().then((data) => {
-            data.userName = JSON.parse(localStorage.getItem('user')).name
-            data.deptName = this.officeName
-            data.userId = JSON.parse(localStorage.getItem('user')).id
-            data.deptId = JSON.parse(localStorage.getItem('user')).officeDTO.id
-            this.inputForm.detailInfoContracts.push(data)
-          })
+          let d = {
+            userName: JSON.parse(localStorage.getItem('user')).name,
+            deptName: JSON.parse(localStorage.getItem('user')).officeDTO.name,
+            userId: JSON.parse(localStorage.getItem('user')).id,
+            deptId: JSON.parse(localStorage.getItem('user')).officeDTO.id
+          }
+          if (this.commonJS.isEmpty(this.inputForm.detailInfoContracts)) {
+            this.inputForm.detailInfoContracts = []
+          }
+          this.$refs.detailTableContract.insertAt(d)
+          this.inputForm.detailInfoContracts.push(d)
+          this.detailKeyContract = Math.random()
         }
         if (type === 'report_detail') {
-          await this.$refs.detailTableReport.insert().then((data) => {
-            data.userName = JSON.parse(localStorage.getItem('user')).name
-            data.deptName = this.officeName
-            data.userId = JSON.parse(localStorage.getItem('user')).id
-            data.deptId = JSON.parse(localStorage.getItem('user')).officeDTO.id
-            this.inputForm.detailInfoReports.push(data)
-          })
+          let d = {
+            userName: JSON.parse(localStorage.getItem('user')).name,
+            deptName: JSON.parse(localStorage.getItem('user')).officeDTO.name,
+            userId: JSON.parse(localStorage.getItem('user')).id,
+            deptId: JSON.parse(localStorage.getItem('user')).officeDTO.id
+          }
+          if (this.commonJS.isEmpty(this.inputForm.detailInfoReports)) {
+            this.inputForm.detailInfoReports = []
+          }
+          this.$refs.detailTableReport.insertAt(d)
+          this.inputForm.detailInfoReports.push(d)
+          this.detailKeyReport = Math.random()
         }
         if (type === 'others') {
-          await this.$refs.detailTableOthers.insert().then((data) => {
-            data.userName = JSON.parse(localStorage.getItem('user')).name
-            data.deptName = this.officeName
-            data.userId = JSON.parse(localStorage.getItem('user')).id
-            data.deptId = JSON.parse(localStorage.getItem('user')).officeDTO.id
-            this.inputForm.detailInfoOthers.push(data)
-          })
+          let d = {
+            userName: JSON.parse(localStorage.getItem('user')).name,
+            deptName: JSON.parse(localStorage.getItem('user')).officeDTO.name,
+            userId: JSON.parse(localStorage.getItem('user')).id,
+            deptId: JSON.parse(localStorage.getItem('user')).officeDTO.id
+          }
+          if (this.commonJS.isEmpty(this.inputForm.detailInfoOthers)) {
+            this.inputForm.detailInfoOthers = []
+          }
+          this.$refs.detailTableOthers.insertAt(d)
+          this.inputForm.detailInfoOthers.push(d)
+          this.detailKeyOthers = Math.random()
         }
         if (type === 'procured') {
-          await this.$refs.detailTableProcured.insert().then((data) => {
-            data.userName = JSON.parse(localStorage.getItem('user')).name
-            data.deptName = this.officeName
-            data.userId = JSON.parse(localStorage.getItem('user')).id
-            data.deptId = JSON.parse(localStorage.getItem('user')).officeDTO.id
-            this.inputForm.detailInfoProcured.push(data)
-          })
+          let d = {
+            userName: JSON.parse(localStorage.getItem('user')).name,
+            deptName: JSON.parse(localStorage.getItem('user')).officeDTO.name,
+            userId: JSON.parse(localStorage.getItem('user')).id,
+            deptId: JSON.parse(localStorage.getItem('user')).officeDTO.id
+          }
+          if (this.commonJS.isEmpty(this.inputForm.detailInfoProcured)) {
+            this.inputForm.detailInfoProcured = []
+          }
+          this.$refs.detailTableProcured.insertAt(d)
+          this.inputForm.detailInfoProcured.push(d)
+          this.detailKeyProcured = Math.random()
         }
       },
       // 暂存