Browse Source

创建系统 一并创建建筑楼层关系

haojianlong 5 years ago
parent
commit
b5feb1443d

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

@@ -1127,6 +1127,12 @@ export function createGeneralSys(param, success) {
     http.postJson(url, param, success)
 }
 
+//创建系统---处理建筑楼层(一对多)
+export function createSystemBuildFloor(param, success) {
+    let url = `${baseUrl}/datacenter/general—system/create-bd-fl`
+    http.postJson(url, param, success)
+}
+
 //查询不在当前系统下的设备
 export function getEquipNotInSys(param, success) {
     let url = `${baseUrl}/equip-component/equip-query/equip-sys?sysId=${param.sysId}`;

+ 12 - 0
src/components/ledger/lib/editSysFloor.vue

@@ -27,6 +27,11 @@ export default {
   components: {
     bfCascader
   },
+  props: {
+    isCreate: {
+      default: false
+    }
+  },
   methods: {
     showDialog(system) {
       this.system = system;
@@ -48,6 +53,13 @@ export default {
       })
     },
     save() {
+      // 如果是创建
+      if (this.isCreate) {
+        let data = this.$refs.bfCascader.getSelectedNodes();
+        this.connectDialogVis = false;
+        this.$emit('relateSuccess', data);
+        return
+      }
       let arr = this.$refs.bfCascader.value;
       let buildIds = [], floorIds = [];
       arr.map(t => {

+ 51 - 133
src/views/ledger/system/addsystem.vue

@@ -1,9 +1,9 @@
 <template>
   <div id="deviceList">
     <el-row class="right">
-      <span style="width:20px;float:left;display:block;height:20px;cursor: pointer;" @click="changeAssetsFalg">
+      <!-- <span style="width:20px;float:left;display:block;height:20px;cursor: pointer;" @click="changeAssetsFalg">
         <i class="el-icon-fa  el-icon-fa-compass"></i>
-      </span>
+      </span> -->
       <span style="float:left;">当前选择的系统类型:{{category.CategoryName}}</span>
       <el-select v-model="showType" @change="initTable" style="width:125px;margin-right:10px;vertical-align:bottom;">
         <el-option v-for="item in showTypes" :key="item.value" :label="item.label" :value="item.value"></el-option>
@@ -27,6 +27,9 @@
     <el-row class="center">
       <el-button type="primary" size="medium" @click="handleCreateTableData" class="create_button">创建系统</el-button>
     </el-row>
+
+    <!-- 关联楼层 -->
+    <editSysfloor ref="editFloor" @relateSuccess="relateSuccess" :isCreate="true"></editSysfloor>
   </div>
 </template>
 <script>
@@ -36,10 +39,11 @@ import showTools from "@/utils/handsontable/notShow";
 import text from "@/utils/handsontable/mainText";
 import session from "@/framework/utils/storage";
 
+import editSysfloor from "@/components/ledger/lib/editSysFloor";
 import handsonTable from "@/components/common/handsontable";
 import {
   getDataDictionary,
-  createGeneralSys,
+  createSystemBuildFloor,
   buildingQuery
 } from "@/api/scan/request";
 import { mapGetters, mapActions } from "vuex";
@@ -47,7 +51,8 @@ import { mapGetters, mapActions } from "vuex";
 import qrcode from "@/components/ledger/lib/qrcode";
 export default {
   components: {
-    handsonTable
+    handsonTable,
+    editSysfloor
   },
   data() {
     return {
@@ -100,24 +105,24 @@ export default {
   },
   methods: {
     //维护建筑
-    changeAssetsFalg() {
-      if (this.floorFlag) {
-        this.floorFlag = false
-      } else {
-        this.$confirm('<p>维护设备所在建筑楼层后,对后续数据影响较大,如业务空间中的所在关系or其他?暂未梳理明白……</p><p>后续要修改设备所属建筑楼层,只能通过模型中的待建模清单操作</p>', '提示', {
-          dangerouslyUseHTMLString: true,
-          confirmButtonText: '就要维护设备所属建筑楼层',
-          cancelButtonText: '暂时不搞了',
-          confirmButtonClass: 'confirmButtonClass',
-          cancelButtonClass: 'cancelButtonClass'
-        }).then(_ => {
-          this.floorFlag = true
-          this.getTableHeader()
-        }).catch(_ => {
-          this.$message("取消")
-        })
-      }
-    },
+    // changeAssetsFalg() {
+    //   if (this.floorFlag) {
+    //     this.floorFlag = false
+    //   } else {
+    //     this.$confirm('<p>维护设备所在建筑楼层后,对后续数据影响较大,如业务空间中的所在关系or其他?暂未梳理明白……</p><p>后续要修改设备所属建筑楼层,只能通过模型中的待建模清单操作</p>', '提示', {
+    //       dangerouslyUseHTMLString: true,
+    //       confirmButtonText: '就要维护设备所属建筑楼层',
+    //       cancelButtonText: '暂时不搞了',
+    //       confirmButtonClass: 'confirmButtonClass',
+    //       cancelButtonClass: 'cancelButtonClass'
+    //     }).then(_ => {
+    //       this.floorFlag = true
+    //       this.getTableHeader()
+    //     }).catch(_ => {
+    //       this.$message("取消")
+    //     })
+    //   }
+    // },
     //获取建筑数据
     getBuildData() {
       let param = {
@@ -179,10 +184,6 @@ export default {
         if (!item.SysLocalName) {
           flag = true;
         }
-        // 处理建筑
-        if (item.flowBuild) {
-          item.BuildingId = item.flowBuild
-        }
         item.Category = this.category.Category
       })
       if (flag) {
@@ -190,7 +191,9 @@ export default {
         return;
       }
       params.Content = newData
-      createGeneralSys(params, res => {
+      console.log(params)
+      // return
+      createSystemBuildFloor(params, res => {
         this.$message.success('创建成功')
         session.remove("systemAddData")
         this.$router.push({
@@ -237,7 +240,7 @@ export default {
     formatHeaderData(list) {
       let arr = tools.copyArr(list);
       let data = showTools.headerTextFilter(arr, 'system', this.onlyRead, this.showType);
-      data.unshift("所属建筑");
+      data.unshift("所属建筑楼层");
       return data;
     },
     formatHeaderType(list) {
@@ -245,13 +248,8 @@ export default {
       let arr = tools.copyArr(list);
       let data = showTools.headerTypeFilter(arr, 'system', this.onlyRead, this.showType);
       data.unshift({
-        data: "flowBuild",
-        renderer: tools.customDropdownRenderer,
-        editor: "chosen",
-        chosenOptions: {
-          // multiple: true,//多选
-          data: this.buildingData
-        }
+        data: "BuildingFloorInfoList",
+        renderer: text.sysInBuildFloor
       });
       return data;
     },
@@ -266,10 +264,14 @@ export default {
         contextMenu: {
           items: {
             remove_row: {
-              name: "删除设备"
+              name: "删除该系统"
             }
           }
         },
+        autoColumnSize: true,
+        language: "zh-CN",
+        manualColumnResize: true,
+        manualColumnMove: true,
         // 事件
         afterChange: this.handleUpdataTable, //修改后
         afterFilter: this.trimmedRows, //排序前
@@ -338,7 +340,8 @@ export default {
     },
     getInfors(infos, row) {
       let val = this.tableExample.colToProp(row.col);
-      console.log(val)
+      this.row = row.row;
+      this.messKey = val;
       switch (val) {
         //操作
         case 'caozuo':
@@ -354,112 +357,27 @@ export default {
             this.$message("此设备没有设备二维码");
           }
           break;
-        //关联系统
-        case 'linkSystem':
-          if (!this.onlyRead) {
-            this.systemList = this.tableData[row.row].LinkSystem || [];
-            this.myDialog.systemType = true;
-          }
-          break;
-        //关联资产
-        case 'LinkEquipLocalName':
-          if (this.linkNameFalg) {
-            this.myDialog.changeRea = true;
-          }
-          break;
-        //品牌型号弹窗
-        case 'DPManufacturerID':
-          if (!this.onlyRead) {
-            this.myDialog.firm = true;
-          }
-          break;
-        //供应商信息弹窗
-        case 'DPSupplierID':
-          if (!this.onlyRead) {
-            this.myDialog.supplier = true;
-          }
-          break;
-        //维修商信息弹窗
-        case 'DPMaintainerID':
-          if (!this.onlyRead) {
-            this.myDialog.maintainer = true;
-          }
-          break;
-        //保险公司信息
-        case 'DPInsurerID':
-          if (!this.onlyRead) {
-            this.myDialog.insurer = true;
-          }
-          break;
-        //供应合同编号
-        case 'LedgerParam.SupplyPurchase.SupplierContractID':
+        //关联设备数量
+        case 'Count':
           if (!this.onlyRead) {
-            let ContractIDflag = null;
-            let DPSdata = this.tableData[row.row].DPSupplierID;
-            if (DPSdata) {
-              ContractIDflag = DPSdata.split("-")[0];
-            }
-            if (!!ContractIDflag) {
-              this.id = ContractIDflag;
-              this.myDialog.supply = true;
-            } else {
-              this.$message("请先选择供应商");
-            }
+            this.myDialog.relevance = true
           }
           break;
-        //保险单号
-        case 'LedgerParam.InsuranceDoc.InsuranceNum':
+        //所属建筑楼层
+        case 'BuildingFloorInfoList':
           if (!this.onlyRead) {
-            let DPInsurerIDflag = null;
-            let DPIdata = this.tableData[row.row].DPInsurerID;
-            if (DPIdata) {
-              DPInsurerIDflag = DPIdata.split("-")[0];
-            }
-            if (!!DPInsurerIDflag) {
-              this.id = DPInsurerIDflag;
-              this.myDialog.guarantee = true;
-            } else {
-              this.$message("请先选择保险商");
-            }
-          }
-          break;
-        //保险文件--设备文档--安装质检报告
-        case 'LedgerParam.InsuranceDoc.InsuranceFile':
-        case 'LedgerParam.PhotoDoc.Archive':
-        case 'LedgerParam.Siteinstall.CheckReport':
-          let IPSdata = tools.dataForKey(this.tableData[row.row], val);
-          this.filesArr = IPSdata ? IPSdata : [];
-          this.myDialog.uploadFiles = true;
-          break;
-        //安装照片--安装图纸--设备铭牌照片--设备图纸
-        case 'LedgerParam.Siteinstall.InstallPic':
-        case 'LedgerParam.Siteinstall.InstallDrawing':
-        case 'LedgerParam.PhotoDoc.Nameplate':
-        case 'LedgerParam.PhotoDoc.Drawing':
-          let SSPPdata = tools.dataForKey(this.tableData[row.row], val);
-          this.imgsArr = SSPPdata ? SSPPdata : [];
-          this.myDialog.uploadImgs = true;
-          break;
-        //设备照片
-        case 'LedgerParam.PhotoDoc.Pic':
-          let Pdata = tools.dataForKey(this.tableData[row.row], val);
-          this.picsArr = Pdata ? Pdata : [];
-          this.myDialog.pic = true;
-          break;
-        //包含的部件字段
-        case 'Count':
-          if (this.onlyRead) {
-            this.$router.push({ path: '/ledger/parts', query: { deviceId: infos.EquipID } });
-          } else {
-            this.$router.push({ path: '/ledger/partsmanage', query: { deviceId: infos.EquipID, typeId: this.mess.deviceId } });
+            this.$refs.editFloor.showDialog(this.tableData[row.row]);
           }
           break;
         default:
           break;
       }
-      this.row = row.row;
-      this.messKey = val;
     },
+    //建筑楼层
+    relateSuccess(data) {
+      this.tableData[this.row].BuildingFloorInfoList = data
+      this.tableExample.render()
+    }
   }
 };
 </script>

+ 1 - 1
src/views/ready/buildfloor/addFloor/index.vue

@@ -1,5 +1,5 @@
 <template>
-  <el-dialog :title="title" :visible.sync="dialogVisible" width="40%" @close="handleClose" id="messageDialog">
+  <el-dialog :title="title" :visible.sync="dialogVisible" width="45%" @close="handleClose" id="messageDialog">
     <el-row>
       <formItems :type="'Floor'" ref="formItems"></formItems>
     </el-row>