shaun-sheep 5 年之前
父节点
当前提交
580f3a5500
共有 2 个文件被更改,包括 154 次插入98 次删除
  1. 115 60
      src/components/business_space/business/handsontable.vue
  2. 39 38
      src/views/ledger/spacelist/index.vue

+ 115 - 60
src/components/business_space/business/handsontable.vue

@@ -66,8 +66,8 @@ import {
   createZone,
   BeatchQueryParam,
   updateRelateInSpAndBuild,
-  queryAllZoneType
-
+  queryAllZoneType,
+  searchZoneQuery
 } from "@/api/scan/request";
 import { mapGetters, mapActions } from "vuex";
 import dialogZone from "../../ledger/addDialog/dialogZone";
@@ -83,7 +83,8 @@ export default {
     myPagination,
     addBusiness,
     uploadImgDialog,
-    dialogZone
+    dialogZone,
+
   },
   computed: {
     ...mapGetters("layout", ["projectId", "secret", "userId"]),
@@ -156,70 +157,124 @@ export default {
       this.page.pageNumber = 1
       this.getData()
     },
-    getData() {
-      if (this.zoneCode != 'OtherZone') {
-        this.isLoading = true
-        let params = {
-          zone: this.zoneCode,
-          data: {
-            Filters: ``,
-            Orders: "createTime desc, RoomID asc",
-            PageNumber: this.page.pageNumber,
-            PageSize: this.page.pageSize
-          }
-        }
-        if (this.buildFloorSelectd[0] == "noKnow") {
-          params.data.Filters += `buildingId isNull`
-        } else if (this.buildFloorSelectd[0] && this.buildFloorSelectd[0] != "all") {
-          params.data.Filters += `buildingId='${this.buildFloorSelectd[0]}'`
-        }
-        if (this.buildFloorSelectd.length > 1) {
-          if (this.buildFloorSelectd[1] == "noKnow") {
-            params.data.Filters += `;floorId isNull`
-          } else if (this.buildFloorSelectd[1] && this.buildFloorSelectd[1] != "all") {
-            params.data.Filters += `;floorId='${this.buildFloorSelectd[1]}'`
-          }
-        }
-        if (this.zoneItemID) {
-          params.data.Filters += `;RoomID='${this.zoneItemID}'`
-        }
-        if (!params.data.Filters) {
-          delete params.data.Filters
+    getData(){
+      this.loading = true
+      let params = {
+        ZoneType: this.zoneCode,
+        PageNumber: 1,
+        PageSize: 50,
+        Orders: "createTime desc, RoomID asc"
+      }
+      if (this.buildFloorSelectd.length === 1) {
+        switch (this.buildFloorSelectd[0]) {
+          case 'noKnow':
+            params.BuildingId = 'isnull';
+            break;
+          case 'all':
+            // params.BuildingId = '';
+            break
         }
-        // if (this.buildFloorSelectd.length && this.buildFloorSelectd[0] && this.buildFloorSelectd[1]) {
-        //   params.data.Filters = `BuildingId='${this.buildFloorSelectd[0]}';FloorId='${this.buildFloorSelectd[1]}'`
-        // }
-        // else if (buildFloorSelectd.length && buildFloorSelectd[0] && !buildFloorSelectd[1]) {
-        //   params.data.Filters = `BuildingId='${buildFloorSelectd[0]}'`
-        // } else {
-        //   params.data.Filters = `BuildingId='';FloorId=''`
-        // }
+      } else if (this.buildFloorSelectd.length === 2) {
+        switch (this.buildFloorSelectd[1]) {
+          case 'noKnow':
+            params.BuildingId = this.buildFloorSelectd[0];
+            params.FloorId = 'isnull';
+            break;
+          case 'all' :
+            params.BuildingId = this.buildFloorSelectd[0];
+            // params.FloorId = '';
+            break;
+          default:
+            params.BuildingId = this.buildFloorSelectd[0];
+            params.FloorId = this.buildFloorSelectd[1]
 
-        queryZone(params, res => {
-          this.page.total = res.Total
-          this.main = res.Content.map((item) => {
-            if (item.hasOwnProperty("BuildingId") && item.hasOwnProperty("FloorId")) {
-              item.flowBuild = item.BuildingId + "-" + item.FloorId
-            } else if (item.hasOwnProperty("BuildingId") && !item.hasOwnProperty("FloorId")) {
-              item.flowBuild = item.BuildingId
-            }
-            return item
-          });
-          if (this.main && this.main.length && this.main[0].RoomID) {
-            this.copyMain = tools.deepCopy(this.main);
-            if (this.onlyRead) {
-              this.getBatch(this.main)
-            }
+        }
+      }
+      searchZoneQuery(params, res => {
+        this.page.total = res.Total
+        this.main = res.Content && res.Content.length && res.Content.map(item=> {
+          if (item.hasOwnProperty("BuildingId") && item.hasOwnProperty("FloorId")) {
+            item.flowBuild = item.BuildingId + "-" + item.FloorId
+          } else if(item.hasOwnProperty("BuildingId") && !item.hasOwnProperty("FloorId")) {
+            item.flowBuild = item.BuildingId
           }
-          this.isLoading = false
-          this.getMain()
+          return item
         })
-      } else {
-        // 其他分区类型查询表数据接口
+        if (this.main && this.main.length && this.main[0].RoomID) {
+          this.copyMain = tools.deepCopy(this.main);
+          if (this.onlyRead) {
+            this.getBatch(this.main)
+          }
+        }
         this.isLoading = false
+        this.getMain()
         this.getOtherType();
-      }
+      })
     },
+    // getData() {
+    //   if (this.zoneCode != 'OtherZone') {
+    //     this.isLoading = true
+    //     let params = {
+    //       zone: this.zoneCode,
+    //       data: {
+    //         Filters: ``,
+    //         Orders: "createTime desc, RoomID asc",
+    //         PageNumber: this.page.pageNumber,
+    //         PageSize: this.page.pageSize
+    //       }
+    //     }
+    //     if (this.buildFloorSelectd[0] == "noKnow") {
+    //       params.data.Filters += `buildingId isNull`
+    //     } else if (this.buildFloorSelectd[0] && this.buildFloorSelectd[0] != "all") {
+    //       params.data.Filters += `buildingId='${this.buildFloorSelectd[0]}'`
+    //     }
+    //     if (this.buildFloorSelectd.length > 1) {
+    //       if (this.buildFloorSelectd[1] == "noKnow") {
+    //         params.data.Filters += `;floorId isNull`
+    //       } else if (this.buildFloorSelectd[1] && this.buildFloorSelectd[1] != "all") {
+    //         params.data.Filters += `;floorId='${this.buildFloorSelectd[1]}'`
+    //       }
+    //     }
+    //     if (this.zoneItemID) {
+    //       params.data.Filters += `;RoomID='${this.zoneItemID}'`
+    //     }
+    //     if (!params.data.Filters) {
+    //       delete params.data.Filters
+    //     }
+    //     // if (this.buildFloorSelectd.length && this.buildFloorSelectd[0] && this.buildFloorSelectd[1]) {
+    //     //   params.data.Filters = `BuildingId='${this.buildFloorSelectd[0]}';FloorId='${this.buildFloorSelectd[1]}'`
+    //     // }
+    //     // else if (buildFloorSelectd.length && buildFloorSelectd[0] && !buildFloorSelectd[1]) {
+    //     //   params.data.Filters = `BuildingId='${buildFloorSelectd[0]}'`
+    //     // } else {
+    //     //   params.data.Filters = `BuildingId='';FloorId=''`
+    //     // }
+    //
+    //     queryZone(params, res => {
+    //       this.page.total = res.Total
+    //       this.main = res.Content.map((item) => {
+    //         if (item.hasOwnProperty("BuildingId") && item.hasOwnProperty("FloorId")) {
+    //           item.flowBuild = item.BuildingId + "-" + item.FloorId
+    //         } else if (item.hasOwnProperty("BuildingId") && !item.hasOwnProperty("FloorId")) {
+    //           item.flowBuild = item.BuildingId
+    //         }
+    //         return item
+    //       });
+    //       if (this.main && this.main.length && this.main[0].RoomID) {
+    //         this.copyMain = tools.deepCopy(this.main);
+    //         if (this.onlyRead) {
+    //           this.getBatch(this.main)
+    //         }
+    //       }
+    //       this.isLoading = false
+    //       this.getMain()
+    //     })
+    //   } else {
+    //     // 其他分区类型查询表数据接口
+    //     this.isLoading = false
+    //     this.getOtherType();
+    //   }
+    // },
     //获取表格主体内容
     getMain() {
       if (!!this.hot) {

+ 39 - 38
src/views/ledger/spacelist/index.vue

@@ -263,7 +263,7 @@
     //修改所选建筑楼层
     changeCascader(val) {
       this.buildFloorSelectd = val;
-      this.inquireZone()
+      // this.inquireZone()
 
       // 如果选择的是全部或者未明确
       if (val.indexOf('noKnow') > -1 || val.indexOf('all') > -1) {
@@ -296,45 +296,46 @@
         this.$refs.graphy.getData(this.buildFloorSelectd, this.FloorMap, this.activeTabType);
       }
     },
-    inquireZone() {
-      //查询空间信息
-      let params = {
-        ZoneType: this.activeName,
-        PageNumber: 1,
-        PageSize: 50,
-      };
-      if (this.buildFloorSelectd.length === 1) {
-        switch (this.buildFloorSelectd[0]) {
-          case 'noKnow':
-            params.BuildingId = 'isnull';
-            break;
-          case 'all':
-            // params.BuildingId = '';
-            break
-        }
-      } else if (this.buildFloorSelectd.length === 2) {
-        switch (this.buildFloorSelectd[1]) {
-          case 'noKnow':
-            params.BuildingId = this.buildFloorSelectd[0];
-            params.FloorId = 'isnull';
-            break;
-          case 'all' :
-            params.BuildingId = this.buildFloorSelectd[0];
-            // params.FloorId = '';
-            break;
-          default:
-            params.BuildingId = this.buildFloorSelectd[0];
-            params.FloorId = this.buildFloorSelectd[1]
-
-        }
-      }
-      searchZoneQuery(params, res => {
-
-      })
-    },
+    // inquireZone() {
+    //   //查询空间信息
+    //   let params = {
+    //     ZoneType: this.activeName,
+    //     PageNumber: 1,
+    //     PageSize: 50,
+    //     Orders: "createTime desc, RoomID asc"
+    //   };
+    //   if (this.buildFloorSelectd.length === 1) {
+    //     switch (this.buildFloorSelectd[0]) {
+    //       case 'noKnow':
+    //         params.BuildingId = 'isnull';
+    //         break;
+    //       case 'all':
+    //         // params.BuildingId = '';
+    //         break
+    //     }
+    //   } else if (this.buildFloorSelectd.length === 2) {
+    //     switch (this.buildFloorSelectd[1]) {
+    //       case 'noKnow':
+    //         params.BuildingId = this.buildFloorSelectd[0];
+    //         params.FloorId = 'isnull';
+    //         break;
+    //       case 'all' :
+    //         params.BuildingId = this.buildFloorSelectd[0];
+    //         // params.FloorId = '';
+    //         break;
+    //       default:
+    //         params.BuildingId = this.buildFloorSelectd[0];
+    //         params.FloorId = this.buildFloorSelectd[1]
+    //
+    //     }
+    //   }
+    //   searchZoneQuery(params, res => {
+    //
+    //   })
+    // },
     // 触发获取表头-获取初始化信息点
     initMessage() {
-  this.inquireZone()
+  // this.inquireZone()
       //
       let params = {
         data: {