Browse Source

adm:feat> 修改设备展示规则

onlyh 3 years ago
parent
commit
ab0168e7f3

+ 11 - 0
src/components/business/dataForm.vue

@@ -165,6 +165,7 @@ export default class extends Vue {
                 this.deviceHeaders.dictStages.length > 0 && this.deviceHeaders.dictStages.forEach(item => {
                     if (this.currentHeader == item.name) {
                         item.infos && item.infos.forEach(val => {
+                            this.addFormData(val);
                             if (val.dataType == 'ATTACHMENT') {
                                 pic.push(val)
                             } else {
@@ -173,6 +174,9 @@ export default class extends Vue {
                         })
                     }
                 })
+                this.deviceHeaders.basicInfos.length > 0 && this.deviceHeaders.basicInfos.forEach(item => {
+                    this.addFormData(item)
+                })
             }
             this.header = {
                 basicInfos: {
@@ -187,6 +191,13 @@ export default class extends Vue {
         })
     }
 
+    addFormData(headerItem: any) {
+        if (headerItem.render) {
+            const val = headerItem.render(this.currRowContent)
+            this.form[headerItem.path] = val
+        }
+    }
+
     changeItem(val) {
         console.log(val)
         let _key = Object.keys(val)[0] + '';

+ 1 - 1
src/components/public/adm-multi-table.vue

@@ -58,7 +58,7 @@ export default class extends Vue {
     }
 
     get headerInfoMap() {
-        const arr = [...this.headersStage?.basicInfos?.data?? [], ...this.headersStage?.dictStages?.data?? []]
+        const arr = [...this.headersStage?.basicInfos?.data ?? [], ...this.headersStage?.dictStages?.data ?? []]
         const headerInfoMap: any = {};
         arr.forEach((item: any) => {
             headerInfoMap[item.path] = item;

+ 23 - 16
src/views/maintain/device/index.vue

@@ -229,17 +229,7 @@ export default class extends Vue {
                 // 类型下信息点,默认设计阶段
                 this.headerInformation = res[0] // 获取表头
                 // 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.tableData = res[1].content
                 this.paneMsg = res[0].dictStages.map(i => i.name)
                 this.currentHeader = this.paneMsg[this.activeName]
                 this.headerStage()
@@ -251,7 +241,6 @@ export default class extends Vue {
     }
 
     async handleNext() {
-
         if (this.deviceVal[1]) {
             this.next = false
             this.isWidth = true
@@ -261,8 +250,17 @@ export default class extends Vue {
             await dictInfo(param).then(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"}]
+                    {path: 'floor.localName', editable: false, aliasName: '所属楼层', category: "STATIC"},
+                    {
+                        path: 'onSpace',
+                        editable: false,
+                        aliasName: '所在空间',
+                        dataType: 'STRING',
+                        category: "STATIC",
+                        render: (obj: any) => {
+                            return obj?.objectInfo && obj.objectInfo.map((item: any) => item.localName).join(',') || ''
+                        }
+                    }]
                 this.deviceHeaders = {
                     basicInfos,
                     dictStages: res.dictStages
@@ -305,8 +303,17 @@ export default class extends Vue {
                 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"}
+                    {path: 'floor.localName', editable: false, aliasName: '所属楼层', category: "STATIC"},
+                    {
+                        path: 'onSpace',
+                        editable: false,
+                        aliasName: '所在空间',
+                        dataType: 'STRING',
+                        category: "STATIC",
+                        render: (obj: any) => {
+                            return obj?.objectInfo && obj.objectInfo.map((item: any) => item.localName).join(',') || ''
+                        }
+                    }
                 ],
             },
             dictStages: {