Browse Source

绑点设备修改

zhangyu 3 years ago
parent
commit
36b7089e7a

+ 14 - 3
src/components/business/baseDataForm.vue

@@ -3,7 +3,7 @@
         <el-form label-position="top" label-width="300px" :model="form" :rules="rules" ref="form">
             <template v-if="Object.keys(infoHeaders).length > 0">
                 <div v-for="obj in infoHeaders" :key="obj.name">
-                    <p class="title"> {{ obj.name }}</p>
+                    <p v-if="obj.data.length" class="title"> {{ obj.name }}</p>
                     <el-row :gutter="18">
                         <el-col :span="item.dataType == 'ATTACHMENT'? 24:8"
                                 :key="item.path"
@@ -125,20 +125,24 @@ export default class extends Vue {
         'floorSign': [{required: true, message: '请填写本地楼层', trigger: 'blur'}]
     }
     header = {}
-    form = {}
+    form: any = {}
     @Prop({default: Object}) objectHeaders ?: any
     @Prop({default: Object}) currRowContent ?: any
 
     private get infoHeaders(): any {
-        if (this.objectHeaders?.dictStages?.data?.length && this.objectHeaders?.basicInfos) {
+        if (this.objectHeaders?.dictStages?.data && this.objectHeaders?.basicInfos) {
             const base: any[] = [], enclosure: any[] = [];
             this.objectHeaders.dictStages.data.forEach((item: any) => {
+                this.addFormData(item);
                 if (item.dataType === 'ATTACHMENT') {
                     enclosure.push(item);
                 } else {
                     base.push(item);
                 }
             })
+            this.objectHeaders.basicInfos.data.forEach((item: any) => {
+                this.addFormData(item);
+            })
             return {
                 basicInfos: this.objectHeaders.basicInfos,
                 dictStages: {
@@ -161,6 +165,13 @@ export default class extends Vue {
 
     }
 
+    private 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] + '';

+ 10 - 9
src/components/public/adm-multi-table.vue

@@ -58,15 +58,12 @@ export default class extends Vue {
     }
 
     get headerInfoMap() {
-        if (this.headersStage?.dictStages?.data?.length) {
-            const headerInfoMap: any = {};
-            this.headersStage.dictStages.data.forEach((item: any) => {
-                headerInfoMap[item.path] = item;
-            });
-            return headerInfoMap;
-        } else {
-            return {};
-        }
+        const arr = [...this.headersStage?.basicInfos?.data?? [], ...this.headersStage?.dictStages?.data?? []]
+        const headerInfoMap: any = {};
+        arr.forEach((item: any) => {
+            headerInfoMap[item.path] = item;
+        });
+        return headerInfoMap;
     }
 
     /**
@@ -74,6 +71,10 @@ export default class extends Vue {
      */
     private formatContent(row: any, column: any, cellValue: any) {
         const info = this.headerInfoMap[column.property];
+        // 对有render函数的信息点特殊处理
+        if (info && info.render) {
+            return info.render(row);
+        }
         // 有值且获取到表头信息
         if (info && cellValue) {
             // 动态类型且值不需要做转换

+ 11 - 2
src/views/scene/tiepoint/components/equipTab/index.vue

@@ -154,6 +154,7 @@ export default class EquipTab extends Vue {
             };
             let param2 = {
                 filters: `classCode='${ this.deviceType }'`,
+                cascade: [{"name": "floor",}, {"name": "objectInfo"}],
                 pageNumber: this.paginationList.page,
                 pageSize: this.paginationList.size,
                 orders: "createTime desc, id asc",
@@ -222,6 +223,14 @@ export default class EquipTab extends Vue {
     private informationArrangement(data: any): any {
         if (data?.basicInfos && data?.dictStages) {
             const base: any[] = [];
+            const basicInfos: any[] = [
+                {path: 'bimTypeName', editable: true, aliasName: '构件分类名称', dataType: 'STRING', category: "STATIC"},
+                {path: 'localId', editable: true, aliasName: '本地编码', dataType: 'STRING', category: "STATIC"},
+                {path: 'floor.localName', editable: false, aliasName: '所属楼层', dataType: 'STRING', 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(',') || ''
+                }}
+            ]
             data.dictStages.forEach((item: any) => {
                 if (this.currentHeader === item.name) {
                     item?.infos.forEach((val: any) => {
@@ -230,7 +239,7 @@ export default class EquipTab extends Vue {
                 }
             });
             // 信息点集合
-            this.all = [...data.basicInfos, ...base];
+            this.all = [...basicInfos, ...data.basicInfos, ...base];
             this.codeToDataSource = {};
             this.all.forEach((item: any) => {
                 if (item.dataSource) {
@@ -247,7 +256,7 @@ export default class EquipTab extends Vue {
             return {
                 basicInfos: {
                     name: "基础信息台账",
-                    data: data.basicInfos,
+                    data: basicInfos,
                 },
                 dictStages: {
                     name: this.currentHeader,