Parcourir la source

客户基本信息联动开票信息

lizhenhao il y a 2 ans
Parent
commit
a32a0257a4

+ 27 - 1
src/views/modules/cw/workClientInfo/WorkClientAddForm.vue

@@ -537,7 +537,7 @@
             <el-tab-pane  label="开票信息" name="billing">
               <span slot="label"><span style="color: red;border-top: 20px">*</span> 开票信息</span>
               <el-row :gutter="15">
-                <el-button type="primary" style="margin-bottom: 15px" size="mini" :disabled="status === 'audit' || status === 'taskFormDetail'" @click="insertEvent('billing')">
+                <el-button type="primary" style="margin-bottom: 15px" size="mini" :disabled="status === 'audit' || status === 'taskFormDetail' || commonJS.isEmpty(inputForm.cwWorkClientBillingDTOList)" @click="insertEvent('billing')">
                   新增开票信息
                 </el-button>
               </el-row>
@@ -1219,12 +1219,35 @@
       rowStyle (event) {
         return 'cursor:pointer;'
       },
+      startBillingDTOList () {
+        if (this.commonJS.isEmpty(this.inputForm.cwWorkClientBillingDTOList)) {
+          this.inputForm.cwWorkClientBillingDTOList = []
+          let d = {
+            companyName: this.inputForm.name,
+            account: '',
+            accountHolder: '',
+            address: '',
+            isTaxpayerIdentificationNo: this.inputForm.isUscCode,
+            phone: '',
+            taxpayerIdentificationNo: this.inputForm.isUscCode === '1' ? this.inputForm.uscCode : '',
+            disabledTaxpayerIdentificationNo: true
+          }
+          this.$refs.billingTable.insertAt(d)
+          this.inputForm.cwWorkClientBillingDTOList.push(d)
+          this.tableKeyBilling = Math.random()
+        } else {
+          this.inputForm.cwWorkClientBillingDTOList[0].companyName = this.inputForm.name
+          this.inputForm.cwWorkClientBillingDTOList[0].isTaxpayerIdentificationNo = this.inputForm.isUscCode
+          this.inputForm.cwWorkClientBillingDTOList[0].taxpayerIdentificationNo = this.inputForm.isUscCode === '1' ? this.inputForm.uscCode : ''
+        }
+      },
       async rowClick (event) {
         let id = this.gridData[event.rowIndex].companyid
         await this.enterpriseSearchService.enterpriseTicketInfo(id).then((data) => {
           this.inputForm.name = data.data.ENTNAME
           this.inputForm.uscCode = data.data.UNCID
           this.inputForm.address = data.data.OPLOC
+          this.startBillingDTOList()
           setTimeout(() => {
             if (this.commonJS.isNotEmpty(this.inputForm.name)) {
               this.blurName(this.inputForm.name)
@@ -1521,6 +1544,7 @@
         })
       },
       changeIsUscCode (event) {
+        this.startBillingDTOList()
         if (event === '1') {
           if (this.commonJS.isNotEmpty(this.inputForm.cwWorkClientBillingDTOList)) {
             this.inputForm.cwWorkClientBillingDTOList.forEach(item => {
@@ -1539,6 +1563,7 @@
       },
       // 统一社会信用代码blur事件
       blurUscCode () {
+        this.startBillingDTOList()
         if (this.commonJS.isNotEmpty(this.inputForm.uscCode)) {
           this.workClientService.queryUscCodeIsUse(this.inputForm.uscCode).then(({data}) => {
             if (this.commonJS.isNotEmpty(this.inputForm.id)) {
@@ -1597,6 +1622,7 @@
       },
       // 客户名称blur事件
       blurName () {
+        this.startBillingDTOList()
         if (this.commonJS.isNotEmpty(this.inputForm.name)) {
           this.workClientService.queryNameIsUse(this.inputForm.name).then(({data}) => {
             if (this.commonJS.isNotEmpty(this.inputForm.id)) {

+ 27 - 1
src/views/modules/cw/workClientInfo/WorkClientTaskForm.vue

@@ -527,7 +527,7 @@
             <el-tab-pane  label="开票信息" name="billing">
               <span slot="label"><span style="color: red;border-top: 20px">*</span> 开票信息</span>
               <el-row :gutter="15">
-                <el-button type="primary" style="margin-bottom: 15px" size="mini" :disabled="status === 'audit' || status === 'taskFormDetail'" @click="insertEvent('billing')">
+                <el-button type="primary" style="margin-bottom: 15px" size="mini" :disabled="status === 'audit' || status === 'taskFormDetail' || commonJS.isEmpty(inputForm.cwWorkClientBillingDTOList)" @click="insertEvent('billing')">
                   新增开票信息
                 </el-button>
               </el-row>
@@ -1374,6 +1374,7 @@
           this.inputForm.name = data.data.ENTNAME
           this.inputForm.uscCode = data.data.UNCID
           this.inputForm.address = data.data.OPLOC
+          this.startBillingDTOList()
           setTimeout(() => {
             if (this.commonJS.isNotEmpty(this.inputForm.name)) {
               this.blurName(this.inputForm.name)
@@ -1658,6 +1659,7 @@
         })
       },
       changeIsUscCode (event) {
+        this.startBillingDTOList()
         if (event === '1') {
           if (this.commonJS.isNotEmpty(this.inputForm.cwWorkClientBillingDTOList)) {
             this.inputForm.cwWorkClientBillingDTOList.forEach(item => {
@@ -1676,6 +1678,7 @@
       },
       // 统一社会信用代码blur事件
       blurUscCode () {
+        this.startBillingDTOList()
         if (this.commonJS.isNotEmpty(this.inputForm.uscCode)) {
           this.workClientService.queryUscCodeIsUse(this.inputForm.uscCode).then(({data}) => {
             this.workClientService.queryUscCodeById(this.inputForm.id).then((uscCode) => {
@@ -1711,6 +1714,7 @@
       },
       // 客户名称blur事件
       blurName () {
+        this.startBillingDTOList()
         if (this.commonJS.isNotEmpty(this.inputForm.name)) {
           this.workClientService.queryNameIsUse(this.inputForm.name).then(({data}) => {
             this.workClientService.queryNameById(this.inputForm.id).then((name) => {
@@ -1724,6 +1728,28 @@
         } else {
           this.nameMessage = ''
         }
+      },
+      startBillingDTOList () {
+        if (this.commonJS.isEmpty(this.inputForm.cwWorkClientBillingDTOList)) {
+          this.inputForm.cwWorkClientBillingDTOList = []
+          let d = {
+            companyName: this.inputForm.name,
+            account: '',
+            accountHolder: '',
+            address: '',
+            isTaxpayerIdentificationNo: this.inputForm.isUscCode,
+            phone: '',
+            taxpayerIdentificationNo: this.inputForm.isUscCode === '1' ? this.inputForm.uscCode : '',
+            disabledTaxpayerIdentificationNo: true
+          }
+          this.$refs.billingTable.insertAt(d)
+          this.inputForm.cwWorkClientBillingDTOList.push(d)
+          this.tableKeyBilling = Math.random()
+        } else {
+          this.inputForm.cwWorkClientBillingDTOList[0].companyName = this.inputForm.name
+          this.inputForm.cwWorkClientBillingDTOList[0].isTaxpayerIdentificationNo = this.inputForm.isUscCode
+          this.inputForm.cwWorkClientBillingDTOList[0].taxpayerIdentificationNo = this.inputForm.isUscCode === '1' ? this.inputForm.uscCode : ''
+        }
       }
     }
   }