zhangyu 5 år sedan
förälder
incheckning
2321bcb047
1 ändrade filer med 100 tillägg och 10 borttagningar
  1. 100 10
      src/components/ledger/lib/linkassets.vue

+ 100 - 10
src/components/ledger/lib/linkassets.vue

@@ -1,11 +1,15 @@
 <template>
   <el-dialog title="批量关联资产" :visible.sync="dialog.linkAssets" width="900px">
     <el-row>
-      <build-floor></build-floor>
-      <zone-space :isWidth="false"></zone-space>
+      <device-parts></device-parts>
     </el-row>
     <el-row style="margin-top:30px;">
-      <device-parts></device-parts>
+      <!-- <build-floor></build-floor> -->
+      <span class="condition-title">建筑楼层:</span>
+      <el-cascader placeholder="请选择建筑楼层" :options="bfoptions" v-model="buildFloor" filterable size="small" @change="handleChangeBf"></el-cascader>
+    </el-row>
+    <el-row style="margin-top:30px;">
+      <zone-space :isWidth="false"></zone-space>
     </el-row>
     <span slot="footer" class="dialog-footer">
       <el-button @click="handleClickClose">取 消</el-button>
@@ -15,6 +19,8 @@
 </template>
 <script>
 
+import { floorQuery, buildingQuery } from '@/api/scan/request'
+
 import { mapGetters } from "vuex"
 import buildFloor from "@/components/ledger/lib/buildFloor"
 import zoneSpace from "@/components/ledger/lib/zoneSpace"
@@ -35,19 +41,98 @@ export default {
       }
     }
   },
+  computed: {
+    ...mapGetters("layout", ["projectId", "secret", "userId"])
+  },
   data() {
     return {
-      
+      bfoptions: [], //建筑楼层列表
+      buildFloor: ['all'], //选择的建筑楼层
     };
   },
   created() {
-    
-  },
-  computed: {
-    ...mapGetters("layout", ["projectId", "secret", "userId"])
+    this.getData()
   },
   mounted() { },
   methods: {
+    //获取数据
+    getData() {
+      let data, buildParams = {
+        PageNumber: 1,
+        PageSize: 500,
+        Projection: [
+          "BuildID",
+          "BuildLocalName"
+        ]
+      }, floorParams = {
+        Orders: "FloorSequenceID desc",
+        PageNumber: 1,
+        PageSize: 500,
+        Projection: [
+          "BuildID",
+          "FloorID",
+          "FloorLocalName",
+          "FloorSequenceID"
+        ]
+      }
+      let promise1 = new Promise((resolve, reject) => {
+        buildingQuery(buildParams, res => {
+          resolve(res)
+        })
+      })
+      let promise2 = new Promise((resolve, reject) => {
+        floorQuery(floorParams, res => {
+          resolve(res)
+        })
+      })
+      Promise.all([promise1, promise2]).then(values => {
+        let builData = values[0].Content, floorData = values[1].Content
+        data = builData.map(build => {
+          return {
+            value: build.BuildID,
+            label: build.BuildLocalName
+          }
+        })
+        data.unshift({
+          value: "all",
+          label: "全部"
+        }, {
+            value: "noKnow",
+            label: "不在建筑内"
+          })
+        data.forEach(build => {
+          floorData.forEach(floor => {
+            if (build.value == floor.BuildID && floor.FloorID && floor.FloorLocalName && this.type == "yes") {
+              if (build.children) {
+                build.children.push({
+                  value: floor.FloorID,
+                  label: floor.FloorLocalName,
+                  FloorSequenceID: floor.FloorSequenceID
+                })
+              } else {
+                build.children = []
+                build.children.push({
+                  value: "all",
+                  label: "全部"
+                }, {
+                    value: 'noKnow',
+                    label: "不在楼层内"
+                  }, {
+                    value: floor.FloorID,
+                    label: floor.FloorLocalName,
+                    FloorSequenceID: floor.FloorSequenceID
+                  })
+              }
+            }
+          })
+        })
+        this.bfoptions = data
+      })
+    },
+    // 修改建筑楼层
+    handleChangeBf() {
+
+    },
     handleClickClose() {
       this.dialog.linkAssets = false
     }
@@ -58,6 +143,11 @@ export default {
 };
 </script>
 
-<style lang="less">
-
+<style lang="less" scoped>
+  .condition-title{
+    margin-left: 10px;
+    margin-right: 12px;
+    color: #999999;
+    font-size: 14px;
+  }
 </style>