فهرست منبع

修复问题7693

haojianlong 4 سال پیش
والد
کامیت
bba9267844
1فایلهای تغییر یافته به همراه16 افزوده شده و 4 حذف شده
  1. 16 4
      src/components/relation/relationShip/Modal/addRelationShip.vue

+ 16 - 4
src/components/relation/relationShip/Modal/addRelationShip.vue

@@ -65,7 +65,7 @@
               :key="index"
               :prop="`codeList.${index}.value`"
               :rules="rules.codeList"
-              :error="fromError"
+              :error="item.fromError"
             >
               <el-input
                 v-model="item.value"
@@ -157,7 +157,9 @@ export default {
         ruleForm: {
           main: '',
           codeList: [{
-            value: ''
+            value: '',
+            fromError: '',
+            key: +new Date()
           }]
         },
         rules: {
@@ -187,7 +189,8 @@ export default {
       addCode() {
         this.ruleForm.codeList.push({
           value: '',
-          key: Date.now()
+          key: Date.now(),
+          fromError: ''
         })
       },
       removeCode(item) {
@@ -202,6 +205,7 @@ export default {
           if (valid) {
             let arr = []
             for(let item  of this.ruleForm.codeList) {
+              item.fromError = ''
               if(item.value) {
                 arr = arr.concat(item.value)
               }
@@ -220,7 +224,15 @@ export default {
                   // this.mainError = res.data.Message
                   this.$nextTick(()=>{this.mainError = res.data.message})
                 } else if(res.data.errorType == 2) {
-                  this.$nextTick(()=>{this.fromError = res.data.message})
+                  const str = res.data.message.split(':')
+                  this.$nextTick(()=>{
+                    this.ruleForm.codeList.forEach(t => {
+                      if (str.length > 1 && t.value == str[0]) {
+                        t.fromError = res.data.message;
+                        t.key = +new Date()
+                      }
+                    })
+                  })
                 } else {
                   this.$message.error(res.data.message);
                 }