Преглед на файлове

空间任务可选中建筑

hanyaolong преди 3 години
родител
ревизия
8710dd4bd9
променени са 1 файла, в които са добавени 27 реда и са изтрити 6 реда
  1. 27 6
      src/views/spacetask.vue

+ 27 - 6
src/views/spacetask.vue

@@ -3,7 +3,7 @@
     <div class="top">
       <div class="top-item">
         <span>建筑/楼层:</span>
-        <el-select
+        <!-- <el-select
           v-model="floorValue"
           @change="changeFloor"
           placeholder="请选择"
@@ -15,7 +15,18 @@
             :value="item.id"
           >
           </el-option>
-        </el-select>
+        </el-select> -->
+        <el-cascader
+          @change="changeFloor"
+          :options="floorOptions"
+          :props="{
+            checkStrictly: true,
+            value: 'id',
+            label: 'localName',
+            children: 'floor',
+          }"
+          clearable
+        ></el-cascader>
       </div>
       <div class="top-item">
         <span>功能分区:</span>
@@ -42,7 +53,7 @@
         <span>任务状态:</span>
         <el-select
           v-model="jobStatusValue"
-          @change="changeFloor"
+          @change="spaceJob"
           placeholder="请选择"
         >
           <el-option
@@ -241,9 +252,9 @@ export default {
       return new Promise((reslove, reject) => {
         building_floor({ target: "rtn" })
           .then((res) => {
-            this.floorOptions = res.rtn[0].floor;
-            this.buildingId = res.rtn[0].id;
-            this.buildName = res.rtn[0].localName;
+            this.floorOptions = res.rtn;
+            // this.buildingId = res.rtn[0].id;
+            // this.buildName = res.rtn[0].localName;
             reslove();
           })
           .catch(() => {
@@ -305,6 +316,16 @@ export default {
     },
     // 改变楼层
     changeFloor(a, b) {
+      this.buildingId = "";
+      this.floorValue = "";
+      if (a.length == 0) {
+        this.buildingId = "";
+        this.floorValue = "";
+      } else if (a.length == 1) {
+        [this.buildingId] = a;
+      } else {
+        [this.buildingId, this.floorValue] = a;
+      }
       this.spaceJob();
     },
     //重置工作状态