Browse Source

按区域添加增加全区

suxinf 4 years ago
parent
commit
06012c6ef4

+ 12 - 9
src/views/data/UploadInfor.vue

@@ -252,20 +252,22 @@ export default {
     // 保证多选框东区和其他的多选框互斥
     clickCheckbox(i) {
       let list = this.checkedBoxList;
-      let include = list.indexOf("东区");
-      console.log(i, include);
-      // if (i === 0) {
-      //   this.checkedBoxList = [];
-      //   return;
-      // }
-      // if (include >= 0) {
-      //   this.checkedBoxList.splice(0, 1);
-      // }
+      let include = list.indexOf("全区");
+      if (i === 0) {
+        this.checkedBoxList = [];
+        return;
+      }
+      if (include >= 0) {
+        this.checkedBoxList.splice(0, 1);
+      }
     },
     // 点击按区域添加button
     addByArea: function () {
       if (this.checkedBoxList.length !== 0) {
         let strReq = this.checkedBoxList.join(",");
+        if (this.checkedBoxList[0] === '全区') {
+          strReq = ''
+        }
         let req = {
           localArea: strReq,
         };
@@ -565,6 +567,7 @@ export default {
         .then((res) => {
           if (res.data && res.data.code === 200) {
             this.areaList = res.data.data;
+            this.areaList.unshift('全区');
           } else {
             console.log(res);
           }

+ 11 - 7
src/views/parameter/components/Grouping/GroupMemberModal.vue

@@ -125,18 +125,21 @@ export default {
       let list = this.checkedBoxList;
       let include = list.indexOf("全区");
       console.log(include, i);
-      // if (i === 0) {
-      //   this.checkedBoxList = [];
-      //   return;
-      // }
-      // if (include >= 0) {
-      //   this.checkedBoxList.splice(0, 1);
-      // }
+      if (i === 0) {
+        this.checkedBoxList = [];
+        return;
+      }
+      if (include >= 0) {
+        this.checkedBoxList.splice(0, 1);
+      }
     },
     // 点击按区域添加button
     addByArea: function () {
       if (this.checkedBoxList.length !== 0) {
         let strReq = this.checkedBoxList.join(",");
+        if (this.checkedBoxList[0] === '全区') {
+          strReq = ''
+        }
         let req = {
           localArea: strReq,
         };
@@ -271,6 +274,7 @@ export default {
           console.log(res, 11);
           if (res.data && res.data.code === 200) {
             this.areaList = res.data.data;
+            this.areaList.unshift('全区');
           } else {
             console.log(res);
           }