|
@@ -5,7 +5,7 @@
|
|
|
<el-button size="small" type="default" icon="el-icon-back" @click="goback"></el-button>
|
|
|
<div style="display:inline-block;margin-left:10px;">
|
|
|
<label style="margin-right:10px;">业务空间类型</label>
|
|
|
- <el-select v-model="value" placeholder="请选择" @change="getBusinessSpace">
|
|
|
+ <el-select v-model="value" placeholder="请选择" @change="getTnRelatFloor">
|
|
|
<el-option v-for="item in options" :key="item.value" :label="item.label" :value="item.value">
|
|
|
</el-option>
|
|
|
</el-select>
|
|
@@ -45,7 +45,7 @@
|
|
|
</div>
|
|
|
</div>
|
|
|
<div class="canvas-container" ref="graphy" v-loading="canvasLoading">
|
|
|
- <div class="floor-container">
|
|
|
+ <div class="floor-container" v-show="hasMap">
|
|
|
<div class="before" @click="toBefore">
|
|
|
<div><i class="el-icon-caret-top"></i></div>
|
|
|
</div>
|
|
@@ -53,7 +53,7 @@
|
|
|
<div v-for="(fl,i) in floorList" :key="fl.id" :class="{'active':fl.active,'textParent':true}" @click="floorChange(i)">
|
|
|
<div class="text">
|
|
|
{{fl.FloorLocalID || fl.FloorLocalName}}
|
|
|
- <span>{{fl.count>9?'9+':fl.count}}</span>
|
|
|
+ <span v-if="fl.Count">{{fl.Count>9?'9+':fl.Count}}</span>
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
@@ -83,7 +83,8 @@ import { mapGetters, mapActions } from "vuex";
|
|
|
import { SColor, SPoint } from "@saga-web/draw/lib";
|
|
|
import { DivideFloorScene, SpaceItem, ZoneItem, FloorView } from "@saga-web/cad-engine/lib";
|
|
|
import { colorArr } from "@/utils/spaceColor"
|
|
|
-import { buildingQuery, queryZone, tnRelateZone, queryRentTableData } from '@/api/scan/request'
|
|
|
+import { buildingQuery, queryTnRelateFloor, queryRentTableData, tnRelateZone, queryZone } from '@/api/scan/request'
|
|
|
+import { resolve } from 'q';
|
|
|
export default {
|
|
|
data() {
|
|
|
return {
|
|
@@ -108,6 +109,10 @@ export default {
|
|
|
},
|
|
|
hasMap: true,
|
|
|
keyWord: '', // 查询租户名称
|
|
|
+ Cascade: {
|
|
|
+ GeneralZone: 'zoneGeneraltList',
|
|
|
+ TenantZone: 'zoneTenantList'
|
|
|
+ }
|
|
|
}
|
|
|
},
|
|
|
components: {
|
|
@@ -127,7 +132,6 @@ export default {
|
|
|
methods: {
|
|
|
init() {
|
|
|
this.getTenant();
|
|
|
- this.getAllBuilding();
|
|
|
},
|
|
|
// 返回
|
|
|
goback() {
|
|
@@ -200,7 +204,7 @@ export default {
|
|
|
},
|
|
|
// 租户更改引起的修改
|
|
|
tenantChangeInflu(i) {
|
|
|
- if (this.onlyRead) { // 只读模式-对空间类型处理
|
|
|
+ if (this.onlyRead === true || this.onlyRead === 'true') { // 只读模式-对空间类型处理
|
|
|
let g = this.tenantList[i].ZoneGeneraltList;
|
|
|
let t = this.tenantList[i].ZoneTenantList;
|
|
|
let gFlag = g && g.length;
|
|
@@ -223,16 +227,15 @@ export default {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+ this.getTnRelatFloor();
|
|
|
},
|
|
|
// 楼层修改
|
|
|
floorChange(index) {
|
|
|
- console.log(this.floorList)
|
|
|
this.floorList.map(t => {
|
|
|
t.active = false;
|
|
|
})
|
|
|
this.activeFloor = index;
|
|
|
this.floorList[index].active = true;
|
|
|
-
|
|
|
this.getGraphy(index)
|
|
|
},
|
|
|
// canvas点击事件
|
|
@@ -245,7 +248,10 @@ export default {
|
|
|
editCanvas() {
|
|
|
this.isEdit = true;
|
|
|
this.config.isEdit = true;
|
|
|
- // 将已关联选中
|
|
|
+ this.scene.zoneList.map(t => {
|
|
|
+ t.selected = t.highLightFlag;
|
|
|
+ t.highLightFlag = false;
|
|
|
+ })
|
|
|
},
|
|
|
// 取消
|
|
|
cancel() {
|
|
@@ -261,7 +267,6 @@ export default {
|
|
|
}
|
|
|
this.view = new FloorView('floorCanvas')
|
|
|
},
|
|
|
-
|
|
|
// 获取列表
|
|
|
getTenant() {
|
|
|
let pa = {
|
|
@@ -286,32 +291,11 @@ export default {
|
|
|
}
|
|
|
})
|
|
|
},
|
|
|
- // 编辑态获取所有建筑
|
|
|
- getAllBuilding() {
|
|
|
- let pa = {
|
|
|
- Cascade: [{ name: 'floor', Orders: 'SequenceId desc' }],
|
|
|
- Orders: "BuildLocalName asc",
|
|
|
- }
|
|
|
- buildingQuery(pa, res => {
|
|
|
- this.allBuilding = res.Content.map(t => {
|
|
|
- t.active = false;
|
|
|
- if (t.Floor) {
|
|
|
- t.Floor.map(item => {
|
|
|
- item.active = false;
|
|
|
- item.count = (20 * Math.random()).toFixed(0);
|
|
|
- })
|
|
|
- }
|
|
|
- return t;
|
|
|
- });
|
|
|
- if (this.allBuilding.length) {
|
|
|
- this.changeBuildSelect(0);
|
|
|
- }
|
|
|
- })
|
|
|
- },
|
|
|
// 获取业务空间
|
|
|
getBusinessSpace() {
|
|
|
let buildid = this.floorList[this.activeFloor].BuildID;
|
|
|
let floorid = this.floorList[this.activeFloor].FloorID;
|
|
|
+ let TenantID = this.tenantList[this.activeTentanIndex].TenantID
|
|
|
if (buildid && floorid && this.value) {
|
|
|
this.canvasLoading = true
|
|
|
let pa = {
|
|
@@ -322,12 +306,62 @@ export default {
|
|
|
PageSize: 1000
|
|
|
}
|
|
|
}
|
|
|
- queryZone(pa, res => {
|
|
|
- // 所有业务空间
|
|
|
- this.businessSpaceList = res.Content;
|
|
|
+ // queryZone(pa, res => {
|
|
|
+ // // 所有业务空间
|
|
|
+ // this.businessSpaceList = res.Content;
|
|
|
+ // // 已关联元空间的业务空间
|
|
|
+ // this.BSPRelaISPList = [];
|
|
|
+ // res.Content.map(t => {
|
|
|
+ // if (t.Outline && t.Outline.length) {
|
|
|
+ // this.BSPRelaISPList.push(t)
|
|
|
+ // }
|
|
|
+ // })
|
|
|
+ // let key = 'Z' + this.Cascade[this.value].substring(1)
|
|
|
+ // let relationList = this.tenantList[this.activeTentanIndex][key] || []
|
|
|
+ // // 绘制业务空间
|
|
|
+ // let tempArr = this.BSPRelaISPList.map((t, i) => {
|
|
|
+ // if (t.FloorId == this.floorList[this.activeFloor].FloorID && t.ObjectType == this.value) {
|
|
|
+ // return {
|
|
|
+ // RoomLocalName: t.RoomLocalName,
|
|
|
+ // OutLine: t.Outline,
|
|
|
+ // RoomID: t.RoomID,
|
|
|
+ // Color: colorArr[i % colorArr.length],
|
|
|
+ // HighLightFlag: relationList.findIndex((item) => (item.RoomID == t.RoomID)) > -1
|
|
|
+ // }
|
|
|
+ // } else {
|
|
|
+ // return undefined;
|
|
|
+ // }
|
|
|
+ // }).filter(item => item)
|
|
|
+ // this.scene.removeAllZone();
|
|
|
+ // this.scene.addZoneList(tempArr);
|
|
|
+ // this.scene.click(this, this.canvasClick);
|
|
|
+ // })
|
|
|
+ this.canvasLoading = false;
|
|
|
+ let promise1 = new Promise((resolve) => {
|
|
|
+ queryZone(pa, res => {
|
|
|
+ resolve(res);
|
|
|
+ })
|
|
|
+ })
|
|
|
+ let pa2 = {
|
|
|
+ Cascade: [
|
|
|
+ { Name: this.Cascade[this.value], Filters: `FloorId='${floorid}'` }
|
|
|
+ ],
|
|
|
+ Filters: `TenantID='${TenantID}'`
|
|
|
+ }
|
|
|
+ let promise2 = new Promise((resolve) => {
|
|
|
+ queryRentTableData(pa2, res => {
|
|
|
+ resolve(res);
|
|
|
+ })
|
|
|
+ })
|
|
|
+ Promise.all([promise1, promise2]).then(response => {
|
|
|
+ let res1 = response[0];
|
|
|
+ let res2 = response[1];
|
|
|
+ let key = 'Z' + this.Cascade[this.value].substring(1);
|
|
|
+ let relationList = res2.Content[0][key] || [];
|
|
|
+ this.businessSpaceList = res1.Content;
|
|
|
// 已关联元空间的业务空间
|
|
|
this.BSPRelaISPList = [];
|
|
|
- res.Content.map(t => {
|
|
|
+ res1.Content.map(t => {
|
|
|
if (t.Outline && t.Outline.length) {
|
|
|
this.BSPRelaISPList.push(t)
|
|
|
}
|
|
@@ -340,17 +374,15 @@ export default {
|
|
|
OutLine: t.Outline,
|
|
|
RoomID: t.RoomID,
|
|
|
Color: colorArr[i % colorArr.length],
|
|
|
+ HighLightFlag: relationList.findIndex((item) => (item.RoomID == t.RoomID)) > -1
|
|
|
}
|
|
|
} else {
|
|
|
- console.log('internet slow')
|
|
|
return undefined;
|
|
|
}
|
|
|
}).filter(item => item)
|
|
|
this.scene.removeAllZone();
|
|
|
this.scene.addZoneList(tempArr);
|
|
|
this.scene.click(this, this.canvasClick);
|
|
|
- // 将已关联的高亮
|
|
|
- this.canvasLoading = false;
|
|
|
})
|
|
|
}
|
|
|
},
|
|
@@ -383,21 +415,60 @@ export default {
|
|
|
this.hasMap = false;
|
|
|
}
|
|
|
},
|
|
|
+ // 查询租户关联的业务空间所在建筑楼层,分区修改也会触发
|
|
|
+ getTnRelatFloor() {
|
|
|
+ if (this.value) {
|
|
|
+ let pa = {
|
|
|
+ objectType: this.value,
|
|
|
+ tenantId: this.curTenantId
|
|
|
+ }
|
|
|
+ queryTnRelateFloor(pa, res => {
|
|
|
+ this.allBuilding = res.Content.map(t => {
|
|
|
+ t.active = false;
|
|
|
+ if (t.Floor) {
|
|
|
+ t.Floor.map(item => {
|
|
|
+ item.active = false;
|
|
|
+ })
|
|
|
+ }
|
|
|
+ return t;
|
|
|
+ });
|
|
|
+ if (this.onlyRead === true || this.onlyRead === 'true') {
|
|
|
+ this.allBuilding = this.allBuilding.filter(item => item.Count > 0)
|
|
|
+ this.allBuilding.map(t => {
|
|
|
+ if (t.Floor) {
|
|
|
+ t.Floor = t.Floor.filter(item => item.Count > 0)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ if (this.allBuilding.length) {
|
|
|
+ this.changeBuildSelect(this.buildSelect);
|
|
|
+ }
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ this.hasMap = false;
|
|
|
+ this.canvasLoading = false;
|
|
|
+ this.allBuilding = [];
|
|
|
+ }
|
|
|
+ },
|
|
|
// 保存关系
|
|
|
save() {
|
|
|
let arr = this.scene.getSelectedZone();
|
|
|
let pa = {
|
|
|
data: {
|
|
|
SpaceIdList: [],
|
|
|
+ FloorId: this.floorList[this.activeFloor].FloorID,
|
|
|
TenantId: this.curTenantId
|
|
|
},
|
|
|
type: this.value
|
|
|
}
|
|
|
- pa.SpaceIdList = arr.map(t => {
|
|
|
+ pa.data.SpaceIdList = arr.map(t => {
|
|
|
return t.data.RoomID;
|
|
|
})
|
|
|
tnRelateZone(pa, res => {
|
|
|
+ this.isEdit = false;
|
|
|
+ this.config.isEdit = false;
|
|
|
this.$message.success('关联成功');
|
|
|
+ this.getTnRelatFloor();
|
|
|
})
|
|
|
},
|
|
|
},
|