Selaa lähdekoodia

用户管理-地市选择问题修改

wangrulan 2 vuotta sitten
vanhempi
commit
66081d3d61
1 muutettua tiedostoa jossa 16 lisäystä ja 5 poistoa
  1. 16 5
      src/components/permissions/user/index.vue

+ 16 - 5
src/components/permissions/user/index.vue

@@ -33,13 +33,14 @@
           @keyup.enter.native="handleQuery"
           @keyup.enter.native="handleQuery"
         />
         />
       </el-form-item>
       </el-form-item>
-      <el-form-item label="地区" prop="areaId">
+      <el-form-item label="地区" prop="areaId2">
         <el-cascader
         <el-cascader
-          v-model="queryParams.areaId"
+          v-model="queryParams.areaId2"
           placeholder="请选择省份/地市/区县"
           placeholder="请选择省份/地市/区县"
           :options="cityList"
           :options="cityList"
           @change="areaIdChange"
           @change="areaIdChange"
           clearable
           clearable
+          :props="{ checkStrictly: true }"
           size="small"
           size="small"
         ></el-cascader>
         ></el-cascader>
         <!-- <el-select
         <!-- <el-select
@@ -268,6 +269,7 @@
             @change="formareaIdChange(item.cityId, index)"
             @change="formareaIdChange(item.cityId, index)"
             clearable
             clearable
             :disabled="isDisabled2"
             :disabled="isDisabled2"
+            :props="{ checkStrictly: true }"
             style="width: 100%"
             style="width: 100%"
           >
           >
           </el-cascader>
           </el-cascader>
@@ -309,6 +311,7 @@ export default {
         userName: null,
         userName: null,
         org: null,
         org: null,
         areaId: null,
         areaId: null,
+        areaId2: null,
       },
       },
       tableList: [],
       tableList: [],
       total: 0,
       total: 0,
@@ -374,11 +377,13 @@ export default {
     },
     },
     // 查询条件地区选择
     // 查询条件地区选择
     areaIdChange(val) {
     areaIdChange(val) {
+      console.log('val: ', val);
       this.queryParams.areaId = val[val.length - 1];
       this.queryParams.areaId = val[val.length - 1];
     },
     },
     // 重置
     // 重置
     resetQuery() {
     resetQuery() {
       this.resetForm("queryForm");
       this.resetForm("queryForm");
+      this.queryParams.areaId = '';
       this.queryParams.current = 1;
       this.queryParams.current = 1;
       this.getList();
       this.getList();
     },
     },
@@ -422,8 +427,10 @@ export default {
           this.form = res.data;
           this.form = res.data;
           this.$nextTick(() => {
           this.$nextTick(() => {
             this.form.roles.map((item) => {
             this.form.roles.map((item) => {
+              // item.cityId2 = item.cityId;
               this.modelList.push(item.roleName);
               this.modelList.push(item.roleName);
             });
             });
+            // console.log('this.form.roles: ', this.form.roles);
             // this.modelList = ['投诉预测']
             // this.modelList = ['投诉预测']
             // console.log("this.modelList: ", this.modelList);
             // console.log("this.modelList: ", this.modelList);
           });
           });
@@ -440,6 +447,7 @@ export default {
       this.isDisabledEmail = false;
       this.isDisabledEmail = false;
       this.isDisabled2 = false;
       this.isDisabled2 = false;
       this.userInfo({ userId: val.userId });
       this.userInfo({ userId: val.userId });
+      // this.$refs['form'].clearValidate();
     },
     },
     // 详情
     // 详情
     handleDetail(val) {
     handleDetail(val) {
@@ -451,6 +459,7 @@ export default {
       this.isDisabledEmail = true;
       this.isDisabledEmail = true;
       this.isDisabled2 = true;
       this.isDisabled2 = true;
       this.userInfo({ userId: val.userId });
       this.userInfo({ userId: val.userId });
+      // this.$refs['form'].clearValidate();
     },
     },
     // 查询用户信息
     // 查询用户信息
     searchUserList() {
     searchUserList() {
@@ -499,9 +508,11 @@ export default {
     formareaIdChange(val, index) {
     formareaIdChange(val, index) {
       // console.log("index111: ", index);
       // console.log("index111: ", index);
       // console.log("val111: ", val);
       // console.log("val111: ", val);
-      this.form.roles[index].cityId = val[val.length - 1];
+      if(val){
-      this.form.roles[index].cityName =
+        this.form.roles[index].cityId = val[val.length - 1];
-        this.$refs["refCity"][index].getCheckedNodes()[0].label;
+        this.form.roles[index].cityName =
+          this.$refs["refCity"][index].getCheckedNodes()[0].label;
+      }
       // console.log(this.$refs["refCity"].getCheckedNodes()[0].label)
       // console.log(this.$refs["refCity"].getCheckedNodes()[0].label)
       // console.log("this.form.roles: ", this.form.roles);
       // console.log("this.form.roles: ", this.form.roles);
     },
     },