Browse Source

财务-bug修改

wangqiang 2 years ago
parent
commit
5d79b0b36d

+ 19 - 1
src/views/modules/cw/reimbursementApproval/info/InfoForm.vue

@@ -61,7 +61,9 @@
         <el-row  :gutter="15" >
           <vxe-table
             border
+            show-footer
             show-overflow
+            :footer-method="footerMethod"
             ref="detailTable"
             class="vxe-table-element"
             :data="inputForm.detailInfos"
@@ -69,7 +71,7 @@
             @cell-click=""
             @edit-closed=""
             highlight-current-row
-            :edit-config="{trigger: 'click', mode: 'cell', showStatus: true, autoClear: true}"
+            :edit-config="{trigger: 'click', mode: 'row', showStatus: false, autoClear: true, icon: '-'}"
           >
             <vxe-table-column field="userName" title="报销人" :edit-render="{}">
               <template v-slot:edit="scope">
@@ -191,6 +193,7 @@
   // import ReimbursementService from '@/api/sys/ReimbursementService'
   import ReimbursementApprovalService from '@/api/cw/reimbursementApproval/ReimbursementApprovalService'
   import UpLoadComponent from '@/views/common/UpLoadComponent'
+  import XEUtils from 'xe-utils'
   export default {
     data () {
       return {
@@ -265,6 +268,21 @@
           }
         })
       },
+      footerMethod ({ columns, data }) {
+        const footerData = [
+          columns.map((column, columnIndex) => {
+            if (columnIndex === 0) {
+              return '总报销费用'
+            }
+            if (['number'].includes(column.property)) {
+              // eslint-disable-next-line no-undef
+              return XEUtils.sum(data, column.property)
+            }
+            return null
+          })
+        ]
+        return footerData
+      },
       // 表单提交
       doSubmit () {
         this.$refs['inputForm'].validate((valid) => {

+ 33 - 16
src/views/modules/cw/workContract/ContractRegistrationForm.vue

@@ -662,33 +662,50 @@
         let _this = this
         // eslint-disable-next-line no-unused-vars
         let _list = list
+        let _num = 0
         const waitForEach = function () {
           return new Promise(function (resolve, reject) {
-            _this.inputForm.cwWorkClientContactDTOList.forEach((client, index) => {
-              if (_this.inputForm.customerNo === client.no) {
-                _this.$refs.contactTable.remove(client)
-                _this.inputForm.cwWorkClientContactDTOList.splice(index, 1)
-                // _this.$message.error('已存在客户 “' + client.name + '”,请重新选择')
-                // throw new Error('已存在客户 “' + client.name + '”,请重新选择')
-              }
-            })
-            resolve()
+            if (_this.commonJS.isEmpty(_this.inputForm.cwWorkClientContactDTOList)) {
+              resolve()
+            } else {
+              _this.inputForm.cwWorkClientContactDTOList.forEach((client, index) => {
+                if (_this.inputForm.customerNo === client.no) {
+                  _this.$refs.contactTable.remove(client)
+                  _this.inputForm.cwWorkClientContactDTOList.splice(index, 1)
+                }
+              })
+              setTimeout(() => {
+                resolve()
+              }, 400)
+            }
           })
         }
         waitForEach().then(() => {
-          // eslint-disable-next-line no-unused-vars
-          let item = {
-            no: list.no,
-            name: list.name
-          }
-          // console.log('list', list)
           this.inputForm.customerNo = list.no
           this.inputForm.uscCode = list.uscCode
           this.inputForm.address = list.address
           this.inputForm.customerId = list.id
-          this.inputForm.cwWorkClientContactDTOList.push(item)
           this.inputForm.clientContacts = list.name
           this.inputForm.clientContactsPhone = list.mobile
+          const wait = function () {
+            return new Promise(function (resolve, reject) {
+              _this.inputForm.cwWorkClientContactDTOList.forEach(client => {
+                if (_list.no === client.no) {
+                  _num = 1
+                }
+              })
+              setTimeout(() => {
+                resolve()
+              }, 100)
+            })
+          }
+          wait().then(() => {
+            if (_num === 0) {
+              this.inputForm.cwWorkClientContactDTOList.push({no: list.no, name: list.name})
+              this.$refs.contactTable.insertAt({no: list.no, name: list.name})
+              this.tableKeyClient = Math.random()
+            }
+          })
         })
       },
       // 表单提交