瀏覽代碼

wanda-adm:feat > 建筑楼层添加全部,默认全部

shaun-sheep 4 年之前
父節點
當前提交
912449e6a5
共有 1 個文件被更改,包括 64 次插入35 次删除
  1. 64 35
      src/views/maintain/space/index.vue

+ 64 - 35
src/views/maintain/space/index.vue

@@ -48,6 +48,7 @@ import { buildingQuery, dictQuery, floorQuery, queryCountSpace, queryZone } from
 import tools from "@/utils/maintain";
 import { BeatchQueryParam } from "@/api/equipComponent";
 import { UserModule } from "@/store/modules/user";
+import it from "element-ui/src/locale/lang/it";
 
 @Component({
     name: "space-index",
@@ -63,8 +64,8 @@ export default class spaceIndex extends Vue {
     };
     currentHeader = '租赁系统'
     activeName = "table";
-    building = [];
-    buildingLabel = []
+    building = ['all'];
+
     value2 = [];
     // 分页
     private paginationList = {
@@ -92,6 +93,8 @@ export default class spaceIndex extends Vue {
     created() {
         this.getData()
         this.dataCount()
+        //    默认显示全部建筑信息
+        this.changeCascader()
     }
 
 //查询统计数量
@@ -134,13 +137,13 @@ export default class spaceIndex extends Vue {
                     label: build.localName
                 }
             })
-            // data.unshift({
-            //     value: "all",
-            //     label: "全部"
-            // }, {
-            //     value: "noKnow",
-            //     label: "未明确建筑"
-            // })
+            data.unshift({
+                value: "all",
+                label: "全部"
+            }, {
+                value: "noKnow",
+                label: "未明确建筑"
+            })
             data.forEach(build => {
                 floorData.forEach(floor => {
                     if (build.value == floor.buildingId && floor.id && floor.localName) {
@@ -155,13 +158,13 @@ export default class spaceIndex extends Vue {
                         } else {
                             build.children = []
                             build.children.push(
-                                //     {
-                                //     value: "all",
-                                //     label: "全部"
-                                // }, {
-                                //     value: 'noKnow',
-                                //     label: "未明确楼层"
-                                // },
+                                {
+                                    value: "all",
+                                    label: "全部"
+                                }, {
+                                    value: 'noKnow',
+                                    label: "未明确楼层"
+                                },
                                 {
                                     value: floor.id,
                                     label: floor.localName,
@@ -179,9 +182,10 @@ export default class spaceIndex extends Vue {
 
     //改变楼层
     changeCascader(value) {
-        if (value.length > 0) {
-            this.buildingLabel = this.$refs['floorCascader'].getCheckedNodes()[0].pathLabels
-        }
+        //todo delete
+        // if (value && value.length > 0  && this.building[0] != 'all') {
+        //     this.buildingLabel = this.$refs['floorCascader'].getCheckedNodes()[0].pathLabels
+        // }
         if (this.building.length > 0) {
             this.loading = true
             let param = {
@@ -192,24 +196,37 @@ export default class spaceIndex extends Vue {
             }
             let param2 = {
                 // 级联查建筑楼层信息
-                // cascade: [{ name: 'building' }, { name: 'floor', orders: 'floorSequenceId desc' }],
+                cascade: [{ name: 'building' }, { name: 'floor', orders: 'floorSequenceId desc' }],
                 zoneType: 'FunctionZone',
                 pageNumber: this.paginationList.page,
                 pageSize: this.paginationList.size,
                 orders: "createTime desc, localName desc, localId desc, id asc"
             }
 
-            param2.filters = ''
-            if (this.building[0]) {
-                param2.filters += `buildingId='${ this.building[0] }'`
-            }
-            if (this.building[1] == "") {
-                param2.filters += `;floorId isNull`
-            } else if (this.building[1]) {
-                param2.filters += `;floorId='${ this.building[1] }'`
-            }
-            if (this.inputSearch != '') {
-                param2.filters += `;localName contain '${ this.inputSearch }' or localId contain '${ this.inputSearch }'`
+
+            if (this.building.length === 1) {
+                param2.filters = ''
+                switch (this.building[0]) {
+                    case 'noKnow':
+                        param2.filters =`buildingId='isnull'`
+                        break;
+                    case 'all':
+                        delete param2.filters
+
+                        break
+                }
+            } else if (this.building.length === 2) {
+                switch (this.building[1]) {
+                    case 'noKnow':
+                        param2.filters = `buildingId='${ this.building[0] }';floorId='isnull'`
+
+                        break;
+                    case 'all':
+                        param2.filters = `buildingId='${ this.building[0] }'`
+                        break;
+                    default:
+                        param2.filters = `buildingId='${ this.building[0] }';floorId='${ this.building[1] }'`
+                }
             }
 
             let promise = new Promise(resolve => {
@@ -236,6 +253,17 @@ export default class spaceIndex extends Vue {
                         dictStages.push(item)
                     }
                 })
+                basicInfos.map(item => {
+                    if(item.path == 'building') {
+                        item.path='buildingSign'
+
+                    }
+                    if(item.path == 'floor') {
+                        item.path='floorSign'
+
+                    }
+                    return item
+                })
 
                 this.headersStage = {
                     basicInfos: {
@@ -252,11 +280,12 @@ export default class spaceIndex extends Vue {
                 // 处理 outline BIM模型中轮廓坐标 展示
                 // 添加建筑,楼层展示(从下拉框获取)
                 this.tableData = tableData.map(item => {
-                    if (this.buildingLabel[0]) {
-                        item.building = this.buildingLabel[0]
+
+                    if(item.building) {
+                        item.buildingSign = item.building.localName
                     }
-                    if (this.buildingLabel[1]) {
-                        item.floor = this.buildingLabel[1]
+                    if(item.floor) {
+                        item.floorSign = item.floor.localName
                     }
                     item = {
                         ...item,