Explorar el Código

modify system

haojianlong hace 5 años
padre
commit
9f2c970231

+ 6 - 0
src/api/scan/request.js

@@ -884,6 +884,12 @@ export function createEquip(param, success) {
     http.postJson(url, param, success)
 }
 
+//设备清单 - 创建设备-关联资产-关联系统
+export function createEquipAndProperty(param, success) {
+    let url = `${baseUrl}/equip-component/equip-query/creat-equip-pro`;
+    http.postJson(url, param, success)
+}
+
 //设备清单 - 更新设备
 export function updateEquip(param, success) {
     let url = `${baseUrl}/datacenter/equip/update`;

+ 21 - 21
src/components/dialogs/list/systemType.vue

@@ -71,7 +71,9 @@ export default {
       default: ""
     },
     device: {},
-    curDevice:'',//设备id
+    curDevice: {
+      default: ''
+    },//设备id
     type: {
       type: String,
       default: "read"
@@ -170,16 +172,9 @@ export default {
 
     getChange() {
       this.createRelatSys()
-      if (this.multipleSelection.length >= 2) {
-        this.$confirm("确定关联多个系统?").then(_ => {
-          this.$emit("change", this.multipleSelection)
-          this.dialog.systemType = false
-        }).catch(_ => {
-        })
-      } else {
-        this.$emit("change", this.multipleSelection)
-        this.dialog.systemType = false
-      }
+      this.$emit("change", this.multipleSelection)
+      this.dialog.systemType = false
+      this.multipleSelection = []
     },
 
     //设置默认选中项
@@ -217,9 +212,9 @@ export default {
         PageSize: 100
       }
       //建筑id
-      if(this.buildId == "noKnow"){
+      if (this.buildId == "noKnow") {
         param.Filters += `;buildingId isNull`
-      }else if(this.buildId && this.buildId != "all"){
+      } else if (this.buildId && this.buildId != "all") {
         param.Filters += `;buildingId='${this.buildId}'`
       }
       //输入的查询条件
@@ -229,18 +224,23 @@ export default {
       queryLinkSys(param, res => {
         this.allData = res.Content
         this.tableData = res.Content
+        this.multipleSelection = []
       })
     },
     //添加设备关联系统关系
-    createRelatSys(){
-      let param = {
-        EquipID:this.curDevice,
-        SysIdList:[]
+    createRelatSys() {
+      if (this.curDevice) {//有即为编辑
+        let param = {
+          EquipID: this.curDevice,
+          SysIdList: []
+        }
+        this.multipleSelection.map(t => {
+          param.SysIdList.push(t.SysID)
+        })
+        equipLinkSys(param, res => {
+          this.multipleSelection = []
+        })
       }
-      this.multipleSelection.map(t => {
-        param.SysIdList.push(t.SysID)
-      })
-      equipLinkSys(param, res => {})
     }
   },
   watch: {

+ 2 - 0
src/components/ledger/lib/cascader.vue

@@ -120,6 +120,8 @@ export default {
           return item
         }
       })
+      console.log(this.content)
+      console.log(this.options)
     }
   }
 };

+ 51 - 37
src/views/ledger/facility/addfacility.vue

@@ -43,7 +43,7 @@
     <maintainer-dialog @changeMaintainer="changeMaintainer" ref="maintainer" :dialog="myDialog"></maintainer-dialog>
     <insurer-dialog @changeInsurer="changeInsurer" ref="insurer" :dialog="myDialog"></insurer-dialog>
     <pic-dialog :read="onlyRead ? true : false" :dialog="myDialog" :keysArr="picsArr" @change="changePics"></pic-dialog>
-    <system-type :infos="systemId" :graphyId="graphyId" :dialog="myDialog" :type="'edit'" @change="changeSystemType"></system-type>
+    <system-type :device="category" :dialog="myDialog" :type="onlyRead?'read':'edit'" @change="changeSystemType"></system-type>
     <details-dialog :iframeSrc="iframeSrc" v-if="myDialog.details" :dialog="myDialog"></details-dialog>
   </div>
 </template>
@@ -53,6 +53,7 @@ import handsonUtils from "@/utils/hasontableUtils";
 import showTools from "@/utils/handsontable/notShow";
 import text from "@/utils/handsontable/mainText";
 import session from "@/framework/utils/storage";
+import buildFloorData from '@/utils/handsontable/buildFloorData'
 
 import handsonTable from "@/components/common/handsontable";
 import {
@@ -60,7 +61,8 @@ import {
   createEquip,
   createPropertyData,
   getEquipBelongs,
-  getSpaceFloor
+  getSpaceFloor,
+  createEquipAndProperty
 } from "@/api/scan/request";
 import { mapGetters, mapActions } from "vuex";
 
@@ -273,51 +275,63 @@ export default {
         }
         // 处理建筑-楼层
         if (item.flowBuild) {
+          let bid = item.flowBuild.split("-");
           item.BuildingId = item.flowBuild.split("-")[0]
-          item.FloorId = item.flowBuild.split("-")[1]
+          if (bid[1]) {
+            item.FloorId = item.flowBuild.split("-")[1]
+          }
         }
         //处理管理的系统
         if (item.LinkSystem && item.LinkSystem.length) {
           item.SystemList = []
           item.LinkSystem.map(t => {
-            item.SystemList.push(t.id)
+            item.SystemList.push(t.SysID)
           })
         }
+        item.PropertyId = !!item.Checked;
+        item.Category = this.category.deviceId;
       })
       if (flag) {
         this.$message.info("存在设备的本地名称为空,请检查")
         return;
       }
 
-      for (let i = 0; i < newData.length; i++) {
-        let params = newData[i]
-        params.Family = this.firmId;
-        params.Category = this.category.deviceId;
-        if (newData[i].Checked) {//同时创建资产
-          await createPropertyData([params], async res => {
-            params.PropertyId = res.EntityList[0].EquipID
-            await createEquip([params], res => {
-              if (i == newData.length - 1) {
-                this.$router.push({
-                  path: "/ledger/facility",
-                  query: { deviceId: this.category.deviceId }
-                });
-                session.remove("deviceAddData")
-              }
-            })
-          })
-        } else {
-          await createEquip([params], res => {
-            if (i == newData.length - 1) {
-              this.$router.push({
-                path: "/ledger/facility",
-                query: { deviceId: this.category.deviceId }
-              });
-              session.remove("deviceAddData")
-            }
-          });
-        }
-      }
+      // for (let i = 0; i < newData.length; i++) {
+      //   let params = newData[i]
+      //   params.Family = this.firmId;
+      //   params.Category = this.category.deviceId;
+      //   if (newData[i].PropertyId) {//同时创建资产
+      //     await createPropertyData([params], async res => {
+      //       params.PropertyId = res.EntityList[0].EquipID
+      //       await createEquip([params], res => {
+      //         if (i == newData.length - 1) {
+      //           this.$router.push({
+      //             path: "/ledger/facility",
+      //             query: { deviceId: this.category.deviceId }
+      //           });
+      //           session.remove("deviceAddData")
+      //         }
+      //       })
+      //     })
+      //   } else {
+      //     await createEquip([params], res => {
+      //       if (i == newData.length - 1) {
+      //         this.$router.push({
+      //           path: "/ledger/facility",
+      //           query: { deviceId: this.category.deviceId }
+      //         });
+      //         session.remove("deviceAddData")
+      //       }
+      //     });
+      //   }
+      // }
+      createEquipAndProperty(newData, res => {
+        this.$router.push({
+          path: "/ledger/facility",
+          query: { deviceId: this.category.deviceId }
+        });
+        session.remove("deviceAddData")
+      })
     },
     // 删除表格行
     handleDeleteTableRow() {
@@ -356,7 +370,7 @@ export default {
     //格式化表头显示的数据
     formatHeaderData(list) {
       let arr = tools.copyArr(list);
-      let showType = this.showTypeFlag?'partInfo':'all';
+      let showType = this.showTypeFlag ? 'partInfo' : 'all';
       let data = showTools.headerTextFilter(arr, 'equipment', this.onlyRead, showType, true);
       data.unshift("同时创建资产", "所属系统实例");
       if (this.floorFlag) {
@@ -367,7 +381,7 @@ export default {
     formatHeaderType(list) {
       //格式化表头头映射的数据
       let arr = tools.copyArr(list);
-      let showType = this.showTypeFlag?'partInfo':'all';
+      let showType = this.showTypeFlag ? 'partInfo' : 'all';
       let data = showTools.headerTypeFilter(arr, 'equipment', this.onlyRead, showType, true);
       data.unshift({
         type: "checkbox",
@@ -389,7 +403,7 @@ export default {
           editor: "chosen",
           chosenOptions: {
             // multiple: true,//多选
-            data: this.floorData
+            data: buildFloorData.data
           }
         })
       }
@@ -547,7 +561,7 @@ export default {
           }
           break;
         //关联系统
-        case 'linkSystem':
+        case 'LinkSystem':
           if (!this.onlyRead) {
             this.systemList = this.tableData[row.row].LinkSystem || [];
             this.myDialog.systemType = true;