浏览代码

解决冲突

zhangyu 5 年之前
父节点
当前提交
13131c73ed

+ 9 - 1
src/api/scan/config.js

@@ -9,5 +9,13 @@ export const zone = {
   PowerSupplyZone: 'zone-power-supply', //供电分区
   LightingZone: 'zone-lighting', //照明分区
   AirConditioningZone: 'metaspace', //空调分区
-  TenantZone: 'zone-tenant' //租赁分区
+  TenantZone: 'zone-tenant', //租赁分区
+  HeatingZone:'zone-heating', //采暖分区
+  CleanZone:'zone-clean', //洁净分区
+  DomesticWaterSupplyZone:'zone-domestic-water', //生活给水分区
+  NetworkZone:'zone-network', //网络分区
+  FunctionZone:'zone-function', //功能分区
+  FireZone:'zone-fire', //防火分区
+  SecurityZone:'zone-security', //安防分区
+  Ispace:'ispace', //元空间
 }

+ 45 - 1
src/api/scan/request.js

@@ -1245,4 +1245,48 @@ export function floorUpdate(param, success) {
     let url = `${baseUrl}/datacenter/floor/update`;
     http.postJson(url, param, success)
 }
-
+//关系-----设备所在业务空间--删除关系
+export function eqInSpaceDelete(param, success) {
+    let url = `${baseUrl}/datacenter/eq-in-sp-base/unlink-list?type=${param.type}`;
+    http.postJson(url, param.data, success)
+}
+//关系-----设备所在业务空间--创建关系
+export function eqInSpaceCreate(param, success) {
+    let url = `${baseUrl}/datacenter/eq-in-sp-base/link-eq-sp?type=${param.type}`;
+    http.postJson(url, param.data, success)
+}
+//关系-----设备服务业务空间--删除关系
+export function eqForSpaceDelete(param, success) {
+    let url = `${baseUrl}/datacenter/eq-for-sp-base/unlink-list?type=${param.type}`;
+    http.postJson(url, param.data, success)
+}
+//关系-----设备服务业务空间--创建关系
+export function eqForSpaceCreate(param, success) {
+    let url = `${baseUrl}/datacenter/eq-for-sp-base/link-eq-sp?type=${param.type}`;
+    http.postJson(url, param.data, success)
+}
+//关系-----系统所在业务空间--删除关系
+export function syInSpaceDelete(param, success) {
+    let url = `${baseUrl}/datacenter/sy-in-sp-base/unlink-list?type=${param.type}`;
+    http.postJson(url, param.data, success)
+}
+//关系-----系统所在业务空间--创建关系
+export function syInSpaceCreate(param, success) {
+    let url = `${baseUrl}/datacenter/sy-in-sp-base/link-sp-sys?type=${param.type}`;
+    http.postJson(url, param.data, success)
+}
+//关系-----没有和当前空间绑定的设备
+export function notEqInSpaceQuery(param, success) {
+    let url = `${baseUrl}/equip-component/space/unspace-in-eq?type=${param.type}&spaceId=${param.spaceId}`;
+    http.postJson(url, param.data, success)
+}
+//关系-----未服务当前空间的设备
+export function notEqForSpaceQuery(param, success) {
+    let url = `${baseUrl}/equip-component/space/unspace-for-eq?type=${param.type}&spaceId=${param.spaceId}`;
+    http.postJson(url, param.data, success)
+}
+//关系-----没有和当前空间绑定的系统
+export function notSyInSpaceQuery(param, success) {
+    let url = `${baseUrl}/equip-component/space/unspace-in-sys?type=${param.type}&spaceId=${param.spaceId}`;
+    http.postJson(url, param.data, success)
+}

+ 93 - 101
src/components/business_space/business/handsontable.vue

@@ -1,6 +1,6 @@
 <template>
   <div id="handsontable" v-loading="isLoading">
-		<el-row class="left">
+    <el-row class="left">
       <el-select v-model="onlyRead" @change="getData(false)" style="width:100px;margin-right:20px;vertical-align:bottom;">
         <el-option v-for="item in options" :key="item.value" :label="item.label" :value="item.value"></el-option>
       </el-select>
@@ -8,8 +8,8 @@
         <el-option v-for="item in showTypes" :key="item.value" :label="item.label" :value="item.value"></el-option>
       </el-select>
       <el-button v-show="!onlyRead" @click="addSp">添加</el-button>
-			<el-button @click="reset">刷新</el-button>
-			<el-button v-show="!onlyRead" @click="undo">撤销</el-button>
+      <el-button @click="reset">刷新</el-button>
+      <el-button v-show="!onlyRead" @click="undo">撤销</el-button>
     </el-row>
     <div v-show="main &&main.length" :id="id"></div>
     <div class="center" v-show="!main || !main.length" style="height: 400px;padding-top:140px;box-sizing:border-box;">
@@ -17,9 +17,9 @@
       暂无数据
     </div>
     <!-- <add-business :buildMess="buildMess" :dialog="dialog"></add-business> -->
-    <el-pagination class="right" v-show="main && main.length" @size-change="handleSizeChange"
-      @current-change="handleCurrentChange" :current-page="page.pageNumber" :page-sizes="page.pageSizes"
-      :page-size="page.pageSize" layout="total, sizes, prev, pager, next, jumper" :total="page.total">
+    <el-pagination class="right" v-show="main && main.length" @size-change="handleSizeChange" @current-change="handleCurrentChange"
+      :current-page="page.pageNumber" :page-sizes="page.pageSizes" :page-size="page.pageSize" layout="total, sizes, prev, pager, next, jumper"
+      :total="page.total">
     </el-pagination>
     <!-- <div class="right" v-show="main && main.length">
       <my-pagination :page="page" @change="pageChange"></my-pagination>
@@ -45,12 +45,8 @@ import { queryZone, updateZone, deleteZone, createZone, BeatchQueryParam } from
 import { mapGetters, mapActions } from "vuex";
 export default {
   props: {
-    id: {
-      type: String
-		},
-		zoneObj: {
-			type: Object
-		}
+    id: {},
+    zoneCode: {}
   },
   components: {
     qrcode, //二维码页面
@@ -58,11 +54,11 @@ export default {
     addBusiness
   },
   computed: {
-		...mapGetters("layout", ["projectId", "secret", "userId"]),
-		showTypes () {
-      return this.onlyRead?
-        [{value: "Visible", label: '只看采集信息'}, {value: "all", label: '全部'}]: 
-        [{value: "partInfo", label: '隐藏信息点'}, {value: "Visible", label: '只看采集信息'}, {value: "all", label: '全部'} ]
+    ...mapGetters("layout", ["projectId", "secret", "userId"]),
+    showTypes() {
+      return this.onlyRead ?
+        [{ value: "Visible", label: '只看采集信息' }, { value: "all", label: '全部' }] :
+        [{ value: "partInfo", label: '隐藏信息点' }, { value: "all", label: '全部' }]
     }
   },
   data() {
@@ -76,15 +72,15 @@ export default {
       main: [],
       hot: null,
       isLoading: true,
-			options: [{
+      options: [{
         value: true,
         label: '只读模式'
       }, {
         value: false,
         label: '编辑模式'
       }],
-			onlyRead: true,
-			showType: "",
+      onlyRead: true,
+      showType: "",
       page: {
         pageSize: 50,
         pageSizes: [10, 20, 50, 100],
@@ -99,7 +95,6 @@ export default {
       buildMess: null,
       filtersArr: [], //表格数据被过滤后的下标
       copyMain: [], //深拷贝数组
-      activeType: {}
     };
   },
   created() {
@@ -113,43 +108,39 @@ export default {
       this.param.secret = this.secret
     },
     //获取表头
-    getHeader(headers, activeTabType) {
+    getHeader(headers, buildFloorSelectd) {
       this.headers = headers
-      this.activeType = activeTabType
+      this.buildFloorSelectd = buildFloorSelectd
+      this.getData()
     },
-    getData(buildMess) {
+    getData() {
       this.isLoading = true
-      if (buildMess) {
-        this.buildMess = buildMess
-			}
       let params = {
-				zone: this.zoneObj.code,
-				data: {
-					Filters: ``,
-					Orders: "createTime desc, RoomID asc",
-					PageNumber: this.page.pageNumber,
-					PageSize: this.page.pageSize
-				}
-			}
-			if (this.buildMess.selectd && this.buildMess.selectd[0] && this.buildMess.selectd[1]) {
-				params.data.Filters = `BuildingId='${this.buildMess.selectd[0]}';FloorId='${this.buildMess.selectd[1]}'`
-			} else if (this.buildMess.selectd && this.buildMess.selectd[0] && !this.buildMess.selectd[1]) {
-				params.data.Filters = `BuildingId='${this.buildMess.selectd[0]}'`
-			} else {
-				params.data.Filters = `BuildingId='';FloorId=''`
-			}
-			queryZone(params, res => {
-				this.page.total = res.Total
-				this.main = res.Content
-				if (this.main && this.main.length && this.main[0].RoomID) {
+        zone: this.zoneCode,
+        data: {
+          Filters: ``,
+          Orders: "createTime desc, RoomID asc",
+          PageNumber: this.page.pageNumber,
+          PageSize: this.page.pageSize
+        }
+      }
+      if (this.buildFloorSelectd.length && this.buildFloorSelectd[0] && this.buildFloorSelectd[1]) {
+        params.data.Filters = `BuildingId='${this.buildFloorSelectd[0]}';FloorId='${this.buildFloorSelectd[1]}'`
+      }
+      // else if (buildFloorSelectd.length && buildFloorSelectd[0] && !buildFloorSelectd[1]) {
+      //   params.data.Filters = `BuildingId='${buildFloorSelectd[0]}'`
+      // } else {
+      //   params.data.Filters = `BuildingId='';FloorId=''`
+      // }
+      queryZone(params, res => {
+        this.page.total = res.Total
+        this.main = res.Content
+        if (this.main && this.main.length && this.main[0].RoomID) {
           this.copyMain = tools.deepCopy(this.main);
-          if (this.onlyRead) {
-            this.getBatch(this.main)
-          }
         }
         this.isLoading = false
-				this.getMain()
-			})
+        this.getMain()
+      })
     },
     //获取表格主体内容
     getMain() {
@@ -163,7 +154,6 @@ export default {
     },
     //初始化handsontable组件
     initHot() {
-      let id = this.id
       var container = document.getElementById(this.id);
       let winHeight = document.documentElement.clientHeight;
       this.hot = new Handsontable(container, {
@@ -171,6 +161,7 @@ export default {
         colHeaders: this.delHeader(this.headers), //表头文案
         columns: this.getType(this.headers), //数据显示格式
         filters: true,
+        fixedColumnsLeft: 4,
         maxRows: this.main.length,
         height: winHeight - 100 - 50 - 176,
         columnSorting: true, //添加排序
@@ -232,7 +223,10 @@ export default {
     getInfors(infos, row) {
       let val = this.hot.colToProp(row.col);
       if (val == "point") {
-        this.$emit("lookEqu", infos);
+        this.$router.push({
+          path: "/ledger/spaceDetail",
+          query: { RoomID: infos.RoomID, zone: this.zoneCode, isMyTab: 2 }
+        })
       } else if (val == "RoomQRCode") {
         this.qrcodeUrl = this.main[row.row].RoomQRCode
         if (!!this.qrcodeUrl) {
@@ -246,7 +240,7 @@ export default {
     },
     //表格发生更改
     tdChange(changeData, source) {
-			if (!this.onlyRead) {
+      if (!this.onlyRead) {
         if (changeData) {
           let trimmedArr = this.trimmedRows();
           let param = handsonUtils.getParam(changeData, source, this.hot, trimmedArr);
@@ -272,17 +266,17 @@ export default {
     },
     //右键删除
     romoveFm() {
-			let params = tools.differenceArr(this.main, this.copyMain)
+      let params = tools.differenceArr(this.main, this.copyMain)
       if (params.length < 1 || this.main > this.copyMain) {
         return
       }
       let param = {
-				data: [],
-				zone: this.zoneObj.code
-			}
+        data: [],
+        zone: this.zoneCode
+      }
       params.map(item => {
-        if(item.RoomID)
-        param.data.push({RoomID: item.RoomID})
+        if (item.RoomID)
+          param.data.push({ RoomID: item.RoomID })
       })
       this.$confirm("此操作将删除业务空间,是否继续?", "提示", {
         confirmButtonText: '确定',
@@ -290,9 +284,9 @@ export default {
         type: 'warning'
       }).then(() => {
         deleteZone(param, res => {
-					this.$message.success("删除成功!")
-        	this.getData()
-				})
+          this.$message.success("删除成功!")
+          this.getData()
+        })
       }).catch(() => {
         this.getData()
         this.$message("取消删除")
@@ -302,7 +296,7 @@ export default {
     handleCreateZone(param) {
       let keys = Object.keys(param)
       keys.map((key) => { //将值为空字符串的属性删除
-        if(param[key] == "") {
+        if (param[key] == "") {
           delete param[key]
         }
       })
@@ -314,40 +308,37 @@ export default {
         this.$message("新添加业务空间内容不能为空!")
         return
       }
-      if (this.buildMess.selectd && this.buildMess.selectd[0] && this.buildMess.selectd[1]) {
-        param.BuildingId = this.buildMess.selectd[0]
-        param.FloorId = this.buildMess.selectd[1]
-			} else if (this.buildMess.selectd && this.buildMess.selectd[0] && !this.buildMess.selectd[1]) {
-				param.BuildingId = this.buildMess.selectd[0]
-			}
+      if (this.buildFloorSelectd && this.buildFloorSelectd[0] && this.buildFloorSelectd[1]) {
+        param.BuildingId = this.buildFloorSelectd[0]
+        param.FloorId = this.buildFloorSelectd[1]
+      }
+      //  else if (this.buildMess.selectd && this.buildMess.selectd[0] && !this.buildMess.selectd[1]) {
+      //   param.BuildingId = this.buildMess.selectd[0]
+      // }
       let params = {
-        zone: this.zoneObj.code,
+        zone: this.zoneCode,
         data: {
           Content: [param]
         }
       }
-      createZone(params,(res) => {
+      createZone(params, res => {
         this.$message.success("添加成功!")
         this.getData()
       })
     },
     // 修改
     updateBusiness(data, change) {
-			let param = {
-				data: {
-					Content: [],
-        	Projection: []
-				},
-        zone: this.zoneObj.code
-      }, keyList = [];
+      let param = {
+        data: {
+          Content: [],
+          Projection: []
+        },
+        zone: this.zoneCode
+      };
       //生成要修改字段列表
       change.map((item) => {
-        let key = item[1].split(".")[0]
-        if(item[1] && keyList.indexOf(key) == -1) {
-          keyList.push(key)
-        }
-        if(item[1] && item[3] == "" && param.data.Projection.indexOf(key) == -1) {
-          param.data.Projection.push(key)
+        if (item[1] && param.data.Projection.indexOf(item[1]) == -1) {
+          param.data.Projection.push(item[1])
         }
       })
       //生成对应修改数据
@@ -357,8 +348,9 @@ export default {
           tools.setDataForKey(item, value, itemData == "" ? null : itemData)
         })
         param.data.Content.push(item);
-			})
-			updateZone(param, (res) => {})
+      })
+      param.Projection = []
+      updateZone(param, (res) => { })
     },
     //获取被筛选掉的行号
     trimmedRows() {
@@ -470,17 +462,17 @@ export default {
      * @return 处理好的数据格式
      */
     getType(list) {
-			let arr = tools.copyArr(list)
-			let data = showTools.headerTypeFilter(arr, "space", this.onlyRead, this.showType)
+      let arr = tools.copyArr(list)
+      let data = showTools.headerTypeFilter(arr, "space", this.onlyRead, this.showType)
       data.unshift({
         data: "hasSi",
         renderer: this.myRenderer,
         readOnly: true
       }, {
-				data: "point",
-				renderer: this.facilityRender,
-				readOnly: true
-			});
+          data: "point",
+          renderer: this.facilityRender,
+          readOnly: true
+        });
       return data;
     },
     myRenderer(instance, td, row, col, prop, value, cellProperties) {
@@ -521,8 +513,8 @@ export default {
     undo() {
       this.hot.undo()
     },
-		/**  分页事件------------------------ */
-		//切换每页显示多少条数据
+    /**  分页事件------------------------ */
+    //切换每页显示多少条数据
     handleSizeChange(val) {
       this.page.pageSize = val
       this.getData()
@@ -537,8 +529,8 @@ export default {
     projectId() {
       this.setData()
       this.main = null
-		},
-		showTypes: {
+    },
+    showTypes: {
       handler(newName, oldName) {
         if (newName && newName[0] && newName[0].value) {
           this.showType = newName[0].value
@@ -554,10 +546,10 @@ export default {
 </script>
 <style lang="less" scoped>
 #handsontable {
-	.left{
-		padding-top: 0;
-		padding-bottom: 10px;
-	}
+  .left {
+    padding-top: 0;
+    padding-bottom: 10px;
+  }
   .no-data {
     height: 150px;
     line-height: 150px;

+ 188 - 0
src/components/business_space/newAddDialogs/addEquipDialog.vue

@@ -0,0 +1,188 @@
+<template>
+  <el-dialog :title="title" :visible.sync="dialogVisible" width="900px" id="addEqDialog">
+    <el-row class="filters">
+      <el-col :span="9">
+        <el-input placeholder="输入设备名称或设备本地编码查询进行查询" v-model="keycode" clearable @keyup.enter.native="getTableData">
+          <i slot="suffix" class="el-input__icon el-icon-search" @click="getTableData"></i>
+        </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>
+      </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"
+        @selection-change="handleSelectionChange">
+        <el-table-column :label="`${inSpaceType}名称`" show-overflow-tooltip min-width="100">
+          <template slot-scope="scope">
+            <div>
+              {{scope.row.EquipLocalName||scope.row.EquipName||''}}
+            </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="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="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>
+          </template>
+        </el-table-column>
+      </el-table>
+      <!-- 分页 -->
+      <el-pagination class="fr" v-show="tableData && tableData.length" @size-change="handleSizeChange" @current-change="handleCurrentChange"
+        :current-page="page.pageNumber" :page-sizes="page.pageSizes" :page-size="page.pageSize" layout="total, sizes, prev, pager, next, jumper"
+        :total="page.total"></el-pagination>
+    </div>
+    <span slot="footer" class="dialog-footer">
+      <el-button size="small" @click="dialogVisible = false">取 消</el-button>
+      <el-button size="small" type="primary" @click="savaRelation">确 定</el-button>
+    </span>
+  </el-dialog>
+</template>
+
+<script>
+import {
+  getSpaceEquip,
+  buildingQuery, //数据中心-建筑查询
+  notEqInSpaceQuery, //没有和当前空间绑定的设备
+  notEqForSpaceQuery, //未服务当前空间的设备
+  eqInSpaceCreate, //设备所在业务空间--创建关系
+  eqForSpaceCreate, //设备服务业务空间--创建关系
+} from "@/api/scan/request";
+import { mapGetters } from "vuex";
+export default {
+  components: {
+
+  },
+  computed: {
+    ...mapGetters("layout", ["projectId"])
+  },
+  data() {
+    return {
+      title: "添加设备",
+      keycode: '', //输入查询条件
+      options: [], //建筑楼层级联
+      floor: [], // 选中的建筑楼层
+      showType: false, //是否只显示在当前业务空间中的设备
+      inSpaceType: '设备',
+      dialogVisible: false,
+      tableData: [],
+      loading: false,
+      headerStyle: {
+        backgroundColor: '#e1e4e5',
+        color: '#2b2b2b',
+        lineHeight: '30px'
+      }, // 列表样式
+      selections: [], // 选中项
+      page: {
+        pageSize: 50,
+        pageSizes: [10, 20, 50, 100],
+        pageNumber: 1,
+        total: 0
+      },
+      props: { //自定义字段
+        value: "BuildID",
+        label: "BuildLocalName",
+        children: "Floor"
+      },
+    };
+  },
+  props: {
+    type: {}, //equipment--equipmentFor
+    spaceId: {},
+    zone: {}, //分区类型 
+  },
+  created() {
+    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;
+        })
+      })
+    },
+    // 显示弹窗
+    showDialog() {
+      this.dialogVisible = true;
+      this.getTableData();
+    },
+    getTableData() {
+      let pa = {
+        data: {
+          Filters:`BuildingId="${this.floor[0]}";FloorId="${this.floor[1]}"`,
+          PageNumber: this.page.pageNumber,
+          PageSize: this.page.pageSize,
+        },
+        type: this.zone,
+        spaceId: this.spaceId
+      }
+      if(this.keycode!=''){
+        pa.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;
+        })
+      }
+    },
+    //选中项修改
+    handleSelectionChange(val) {
+      this.selections = val;
+    },
+    savaRelation() { },
+    //改变pagesize
+    handleSizeChange(pageSize) {
+      this.page.pageSize = pageSize;
+      this.getTableData();
+    },
+    //改变pageno
+    handleCurrentChange(pageNo) {
+      this.page.pageNumber = pageNo;
+      this.getTableData();
+    },
+    // 查看详情
+    toDetail() {
+      this.$message('开发中')
+    }
+  },
+};
+</script>
+<style lang="less" scoped>
+#addEqDialog {
+  .filters {
+    margin-bottom: 10px;
+    /deep/ .el-input__inner {
+      vertical-align: baseline;
+    }
+  }
+  .table-box {
+    height: 350px;
+  }
+}
+</style>

+ 110 - 0
src/components/business_space/newAddDialogs/addSystemDialog.vue

@@ -0,0 +1,110 @@
+<template>
+  <el-dialog :title="title" :visible.sync="dialogVisible" width="800px" id="addSyDialog">
+    <div class="table-box">
+      <el-table :data="tableData" style="width: 100%" height="100%" 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>
+              {{scope.row.SysLocalName||scope.row.SysName||''}}
+            </div>
+          </template>
+        </el-table-column>
+        <el-table-column prop="SysLocalID" :label="`${inSpaceType}本地编码`" show-overflow-tooltip min-width="100"></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>
+          </template>
+        </el-table-column>
+      </el-table>
+    </div>
+    <span slot="footer" class="dialog-footer">
+      <el-button size="small" @click="dialogVisible = false">取 消</el-button>
+      <el-button size="small" type="primary" @click="savaRelation">确 定</el-button>
+    </span>
+  </el-dialog>
+</template>
+
+
+<script>
+import {
+  notSyInSpaceQuery, //没有和当前空间绑定的系统
+  syInSpaceCreate, //系统所在业务空间--创建关系
+} from "@/api/scan/request";
+export default {
+  data() {
+    return {
+      title: '添加空间内的系统',
+      inSpaceType: '系统',
+      dialogVisible: false,
+      tableData: [],
+      loading: false,
+      headerStyle: {
+        backgroundColor: '#e1e4e5',
+        color: '#2b2b2b',
+        lineHeight: '30px'
+      }, // 列表样式
+      selections: [], // 选中项
+    }
+  },
+  props: {
+    type: {}, //equipment--equipmentFor
+    spaceId: {},
+    zone: {}, //分区类型 
+  },
+  methods: {
+    // 显示
+    showDialog() {
+      this.dialogVisible = true;
+      this.getTableData();
+    },
+    // 选中项修改
+    handleSelectionChange(val) {
+      this.selections = val;
+    },
+    // 确认
+    savaRelation() {
+      let pa = {
+        data: {
+          SpaceId: this.spaceId,
+          SysIdList: []
+        },
+        type: this.zone
+      }
+      this.selections.map(t => {
+        pa.data.SysIdList.push(t.SysID)
+      })
+      syInSpaceCreate(pa, res => {
+        this.$message.success('关联成功');
+        this.$emit('refresh');
+        this.dialogVisible = false;
+      })
+    },
+    // 获取表格数据
+    getTableData() {
+      let pa = {
+        data: {
+          PageSize: 200,
+        },
+        type: this.zone,
+        spaceId: this.spaceId
+      }
+      notSyInSpaceQuery(pa, res => {
+        this.tableData = res.Content;
+      })
+    },
+    // 查看详情
+    toDetail() {
+      this.$message('开发中')
+    }
+  }
+}
+</script>
+<style lang="less" scoped>
+#addSyDialog {
+  .table-box {
+    height: 350px;
+  }
+}
+</style>

+ 172 - 0
src/components/business_space/newTables/eqToSpaceTable.vue

@@ -0,0 +1,172 @@
+<template>
+  <div id="eqInSp">
+    <el-row>
+      <el-button type="primary" @click="add">添加{{inSpaceType}}</el-button>
+      <el-tooltip class="item" effect="dark" :content="`可前往“全部关系总览”中,按坐标计算${typeToTips[type]}`" placement="right">
+        <el-button>按空间计算</el-button>
+      </el-tooltip>
+    </el-row>
+    <div class="table-box">
+      <el-table :data="tableData" style="width: 100%" height="100%" v-loading="loading" :header-cell-style="headerStyle">
+        <el-table-column :label="`${inSpaceType}名称`" show-overflow-tooltip min-width="100">
+          <template slot-scope="scope">
+            <div>
+              {{scope.row.EquipLocalName||scope.row.EquipName||''}}
+            </div>
+          </template>
+        </el-table-column>
+        <el-table-column prop="EquipLocalID" :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}}
+            </div>
+          </template>
+        </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>
+          </template>
+        </el-table-column>
+        <template slot="empty">
+          <div style="height: 60%;transform: translateY(50%);">
+            <i class="icon-wushuju iconfont"></i>
+            可前往“全部关系总览”中,按坐标计算{{typeToTips[type]}}
+          </div>
+        </template>
+      </el-table>
+    </div>
+    <!-- 添加设备弹窗 -->
+    <addEquipDialog ref="addEqDialog" :type="type" :spaceId="params.RoomID" :zone="params.zone"></addEquipDialog>
+  </div>
+</template>
+
+<script>
+import {
+  queryZone,
+  eqInSpaceDelete, //设备所在业务空间--删除关系
+  eqForSpaceDelete, //设备服务业务空间--删除关系
+} from "@/api/scan/request";
+import { mapGetters } from "vuex";
+import addEquipDialog from "@/components/business_space/newAddDialogs/addEquipDialog"
+export default {
+  components: {
+    addEquipDialog
+  },
+  computed: {
+    ...mapGetters("layout", ["projectId"])
+  },
+  data() {
+    return {
+      inSpaceType: '设备',
+      headerStyle: {
+        backgroundColor: '#e1e4e5',
+        color: '#2b2b2b',
+        lineHeight: '30px'
+      }, // 列表样式
+      loading: false, // loading
+      tableData: [], //列表数据
+      typeToTips: {
+        equipment: '空间内的设备',
+        equipmentFor: '服务于空间的设备',
+      }
+    };
+  },
+  props: {
+    params: {},
+    type: {}
+  },
+  created() {
+    this.getTableData()
+  },
+  methods: {
+    // 删除关系
+    handleDelete(index, row) {
+      this.$confirm("确认删除该关系?", "提示", {
+        confirmButtonText: '确定',
+        cancelButtonText: '取消',
+        type: 'warning'
+      }).then(() => {
+        let pa = {
+          data: [row],
+          type: this.params.zone
+        }
+        if (this.type == 'equipment') {
+          this.deleteEqInSpace(pa);
+        } else {
+          this.deleteEqForSpace(pa);
+        }
+      }).catch(() => {
+        this.$message("取消删除")
+      })
+    },
+    // 删除设备所在空间关系
+    deleteEqInSpace(pa) {
+      eqInSpaceDelete(pa, res => {
+        this.$message.success('删除成功')
+        this.getTableData()
+      })
+    },
+    // 删除设备服务空间关系
+    deleteEqForSpace(pa) {
+      eqForSpaceDelete(pa, res => {
+        this.$message.success('删除成功')
+        this.getTableData()
+      })
+    },
+    // 改变pagesize
+    handleSizeChange(pageSize) {
+      this.page.pageSize = pageSize;
+      this.getTableData();
+    },
+    // 改变pageno
+    handleCurrentChange(pageNo) {
+      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.addEqDialog.floor = [this.params.BuildingId, this.params.FloorId];
+      this.$refs.addEqDialog.showDialog()
+    }
+  },
+  watch: {
+    type() {
+      this.getTableData()
+    }
+  }
+};
+</script>
+<style lang="less" scoped>
+#eqInSp {
+  height: 100%;
+  .table-box {
+    margin-top: 10px;
+    height: calc(100% - 50px);
+  }
+}
+</style>

+ 135 - 0
src/components/business_space/newTables/syInSpaceTable.vue

@@ -0,0 +1,135 @@
+<template>
+  <div id="eqInSp">
+    <el-row>
+      <el-button type="primary" @click="add">添加{{inSpaceType}}</el-button>
+      <el-tooltip class="item" effect="dark" :content="`可前往“全部关系总览”中,按坐标计算${typeToTips[type]}`" placement="right">
+        <el-button>按空间计算</el-button>
+      </el-tooltip>
+    </el-row>
+    <div class="table-box">
+      <el-table :data="tableData" style="width: 100%" height="100%" v-loading="loading" :header-cell-style="headerStyle">
+        <el-table-column :label="`${inSpaceType}名称`" show-overflow-tooltip min-width="100">
+          <template slot-scope="scope">
+            <div>
+              {{scope.row.SysLocalName||scope.row.SysName}}
+            </div>
+          </template>
+        </el-table-column>
+        <el-table-column prop="SysLocalID" :label="`${inSpaceType}本地编码`" show-overflow-tooltip min-width="100"></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>
+          </template>
+        </el-table-column>
+        <template slot="empty">
+          <div style="height: 60%;transform: translateY(50%);">
+            <i class="icon-wushuju iconfont"></i>
+            可前往“全部关系总览”中,按坐标计算{{typeToTips[type]}}
+          </div>
+        </template>
+      </el-table>
+    </div>
+    <addSystemDialog ref="addSyDialog" :type="type" :spaceId="params.RoomID" :zone="params.zone" @refresh='getTableData'></addSystemDialog>
+  </div>
+</template>
+
+<script>
+import {
+  queryZone,
+  syInSpaceDelete
+} from "@/api/scan/request";
+import { mapGetters } from "vuex";
+import addSystemDialog from "@/components/business_space/newAddDialogs/addSystemDialog";
+export default {
+  components: {
+    addSystemDialog
+  },
+  computed: {
+    ...mapGetters("layout", ["projectId"])
+  },
+  data() {
+    return {
+      inSpaceType: '系统',
+      headerStyle: {
+        backgroundColor: '#e1e4e5',
+        color: '#2b2b2b',
+        lineHeight: '30px'
+      }, // 列表样式
+      loading: false, // loading
+      tableData: [], //列表数据
+      typeToTips: {
+        generalSystem: '空间内的系统',
+      }
+    };
+  },
+  props: {
+    params: {},
+    type: {}
+  },
+  created() {
+    this.getTableData()
+  },
+  methods: {
+    // 删除关系
+    handleDelete(index, row) {
+      this.$confirm("确认删除该关系?", "提示", {
+        confirmButtonText: '确定',
+        cancelButtonText: '取消',
+        type: 'warning'
+      }).then(() => {
+        let pa = {
+          data: [row],
+          type: this.params.zone
+        }
+        this.deleteSyInSpace(pa)
+      }).catch(() => {
+        this.$message("取消删除")
+      })
+    },
+    // 删除关系
+    deleteSyInSpace(pa){
+      syInSpaceDelete(pa, res => {
+        this.$message.success('删除成功');
+        this.getTableData();
+      })
+    },
+    // 获取列表数据
+    getTableData() {
+      let pa = {
+        data: {
+          Cascade: [{ Name: "generalSystem" }],
+          Filters: `RoomID="${this.params.RoomID}"`,
+        },
+        zone: this.params.zone
+      }
+      queryZone(pa, res => {
+        this.tableData = res.Content[0].GeneralSystem || [];
+        this.tableData.map(t => {
+          t.SpaceId = res.Content[0].RoomID;
+          return t;
+        })
+      })
+    },
+    // 添加系统
+    add() {
+      this.$refs.addSyDialog.showDialog()
+    }
+  },
+  watch: {
+    type() {
+      this.getTableData()
+    }
+  }
+};
+</script>
+<style lang="less" scoped>
+#eqInSp {
+  height: 100%;
+  .table-box {
+    margin-top: 10px;
+    height: calc(100% - 50px);
+  }
+}
+</style>

+ 1 - 1
src/components/business_space/table/businessTable.vue

@@ -72,7 +72,7 @@ export default {
     return {
       page: {
         size: 50,
-        sizes: [10, 30, 50, 100, 150, 200],
+        sizes: [50, 100, 150, 200],
         total: 1,
         currentPage: 1
       },

+ 7 - 0
src/router/system.js

@@ -60,6 +60,7 @@ import rentadd from '@/views/ledger/rentlist/rentadd' //竖井清单
 import dataReport from '@/views/ledger/report'
 import auth from '@/views/system/auth'
 import noUser from '@/views/system/nouser'
+import spaceDetail from '@/views/ledger/spacelist/spaceDetail'
 
 /**  关系维护并计算 */
 import maintain from '@/views/relation/maintain'
@@ -295,6 +296,12 @@ export default [
                 meta: { keepAlive: false, breadcrumbs: [{ label: '台账管理', path: '/ledger/facility' }, { label: '业务空间台账' }] }
             },
             {
+                path: 'spaceDetail',
+                name: 'spaceDetail',
+                component: spaceDetail,
+                meta: { keepAlive: false, breadcrumbs: [{ label: '台账管理', path: '/ledger/facility' }, { label: '业务空间台账',path: '/ledger/spacelist' }, {label:'业务空间详情'}] }
+            },
+            {
                 path: 'cenotelist',
                 name: 'cenotelist',
                 component: cenotelist,

+ 144 - 326
src/views/ledger/spacelist/index.vue

@@ -4,80 +4,66 @@
 <template>
   <div id="businessSpace">
     <!------------------------    头部弹窗,选择楼层信息     -------------->
-    <!-- <no-model-dialog :param="param" title="选择要进行空间管理的楼层" :isShow="floor" @close="close"></no-model-dialog> -->
     <influence-dialog ref="influence" :param="param" :tabsList="tabsList" title="受元空间变化影响的业务空间" :isShow="floor"></influence-dialog>
-    <details-dialog ref="details" @del="delSuccess" :param="param" :tabsList="tabsList" title="业务空间详情" :isShow="floor" :activeTabType="activeTabType"></details-dialog>
+    <details-dialog ref="details" @del="delSuccess" :param="param" :tabsList="tabsList" title="业务空间详情" :isShow="floor" :activeTabType="activeTabType">
+    </details-dialog>
     <not-related ref="notRelated" @createSuccess="createSuccess" :isShow="floor"></not-related>
     <facility-dialog ref="facility" :activeTabType="activeTabType" :isShow="floor"></facility-dialog>
     <!--------- 页面头部   -------------->
     <div class="saga-title">
-      <!-- <div class="saga-build-mess">
-                <p>
-                    <i class="iconfont icon-jianzhu"></i> {{buildMess.buildName}} - {{buildMess.name}}
-                </p>
-                <el-button class="saga-btn" type="text" @click="changeShow">切换楼层</el-button>
-            </div> -->
       <div class="saga-build-mess">
         <span style="padding-right:12px;color:#999999;">建筑楼层</span>
-        <el-cascader :options="options" v-model="buildMess.selectd" :props="props" @change="close"></el-cascader>
+        <el-cascader :options="options" v-model="buildFloorSelectd" :props="props" @change="changeCascader"></el-cascader>
       </div>
       <div class="saga-build-tab">
-        <!-- <div class="tab-main" @click="tabList(1)" :class="isMyTab == 1 ? 'tab-active' : ''">
-                    <i class="iconfont icon-tupian"></i>
-                    <span>平面图</span>
-                </div>
-                <div class="tab-main" @click="tabList(2)" :class="isMyTab == 2 ? 'tab-active' : ''">
-                    <i class="iconfont icon-liebiao"></i>
-                    <span>列表</span>
-                </div> -->
         <el-radio-group v-model="isMyTab" @change="changeRadio" style="width: 136px;">
           <el-radio-button label="1">平面图</el-radio-button>
           <el-radio-button label="2" class="space-own-radio" style="width: 68px;">列表</el-radio-button>
         </el-radio-group>
       </div>
     </div>
-    <div v-show="isMyTab == 1" class="saga-business-sapce-main">
-      <el-tabs v-model="activeName" @tab-click="tab1Click">
-        <template v-for="(item,index) in tabsList">
-          <el-tab-pane :name="item.code" :key="index" :disabled="item.code > 3">
-            <span slot="label">{{item.name}}</span>
-            <graphy @getSp="checkSpace" @dimension="checkSpace" @businessDetails="getBuinessDetails"
-              :ref="'graphy' + item.code" :canvasId="item.code"></graphy>
-          </el-tab-pane>
-        </template>
-      </el-tabs>
-      <!-- <space-graphy @dimension="checkSpace" :tabsList="tabsList" ref="graphy" :param="param"></space-graphy> -->
-    </div>
-    <div v-show="isMyTab == 2" class="saga-business-sapce-main">
-      <el-tabs v-model="activeName" @tab-click="handleClick">
-        <template v-for="(item,index) in tabsList">
-          <el-tab-pane :name="item.code" :key="index" :disabled="item.code > 3">
-            <span slot="label">{{item.name}}</span>
-            <handsontable-main @lookEqu="lookEqu" :ref="'handsontable' + item.code" :zoneObj="item" :id="'handsontable' + item.code" :param="param"></handsontable-main>
-          </el-tab-pane>
-        </template>
-      </el-tabs>
-      <!-- <space-handsontable :tabsList="tabsList" ref="spaceTable" :param="param"></space-handsontable> -->
+    <div class="saga-business-sapce-main">
+      <el-row class="spaceTypes">
+        <div class="types">
+          <el-tabs v-model="activeName" type='card' @tab-click="tabClick">
+            <template v-for="(item,index) in tabsList">
+              <el-tab-pane :name="item.Code" :key="index" :label="item.Name"></el-tab-pane>
+            </template>
+          </el-tabs>
+        </div>
+        <div class="groupAdd">
+          <el-button size="small">批量创建业务空间</el-button>
+        </div>
+      </el-row>
+      <div v-show="isMyTab == 1">
+        <graphy @getSp="checkSpace" @dimension="checkSpace" @businessDetails="getBuinessDetails" ref="graphy"></graphy>
+      </div>
+      <div v-show="isMyTab == 2">
+        <handsontable-main @lookEqu="lookEqu" ref="handsontable" :zoneCode="activeName" :id="`handsontable${activeName}`"></handsontable-main>
+      </div>
     </div>
   </div>
 </template>
-
 <script>
 import noModelDialog from "@/components/business_space/dialogs/noModelDialog";
 import influenceDialog from "@/components/business_space/dialogs/influenceDialog";
 import detailsDialog from "@/components/business_space/dialogs/detailsDialog";
 import notRelated from "@/components/business_space/dialogs/notRelated";
 import facilityDialog from "@/components/business_space/dialogs/facilityDialog";
-// import spaceHandsontable from "@/components/business_space/business/spaceHandsontable";
 import graphy from "@/components/business_space/graphy/business";
 import handsontableMain from "@/components/business_space/business/handsontable";
-import { getDataDictionary, getAllbusiness, getBussTypes, getSpaceFloor, buildingQuery, floorQuery } from "@/api/scan/request";
+import {
+  getDataDictionary,
+  getAllbusiness,
+  getSpaceFloor,
+  buildingQuery, //数据中心-建筑查询
+  queryDictionaryHead, //数据中心-字典头部信息查询接口
+} from "@/api/scan/request";
 import tools from '@/utils/scan/tools'
 import { mapGetters, mapActions } from "vuex";
 export default {
   components: {
     noModelDialog,
-    // spaceHandsontable,
     influenceDialog,
     detailsDialog,
     notRelated,
@@ -91,7 +77,6 @@ export default {
   data() {
     return {
       floor: {
-        // dialogVisible: true, //选择楼层弹窗
         influence: false, //受影响的业务空间弹窗
         details: false, //详情弹窗
         notRelated: false,
@@ -119,196 +104,123 @@ export default {
         "name": "默认分区",
         "rel_type": "99"
       },
-      options: [],
-      props: {
-        value: "code",
-        label: "name",
-        children: "children"
-      }
+      options: [], //建筑楼层级联下拉
+      props: { //自定义字段
+        value: "BuildID",
+        label: "BuildLocalName",
+        children: "Floor"
+      },
+      floorToMap: {}, //楼层及其对应的模型图
+      buildFloorSelectd: [], //当前所选的建筑楼层
     };
   },
   created() {
-    this.changeData()
+    this.init();
+    let params = this.$route.params;
+    if (params.BuildingId) {
+      this.buildFloorSelectd = [params.BuildingId, params.FloorId];
+      this.activeName = params.zone;
+      this.isMyTab = params.isMyTab;
+      this.changeRadio(this.isMyTab)
+    }
   },
   mounted() { },
   methods: {
-    changeData() {
-      this.param.ProjId = this.projectId
-      this.param.UserId = this.userId
-      this.param.secret = this.secret
-      this.getFloor()
+    // 初始化
+    init() {
       this.getTypes()
+      this.getBuilding()
     },
-    changeRadio() {
-      if (!this.buildMess.selectd.length) {
-        this.$message("请选择楼层")
-        return false
+    // 获取项目下建筑
+    getBuilding() {
+      let pa = {
+        Cascade: [{ name: 'floor', Orders: 'SequenceId desc' }],
+        Orders: "BuildLocalName asc",
       }
-      this.tabClick(this.isMyTab)
+      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;
+              this.floorToMap[item.FloorID] = item.StructureInfo ? item.StructureInfo.FloorMap : '';
+              return item;
+            })
+          } else {
+            t.Floor = []
+          }
+          return t;
+        })
+      })
     },
-    //获取楼层
-    getFloor() {
-      // let data, buildParams = {
-      //   PageNumber: 1,
-      //   PageSize: 500
-      // }, floorParams = {
-      //   Orders: "FloorSequenceID desc",
-      //   PageNumber: 1,
-      //   PageSize: 500
-      // }
-      // let promise1 = new Promise((resolve, reject) => {
-      //   buildingQuery(buildParams, res => {
-      //     resolve(res)
-      //   })
-      // })
-      // let promise2 = new Promise((resolve, reject) => {
-      //   floorQuery(floorParams, res => {
-      //     resolve(res)
-      //   })
-      // })
-      // Promise.all([promise1, promise2]).then(values => {
-      //   let builData = values[0].Content, floorData = values[1].Content
-      //   data = builData.map(build => {
-      //     return {
-      //       code: build.BuildID,
-      //       name: build.BuildLocalName
-      //     }
-      //   })
-      //   data.forEach(build => {
-      //     floorData.forEach(floor => {
-      //       if (build.code == floor.BuildID && floor.FloorID && floor.FloorLocalName) {
-      //         if (build.children) {
-      //           build.children.push({
-      //             code: floor.FloorID,
-      //             name: (floor.FloorLocalName || floor.FloorName || "未知") + this.myMess(floor),
-      //             map: floor.StructureInfo?floor.StructureInfo.FloorMap?floor.StructureInfo.FloorMap:null:null,
-      //             affected: floor.affected,
-      //             buildCode: build.BuildID,
-      //             buildName: build.BuildLocalName,
-      //             FloorSequenceID: floor.FloorSequenceID
-      //           })
-      //         } else {
-      //           build.children = []
-      //           build.children.push({
-      //             code: floor.FloorID,
-      //             name: (floor.FloorLocalName || floor.FloorName || "未知") + this.myMess(floor),
-      //             map: floor.StructureInfo?floor.StructureInfo.FloorMap?floor.StructureInfo.FloorMap:null:null,
-      //             affected: floor.affected,
-      //             buildCode: build.BuildID,
-      //             buildName: build.BuildLocalName,
-      //             FloorSequenceID: floor.FloorSequenceID
-      //           })
-      //         }
-      //       }
-      //     })
-      //   })
-      //   this.options = data
-      // })
-
-      let param = {
-        ProjId: this.projectId,
-        UserId: this.UserId,
-        secret: this.secret
-      };
-      getSpaceFloor(param).then(res => {
-        console.log(res, 'res')
-        if (res.data.Result == 'success') {
-          let data = this.changeArr(res.data.Content).map(item => {
-            if (item.children && item.children.length) {
-              item.children = tools.sortArr(item.children, "shunxu", false)
-            }
-            return item
-          })
-          console.log(data, 'res.data')
-          this.options = data
-        } else {
-          this.$message.error(res.data.ResultMsg)
-        }
-      }).catch(() => {
-        this.$message.error("请求出错")
+    // 切换平面图和列表
+    changeRadio(val) {
+      this.changeGraphyOrTable(val)
+    },
+    // 获取tabs的列表
+    getTypes() {
+      let pa = {
+        Filters: `parentId = 'Space'`
+      }
+      queryDictionaryHead(pa, res => {
+        this.tabsList = res.Content;
       })
     },
-
-    //修改已有数组
-    changeArr(arr) {
-      return arr.map(item => {
-        console.log(item.floors)
-        if (item.floors && item.floors.length) {
-          return {
-            code: item.id,
-            name: item.infos.BuildLocalName,
-            children: item.floors.map(i => {
-              return {
-                code: i.id,
-                name: (i.infos.FloorLocalName || i.infos.FloorName || "未知") + this.myMess(i),
-                map: i.infos.FloorMap || null,
-                affected: i.affected,
-                isChilren: 2,
-                buildCode: item.id,
-                buildName: item.infos.BuildLocalName,
-                shunxu: i.infos.FloorSequenceID || 0
-              }
-            })
-          }
-        } else {
-          return {
-            code: item.id,
-            name: item.infos.BuildLocalName,
-            children: null,
-            isChilren: 1,
-          }
+    // 通过选中的tab-Code 获取选中的tab的所有数据
+    getItemForType() {
+      let data = {}
+      this.tabsList.map(item => {
+        if (item.Code == this.activeName) {
+          data.code = item.Code;
+          data.name = item.Name;
         }
       })
+      return data
+    },
+    // 点击tab
+    tabClick(val) {
+      this.changeGraphyOrTable(this.isMyTab)
+    },
+    //修改所选建筑楼层
+    changeCascader(val) {
+      // val[0]->建筑 val[1]->楼层
+      if (!this.floorToMap[val[1]]) {
+        this.isMyTab = 2;
+      }
+      this.changeGraphyOrTable(this.isMyTab)
     },
-    myMess(i) {
-      if (i.affected) {
-        return "(该业务空间受元空间变化影响)"
+    // 判断切换至图还是表
+    changeGraphyOrTable(num) {
+      if (!this.buildFloorSelectd.length) {
+        this.$message("请选择楼层")
+        return false
+      }
+      this.activeTabType = this.getItemForType()
+      if (num == 2) {
+        this.initMessage();
       } else {
-        if (i.infos.FloorMap) {
-        // if (i.StructureInfo && i.StructureInfo.FloorMap) {
-          return ''
-        } else {
-          return "(请初始化平面图)"
-        }
+        let data = this.getItemForType()
+        this.$refs["graphy"].getData(this.buildMess.map, this.buildMess, this.activeTabType);
       }
     },
-    //获取tabs的列表
-    getTypes() {
-      getBussTypes(res => {
-        let arr = [{
-          "code": "GeneralZone",
-          "name": "默认分区",
-          "rel_type": "99"
-        },
-        {
-          "name": "供电分区",
-          "rel_type": "1",
-          "code": "PowerSupplyZone"
-        },
-        {
-          "name": "照明分区",
-          "rel_type": "2",
-          "code": "LightingZone"
+    // 触发获取表头-获取初始化信息点
+    initMessage() {
+      let params = {
+        data: {
+          Orders: "sort asc",
+          PageNumber: 1,
+          PageSize: 500
         },
-        {
-          "name": "空调分区",
-          "rel_type": "4",
-          "code": "AirConditioningZone"
-        }, {
-          "name": '租赁分区',
-          'rel_type': '10',
-          "code": 'TenantZone'
-        }
-        ]
-        this.tabsList = arr
-        // console.log(res)
-        // this.tabsList = res.Content
+        type: this.activeName
+      }
+      getDataDictionary(params, res => {
+        this.$refs.handsontable.getHeader(res.Content, this.buildFloorSelectd);
       })
     },
     checkSpace(list, build, graphyId) {
       this.floor.notRelated = true;
       this.$refs.notRelated.getIdList(list, build, graphyId, this.activeTabType);
-      this.$refs["graphy" + this.activeName][0].getHasSpace();
+      this.$refs["graphy"].getHasSpace();
     },
     changeShow() {
       this.floor.dialogVisible = true;
@@ -316,50 +228,15 @@ export default {
     },
     //成功关联平面图
     createSuccess() {
-      this.$refs["graphy" + this.activeName][0].getHasSpace();
-      this.$refs["graphy" + this.activeName][0].clearDimension();
+      this.$refs["graphy"].getHasSpace();
+      this.$refs["graphy"].clearDimension();
       this.floor.notRelated = false;
     },
     //成功删除业务空间
     delSuccess() {
       this.floor.details = false;
-      this.$refs["graphy" + this.activeName][0].getData(this.buildMess.map, this.buildMess, this.activeTabType);
-      // this.$refs["graphy" + this.activeName][0].getHasSpace();
-      // this.$refs["graphy" + this.activeName][0].clearDimension();
-    },
-    close() {
-      this.buildMess = this.changeBuildMess(this.buildMess, this.options)
-      console.log(this.buildMess, 'this.buildMess')
-      if (this.buildMess.affected) {
-        this.floor.influence = true;
-        this.$nextTick(() => {
-          this.$refs.influence.getData(this.buildMess);
-        });
-      }
-      if (!this.buildMess.map) {
-        this.isMyTab = 2;
-      }
-      if (this.isMyTab == 2) {
-        this.initTabs(this.buildMess);
-      } else {
-        let data = this.getItemForType()
-        this.$refs["graphy" + this.activeName][0].getData(this.buildMess.map, this.buildMess, this.activeTabType);
-      }
-    },
-
-    //通过code查询options中的其他参数
-    changeBuildMess(mess, options) {
-      options.map(item => {
-        if (!!item.children && item.children.length) {
-          item.children.map(child => {
-            if (child.code == mess.selectd[1]) {
-              console.log(child, mess)
-              mess = Object.assign(mess, child)
-            }
-          })
-        }
-      })
-      return mess
+      this.$refs["graphy"].getHasSpace();
+      this.$refs["graphy"].clearDimension();
     },
     //查看业务空间详情
     getBuinessDetails(list) {
@@ -372,87 +249,18 @@ export default {
       this.floor.facility = true
       this.$refs.facility.getData(infos, this.buildMess)
     },
-    tabClick(num) {
-      console.log(this.$refs)
-      this.isMyTab = num;
-      if (num == 2) {
-        this.initTabs(this.buildMess);
-      } else {
-        let data = this.getItemForType()
-        this.$refs["graphy" + this.activeName][0].getData(this.buildMess.map, this.buildMess, this.activeTabType);
-      }
-    },
-    //获取初始化信息点
-    initMessage() {
-      let params = {
-        data: {
-          Orders: "sort asc",
-          PageNumber: 1,
-          PageSize: 500
-        },
-        type: this.activeTabType.code
-      }
-      getDataDictionary(params, res => {
-        let refFlag = "handsontable" + this.activeName;
-        this.$refs[refFlag][0].getHeader(res.Content, this.activeTabType);
-        this.getTableMain()
-      })
-    },
-    getItemForType() {
-      let data = {}
-      this.tabsList.map(item => {
-        if (item.code == this.activeName) {
-          data = item
-        }
-      })
-      return data
-    },
-    tab1Click() {
-      this.activeTabType = this.getItemForType()
-      this.$refs["graphy" + this.activeName][0].getData(this.buildMess.map, this.buildMess, this.activeTabType);
-    },
-    /**
-     * tab标签被点击触发后的函数
-     * @param tab   tab实例
-     * @param event tab的dom
-     *
-     */
-    handleClick(tab, event) {
-      this.activeTabType = this.getItemForType()
-      this.initMessage();
-    },
-    /**
-     * 选择楼层后初始化tabs
-     * 由父级页面调用
-     *
-     * @param  floorParam  父级传入的楼层信息
-     */
-    initTabs(floorParam) {
-      // this.floor = floorParam;
-      this.initMessage();
-    },
-    getTableMain() {
-      let refFlag = "handsontable" + this.activeName;
-      this.$nextTick(() => {
-        this.$refs[refFlag][0].getData(this.buildMess);
-      });
-      //   for (let i = 0; i < this.tabsList.length; i++) {
-      //     if (i == 0) {
-      //     }
-      //   }
-    }
   },
   watch: {
     floor: {
       deep: true,
       handler: function () {
         if (this.floor.notRelated) {
-          this.$refs["graphy" + this.activeName][0].clearDimension();
+          this.$refs["graphy"].clearDimension();
         }
       }
     },
     projectId() {
-      this.changeData()
+      this.init()
     }
   }
 };
@@ -543,14 +351,24 @@ export default {
     overflow-y: auto;
     background: #fff;
     padding: 10px;
-    .el-tabs__nav {
-      padding-left: 10px;
+    /deep/ .el-tabs__item.is-top {
+      border-top: 2px solid transparent;
+      &.is-active {
+        border-top: 2px solid #409eff;
+      }
     }
-    .el-tabs__header{
-      margin-bottom: 10px;
+  }
+  .spaceTypes {
+    .types {
+      float: left;
+      width: calc(100% - 200px);
     }
-    .el-tabs__active-bar {
-      padding-left: 24px;
+    .groupAdd {
+      float: left;
+      width: 200px;
+      text-align: right;
+      height: 40px;
+      border-bottom: 1px solid #e4e7ed;
     }
   }
 }

+ 174 - 0
src/views/ledger/spacelist/spaceDetail/index.vue

@@ -0,0 +1,174 @@
+<template>
+  <div class="box">
+    <div class="condition">
+      <div class="header">
+        <el-button style="float:left;" size="small" type="default" icon="el-icon-back" @click="goBack"></el-button>
+        <span>{{spaceDetails.RoomLocalName||spaceDetails.RoomName||''}}</span>
+      </div>
+      <el-row class="spaceTypes">
+        <div class="types">
+          <el-tabs v-model="activeTab" type='card'>
+            <template v-for="(item,index) in tabsList">
+              <el-tab-pane :name="item.Code" :key="index" :label="item.Name"></el-tab-pane>
+            </template>
+          </el-tabs>
+        </div>
+        <div class="deleBtn">
+          <el-button size="small" @click="deleteSpace">删除业务空间</el-button>
+        </div>
+      </el-row>
+      <div v-if="activeTab=='detail'" style="height:calc(100% - 110px)">
+        <iframe height="100%" width="100%" :src="iframeSrc"></iframe>
+      </div>
+      <!-- 空间内设备列表--服务于空间的设备 -->
+      <eqToSpaceTable v-else-if="activeTab=='equipment' || activeTab=='equipmentFor'" :params="params" :type="activeTab"></eqToSpaceTable>
+      <!-- 空间内系统 -->
+      <syInSpaceTable v-else-if="activeTab=='generalSystem'" :params="params" :type="activeTab"></syInSpaceTable>
+
+    </div>
+  </div>
+</template>
+
+<script>
+import { mapGetters } from "vuex"
+import { queryZone, deleteZone } from '@/api/scan/request'
+import eqToSpaceTable from '@/components/business_space/newTables/eqToSpaceTable'
+import syInSpaceTable from '@/components/business_space/newTables/syInSpaceTable'
+export default {
+  data() {
+    return {
+      params: {}, //参数-包含空间id 分区类型 进入方式(1-平面图 2-列表)
+      tabsList: [
+        { Code: 'detail', Name: '空间详情' },
+        { Code: 'equipment', Name: '空间内设备' },
+        { Code: 'equipmentFor', Name: '服务于空间的设备' },
+        { Code: 'generalSystem', Name: '空间内系统' },
+      ], //tab页
+      activeTab: 'detail', //当前选中的tab
+      spaceDetails: {}, //空间信息
+      iframeSrc: '', //空间详情iframe
+    }
+  },
+  computed: {
+    ...mapGetters("layout", ["projectId", "userId", "secret"])
+  },
+  components: {
+    eqToSpaceTable,
+    syInSpaceTable
+  },
+  created() {
+    this.params = this.$route.query;
+    this.getSpaceDetails();
+    this.setFrame()
+  },
+  mounted() { },
+  watch: {
+    projectId() { }
+  },
+  methods: {
+    // 返回
+    goBack() {
+      this.$router.push({
+        name: "spacelist",
+        params: this.params
+      })
+    },
+    // 查询空间详情
+    getSpaceDetails() {
+      let pa = {
+        data: {
+          Filters: `RoomID="${this.params.RoomID}"`
+        },
+        zone: this.params.zone
+      }
+      queryZone(pa, res => {
+        this.spaceDetails = res.Content[0];
+        this.params.BuildingId = this.spaceDetails.BuildingId;
+        this.params.FloorId = this.spaceDetails.FloorId;
+      })
+    },
+    // 设置iframe
+    setFrame() {
+      this.iframeSrc =
+        `${process.env.BASE_URL}:8889/#/details?perjectId=${this.projectId}&secret=${this.secret}&FmId=${this.params.RoomID}&type=0&code=${this.params.zone}`;
+    },
+    // 删除业务空间
+    deleteSpace() {
+      this.$confirm("此操作将删除业务空间,是否继续?", "提示", {
+        confirmButtonText: '确定',
+        cancelButtonText: '取消',
+        type: 'warning'
+      }).then(() => {
+        let pa = {
+          data: [{
+            RoomID: this.spaceDetails.RoomID
+          }],
+          zone: this.params.zone
+        }
+        deleteZone(pa, res => {
+          this.$message.success('删除成功')
+          this.goBack()
+        })
+      }).catch(() => {
+        this.getData()
+        this.$message("取消删除")
+      })
+    }
+  }
+};
+</script>
+
+<style scoped lang='less'>
+.box {
+  .condition {
+    padding: 10px;
+    display: flex;
+    height: 100%;
+    flex-direction: column;
+    border: 1px solid #dfe6ec;
+    background: #fff;
+    margin-bottom: 10px;
+    .header {
+      padding-bottom: 10px;
+      span {
+        line-height: 33px;
+        margin-left: 15px;
+      }
+    }
+    .spaceTypes {
+      .types {
+        float: left;
+        width: calc(100% - 200px);
+        /deep/ .el-tabs__item.is-top {
+          border-top: 2px solid transparent;
+          &.is-active {
+            border-top: 2px solid #409eff;
+          }
+        }
+      }
+      .deleBtn {
+        float: left;
+        width: 200px;
+        text-align: right;
+        height: 40px;
+        border-bottom: 1px solid #e4e7ed;
+      }
+    }
+    .main {
+      margin-top: 10px;
+      height: calc(100% - 96px);
+    }
+    .footer {
+      margin-bottom: 10px;
+    }
+  }
+}
+</style>
+
+<style lang="less">
+.el-table th {
+  background-color: #d9d9d9;
+  color: #000;
+}
+</style>
+