Browse Source

调试竖井关系接口

zhangyu 5 years ago
parent
commit
52daec9d3b

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

@@ -1258,3 +1258,35 @@ export function floorUpdate(param, success) {
     http.postJson(url, param, success)
 }
 
+/****关系-竖井****/
+//字典查询接口 竖井所有类型
+export function queryShaftType(success) {
+    let url = `${baseUrl}/datacenter/data-dictionary/query-shaft-type`;
+    http.getJson(url, {}, success)
+}
+//根据对象删除设备所在竖井关系,只针对一个对象
+export function eqinshUnlink(param, success) {
+    let url = `${baseUrl}/datacenter/eq-in-sh/unlink`;
+    http.postJson(url, param, success)
+}
+//根据对象删除系统所在竖井关系,只针对一个对象
+export function syinshUnlink(param, success) {
+    let url = `${baseUrl}/datacenter/sy-in-sh/unlink`;
+    http.postJson(url, param, success)
+}
+//根据对象删除竖井的贯通关系,只针对一个对象
+export function shthroughshUnlink(param, success) {
+    let url = `${baseUrl}/datacenter/sh-through-sh/unlink`;
+    http.postJson(url, param, success)
+}
+//查询没有和当前竖井绑定的设备
+export function unshaftInEq(param, success) {
+    let data = param.data
+    let url = `${baseUrl}/equip-component/shaft/unshaft-in-eq?shaftId=${param.shaftId}`;
+    http.postJson(url, data, success)
+}
+//设备所在的竖井,竖井一对多,此方不会覆盖以前的记录,累计添加
+export function linkEqSh(param, success) {
+    let url = `${baseUrl}/datacenter/eq-in-sh/link-eq-sh`;
+    http.postJson(url, param, success)
+}

+ 3 - 4
src/components/ledger/cenote/dialog/addCenoteDialog.vue

@@ -92,12 +92,11 @@ export default {
     };
   },
   props: {
-    type: {}, //equipment--equipmentFor
-    spaceId: {},
-    zone: {}, //分区类型 
+    type: String, //选中的tab页
+    params: Object //查看的竖井关系信息
   },
   created() {
-    this.getBuilding();
+    // this.getBuilding();
   },
   methods: {
     // 获取项目下建筑

+ 73 - 74
src/components/ledger/cenote/dialog/addEquipDialog.vue

@@ -7,14 +7,13 @@
         </el-input>
       </el-col>
       <el-col :span="15">
-        <span style="margin-left:10px;">所属楼层</span>
-        <el-cascader @change="getTableData" v-model="floor" :options="options" :props="props"></el-cascader>
-        <el-checkbox style="margin-left:10px;" @change="getTableData" :checked="showType" label="只显示在当前业务空间中的设备"></el-checkbox>
+        <floor-cascader @change="changeFloor"></floor-cascader>
       </el-col>
     </el-row>
     <div class="table-box">
-      <el-table :data="tableData" style="width: 100%" height="100%" v-loading="loading" :header-cell-style="headerStyle" ref="multipleTable"
+      <el-table :data="tableData" style="width: 100%" height="350" v-loading="loading" :header-cell-style="headerStyle" ref="multipleTable"
         @selection-change="handleSelectionChange">
+        <el-table-column  type="selection" width="55"></el-table-column>
         <el-table-column :label="`${inSpaceType}名称`" show-overflow-tooltip min-width="100">
           <template slot-scope="scope">
             <div>
@@ -23,11 +22,11 @@
           </template>
         </el-table-column>
         <el-table-column prop="EquipLocalID" :label="`${inSpaceType}本地编码`" show-overflow-tooltip min-width="100"></el-table-column>
-        <el-table-column prop="EquipLocalID" :label="`${inSpaceType}类`" show-overflow-tooltip min-width="100"></el-table-column>
-        <el-table-column prop="EquipLocalID" label="已关联其他业务空间" show-overflow-tooltip min-width="100"></el-table-column>
+        <el-table-column prop="EquipCategory.EquipName" :label="`${inSpaceType}类`" show-overflow-tooltip min-width="100"></el-table-column>
+        <el-table-column prop="ShaftListName" label="已关联其他竖井" show-overflow-tooltip min-width="100" max-width="200"></el-table-column>
         <el-table-column prop="action" label="操作" min-width="100">
           <template slot-scope="scope">
-            <el-button size="mini" @click="toDetail(scope.$index, scope.row)" type="danger" plain icon="el-icon-delete"></el-button>
+            <el-button size="mini" @click="toDetail(scope.$index, scope.row)" plain>设备详情</el-button>
           </template>
         </el-table-column>
       </el-table>
@@ -44,38 +43,25 @@
 </template>
 
 <script>
-// import {
-//   getSpaceEquip,
-//   buildingQuery, //数据中心-建筑查询
-//   notEqInSpaceQuery, //没有和当前空间绑定的设备
-//   notEqForSpaceQuery, //未服务当前空间的设备
-//   eqInSpaceCreate, //设备所在业务空间--创建关系
-//   eqForSpaceCreate, //设备服务业务空间--创建关系
-// } from "@/api/scan/request";
+import { unshaftInEq, linkEqSh } from "@/api/scan/request";
+import floorCascader from "@/components/ledger/lib/floorCascader";
 import { mapGetters } from "vuex";
 export default {
   components: {
-
+    floorCascader
   },
   computed: {
     ...mapGetters("layout", ["projectId"])
   },
   data() {
     return {
-      title: "添加竖井内的系统",
+      title: "添加竖井内的设备",
       keycode: '', //输入查询条件
-      options: [], //建筑楼层级联
-      floor: [], // 选中的建筑楼层
-      showType: false, //是否只显示在当前业务空间中的设备
+      Buildfloor: ['all'], // 选中的建筑楼层
       inSpaceType: '设备',
       dialogVisible: false,
       tableData: [],
       loading: false,
-      headerStyle: {
-        backgroundColor: '#e1e4e5',
-        color: '#2b2b2b',
-        lineHeight: '30px'
-      }, // 列表样式
       selections: [], // 选中项
       page: {
         pageSize: 50,
@@ -83,79 +69,89 @@ export default {
         pageNumber: 1,
         total: 0
       },
-      props: { //自定义字段
-        value: "BuildID",
-        label: "BuildLocalName",
-        children: "Floor"
-      },
+      headerStyle: {
+        backgroundColor: '#e1e4e5',
+        color: '#2b2b2b',
+        lineHeight: '30px'
+      } // 列表样式
     };
   },
   props: {
-    type: {}, //equipment--equipmentFor
-    spaceId: {},
-    zone: {}, //分区类型 
+    type: String, //选中的tab页
+    params: Object //查看的竖井关系信息
   },
   created() {
-    this.getBuilding();
+    // this.getBuilding();
   },
   methods: {
-    // 获取项目下建筑
-    getBuilding() {
-      let pa = {
-        Cascade: [{ name: 'floor', Orders: 'SequenceId desc' }],
-        Orders: "BuildLocalName asc",
-      }
-      buildingQuery(pa, res => {
-        this.options = res.Content.map(t => {
-          if (t.Floor) {
-            t.Floor = t.Floor.map(item => {
-              item.BuildID = item.FloorID;
-              item.BuildLocalName = item.FloorLocalName;
-              return item;
-            })
-          } else {
-            t.Floor = []
-          }
-          t.Floor.unshift({ BuildID: 'isNull', BuildLocalName: '未明确楼层' })
-          return t;
-        })
-      })
+    //修改建筑楼层
+    changeFloor(value) {
+      this.Buildfloor = value
     },
     // 显示弹窗
     showDialog() {
-      this.dialogVisible = true;
-      this.getTableData();
+      this.dialogVisible = true
+      this.page.pageNumber = 1
+      this.getTableData()
     },
     getTableData() {
-      let pa = {
+      let params = {
         data: {
-          Filters:`BuildingId="${this.floor[0]}";FloorId="${this.floor[1]}"`,
+          Cascade: [{ Name: 'equipCategory' }, {Name: 'shaftList'}],
+          Filters:`not EquipID isNull`,
+          Orders: "createTime desc, EquipID desc",
           PageNumber: this.page.pageNumber,
           PageSize: this.page.pageSize,
         },
-        type: this.zone,
-        spaceId: this.spaceId
+        shaftId: this.params.ShaftID
+      }
+      if (this.Buildfloor[0] == "noKnow") {
+        param.data.Filters += `;buildingId isNull`
+      } else if (this.Buildfloor[0] && this.Buildfloor[0] != "all") {
+        param.data.Filters += `;buildingId='${this.Buildfloor[0]}'`
+      }
+      if (this.Buildfloor[1] == "noKnow") {
+        param.data.Filters += `;floorId isNull`
+      } else if (this.Buildfloor[1] && this.Buildfloor[1] != "all") {
+        param.data.Filters += `;floorId='${this.Buildfloor[1]}'`
       }
       if(this.keycode!=''){
-        pa.data.Filters += `;EquipName contain "${this.keycode}" or EquipLocalName contain "${this.keycode}" or EquipLocalID contain "${this.keycode}"`
+        params.data.Filters += `;EquipName contain '${this.keycode}' or EquipLocalName contain '${this.keycode}' or EquipLocalID contain '${this.keycode}'`
       }
-      if (this.type == "equipment") {
-        notEqInSpaceQuery(pa, res => {
-          this.tableData = res.Content;
-          this.page.total = res.Total;
-        })
-      } else {
-        notEqForSpaceQuery(pa, res => {
-          this.tableData = res.Content;
-          this.page.total = res.Total;
+      unshaftInEq(params, res => {
+        res.Content.forEach(item => {
+          item.ShaftListName = ""
+          if(item.ShaftList && item.ShaftList.length){
+            item.ShaftListName = item.ShaftList.map(shaft => {
+              return shaft.ShaftLocalName?shaft.ShaftLocalName:shaft.ShaftName
+            }).join("、")
+          }
         })
-      }
+        this.tableData = res.Content
+        this.page.total = res.Total
+      })
     },
     //选中项修改
     handleSelectionChange(val) {
       this.selections = val;
     },
-    savaRelation() { },
+    savaRelation() {
+      if(this.selections.length){
+        let params = {
+          ShaftId: this.params.ShaftID,
+          EquipIdList: this.selections.map(item => {
+            return item.EquipID
+          })
+        }
+        linkEqSh(params, res => {
+          this.dialogVisible = false
+          this.$message.success('关联成功!')
+          this.$emit('refresh')
+        })
+      }else {
+        this.$message('请选择要关联的设备')
+      }
+    },
     //改变pagesize
     handleSizeChange(pageSize) {
       this.page.pageSize = pageSize;
@@ -182,7 +178,10 @@ export default {
     }
   }
   .table-box {
-    height: 350px;
+    height: 370px;
+    .fr{
+      margin-top: 10px;
+    }
   }
 }
 </style>

+ 2 - 3
src/components/ledger/cenote/dialog/addSystemDialog.vue

@@ -49,9 +49,8 @@ export default {
     }
   },
   props: {
-    type: {}, //equipment--equipmentFor
-    spaceId: {},
-    zone: {}, //分区类型 
+    type: String, //选中的tab页
+    params: Object //查看的竖井关系信息
   },
   methods: {
     // 显示

+ 38 - 50
src/components/ledger/cenote/table/cenoteTable.vue

@@ -11,15 +11,15 @@
         <el-table-column :label="`${inSpaceType}名称`" show-overflow-tooltip min-width="100">
           <template slot-scope="scope">
             <div>
-              {{scope.row.EquipLocalName||scope.row.EquipName||''}}
+              {{scope.row.ShaftLocalName||scope.row.ShaftName||''}}
             </div>
           </template>
         </el-table-column>
-        <el-table-column prop="EquipLocalID" :label="`${inSpaceType}本地编码`" show-overflow-tooltip min-width="100"></el-table-column>
+        <el-table-column prop="ShaftLocalID" :label="`${inSpaceType}本地编码`" show-overflow-tooltip min-width="100"></el-table-column>
         <el-table-column :label="`${inSpaceType}类型`" show-overflow-tooltip min-width="100">
           <template slot-scope="scope">
             <div>
-              {{scope.row.EquipCategory.EquipName}}
+              {{scope.row.StructureInfo.ShaftFuncType}}
             </div>
           </template>
         </el-table-column>
@@ -39,16 +39,12 @@
       </el-table>
     </div>
     <!-- 添加设备弹窗 -->
-    <addCenoteDialog ref="addCenoteDialog" :type="type" :spaceId="params.id"></addCenoteDialog>
+    <addCenoteDialog ref="addCenoteDialog" :type="type" :params="params"></addCenoteDialog>
   </div>
 </template>
 
 <script>
-// import {
-//   queryZone,
-//   eqInSpaceDelete, //设备所在业务空间--删除关系
-//   eqForSpaceDelete, //设备服务业务空间--删除关系
-// } from "@/api/scan/request";
+import { queryCenoteTableData, queryShaftType, shthroughshUnlink } from "@/api/scan/request";
 import { mapGetters } from "vuex";
 import addCenoteDialog from "@/components/ledger/cenote/dialog/addCenoteDialog"
 export default {
@@ -67,7 +63,8 @@ export default {
         lineHeight: '30px'
       }, // 列表样式
       loading: false, // loading
-      tableData: [] //列表数据
+      tableData: [], //列表数据
+      shaftType: {} //竖井类型
     };
   },
   props: {
@@ -75,9 +72,33 @@ export default {
     type: String
   },
   created() {
-    // this.getTableData()
+    queryShaftType(res => {
+      res.Content.forEach(item => {
+        this.shaftType[item.Code] = item.Name
+      })
+      this.getTableData()
+    })
   },
   methods: {
+    // 获取列表数据
+    getTableData() {
+      let params = {
+        Filters: `ShaftID='${this.params.ShaftID}'`,
+        Cascade: [
+          {
+            Name: 'shaftThroughList'
+          }
+        ]
+      }
+      queryCenoteTableData(params, res => {
+        this.tableData = res.Content[0].ShaftThroughList || []
+        this.tableData.forEach(item => {
+          if(item.StructureInfo && item.StructureInfo.ShaftFuncType){
+            item.StructureInfo.ShaftFuncType = this.shaftType[item.StructureInfo.ShaftFuncType]
+          }
+        })
+      })
+    },
     // 删除关系
     handleDelete(index, row) {
       this.$confirm("确认删除该关系?", "提示", {
@@ -85,29 +106,18 @@ export default {
         cancelButtonText: '取消',
         type: 'warning'
       }).then(() => {
-        let pa = {
-          data: [row],
-          type: this.params.zone
-        }
-        if (this.type == 'equipment') {
-          this.deleteEqInSpace(pa);
-        } else {
-          this.deleteEqForSpace(pa);
+        let params = {
+          ShaftOtherId: row.ShaftID,
+          ShaftId: this.params.ShaftID
         }
+        this.deleteShThroughSh(params);
       }).catch(() => {
         this.$message("取消删除")
       })
     },
     // 删除设备所在空间关系
-    deleteEqInSpace(pa) {
-      eqInSpaceDelete(pa, res => {
-        this.$message.success('删除成功')
-        this.getTableData()
-      })
-    },
-    // 删除设备服务空间关系
-    deleteEqForSpace(pa) {
-      eqForSpaceDelete(pa, res => {
+    deleteShThroughSh(params) {
+      shthroughshUnlink(params, res => {
         this.$message.success('删除成功')
         this.getTableData()
       })
@@ -122,28 +132,6 @@ export default {
       this.page.pageNumber = pageNo;
       this.getTableData();
     },
-    // 获取列表数据
-    getTableData() {
-      let pa = {
-        data: {
-          Filters: `RoomID='${this.params.RoomID}'`,
-          Cascade: [
-            {
-              Name: this.type,
-              Cascade: [{ Name: 'equipCategory' }]
-            }
-          ]
-        },
-        zone: this.params.zone
-      }
-      queryZone(pa, res => {
-        this.tableData = res.Content[0].Equipment || []
-        this.tableData.map(t => {
-          t.SpaceId = res.Content[0].RoomID
-          return t;
-        })
-      })
-    },
     // 添加设备
     add() {
       this.$refs.addCenoteDialog.showDialog()

+ 11 - 30
src/components/ledger/cenote/table/deviceTable.vue

@@ -25,9 +25,7 @@
         </el-table-column>
         <el-table-column prop="action" label="操作" min-width="100">
           <template slot-scope="scope">
-            <el-tooltip class="item" effect="dark" content="删除关系" placement="left">
-              <el-button size="mini" @click="handleDelete(scope.$index, scope.row)" type="danger" plain icon="el-icon-delete"></el-button>
-            </el-tooltip>
+            <el-button title="删除关系" size="mini" @click="handleDelete(scope.$index, scope.row)" type="danger" plain icon="el-icon-delete"></el-button>
           </template>
         </el-table-column>
         <template slot="empty">
@@ -39,12 +37,12 @@
       </el-table>
     </div>
     <!-- 添加设备弹窗 -->
-    <addEquipDialog ref="addEqDialog" :type="type" :spaceId="params.id"></addEquipDialog>
+    <addEquipDialog ref="addEqDialog" @refresh="getTableData" :type="type" :params="params"></addEquipDialog>
   </div>
 </template>
 
 <script>
-import { queryCenoteTableData } from "@/api/scan/request";
+import { queryCenoteTableData, eqinshUnlink } from "@/api/scan/request";
 import { mapGetters } from "vuex";
 import addEquipDialog from "@/components/ledger/cenote/dialog/addEquipDialog"
 export default {
@@ -86,12 +84,7 @@ export default {
         ]
       }
       queryCenoteTableData(params, res => {
-        debugger
-        this.tableData = res.Content[0].Equipment || []
-        this.tableData.map(t => {
-          t.SpaceId = res.Content[0].RoomID
-          return t;
-        })
+        this.tableData = res.Content[0].EquipmentList || []
       })
     },
     // 删除关系
@@ -101,29 +94,18 @@ export default {
         cancelButtonText: '取消',
         type: 'warning'
       }).then(() => {
-        let pa = {
-          data: [row],
-          type: this.params.zone
-        }
-        if (this.type == 'equipment') {
-          this.deleteEqInSpace(pa);
-        } else {
-          this.deleteEqForSpace(pa);
+        let params = {
+          EquipId: row.EquipID,
+          ShaftId: this.params.ShaftID
         }
+        this.deleteEqInSh(params);
       }).catch(() => {
         this.$message("取消删除")
       })
     },
-    // 删除设备所在空间关系
-    deleteEqInSpace(pa) {
-      eqInSpaceDelete(pa, res => {
-        this.$message.success('删除成功')
-        this.getTableData()
-      })
-    },
-    // 删除设备服务空间关系
-    deleteEqForSpace(pa) {
-      eqForSpaceDelete(pa, res => {
+    // 删除设备所在竖井关系
+    deleteEqInSh(params) {
+      eqinshUnlink(params, res => {
         this.$message.success('删除成功')
         this.getTableData()
       })
@@ -140,7 +122,6 @@ export default {
     },
     // 添加设备
     add() {
-      this.$refs.addEqDialog.floor = [this.params.BuildingId, this.params.FloorId];
       this.$refs.addEqDialog.showDialog()
     }
   },

+ 28 - 47
src/components/ledger/cenote/table/systemTable.vue

@@ -11,15 +11,15 @@
         <el-table-column :label="`${inSpaceType}名称`" show-overflow-tooltip min-width="100">
           <template slot-scope="scope">
             <div>
-              {{scope.row.ShaftLocalName||scope.row.ShaftName||''}}
+              {{scope.row.SysLocalName||scope.row.SysName||''}}
             </div>
           </template>
         </el-table-column>
-        <el-table-column prop="EquipLocalID" :label="`${inSpaceType}本地编码`" show-overflow-tooltip min-width="100"></el-table-column>
+        <el-table-column prop="SysLocalID" :label="`${inSpaceType}本地编码`" show-overflow-tooltip min-width="100"></el-table-column>
         <el-table-column :label="`${inSpaceType}类型`" show-overflow-tooltip min-width="100">
           <template slot-scope="scope">
             <div>
-              {{scope.row.EquipCategory.EquipName}}
+              {{scope.row.CategoryNames.CategoryName}}
             </div>
           </template>
         </el-table-column>
@@ -39,16 +39,12 @@
       </el-table>
     </div>
     <!-- 添加设备弹窗 -->
-    <addSystemDialog ref="addEqDialog" :type="type" :spaceId="params.RoomID" :zone="params.zone"></addSystemDialog>
+    <addSystemDialog ref="addEqDialog" :type="type" :params="params"></addSystemDialog>
   </div>
 </template>
 
 <script>
-// import {
-//   queryZone,
-//   eqInSpaceDelete, //设备所在业务空间--删除关系
-//   eqForSpaceDelete, //设备服务业务空间--删除关系
-// } from "@/api/scan/request";
+import { queryCenoteTableData, syinshUnlink } from "@/api/scan/request";
 import { mapGetters } from "vuex";
 import addSystemDialog from "@/components/ledger/cenote/dialog/addSystemDialog"
 export default {
@@ -75,9 +71,24 @@ export default {
     type: String
   },
   created() {
-    // this.getTableData()
+    this.getTableData()
   },
   methods: {
+    // 获取列表数据
+    getTableData() {
+      let params = {
+        Filters: `ShaftID='${this.params.ShaftID}'`,
+        Cascade: [
+          {
+            Name: 'systemList',
+            Cascade: [{ Name: 'categoryNames' }]
+          }
+        ]
+      }
+      queryCenoteTableData(params, res => {
+        this.tableData = res.Content[0].SystemList || []
+      })
+    },
     // 删除关系
     handleDelete(index, row) {
       this.$confirm("确认删除该关系?", "提示", {
@@ -85,29 +96,18 @@ export default {
         cancelButtonText: '取消',
         type: 'warning'
       }).then(() => {
-        let pa = {
-          data: [row],
-          type: this.params.zone
-        }
-        if (this.type == 'equipment') {
-          this.deleteEqInSpace(pa);
-        } else {
-          this.deleteEqForSpace(pa);
+        let params = {
+          SysId: row.SysID,
+          ShaftId: this.params.ShaftID
         }
+        this.deleteSyInSh(params);
       }).catch(() => {
         this.$message("取消删除")
       })
     },
-    // 删除设备所在空间关系
-    deleteEqInSpace(pa) {
-      eqInSpaceDelete(pa, res => {
-        this.$message.success('删除成功')
-        this.getTableData()
-      })
-    },
-    // 删除设备服务空间关系
-    deleteEqForSpace(pa) {
-      eqForSpaceDelete(pa, res => {
+    // 删除系统所在竖井关系
+    deleteSyInSh(params) {
+      syinshUnlink(params, res => {
         this.$message.success('删除成功')
         this.getTableData()
       })
@@ -122,27 +122,8 @@ export default {
       this.page.pageNumber = pageNo;
       this.getTableData();
     },
-    // 获取列表数据
-    getTableData() {
-      let pa = {
-        data: {
-          Filters: `RoomID='${this.params.RoomID}'`,
-          Cascade: [
-            {
-              Name: this.type,
-              Cascade: [{ Name: 'equipCategory' }]
-            }
-          ]
-        },
-        zone: this.params.zone
-      }
-      queryZone(pa, res => {
-        this.tableData = res.Content[0].EquipmentList || []
-      })
-    },
     // 添加设备
     add() {
-      this.$refs.addEqDialog.floor = [this.params.BuildingId, this.params.FloorId];
       this.$refs.addEqDialog.showDialog()
     }
   },