浏览代码

项目组成员bug

lizhenhao 2 年之前
父节点
当前提交
542a89cda2
共有 1 个文件被更改,包括 44 次插入11 次删除
  1. 44 11
      src/views/modules/program/registered/RegisItemForm.vue

+ 44 - 11
src/views/modules/program/registered/RegisItemForm.vue

@@ -972,8 +972,33 @@
           }
           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
+              if (this.commonJS.isEmpty(item.job)) {
+                if (this.commonJS.isNotEmpty(item.row.job)) {
+                  this.inputForm.members[index].job = item.row.job
+                } else {
+                  this.inputForm.members[index].job = ''
+                }
+              }
+              if (this.commonJS.isEmpty(item.workHours)) {
+                if (this.commonJS.isNotEmpty(item.row.workHours)) {
+                  this.inputForm.members[index].workHours = item.row.workHours
+                } else {
+                  this.inputForm.members[index].workHours = 0
+                }
+              }
+              if (this.commonJS.isEmpty(item.type)) {
+                if (this.commonJS.isNotEmpty(item.row.type)) {
+                  this.inputForm.members[index].type = item.row.type
+                } else {
+                  this.inputForm.members[index].type = ''
+                }
+              }
+              if (this.commonJS.isEmpty(item.name)) {
+                if (this.commonJS.isNotEmpty(item.row.name)) {
+                  this.inputForm.members[index].name = item.row.name
+                } else {
+                  this.inputForm.members[index].name = ''
+                }
               }
             })
           }
@@ -1014,6 +1039,10 @@
           return
         } else {
           this.inputForm.members.forEach((item, index) => {
+            if (this.commonJS.isEmpty(item.name)) {
+              this.$message.error('项目组成员姓名不允许为空')
+              throw new Error('项目组成员姓名不允许为空')
+            }
             if (this.commonJS.isNotEmpty(item.row)) {
               this.inputForm.members[index] = item.row
             }
@@ -1224,13 +1253,16 @@
       },
       // 新增
       // eslint-disable-next-line no-dupe-keys
-      async insertEvent (type) {
+      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.$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)
@@ -1239,20 +1271,21 @@
             // }
             this.inputForm.members.push(data)
             console.log(this.inputForm.members)
+            console.log(this.inputForm.members)
           })
         }
         if (type === 'contact') {
-          await this.$refs.contactTable.insert().then((data) => {
+          this.$refs.contactTable.insert().then((data) => {
             this.inputForm.contactList.push(data)
           })
         }
         if (type === 'equity') {
-          await this.$refs.equityTable.insert().then((data) => {
+          this.$refs.equityTable.insert().then((data) => {
             this.inputForm.equityList.push(data)
           })
         }
         if (type === 'client') {
-          await this.$refs.clientTable.insert().then((data) => {
+          this.$refs.clientTable.insert().then((data) => {
             this.inputForm.clientList.push(data)
           })
         }