瀏覽代碼

评估项目登记查询优化、发票bug修复

lizhenhao 2 年之前
父節點
當前提交
00907d7fd6

+ 21 - 7
src/views/modules/cw/invoice/InvoiceFormTask.vue

@@ -14,6 +14,7 @@
           show-overflow
           show-footer
           ref="baseTable"
+          :key="baseKey"
           class="vxe-table-element"
           :data="inputForm.financeInvoiceBaseDTOList"
           style="margin-left: 5em"
@@ -464,6 +465,7 @@
             show-overflow
             show-footer
             ref="detailTable"
+            :key="detailKey"
             class="vxe-table-element"
             :data="inputForm.financeInvoiceDetailDTOList"
             style="margin-left: 5em"
@@ -567,6 +569,7 @@
             show-overflow
             show-footer
             ref="receivablesTable"
+            :key="receivablesKey"
             class="vxe-table-element"
             :data="inputForm.financeInvoiceReceivablesDTOList"
             style="margin-left: 5em"
@@ -708,7 +711,10 @@
         err: '',
         keyWatch: '',
         importVisible: false,
-        yesNoFlag: [{label: '否', value: '0'}, {label: '是', value: '1'}]
+        yesNoFlag: [{label: '否', value: '0'}, {label: '是', value: '1'}],
+        baseKey: '',
+        detailKey: '',
+        receivablesKey: ''
       }
     },
     financeInvoiceService: null,
@@ -860,7 +866,9 @@
             if (this.commonJS.isEmpty(this.inputForm.billingPeopleReal)) {
               this.inputForm.billingPeopleReal = JSON.parse(localStorage.getItem('user')).id
             }
-
+            if (this.commonJS.isEmpty(this.inputForm.financeInvoiceBaseDTOList)) {
+              this.inputForm.financeInvoiceBaseDTOList = []
+            }
             if (this.commonJS.isEmpty(this.inputForm.workAttachmentDtoList) || this.inputForm.workAttachmentDtoList.length === 0) {
               this.inputForm.workAttachmentDtoList = []
             }
@@ -879,7 +887,8 @@
                 this.inputForm.billingDate = this.moment(new Date()).format('YYYY-MM-DD')
               }
             }
-            if (!this.commonJS.isEmpty(this.status) && this.status === 'audit' && this.inputForm.financeInvoiceDetailDTOList.length === 0) {
+            if (!this.commonJS.isEmpty(this.status) && this.status === 'audit' && (this.commonJS.isEmpty(this.inputForm.financeInvoiceDetailDTOList) || this.inputForm.financeInvoiceDetailDTOList.length === 0)) {
+              this.inputForm.financeInvoiceDetailDTOList = []
               this.inputForm.financeInvoiceDetailDTOList.push({
                 code: '',
                 number: '',
@@ -1002,7 +1011,7 @@
             }
             acc = (acc + parseFloat(parseFloat(item.account).toFixed(2)))
           })
-          if (acc !== this.inputForm.account) {
+          if (parseFloat(acc).toFixed(2) !== parseFloat(this.inputForm.account).toFixed(2)) {
             this.loading = false
             this.$message.warning('发票明细中 “开票金额”总和 与发票详情中 “发票金额” 不等')
             throw new Error()
@@ -1124,9 +1133,12 @@
               return
             }
           }
-          this.$refs.baseTable.insert().then((data) => {
-            this.inputForm.financeInvoiceBaseDTOList.push(data)
-          })
+          this.$refs.baseTable.insertAt({})
+          this.inputForm.financeInvoiceBaseDTOList.push({})
+          this.baseKey = Math.random()
+          // this.$refs.baseTable.insert().then((data) => {
+          //   this.inputForm.financeInvoiceBaseDTOList.push(data)
+          // })
         }
         if (type === 'detail') {
           this.$refs.detailTable.insert().then((data) => {
@@ -1184,7 +1196,9 @@
               contractId: item.contractId,
               programId: item.id
             }
+            this.$refs.baseTable.insertAt(r)
             this.inputForm.financeInvoiceBaseDTOList.push(r)
+            this.baseKey = Math.random()
           }
         })
         this.$forceUpdate()

+ 21 - 7
src/views/modules/finance/invoice/InvoiceFormTask.vue

@@ -14,6 +14,7 @@
           show-overflow
           show-footer
           ref="baseTable"
+          :key="baseKey"
           class="vxe-table-element"
           :data="inputForm.financeInvoiceBaseDTOList"
           style="margin-left: 5em"
@@ -444,6 +445,7 @@
           show-overflow
           show-footer
           ref="detailTable"
+          :key="detailKey"
           class="vxe-table-element"
           :data="inputForm.financeInvoiceDetailDTOList"
           style="margin-left: 5em"
@@ -548,6 +550,7 @@
           show-overflow
           show-footer
           ref="receivablesTable"
+          :key="receivablesKey"
           class="vxe-table-element"
           :data="inputForm.financeInvoiceReceivablesDTOList"
           style="margin-left: 5em"
@@ -684,7 +687,10 @@
         err: '',
         keyWatch: '',
         importVisible: false,
-        yesNoFlag: [{label: '否', value: '0'}, {label: '是', value: '1'}]
+        yesNoFlag: [{label: '否', value: '0'}, {label: '是', value: '1'}],
+        baseKey: '',
+        detailKey: '',
+        receivablesKey: ''
       }
     },
     financeInvoiceService: null,
@@ -813,7 +819,9 @@
             if (this.commonJS.isEmpty(this.inputForm.financeInvoiceReceivablesDTOList) || this.inputForm.financeInvoiceReceivablesDTOList.length === 0) {
               this.inputForm.financeInvoiceReceivablesDTOList = []
             }
-
+            if (this.commonJS.isEmpty(this.inputForm.financeInvoiceBaseDTOList)) {
+              this.inputForm.financeInvoiceBaseDTOList = []
+            }
             if (this.commonJS.isEmpty(this.inputForm.type)) {
               this.inputForm.type = '1'
             }
@@ -845,7 +853,8 @@
                 this.inputForm.billingDate = this.moment(new Date()).format('YYYY-MM-DD')
               }
             }
-            if (!this.commonJS.isEmpty(this.status) && this.status === 'audit' && this.inputForm.financeInvoiceDetailDTOList.length === 0) {
+            if (!this.commonJS.isEmpty(this.status) && this.status === 'audit' && (this.commonJS.isEmpty(this.inputForm.financeInvoiceDetailDTOList) || this.inputForm.financeInvoiceDetailDTOList.length === 0)) {
+              this.inputForm.financeInvoiceDetailDTOList = []
               this.inputForm.financeInvoiceDetailDTOList.push({
                 code: '',
                 number: '',
@@ -968,7 +977,7 @@
             }
             acc = (acc + parseFloat(parseFloat(item.account).toFixed(2)))
           })
-          if (acc !== this.inputForm.account) {
+          if (parseFloat(acc).toFixed(2) !== parseFloat(this.inputForm.account).toFixed(2)) {
             this.loading = false
             this.$message.warning('发票明细中 “开票金额”总和 与发票详情中 “发票金额” 不等')
             throw new Error()
@@ -1086,9 +1095,12 @@
               return
             }
           }
-          this.$refs.baseTable.insert().then((data) => {
-            this.inputForm.financeInvoiceBaseDTOList.push(data)
-          })
+          this.$refs.baseTable.insertAt({})
+          this.inputForm.financeInvoiceBaseDTOList.push({})
+          this.baseKey = Math.random()
+          // this.$refs.baseTable.insert().then((data) => {
+          //   this.inputForm.financeInvoiceBaseDTOList.push(data)
+          // })
         }
         if (type === 'detail') {
           this.$refs.detailTable.insert().then((data) => {
@@ -1150,7 +1162,9 @@
               programId: item.id,
               location: item.location // 项目所在地
             }
+            this.$refs.baseTable.insertAt(r)
             this.inputForm.financeInvoiceBaseDTOList.push(r)
+            this.baseKey = Math.random()
           }
         })
         this.$forceUpdate()

+ 1 - 0
src/views/modules/finance/invoice/ProgramPageForm.vue

@@ -173,6 +173,7 @@
       },
       list () {
         this.loading = true
+        this.searchForm.showInvoiceFlag = '1'  // showInvoiceFlag = '1'时,查询关联发票的开票状态。showInvoiceFlag为其他值或者为空时,不查询
         this.programProjectListInfoService.list({
           'current': this.tablePage.currentPage,
           'size': this.tablePage.pageSize,