3 Commits 33543fc552 ... b6fb5b0599

Author SHA1 Message Date
  onlyh b6fb5b0599 adm:feat> 修改设备展示规则 3 years ago
  onlyh cd8224d7b0 Merge remote-tracking branch 'origin/master' 3 years ago
  onlyh d161bc5b60 adm:feat> 分区包含的功能空间 3 years ago

+ 14 - 13
src/components/business/dataForm.vue

@@ -8,7 +8,7 @@
                         <el-form-item
                             :prop="item.path"
                             :label="item.aliasName">
-                            <el-input v-model="form[item.path]"/>
+                            <el-input v-model="form[item.path]" :disabled="!item.editable"/>
                         </el-form-item>
                     </el-col>
                 </el-row>
@@ -25,7 +25,8 @@
                                     v-for="item in header.dictStages.data"
                                     :style="{ 'height':item.dataType == 'ATTACHMENT'? 'auto':'93px' }"
                             >
-                                <el-form-item :label="item.unit ? item.aliasName + ' (' + item.unit + ')' : item.aliasName">
+                                <el-form-item
+                                    :label="item.unit ? item.aliasName + ' (' + item.unit + ')' : item.aliasName">
                                     <el-input
                                         :disabled="!item.editable"
                                         v-if="item.dataType == 'STRING'"
@@ -95,7 +96,7 @@
 
 <script lang="ts">
 
-import { Component, Prop, Vue, Watch } from 'vue-property-decorator'
+import {Component, Prop, Vue, Watch} from 'vue-property-decorator'
 import uploadFiles from "@/components/public/uploadFiles.vue";
 import uploadImgs from "@/components/public/uploadImgs.vue";
 
@@ -108,7 +109,7 @@ function flattenKeys(obj: any) {
 
     function digKeys(prev: any, obj: any) {
         Object.entries(obj).forEach(([key, value]) => {
-            const currentKey = prev ? `${ prev }.${ key }` : key
+            const currentKey = prev ? `${prev}.${key}` : key
             if (isObject(value)) {
                 digKeys(currentKey, value)
             } else {
@@ -124,14 +125,14 @@ function flattenKeys(obj: any) {
 
 @Component({
     name: "dataForm",
-    components: { uploadFiles, uploadImgs }
+    components: {uploadFiles, uploadImgs}
 })
 export default class extends Vue {
     rules = {
-        bimTypeId: [{ required: true, message: "请填写BIM构件编码", trigger: 'blur' }],
-        systemCategory: [{ required: true, message: "请填写系统分类", trigger: 'blur' }],
-        codeName: [{ required: true, message: "请填写设备类型名称", trigger: 'blur' }],
-        localId: [{ required: true, message: "请填写本地编码", trigger: 'blur' }],
+        bimTypeId: [{required: true, message: "请填写BIM构件编码", trigger: 'blur'}],
+        systemCategory: [{required: true, message: "请填写系统分类", trigger: 'blur'}],
+        codeName: [{required: true, message: "请填写设备类型名称", trigger: 'blur'}],
+        localId: [{required: true, message: "请填写本地编码", trigger: 'blur'}],
     }
     // tabs数据
     activeName = 0
@@ -140,10 +141,10 @@ export default class extends Vue {
     paneMsg = []
     // 默认当前阶段
     currentHeader = ''
-    @Prop({ default: Object }) deviceHeaders ?: {}
-    @Prop({ default: Object }) currRowContent ?: {}
+    @Prop({default: Object}) deviceHeaders ?: {}
+    @Prop({default: Object}) currRowContent ?: {}
 
-    @Watch('currRowContent', { immediate: true, deep: true })
+    @Watch('currRowContent', {immediate: true, deep: true})
     handleRow() {
         this.$nextTick(() => {
             // string =>array key
@@ -153,7 +154,7 @@ export default class extends Vue {
 
     }
 
-    @Watch('deviceHeaders', { immediate: true, deep: true })
+    @Watch('deviceHeaders', {immediate: true, deep: true})
     changeHeaders() {
         this.$nextTick(() => {
             let pic = [], base = []

+ 55 - 20
src/views/maintain/device/index.vue

@@ -17,7 +17,6 @@
                 <template v-if="deviceType.length > 0">
                     <admMultiTable :currentHeader="currentHeader"
                                    @handleCurrentEdit="handleCurrentEdit"
-
                                    :tableData="tableData" :headersStage="headersStage"/>
                     <Pagination v-if="tableData.length > 0" :paginationList="paginationList"
                                 @handleCurrentChange="handleCurrentChange"
@@ -95,18 +94,18 @@
     </div>
 </template>
 <script lang="ts">
-import { Component, Vue, Watch } from "vue-property-decorator";
-import { AdmMultiTable, AdmSearch, dataForm, Pagination, Statistics } from '../components/index'
-import { allDevice, BeatchQueryParam, dictInfo } from "@/api/equipComponent";
-import { createEquip, queryCount, queryEquip, updateEquip, deleteEquip } from "@/api/datacenter";
-import { UserModule } from "@/store/modules/user";
+import {Component, Vue, Watch} from "vue-property-decorator";
+import {AdmMultiTable, AdmSearch, dataForm, Pagination, Statistics} from '../components/index'
+import {allDevice, BeatchQueryParam, dictInfo} from "@/api/equipComponent";
+import {createEquip, queryCount, queryEquip, updateEquip, deleteEquip} from "@/api/datacenter";
+import {UserModule} from "@/store/modules/user";
 import deviceGraph from "./components/deviceGraph.vue"
 import tools from "@/utils/maintain"
 
 
 @Component({
     name: 'adm-device',
-    components: { Statistics, AdmSearch, AdmMultiTable, Pagination, dataForm, deviceGraph }
+    components: {Statistics, AdmSearch, AdmMultiTable, Pagination, dataForm, deviceGraph}
 })
 export default class extends Vue {
 
@@ -205,14 +204,15 @@ export default class extends Vue {
                 category: this.deviceType[1]
             }
             let param2 = {
-                filters: this.deviceType[1] ? `classCode='${ this.deviceType[1] }'` : undefined,
+                filters: this.deviceType[1] ? `classCode='${this.deviceType[1]}'` : undefined,
                 pageNumber: this.paginationList.page,
                 pageSize: this.paginationList.size,
                 orders: "createTime desc, id asc",
-                projectId: this.projectId
+                projectId: this.projectId,
+                cascade: [{"name": "floor",}, {"name": "objectInfo"}]
             }
             if (this.inputSearch != '') {
-                param2.filters += `;codeName contain '${ this.inputSearch }' or systemCategory contain '${ this.inputSearch }' or bimTypeId contain '${ this.inputSearch }' or localId contain '${ this.inputSearch }'`
+                param2.filters += `;codeName contain '${this.inputSearch}' or systemCategory contain '${this.inputSearch}' or bimTypeId contain '${this.inputSearch}' or localId contain '${this.inputSearch}'`
             }
             let promise = new Promise(resolve => {
                 dictInfo(param).then((res: []) => {
@@ -228,7 +228,18 @@ export default class extends Vue {
                 this.loading = false
                 // 类型下信息点,默认设计阶段
                 this.headerInformation = res[0] // 获取表头
-                this.tableData = res[1].content // 主体数据
+                // this.tableData = res[1].content // 主体数据
+                this.tableData = res[1].content.map(i => {
+                    i.readonlyFloor = ''
+                    i.readonlySpace = ''
+                    if (i.floor && i.floor.localName) {
+                        i.readonlyFloor = i.floor.localName
+                    }
+                    if (i.objectInfo) {
+                        i.readonlySpace = i.objectInfo.map(j => j.localName).join(',')
+                    }
+                    return i
+                })
                 this.paneMsg = res[0].dictStages.map(i => i.name)
                 this.currentHeader = this.paneMsg[this.activeName]
                 this.headerStage()
@@ -240,6 +251,7 @@ export default class extends Vue {
     }
 
     async handleNext() {
+
         if (this.deviceVal[1]) {
             this.next = false
             this.isWidth = true
@@ -247,7 +259,14 @@ export default class extends Vue {
                 category: this.deviceVal[1]
             }
             await dictInfo(param).then(res => {
-                this.deviceHeaders = res
+                const basicInfos = [{path: 'bimTypeName', aliasName: '构件分类名称', category: "STATIC", editable: true},
+                    {path: 'localId', aliasName: '本地编码', category: "STATIC", editable: true},
+                    {path: 'readonlyFloor', editable: false, aliasName: '所属楼层', category: "STATIC"},
+                    {path: 'readonlySpace', editable: false, aliasName: '所在空间', category: "STATIC"}]
+                this.deviceHeaders = {
+                    basicInfos,
+                    dictStages: res.dictStages
+                }
             })
         } else {
             console.log(5)
@@ -269,10 +288,26 @@ export default class extends Vue {
                 }
             })
         }
+        // this.headersStage = {
+        //     basicInfos: {
+        //         name: '基础信息台账',
+        //         data: this.headerInformation.basicInfos
+        //     },
+        //     dictStages: {
+        //         name: this.currentHeader,
+        //         data: pic.length > 0 ? [...base, ...pic] : [...base]
+        //     }
+        // }
+        // todo 固定写死基础信息台账
         this.headersStage = {
             basicInfos: {
                 name: '基础信息台账',
-                data: this.headerInformation.basicInfos
+                data: [
+                    {path: 'bimTypeName', aliasName: '构件分类名称', category: "STATIC"},
+                    {path: 'localId', aliasName: '本地编码', category: "STATIC"},
+                    {path: 'readonlyFloor', editable: false, aliasName: '所属楼层', category: "STATIC"},
+                    {path: 'readonlySpace', editable: false, aliasName: '所在空间', category: "STATIC"}
+                ],
             },
             dictStages: {
                 name: this.currentHeader,
@@ -407,7 +442,7 @@ export default class extends Vue {
 
     // 删除设备
     deleteDevice() {
-        deleteEquip([{ id: this.currRowContent.id }]).then(res => {
+        deleteEquip([{id: this.currRowContent.id}]).then(res => {
             if (res.result == 'success') {
                 this.$message.success('删除成功')
                 this.handleChangeDevice()
@@ -460,7 +495,7 @@ export default class extends Vue {
         // @ts-ignore
         const data = this.$refs.deviceGraph.getLocation()
         if (data) {
-            this.curEquip.bimLocation = `${ data.x },${ data.y },${ data.z }`;
+            this.curEquip.bimLocation = `${data.x},${data.y},${data.z}`;
             this.curEquip.buildingId = data.buildingId;
             this.curEquip.floorId = data.floorId;
         }
@@ -478,9 +513,9 @@ export default class extends Vue {
     handleUpdateEquip(obj) {
         let pa;
         if (Array.isArray(obj)) {
-            pa = { content: obj }
+            pa = {content: obj}
         } else {
-            pa = { content: [obj] }
+            pa = {content: [obj]}
         }
         updateEquip(pa).then(res => {
             if (res.result == 'success') {
@@ -495,9 +530,9 @@ export default class extends Vue {
     handleCreateEquip(obj: any) {
         let pa;
         if (Array.isArray(obj)) {
-            pa = { content: obj }
+            pa = {content: obj}
         } else {
-            pa = { content: [obj] }
+            pa = {content: [obj]}
         }
         createEquip(pa).then(res => {
             if (res.result == 'success') {
@@ -521,7 +556,7 @@ export default class extends Vue {
         this.currRowContent = this.currentRow
     }
 
-    @Watch("deviceType", { immediate: true, deep: true })
+    @Watch("deviceType", {immediate: true, deep: true})
     handleDeviceMsg() {
         this.deviceVal = this.deviceType
     }

+ 88 - 71
src/views/maintain/space/index.vue

@@ -15,6 +15,7 @@
                                      @change="changeCascader" style="margin-right: 12px"
                         ></el-cascader>
                         <el-cascader v-model="zoneTypeValue" :options="zoneTypeOption" placeholder="请选择分区"
+                                     ref="cascaderZone"
                                      @change="changeZoneTypes"
                                      class="item"></el-cascader>
                         <admSearch @SearchValue="searchValue" class="item"/>
@@ -379,8 +380,7 @@ export default class spaceIndex extends Vue {
                     {name: "building"},
                     {name: "floor", orders: "floorSequenceId desc"},
                 ],
-                // zoneType: "FunctionZone",
-                zoneType: this.zoneTypeValue[this.zoneTypeValue.length - 1],
+                classCode: this.zoneTypeValue[this.zoneTypeValue.length - 1],
                 pageNumber: this.paginationList.page,
                 pageSize: this.paginationList.size,
                 orders: "createTime desc, localName asc, localId desc, id asc",
@@ -431,78 +431,95 @@ export default class spaceIndex extends Vue {
                 let basicInfos = [],
                     dictStages = [];
                 this.all = res[0].content;
-                res[0].content.forEach((item) => {
-                    let i = ["localName", "localId", "building", "floor"];
-                    if (i.includes(item.path)) {
-                        basicInfos.push(item);
-                    } else {
-                        dictStages.push(item);
-                    }
-                });
-                dictStages.map((val, index) => {
-                    if (val.path == "outline") {
-                        dictStages.splice(index, 1);
-                    }
-                    return val;
-                });
-                basicInfos.map((item) => {
-                    if (item.path == "building") {
-                        item.path = "buildingSign";
-                    }
-                    if (item.path == "floor") {
-                        item.path = "floorSign";
-                    }
-                    return item;
-                });
+                if (this.zoneTypeValue[0] != "FunctionZone") {
+                    // todo 列表只展示 分区 / 包含的功能空间
+                    const currentZone = this.$refs['cascaderZone'].getCheckedNodes()[0].label
+
+                    this.headersStage = {
+                        basicInfos: {
+                            name: "基础信息台账",
+                            data: [
+                                {path: 'localName', editable: false, aliasName: currentZone},
+                                {path: 'defaultSpace', editable: false, aliasName: '包含的功能分区'}
+                            ],
+                        },
+                    };
+                    this.paginationList.total = res[1].total;
+                    tableData = res[1].content.map(i => i.path == 'localName'); // 主体数据
+                } else {
+                    res[0].content.forEach((item) => {
+                        let i = ["localName", "localId", "building", "floor"];
+                        if (i.includes(item.path)) {
+                            basicInfos.push(item);
+                        } else {
+                            dictStages.push(item);
+                        }
+                    });
+                    dictStages.map((val, index) => {
+                        if (val.path == "outline") {
+                            dictStages.splice(index, 1);
+                        }
+                        return val;
+                    });
+                    basicInfos.map((item) => {
+                        if (item.path == "building") {
+                            item.path = "buildingSign";
+                        }
+                        if (item.path == "floor") {
+                            item.path = "floorSign";
+                        }
+                        return item;
+                    });
 
-                this.headersStage = {
-                    basicInfos: {
-                        name: "基础信息台账",
-                        data: basicInfos,
-                    },
-                    dictStages: {
-                        name: "租赁系统",
-                        data: dictStages,
-                    },
-                };
-                this.paginationList.total = res[1].total;
-                tableData = res[1].content; // 主体数据
-                // 处理 outline BIM模型中轮廓坐标 展示
-                // 添加建筑,楼层展示(从下拉框获取)
-                this.tableData = tableData.map((item) => {
-                    if (item.building) {
-                        item.buildingSign = item.building.localName;
-                    }
-                    if (item.floor) {
-                        item.floorSign = item.floor.localName;
-                    }
-                    // 删除轮廓线
-                    if (item.outline) {
-                        delete item.outline;
-                    }
-                    // item = {
-                    //     ...item,
-                    //     outline: JSON.stringify(item.outline),
-                    // };
+                    this.headersStage = {
+                        basicInfos: {
+                            name: "基础信息台账",
+                            data: basicInfos,
+                        },
+                        dictStages: {
+                            name: "租赁系统",
+                            data: dictStages,
+                        },
+                    };
+                    this.paginationList.total = res[1].total;
+                    tableData = res[1].content; // 主体数据
+                    // 处理 outline BIM模型中轮廓坐标 展示
+                    // 添加建筑,楼层展示(从下拉框获取)
+                    this.tableData = tableData.map((item) => {
+                        if (item.building) {
+                            item.buildingSign = item.building.localName;
+                        }
+                        if (item.floor) {
+                            item.floorSign = item.floor.localName;
+                        }
+                        // 删除轮廓线
+                        if (item.outline) {
+                            delete item.outline;
+                        }
+                        // item = {
+                        //     ...item,
+                        //     outline: JSON.stringify(item.outline),
+                        // };
 
-                    return item;
-                });
-                //  列表信息展示,获取动态数据
-                this.codeToDataSource = {};
-                this.all.forEach((item) => {
-                    if (item.dataSource) {
-                        try {
-                            this.codeToDataSource[item.code] = {};
-                            item.dataSource.forEach((dic) => {
-                                this.codeToDataSource[item.code][dic.code] =
-                                    dic.name;
-                            });
-                        } catch (e) {
-                            console.log(e);
+                        return item;
+                    });
+                    //  列表信息展示,获取动态数据
+                    this.codeToDataSource = {};
+                    this.all.forEach((item) => {
+                        if (item.dataSource) {
+                            try {
+                                this.codeToDataSource[item.code] = {};
+                                item.dataSource.forEach((dic) => {
+                                    this.codeToDataSource[item.code][dic.code] =
+                                        dic.name;
+                                });
+                            } catch (e) {
+                                console.log(e);
+                            }
                         }
-                    }
-                });
-                this.getBatch(this.tableData);
+                    });
+                    this.getBatch(this.tableData);
+                }
             });
         } else {
             console.log("void");