|
|
@@ -21,16 +21,31 @@
|
|
|
:data="tree"
|
|
|
show-checkbox
|
|
|
:props="defaultProps"
|
|
|
- node-key="Id"
|
|
|
+ node-Key="Id"
|
|
|
default-expand-all
|
|
|
:expand-on-click-node="false">
|
|
|
<span class="custom-tree-node" slot-scope="{ node, data }">
|
|
|
<span>{{ node.label }}</span>
|
|
|
<span class="treeIcon">
|
|
|
- <img src="../assets/img/region/add.png" height="18" width="18" @click="addLoft(node)"/>
|
|
|
- <img src="../assets/img/region/edit.png" height="18" width="18" @click="editLoft(node)"/>
|
|
|
- <img src="../assets/img/region/del.png" height="18" width="18" @click="delLoft(node)"/>
|
|
|
- <img src="../assets/img/region/watch.png" height="18" width="18" @click="seeLoft(node)"/>
|
|
|
+ <!--第三层不能增加其子区域-->
|
|
|
+ <img src="../assets/img/region/add.png"
|
|
|
+ height="18" width="18"
|
|
|
+ v-if="node.level != 3"
|
|
|
+ @click="addLoft(node)"
|
|
|
+ />
|
|
|
+ <img src="../assets/img/region/edit.png"
|
|
|
+ height="18" width="18"
|
|
|
+ @click="editLoft(node)"
|
|
|
+ />
|
|
|
+ <img src="../assets/img/region/del.png"
|
|
|
+ height="18" width="18"
|
|
|
+ @click="delLoft(node)"
|
|
|
+ />
|
|
|
+ <img src="../assets/img/region/watch.png"
|
|
|
+ height="18" width="18"
|
|
|
+ v-if="node.level != 1"
|
|
|
+ @click="seeLoft(node)"
|
|
|
+ />
|
|
|
</span>
|
|
|
</span>
|
|
|
</el-tree>
|
|
|
@@ -40,14 +55,15 @@
|
|
|
<div class="plateTitle">
|
|
|
{{plateTitle}}
|
|
|
</div>
|
|
|
- <ul class="list" v-if="false">
|
|
|
- <li>
|
|
|
- <img src="../assets/img/region/loft.png" height="22" width="20"/>
|
|
|
- <em>1楼</em>
|
|
|
- </li>
|
|
|
- </ul>
|
|
|
- <div class="plateImg" v-if="false">
|
|
|
- <img src="../assets/img/main/RoomBg.png" height="769" width="1396"/>
|
|
|
+ <!--<ul class="list" v-if="false">-->
|
|
|
+ <!--<li>-->
|
|
|
+ <!--<img src="../assets/img/region/loft.png" height="22" width="20"/>-->
|
|
|
+ <!--<em>1楼</em>-->
|
|
|
+ <!--</li>-->
|
|
|
+ <!--</ul>-->
|
|
|
+ <div class="plateImg" v-if="plateImg">
|
|
|
+ <!--<img src="../assets/img/main/RoomBg.png" height="769" width="1396"/>-->
|
|
|
+ <img :src="plateImgSrc"/>
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
@@ -67,6 +83,13 @@
|
|
|
</label>
|
|
|
<el-input v-model="dialog.name"></el-input>
|
|
|
</el-col>
|
|
|
+ <el-col :span="20">
|
|
|
+ <label>
|
|
|
+ 建筑介绍
|
|
|
+ </label>
|
|
|
+ <el-input type="textarea" v-model="dialog.description"></el-input>
|
|
|
+ </el-col>
|
|
|
+
|
|
|
<!--<el-col :span="20" v-if="dialog_level != 1">-->
|
|
|
<el-col :span="20" v-if="true">
|
|
|
<label>
|
|
|
@@ -125,7 +148,9 @@
|
|
|
import {
|
|
|
GetRegionAndDectorSelect,
|
|
|
RegionStatusEdit,
|
|
|
- RegionAdd
|
|
|
+ RegionAdd,
|
|
|
+ GetRegiononeinfo,
|
|
|
+ RegionPictureGetByRegionId
|
|
|
}
|
|
|
from '../api/getApiRes.js'
|
|
|
|
|
|
@@ -137,21 +162,25 @@
|
|
|
dialog_state: false,
|
|
|
dialog_title: '',
|
|
|
dialog_type: '',//类型,1是添加,2是修改
|
|
|
- dialog_level: 1,//类型,1是楼(无图),2是楼层(有图),3是会议室(有图)
|
|
|
+ dialog_level: 1,//类型,1是楼(有图不显示),2是楼层(有图),3是会议室(有图)
|
|
|
dialog: {
|
|
|
shopID: 1,//One and always is one
|
|
|
token: localStorage.token,
|
|
|
name: '',
|
|
|
region: '',
|
|
|
+ description: '',
|
|
|
regionId: 0,
|
|
|
+ superiorid: 0,
|
|
|
memo: '',
|
|
|
- key: '',
|
|
|
+ Key: '',
|
|
|
image: '',
|
|
|
},
|
|
|
dialogImageUrl: '',
|
|
|
+ plateImgSrc: '',
|
|
|
dialogVisible: false,
|
|
|
disabled: false,
|
|
|
plateTitle: '',
|
|
|
+ plateImg: false,
|
|
|
loftList: [
|
|
|
{}
|
|
|
],
|
|
|
@@ -182,13 +211,27 @@
|
|
|
}
|
|
|
})
|
|
|
},
|
|
|
+ clearDialog() {
|
|
|
+ let that = this;
|
|
|
+ that.dialog.superiorid = 0;//上级 为空
|
|
|
+ that.dialog.name = '';
|
|
|
+ that.dialog.region = '';
|
|
|
+ that.dialog.regmemoion = '';
|
|
|
+ that.dialog.description = '';
|
|
|
+ that.dialog.Key = '';
|
|
|
+ that.dialog.image = '';
|
|
|
+ that.dialog.regionId = 0;
|
|
|
+ },
|
|
|
// 添加主建筑
|
|
|
addMain() {
|
|
|
let that = this;
|
|
|
that.dialog_state = true;
|
|
|
that.dialog_title = '添加主建筑';
|
|
|
- that.dialog_type = 1;
|
|
|
- that.dialog_level = 1;
|
|
|
+ that.dialog_type = 1;//1添加2修改
|
|
|
+ that.dialog_level = 1;//类型,1是楼(有图不显示),2是楼层(有图),3是会议室(有图)
|
|
|
+ // clear dialog
|
|
|
+ that.clearDialog();
|
|
|
+
|
|
|
},
|
|
|
// 修改建筑 弹窗
|
|
|
editLoft(node) {
|
|
|
@@ -196,21 +239,23 @@
|
|
|
that.dialog_state = true;
|
|
|
that.dialog_title = '修改';
|
|
|
that.dialog_type = 2;
|
|
|
- that.dialog_level = node.level;
|
|
|
+ that.dialog_level = node.level;//类型,1是楼(有图不显示),2是楼层(有图),3是会议室(有图)
|
|
|
that.dialog.name = node.data.Name;
|
|
|
that.dialog.regionId = node.data.Id;
|
|
|
+ that.getGetRegiononeinfo(node.data.Id); //读取Description
|
|
|
},
|
|
|
// 删除楼层
|
|
|
delLoft(node) {
|
|
|
let that = this;
|
|
|
let regionId = node.data.Id;
|
|
|
- let name = node.data.label;
|
|
|
+ let name = node.data.Name;
|
|
|
// 状态9删除
|
|
|
let param = {
|
|
|
- 'token': localStorage.token,
|
|
|
- 'regionid ': regionId,
|
|
|
- 'newstatus ': 9,
|
|
|
+ token: localStorage.token,
|
|
|
+ regionid: regionId,
|
|
|
+ newstatus: 9,
|
|
|
};
|
|
|
+ console.log(param);
|
|
|
let postdata = qs.stringify(param);
|
|
|
|
|
|
this.$confirm('是否删除' + name + '区域?', '删除操作', {
|
|
|
@@ -225,179 +270,229 @@
|
|
|
type: 'success',
|
|
|
message: `删除成功`
|
|
|
});
|
|
|
+ that.getDate();
|
|
|
} else {
|
|
|
that.$message.error(json.Memo);
|
|
|
}
|
|
|
});
|
|
|
- that.getDate();
|
|
|
}).catch(() => {
|
|
|
this.$message({
|
|
|
type: 'info',
|
|
|
message: '已取消禁用'
|
|
|
});
|
|
|
});
|
|
|
- },
|
|
|
- // 提交主建筑
|
|
|
- confirmAddMain() {
|
|
|
- let that = this;
|
|
|
- // checkVal
|
|
|
- if (!that.dialog.name) {
|
|
|
- this.$message.error('错了哦,主建筑名称不能空');
|
|
|
- return false
|
|
|
- }
|
|
|
- if (that.dialog.name.length > 20) {
|
|
|
- this.$message.error('错了哦,主建筑名称不能超过20个字符');
|
|
|
- return false
|
|
|
- }
|
|
|
- let param = {
|
|
|
- 'token': localStorage.token,
|
|
|
- 'regionid ': regionId,
|
|
|
- 'comid ': 1,
|
|
|
- 'superiorid ': 0,
|
|
|
- 'longitude ': 0,
|
|
|
- 'latitude ': 0,
|
|
|
- 'width ': 400,
|
|
|
- 'height ': 300,
|
|
|
- 'picMemo ': 300,
|
|
|
- 'picType ': 1, //图片类型,1:主图 2:平面图
|
|
|
- 'key ': dialog.key,
|
|
|
- };
|
|
|
- let postdata = qs.stringify(param);
|
|
|
-
|
|
|
- RegionAdd(postdata).then(res => {
|
|
|
- let json = res;
|
|
|
- if (json.Code == 0) {
|
|
|
- that.dialog_state = false;
|
|
|
- that.$message({
|
|
|
- showClose: true,
|
|
|
- message: '主建筑已添加!',
|
|
|
- type: 'success'
|
|
|
- });
|
|
|
- } else {
|
|
|
- that.$message.error(json.Memo);
|
|
|
+ },
|
|
|
+ // 提交添加新的建筑/区域
|
|
|
+ confirmAddRegion() {
|
|
|
+ let that = this;
|
|
|
+ // checkVal
|
|
|
+ if (!that.dialog.name) {
|
|
|
+ this.$message.error('错了哦,主建筑名称不能空');
|
|
|
+ return false
|
|
|
+ }
|
|
|
+ if (that.dialog.name.length > 20) {
|
|
|
+ this.$message.error('错了哦,主建筑名称不能超过20个字符');
|
|
|
+ return false
|
|
|
+ }
|
|
|
+ let param = {
|
|
|
+ token: localStorage.token,
|
|
|
+ regionname: that.dialog.name,
|
|
|
+ comid: 1,
|
|
|
+ superiorid: that.dialog.superiorid,
|
|
|
+ description: that.dialog.description,
|
|
|
+ longitude: 0,
|
|
|
+ latitude: 0,
|
|
|
+ width: 400,
|
|
|
+ height: 300,
|
|
|
+ picMemo: 300,
|
|
|
+ picType: that.dialog_level, //图片类型,1:主图 2:平面图
|
|
|
+ Key: that.dialog.Key,
|
|
|
+ };
|
|
|
+ let postdata = qs.stringify(param);
|
|
|
+ RegionAdd(postdata).then(res => {
|
|
|
+ let json = res;
|
|
|
+ if (json.Code == 0) {
|
|
|
+ that.dialog_state = false;
|
|
|
+ that.$message({
|
|
|
+ showClose: true,
|
|
|
+ message: '建筑/区域已添加!',
|
|
|
+ type: 'success'
|
|
|
+ });
|
|
|
+ // 重载tree
|
|
|
+ that.getDate();
|
|
|
+ } else {
|
|
|
+ that.$message.error(json.Memo);
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ // 提交修改
|
|
|
+ confirmEdit() {
|
|
|
+ let that = this;
|
|
|
+ // checkVal
|
|
|
+ if (!that.dialog.name) {
|
|
|
+ this.$message.error('错了哦,建筑名称不能空');
|
|
|
+ return false
|
|
|
+ }
|
|
|
+ if (that.dialog.name.length > 20) {
|
|
|
+ this.$message.error('错了哦,建筑名称不能超过20个字符');
|
|
|
+ return false
|
|
|
}
|
|
|
- })
|
|
|
- },
|
|
|
- // 提交修改
|
|
|
- confirmEdit() {
|
|
|
- let that = this;
|
|
|
- // checkVal
|
|
|
- if (!that.dialog.name) {
|
|
|
- this.$message.error('错了哦,建筑名称不能空');
|
|
|
- return false
|
|
|
- }
|
|
|
- if (that.dialog.name.length > 20) {
|
|
|
- this.$message.error('错了哦,建筑名称不能超过20个字符');
|
|
|
- return false
|
|
|
- }
|
|
|
|
|
|
- // ajax todo
|
|
|
- // ok
|
|
|
- that.dialog_state = false;
|
|
|
- that.$message({
|
|
|
- message: '建筑已修改',
|
|
|
- type: 'success'
|
|
|
- });
|
|
|
- },
|
|
|
- // 添加次级建筑
|
|
|
- addLoft(node) {
|
|
|
- let that = this;
|
|
|
- that.dialog_state = true;
|
|
|
- that.dialog_title = '添加楼层或区域';
|
|
|
- that.dialog_type = 1;
|
|
|
- that.dialog_level = 2;
|
|
|
- console.log(node);
|
|
|
- },
|
|
|
- handleImgSuccess(res, file) {
|
|
|
- console.log(res);
|
|
|
- },
|
|
|
- handleImgbefore(file) {
|
|
|
- console.log(file);
|
|
|
- this.dialog.image = file;
|
|
|
- },
|
|
|
- handleCheckChange(data, checked, indeterminate) {
|
|
|
- console.log(data, checked, indeterminate);
|
|
|
- },
|
|
|
- handleNodeClick(data) {
|
|
|
- console.log(data);
|
|
|
- },
|
|
|
- loadNode(node, resolve) {
|
|
|
- if (node.level === 0) {
|
|
|
- return resolve([{name: 'region1'}, {name: 'region2'}]);
|
|
|
- }
|
|
|
- if (node.level > 3) return resolve([]);
|
|
|
-
|
|
|
- var hasChild;
|
|
|
- if (node.data.name === 'region1') {
|
|
|
- hasChild = true;
|
|
|
- } else if (node.data.name === 'region2') {
|
|
|
- hasChild = false;
|
|
|
- } else {
|
|
|
- hasChild = Math.random() > 0.5;
|
|
|
- }
|
|
|
+ // ajax todo
|
|
|
+ // ok
|
|
|
+ that.dialog_state = false;
|
|
|
+ that.$message({
|
|
|
+ message: '建筑已修改',
|
|
|
+ type: 'success'
|
|
|
+ });
|
|
|
+ },
|
|
|
+ // 添加次级建筑
|
|
|
+ addLoft(node) {
|
|
|
+ let that = this;
|
|
|
+ // clear dialog
|
|
|
+ that.clearDialog();
|
|
|
+ that.dialog_state = true;
|
|
|
+ that.dialog_title = '添加楼层或区域';
|
|
|
+ that.dialog_type = 1;//1添加2修改
|
|
|
+ that.dialog_level = node.level;//类型,1是楼(有图不显示),2是楼层(有图),3是会议室(有图)
|
|
|
+ that.dialog.superiorid = node.data.Id;//将当前ID保存为上级ID
|
|
|
+ },
|
|
|
+ handleImgSuccess(res, file) {
|
|
|
+ let that = this;
|
|
|
+ if (res.Code == 0) {
|
|
|
+ that.dialog.Key = res.Key
|
|
|
+ } else {
|
|
|
+ that.$message.error(res.Memo);
|
|
|
+ }
|
|
|
+ console.log(res);
|
|
|
+ },
|
|
|
+ handleImgbefore(file) {
|
|
|
+ console.log(file);
|
|
|
+ this.dialog.image = file;
|
|
|
+ },
|
|
|
+ handleCheckChange(data, checked, indeterminate) {
|
|
|
+ console.log(data, checked, indeterminate);
|
|
|
+ },
|
|
|
+ handleNodeClick(data) {
|
|
|
+ console.log(data);
|
|
|
+ },
|
|
|
+ loadNode(node, resolve) {
|
|
|
+ if (node.level === 0) {
|
|
|
+ return resolve([{name: 'region1'}, {name: 'region2'}]);
|
|
|
+ }
|
|
|
+ if (node.level > 3) return resolve([]);
|
|
|
|
|
|
- setTimeout(() => {
|
|
|
- var data;
|
|
|
- if (hasChild) {
|
|
|
- data = [{
|
|
|
- name: 'zone' + this.count++
|
|
|
- }, {
|
|
|
- name: 'zone' + this.count++
|
|
|
- }];
|
|
|
+ var hasChild;
|
|
|
+ if (node.data.name === 'region1') {
|
|
|
+ hasChild = true;
|
|
|
+ } else if (node.data.name === 'region2') {
|
|
|
+ hasChild = false;
|
|
|
} else {
|
|
|
- data = [];
|
|
|
+ hasChild = Math.random() > 0.5;
|
|
|
}
|
|
|
|
|
|
- resolve(data);
|
|
|
- }, 500);
|
|
|
- },
|
|
|
- dialog_cancel() {
|
|
|
- let that = this;
|
|
|
- that.dialog_state = false;
|
|
|
- },
|
|
|
- dialog_ok() {
|
|
|
- let that = this;
|
|
|
- // 添加类
|
|
|
- if (that.dialog_type == 1) {
|
|
|
- // 获取提交类型
|
|
|
- switch (parseInt(that.dialog_level)) {
|
|
|
+ setTimeout(() => {
|
|
|
+ var data;
|
|
|
+ if (hasChild) {
|
|
|
+ data = [{
|
|
|
+ name: 'zone' + this.count++
|
|
|
+ }, {
|
|
|
+ name: 'zone' + this.count++
|
|
|
+ }];
|
|
|
+ } else {
|
|
|
+ data = [];
|
|
|
+ }
|
|
|
+
|
|
|
+ resolve(data);
|
|
|
+ }, 500);
|
|
|
+ },
|
|
|
+ dialog_cancel() {
|
|
|
+ let that = this;
|
|
|
+ that.dialog_state = false;
|
|
|
+ },
|
|
|
+ dialog_ok() {
|
|
|
+ let that = this;
|
|
|
+ // 添加类 1是添加,2是修改
|
|
|
+ if (that.dialog_type == 1) {
|
|
|
+ // 获取提交类型
|
|
|
+ that.confirmAddRegion();
|
|
|
+ }
|
|
|
+ // 修改类 1是添加,2是修改
|
|
|
+ if (that.dialog_type == 2) {
|
|
|
+ that.confirmEdit();
|
|
|
+ }
|
|
|
+ },
|
|
|
+ handleRemove(file) {
|
|
|
+ console.log(file);
|
|
|
+ },
|
|
|
+ handlePictureCardPreview(file) {
|
|
|
+ this.dialogImageUrl = file.url;
|
|
|
+ this.dialogVisible = true;
|
|
|
+ },
|
|
|
+ handleDownload(file) {
|
|
|
+ console.log(file);
|
|
|
+ },
|
|
|
+ // 查看当前区域情况
|
|
|
+ seeLoft(node) {
|
|
|
+ let that = this;
|
|
|
+ that.plateTitle = node.data.Name;
|
|
|
+ switch (parseInt(node.level)) {
|
|
|
case 1:
|
|
|
- that.confirmAddMain();
|
|
|
+ // 看列表
|
|
|
+ that.loftList = true;
|
|
|
break;
|
|
|
case 2:
|
|
|
+ // 看楼层图
|
|
|
+ that.plateImg = true;
|
|
|
+ that.getRegionPictureGetByRegionId(node.data.Id);
|
|
|
+ // that.plateImgSrc
|
|
|
break;
|
|
|
case 3:
|
|
|
+ // 看会议图
|
|
|
+ that.plateImg = true;
|
|
|
+ that.getRegionPictureGetByRegionId(node.data.Id);
|
|
|
break;
|
|
|
}
|
|
|
+ },
|
|
|
+ getGetRegiononeinfo(regionid) {
|
|
|
+ let that = this;
|
|
|
+ let param = {
|
|
|
+ token: localStorage.token,
|
|
|
+ regionid: regionid,
|
|
|
+ };
|
|
|
+ let postdata = qs.stringify(param);
|
|
|
+ GetRegiononeinfo(postdata).then(res => {
|
|
|
+ let json = res;
|
|
|
+ if (json.Code == 0) {
|
|
|
+ console.log(json);
|
|
|
+ that.dialog.description = json.Rs.Description;
|
|
|
+ } else {
|
|
|
+ that.$message.error(json.Memo);
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ getRegionPictureGetByRegionId(regionID) {
|
|
|
+ let that = this;
|
|
|
+ let param = {
|
|
|
+ token: localStorage.token,
|
|
|
+ regionID: regionID,
|
|
|
+ };
|
|
|
+ let postdata = qs.stringify(param);
|
|
|
+ RegionPictureGetByRegionId(postdata).then(res => {
|
|
|
+ let json = res;
|
|
|
+ that.plateImgSrc = '';
|
|
|
+ if (json.Code == 0) {
|
|
|
+ that.plateImgSrc = json.EncodeString
|
|
|
+ } else {
|
|
|
+ that.$message.error(json.Memo);
|
|
|
+ }
|
|
|
+ })
|
|
|
}
|
|
|
- // 修改类
|
|
|
- if (that.dialog_type == 2) {
|
|
|
- that.confirmEdit();
|
|
|
- }
|
|
|
-
|
|
|
- // let dialog_type = that.dialog_type;
|
|
|
- // let name = that.field_name;
|
|
|
- // let id = that.field_id;
|
|
|
- },
|
|
|
- handleRemove(file) {
|
|
|
- console.log(file);
|
|
|
- },
|
|
|
- handlePictureCardPreview(file) {
|
|
|
- this.dialogImageUrl = file.url;
|
|
|
- this.dialogVisible = true;
|
|
|
- },
|
|
|
- handleDownload(file) {
|
|
|
- console.log(file);
|
|
|
- },
|
|
|
- // 查看当前区域情况
|
|
|
- seeLoft(node) {
|
|
|
- // todo
|
|
|
- },
|
|
|
- }
|
|
|
- ,
|
|
|
- components: {
|
|
|
- dialog_referrer_list
|
|
|
- }
|
|
|
+ }
|
|
|
+ ,
|
|
|
+ components: {
|
|
|
+ dialog_referrer_list
|
|
|
+ }
|
|
|
}
|
|
|
;
|
|
|
</script>
|
|
|
@@ -603,4 +698,15 @@
|
|
|
color: #005EA2;
|
|
|
}
|
|
|
|
|
|
+ /deep/ .modal-body {
|
|
|
+ width: 100%;
|
|
|
+ overflow: hidden;
|
|
|
+ display: block;
|
|
|
+ margin: 0 auto;
|
|
|
+ margin-bottom: 40px;
|
|
|
+ }
|
|
|
+
|
|
|
+ /deep/ .modal-body textarea {
|
|
|
+ color: #005EA2;
|
|
|
+ }
|
|
|
</style>
|