Quellcode durchsuchen

项目登记联系人问题

lizhenhao vor 2 Jahren
Ursprung
Commit
d00fc2a4ff

+ 1 - 0
src/views/modules/program/registered/ContactForm.vue

@@ -112,6 +112,7 @@
         if (!this.commonJS.isEmpty(rows)) {
           rows.forEach(item => {
             let p = {
+              id: item.id,
               contacts: item.name,
               linkMobilePhoneFirst: item.linkPhone,
               linkMobilePhoneSecoed: item.linkMobile,

+ 0 - 1
src/views/modules/program/registered/ProjectThreeAuditForm.vue

@@ -490,7 +490,6 @@
             }
           })
         }
-
       }
     }
   }

+ 53 - 8
src/views/modules/program/registered/RegisItemForm.vue

@@ -535,6 +535,7 @@
             class="vxe-table-element"
             :data="inputForm.clientList"
             style="margin-left: 5em"
+            :key="clientTableKey"
             @cell-click=""
             @edit-closed=""
             highlight-current-row
@@ -757,7 +758,8 @@
           {value: 1, label: '委托人'},
           {value: 2, label: '项目对接人'}
         ],
-        keyWatch: ''
+        keyWatch: '',
+        clientTableKey: 'default'
       }
     },
     programTypeDictService: null,
@@ -902,17 +904,23 @@
               this.inputForm.members = []
             }
             if (!this.commonJS.isEmpty(this.inputForm.links)) {
+              let clients = []
+              this.inputForm.clientList = []
               this.inputForm.links.forEach(item => {
                 if (item.type === '0') {
-                  this.inputForm.clientList.push(item)
+                  clients.push(item)
                 }
                 if (item.type === '2') {
-                  this.inputForm.equityList.push(item)
+                  clients.push(item)
                 }
                 if (item.type === '3') {
-                  this.inputForm.contactList.push(item)
+                  clients.push(item)
                 }
               })
+              this.inputForm.clientList = clients
+            } else {
+              this.inputForm.links = []
+              this.inputForm.clientList = []
             }
             if (this.formReadOnly === true) {
               method = 'view'
@@ -962,6 +970,13 @@
             this.loading = false
             return
           }
+          if (this.commonJS.isNotEmpty(this.inputForm.members)) {
+            this.inputForm.members.forEach((item, index) => {
+              if (this.commonJS.isNotEmpty(item.row)) {
+                this.inputForm.members[index] = item.row
+              }
+            })
+          }
           this.inputForm.files = this.$refs.uploadComponent.getDataList()
           this.programProjectListInfoService.saveForm(this.inputForm).then(({data}) => {
             callback(data.businessTable, data.businessId, this.inputForm)
@@ -997,6 +1012,12 @@
         if (this.commonJS.isEmpty(this.inputForm.members)) {
           this.$message.error('至少填写一条项目组成员信息')
           return
+        } else {
+          this.inputForm.members.forEach((item, index) => {
+            if (this.commonJS.isNotEmpty(item.row)) {
+              this.inputForm.members[index] = item.row
+            }
+          })
         }
         this.$refs['inputForm'].validate((valid) => {
           if (valid) {
@@ -1090,12 +1111,25 @@
         }
       },
       getContact (rows, deputy) {
-        if (deputy === '0') {
-          rows.forEach(item => {
-            this.inputForm.clientList.push(item)
+        if (this.commonJS.isNotEmpty(this.inputForm.clientList)) {
+          this.inputForm.clientList.forEach(item => {
+            rows.forEach(row => {
+              if (item.id === row.id) {
+                this.$message.error('联系人已存在')
+                throw new Error()
+              }
+            })
           })
         }
-        this.$forceUpdate()
+        this.$nextTick(() => {
+          if (deputy === '0') {
+            rows.forEach(item => {
+              this.inputForm.clientList.push(item)
+              this.clientTableKey = Math.random()
+            })
+          }
+          this.$forceUpdate()
+        })
       },
       close () {
         this.inputForm = {
@@ -1193,7 +1227,18 @@
       async insertEvent (type) {
         if (type === 'member') {
           await this.$refs.memberTable.insert().then((data) => {
+            // data.name = ''
+            // data.workHours = ''
+            // data.type = ''
+            // data.job = ''
+            // if (this.commonJS.isEmpty(this.inputForm.members)) {
+            //   this.inputForm.members = []
+            //   this.inputForm.members.push(data)
+            // } else {
+            //   this.inputForm.members.push(data)
+            // }
             this.inputForm.members.push(data)
+            console.log(this.inputForm.members)
           })
         }
         if (type === 'contact') {