|
@@ -14,19 +14,22 @@
|
|
|
<el-row class="main-container">
|
|
|
<el-col :span="3" class="main-left">
|
|
|
<div style="padding:10px;border-bottom:1px solid #e4e4e4;">
|
|
|
- <el-input :placeholder="`请输入租户名称`" @keyup.enter.native="getTenant">
|
|
|
+ <el-input :placeholder="`请输入租户名称`" @keyup.enter.native="getTenant" v-model="keyWord">
|
|
|
<i slot="suffix" class="el-input__icon el-icon-search" @click="getTenant"></i>
|
|
|
</el-input>
|
|
|
</div>
|
|
|
<div style="overflow-y:auto;height: calc(100% - 53px);">
|
|
|
- <div v-for="(item,i) in tenantList" :key="item.id" :class="{'tenantItem':true, 'active':item.active}" @click="tenantChange(i)">{{item.Name}}
|
|
|
+ <div v-for="(item,i) in tenantList" :key="item.TenantID" :class="{'tenantItem':true, 'active':item.active}" @click="tenantChange(i)">
|
|
|
+ {{item.TenantLocalName||item.TenantName}}
|
|
|
</div>
|
|
|
</div>
|
|
|
</el-col>
|
|
|
<el-col :span="21" style="height:100%;">
|
|
|
<div style="height:52px;border-bottom:1px solid #e4e4e4;">
|
|
|
<div v-if="onlyRead===true||onlyRead==='true'">
|
|
|
- <div v-for="(bd,i) in buildList" :key="bd.id" :class="{'building':true,'active':bd.active}" @click="buildChange(i)">{{bd.Name}}</div>
|
|
|
+ <div v-for="(bd,i) in allBuilding" :key="bd.BuildID" :class="{'building':true,'active':bd.active}" @click="changeBuildSelect(i)">
|
|
|
+ {{bd.BuildLocalName||bd.BuildName}}
|
|
|
+ </div>
|
|
|
</div>
|
|
|
<div v-else style="line-height: 52px;padding:0 10px;">
|
|
|
<label style="margin-right:10px;">所属建筑</label>
|
|
@@ -80,14 +83,13 @@ 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 } from '@/api/scan/request'
|
|
|
+import { buildingQuery, queryZone, tnRelateZone, queryRentTableData } from '@/api/scan/request'
|
|
|
export default {
|
|
|
data() {
|
|
|
return {
|
|
|
options: [{ value: 'GeneralZone', label: '默认分区' }, { value: 'TenantZone', label: '租户分区' }],
|
|
|
- value: 'GeneralZone',
|
|
|
- tenantList: [{ id: 1, Name: '发发发', active: false }, { id: 2, Name: '发发发', active: false }, { id: 3, Name: '发发发', active: true }],
|
|
|
- buildList: [{ id: 1, Name: "建筑1", active: false }, { id: 2, Name: "建筑2", active: true }],
|
|
|
+ value: 'TenantZone',
|
|
|
+ tenantList: [],
|
|
|
floorList: [],
|
|
|
canvasWidth: 800,
|
|
|
canvasHeight: 800,
|
|
@@ -95,6 +97,7 @@ export default {
|
|
|
allBuilding: [],
|
|
|
buildSelect: 0,
|
|
|
activeFloor: 0,
|
|
|
+ activeTentanIndex: 0,
|
|
|
canvasLoading: true,
|
|
|
isEdit: false,
|
|
|
view: '',
|
|
@@ -103,7 +106,8 @@ export default {
|
|
|
isEdit: false,
|
|
|
groupSelect: true
|
|
|
},
|
|
|
- hasMap: true
|
|
|
+ hasMap: true,
|
|
|
+ keyWord: '', // 查询租户名称
|
|
|
}
|
|
|
},
|
|
|
components: {
|
|
@@ -114,18 +118,17 @@ export default {
|
|
|
},
|
|
|
created() {
|
|
|
this.onlyRead = this.$route.query.onlyRead;
|
|
|
- // if (this.onlyRead) {
|
|
|
- // this.getTenant();
|
|
|
- // } else {
|
|
|
- this.getAllBuilding();
|
|
|
- // }
|
|
|
+ this.init();
|
|
|
},
|
|
|
mounted() {
|
|
|
this.canvasWidth = this.$refs.graphy.offsetWidth;
|
|
|
this.canvasHeight = this.$refs.graphy.offsetHeight;
|
|
|
},
|
|
|
methods: {
|
|
|
- init() { },
|
|
|
+ init() {
|
|
|
+ this.getTenant();
|
|
|
+ this.getAllBuilding();
|
|
|
+ },
|
|
|
// 返回
|
|
|
goback() {
|
|
|
this.$router.push({ name: 'rentlist' })
|
|
@@ -172,14 +175,18 @@ export default {
|
|
|
this.floorChange(index)
|
|
|
}
|
|
|
},
|
|
|
- // 获取列表
|
|
|
- getTenant() { },
|
|
|
// 建筑修改
|
|
|
- buildChange(index) {
|
|
|
- this.buildList.map(t => {
|
|
|
+ changeBuildSelect(val) {
|
|
|
+ this.allBuilding.map(t => {
|
|
|
t.active = false;
|
|
|
})
|
|
|
- this.buildList[index].active = true;
|
|
|
+ this.allBuilding[val].active = true;
|
|
|
+ if (this.allBuilding[val].Floor && this.allBuilding[val].Floor.length) {
|
|
|
+ this.floorList = this.allBuilding[val].Floor
|
|
|
+ this.floorChange(0);
|
|
|
+ } else {
|
|
|
+ this.floorList = []
|
|
|
+ }
|
|
|
},
|
|
|
// 租户修改
|
|
|
tenantChange(index) {
|
|
@@ -188,6 +195,34 @@ export default {
|
|
|
})
|
|
|
this.curTenantId = this.tenantList[index].TenantID;
|
|
|
this.tenantList[index].active = true;
|
|
|
+ this.activeTentanIndex = index;
|
|
|
+ this.tenantChangeInflu(index);
|
|
|
+ },
|
|
|
+ // 租户更改引起的修改
|
|
|
+ tenantChangeInflu(i) {
|
|
|
+ if (this.onlyRead) { // 只读模式-对空间类型处理
|
|
|
+ let g = this.tenantList[i].ZoneGeneraltList;
|
|
|
+ let t = this.tenantList[i].ZoneTenantList;
|
|
|
+ let gFlag = g && g.length;
|
|
|
+ let tFlag = t && t.length;
|
|
|
+ if (gFlag) {
|
|
|
+ if (tFlag) {
|
|
|
+ this.options = [{ value: 'GeneralZone', label: '默认分区' }, { value: 'TenantZone', label: '租户分区' }]
|
|
|
+ this.value = 'TenantZone';
|
|
|
+ } else {
|
|
|
+ this.options = [{ value: 'GeneralZone', label: '默认分区' }];
|
|
|
+ this.value = 'GeneralZone';
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ if (tFlag) {
|
|
|
+ this.options = [{ value: 'TenantZone', label: '租户分区' }];
|
|
|
+ this.value = 'TenantZone';
|
|
|
+ } else {
|
|
|
+ this.options = [];
|
|
|
+ this.value = '';
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
},
|
|
|
// 楼层修改
|
|
|
floorChange(index) {
|
|
@@ -200,15 +235,6 @@ export default {
|
|
|
|
|
|
this.getGraphy(index)
|
|
|
},
|
|
|
- // 修改下拉选中的建筑
|
|
|
- changeBuildSelect(val) {
|
|
|
- if (this.allBuilding[val].Floor && this.allBuilding[val].Floor.length) {
|
|
|
- this.floorList = this.allBuilding[val].Floor
|
|
|
- this.floorChange(0);
|
|
|
- } else {
|
|
|
- this.floorList = []
|
|
|
- }
|
|
|
- },
|
|
|
// canvas点击事件
|
|
|
canvasClick(item, event) {
|
|
|
if (!this.isEdit) {
|
|
@@ -235,6 +261,31 @@ export default {
|
|
|
}
|
|
|
this.view = new FloorView('floorCanvas')
|
|
|
},
|
|
|
+
|
|
|
+ // 获取列表
|
|
|
+ getTenant() {
|
|
|
+ let pa = {
|
|
|
+ Cascade: [
|
|
|
+ { Name: 'zoneTenantList' },
|
|
|
+ // , Cascade: [{ Name: 'building' }, { Name: 'floor' }]
|
|
|
+ { Name: 'zoneGeneraltList' }
|
|
|
+ ],
|
|
|
+ Orders: "TenantID asc",
|
|
|
+ PageSize: 1000
|
|
|
+ }
|
|
|
+ if (this.keyWord) {
|
|
|
+ pa.Filters = `TenantLocalName contain '${this.keyWord}'`
|
|
|
+ }
|
|
|
+ queryRentTableData(pa, res => {
|
|
|
+ this.tenantList = res.Content.map(t => {
|
|
|
+ t.active = false;
|
|
|
+ return t;
|
|
|
+ })
|
|
|
+ if (this.tenantList.length) {
|
|
|
+ this.tenantChange(0)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
// 编辑态获取所有建筑
|
|
|
getAllBuilding() {
|
|
|
let pa = {
|
|
@@ -243,6 +294,7 @@ export default {
|
|
|
}
|
|
|
buildingQuery(pa, res => {
|
|
|
this.allBuilding = res.Content.map(t => {
|
|
|
+ t.active = false;
|
|
|
if (t.Floor) {
|
|
|
t.Floor.map(item => {
|
|
|
item.active = false;
|
|
@@ -335,14 +387,15 @@ export default {
|
|
|
save() {
|
|
|
let arr = this.scene.getSelectedZone();
|
|
|
let pa = {
|
|
|
- SpaceIdList: [],
|
|
|
- TenantId: this.curTenantId
|
|
|
+ data: {
|
|
|
+ SpaceIdList: [],
|
|
|
+ TenantId: this.curTenantId
|
|
|
+ },
|
|
|
+ type: this.value
|
|
|
}
|
|
|
pa.SpaceIdList = arr.map(t => {
|
|
|
return t.data.RoomID;
|
|
|
})
|
|
|
- console.log(pa)
|
|
|
- return
|
|
|
tnRelateZone(pa, res => {
|
|
|
this.$message.success('关联成功');
|
|
|
})
|