qinhouyu 1 год назад
Родитель
Сommit
0b5755bf49
1 измененных файлов с 20 добавлено и 3 удалено
  1. 20 3
      src/views/zdsz/house/index.vue

+ 20 - 3
src/views/zdsz/house/index.vue

@@ -130,7 +130,7 @@
         <el-row :gutter="20">
           <el-col :span="12">
             <el-form-item label="小区" prop="areaId">
-              <el-select v-model="form.areaId" placeholder="请选择小区" filterable @change="getBuildings">
+              <el-select v-model="form.areaId" placeholder="请选择小区" filterable @change="getBuildings1">
                 <el-option
                   v-for="obj in areas"
                   :key="obj.id"
@@ -142,7 +142,7 @@
           </el-col>
           <el-col :span="12">
             <el-form-item label="楼栋" prop="buildingId">
-              <el-select v-model="form.buildingId" placeholder="请选择楼栋" filterable @change="getUnits">
+              <el-select v-model="form.buildingId" placeholder="请选择楼栋" filterable @change="getUnits1">
                 <el-option
                   v-for="obj in builds"
                   :key="obj.id"
@@ -156,7 +156,7 @@
         <el-row :gutter="20">
           <el-col :span="12">
             <el-form-item label="单元" prop="unitId">
-              <el-select v-model="form.unitId" placeholder="请选择单元" filterable @change="getUnits1">
+              <el-select v-model="form.unitId" placeholder="请选择单元" filterable>
                 <el-option
                   v-for="obj in units"
                   :key="obj.id"
@@ -262,17 +262,34 @@ export default {
   methods: {
     /** 查询楼栋下拉 */
     getBuildings(id) {
+      this.builds = []
+      this.units = []
+      this.queryParams.buildingId = undefined
+      this.queryParams.unitId = undefined
+      getBuildings(id).then(res => {
+        this.builds = res.data
+      })
+    },
+    getBuildings1(id) {
+      this.builds = []
+      this.units = []
+      this.form.buildingId = undefined
+      this.form.unitId = undefined
       getBuildings(id).then(res => {
         this.builds = res.data
       })
     },
     /** 查询单元下拉 */
     getUnits(id) {
+      this.units = []
+      this.queryParams.unitId = undefined
       getUnits(this.queryParams.areaId,id).then(res => {
         this.units = res.data
       })
     },
     getUnits1(id) {
+      this.units = []
+      this.form.unitId = undefined
       getUnits(this.form.areaId,id).then(res => {
         this.units = res.data
       })