Explorar o código

倍力优-渠道活码员工上限列表修改

Long hai 7 horas
pai
achega
cc54b6535d
Modificáronse 1 ficheiros con 21 adicións e 10 borrados
  1. 21 10
      src/views/qw/contactWay/index.vue

+ 21 - 10
src/views/qw/contactWay/index.vue

@@ -868,6 +868,21 @@ export default {
       },
     };
   },
+  watch: {
+    userIds: {
+      handler() {
+        if (this.form.userType === 1 && this.form.isUserLimit === 1) {
+          this.userChange();
+        }
+      },
+      deep: true,
+    },
+    'form.isUserLimit'(val) {
+      if (val === 1 && this.form.userType === 1) {
+        this.userChange();
+      }
+    },
+  },
   created() {
 	  informationList().then(response => {
 	      this.informationList = response.data;
@@ -1190,18 +1205,14 @@ export default {
 
 
     userChange(){
-
       for (let i = 0; i < this.userIds.length; i++) {
-             if(!this.userLimitJson.find(item => item.userId == this.userIds[i])){
-               this.userLimitJson.push({userId:this.userIds[i],limitCount:100})
-               console.log(this.userLimitJson)
-             }
-          }
-      for (let i = 0; i < this.userLimitJson.length; i++) {
-            if(!this.userIds.find(item => item== this.userLimitJson[i].userId)){
-                this.userLimitJson.splice(i,1)
-         }
+        if (!this.userLimitJson.find(item => item.userId == this.userIds[i])) {
+          this.userLimitJson.push({ userId: this.userIds[i], limitCount: 100 });
+        }
       }
+      this.userLimitJson = this.userLimitJson.filter(item =>
+        this.userIds.some(id => id == item.userId)
+      );
     },
     showInput() {
       this.inputVisible = true;