|
|
@@ -10,16 +10,22 @@
|
|
|
<i v-else class="el-icon-arrow-right"></i>
|
|
|
</div>
|
|
|
<div class="item-loudong" v-for="(item1, index1) in item0.children" :key="index1" :style="{display: item0.isShow ? '' : 'none'}">
|
|
|
- <div class="loudong" @click="loudong_toggle(item1.id + '|' + item0.id, item1.label + '|'+ item0.label)">
|
|
|
- <div class="louidong_text" :title="item1.label">{{item1.label}}</div>
|
|
|
- <i v-if="item1.isShow" class="el-icon-arrow-down"></i>
|
|
|
- <i v-else class="el-icon-arrow-right"></i>
|
|
|
- </div>
|
|
|
+ <el-tooltip class="item" effect="dark" :content="item1.label" placement="right">
|
|
|
+ <div class="loudong" @click="loudong_toggle(item1.id + '|' + item0.id, item1.label + '|'+ item0.label)">
|
|
|
+ <div class="louidong_text">{{item1.label}}</div>
|
|
|
+ <i v-if="item1.isShow" class="el-icon-arrow-down"></i>
|
|
|
+ <i v-else class="el-icon-arrow-right"></i>
|
|
|
+ </div>
|
|
|
+ </el-tooltip>
|
|
|
<div class="item-louceng" v-for="(item2, index2) in item1.children" :key="index2" :style="{display: item1.isShow ? '' : 'none'}">
|
|
|
<div :id="`louceng${index0}${index1}${index2}`" class="louceng" :class="louceng_click_id == item2.id ? 'louceng-clicked' : '' "
|
|
|
@click="louceng_click($event, item2.id + '|' + item1.id + '|' + item0.id, item2.label + '|' + item1.label + '|'+ item0.label, item2.rooms)">
|
|
|
{{item2.label}}
|
|
|
</div>
|
|
|
+ <div class="louceng-del"
|
|
|
+ @click="del_louceng_click($event, item2.id + '|' + item1.id + '|' + item0.id, item2.label + '|' + item1.label + '|'+ item0.label, item2.rooms)">
|
|
|
+ <i class="el-icon-delete"></i>
|
|
|
+ </div>
|
|
|
</div>
|
|
|
<div class="loudong-add-louceng" :style="{display: item1.isShow ? '' : 'none'}"
|
|
|
@click="add_louceng(item1.id + '|' + item0.id, item1.label + '|'+ item0.label)">
|
|
|
@@ -110,13 +116,15 @@
|
|
|
</el-table-column>
|
|
|
<el-table-column label="开关状态" align="center">
|
|
|
<template slot-scope="scope">
|
|
|
- <span v-if="scope.row.onOffStatus == 0" title="已关机"
|
|
|
- @click="open_close_airs(0, scope.$index, scope.row, 'open')">
|
|
|
- <svg-icon icon-class="power" class="power-icon-off" />
|
|
|
+ <span v-if="scope.row.onOffStatus == 0" @click="open_close_airs(0, scope.$index, scope.row, 'open')">
|
|
|
+ <el-tooltip class="item" effect="dark" content="已关机" placement="left">
|
|
|
+ <svg-icon icon-class="power" class="power-icon-off" />
|
|
|
+ </el-tooltip>
|
|
|
</span>
|
|
|
- <span v-else class="txt-cell-blue" title="已开机"
|
|
|
- @click="open_close_airs(0, scope.$index, scope.row, 'close')">
|
|
|
- <svg-icon icon-class="power" class="power-icon-on" />
|
|
|
+ <span v-else class="txt-cell-blue" @click="open_close_airs(0, scope.$index, scope.row, 'close')">
|
|
|
+ <el-tooltip class="item" effect="dark" content="已开机" placement="left">
|
|
|
+ <svg-icon icon-class="power" class="power-icon-on" />
|
|
|
+ </el-tooltip>
|
|
|
</span>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
@@ -185,13 +193,15 @@
|
|
|
</el-table-column>
|
|
|
<el-table-column label="开关状态" align="center">
|
|
|
<template slot-scope="scope">
|
|
|
- <span v-if="scope.row.onOffStatus == 0" title="已关机"
|
|
|
- @click="open_close_airs(1, scope.$index, scope.row, 'open')">
|
|
|
- <svg-icon icon-class="power" class="power-icon-off" />
|
|
|
+ <span v-if="scope.row.onOffStatus == 0" @click="open_close_airs(1, scope.$index, scope.row, 'open')">
|
|
|
+ <el-tooltip class="item" effect="dark" content="已关机" placement="left">
|
|
|
+ <svg-icon icon-class="power" class="power-icon-off" />
|
|
|
+ </el-tooltip>
|
|
|
</span>
|
|
|
- <span v-else class="txt-cell-blue" title="已开机"
|
|
|
- @click="open_close_airs(1, scope.$index, scope.row, 'close')">
|
|
|
- <svg-icon icon-class="power" class="power-icon-on" />
|
|
|
+ <span v-else class="txt-cell-blue" @click="open_close_airs(1, scope.$index, scope.row, 'close')">
|
|
|
+ <el-tooltip class="item" effect="dark" content="已开机" placement="left">
|
|
|
+ <svg-icon icon-class="power" class="power-icon-on" />
|
|
|
+ </el-tooltip>
|
|
|
</span>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
@@ -262,13 +272,15 @@
|
|
|
</el-table-column>
|
|
|
<el-table-column label="开关状态" align="center">
|
|
|
<template slot-scope="scope">
|
|
|
- <span v-if="scope.row.onOffStatus == 0" title="已关机"
|
|
|
- @click="open_close_airs(2, scope.$index, scope.row, 'open')">
|
|
|
- <svg-icon icon-class="power" class="power-icon-off" />
|
|
|
+ <span v-if="scope.row.onOffStatus == 0" @click="open_close_airs(2, scope.$index, scope.row, 'open')">
|
|
|
+ <el-tooltip class="item" effect="dark" content="已关机" placement="left">
|
|
|
+ <svg-icon icon-class="power" class="power-icon-off" />
|
|
|
+ </el-tooltip>
|
|
|
</span>
|
|
|
- <span v-else class="txt-cell-blue" title="已开机"
|
|
|
- @click="open_close_airs(2, scope.$index, scope.row, 'close')">
|
|
|
- <svg-icon icon-class="power" class="power-icon-on" />
|
|
|
+ <span v-else class="txt-cell-blue" @click="open_close_airs(2, scope.$index, scope.row, 'close')">
|
|
|
+ <el-tooltip class="item" effect="dark" content="已开机" placement="left">
|
|
|
+ <svg-icon icon-class="power" class="power-icon-on" />
|
|
|
+ </el-tooltip>
|
|
|
</span>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
@@ -337,13 +349,15 @@
|
|
|
</el-table-column>
|
|
|
<el-table-column label="开关状态" align="center">
|
|
|
<template slot-scope="scope">
|
|
|
- <span v-if="scope.row.onOffStatus == 0" title="已关机"
|
|
|
- @click="open_close_airs(3, scope.$index, scope.row, 'open')">
|
|
|
- <svg-icon icon-class="power" class="power-icon-off" />
|
|
|
+ <span v-if="scope.row.onOffStatus == 0" @click="open_close_airs(3, scope.$index, scope.row, 'open')">
|
|
|
+ <el-tooltip class="item" effect="dark" content="已关机" placement="left">
|
|
|
+ <svg-icon icon-class="power" class="power-icon-off" />
|
|
|
+ </el-tooltip>
|
|
|
</span>
|
|
|
- <span v-else class="txt-cell-blue" title="已开机"
|
|
|
- @click="open_close_airs(3, scope.$index, scope.row, 'close')">
|
|
|
- <svg-icon icon-class="power" class="power-icon-on" />
|
|
|
+ <span v-else class="txt-cell-blue" @click="open_close_airs(3, scope.$index, scope.row, 'close')">
|
|
|
+ <el-tooltip class="item" effect="dark" content="已开机" placement="left">
|
|
|
+ <svg-icon icon-class="power" class="power-icon-on" />
|
|
|
+ </el-tooltip>
|
|
|
</span>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
@@ -378,8 +392,7 @@
|
|
|
<!-- 添加楼栋 -->
|
|
|
<el-dialog title="添加楼栋" custom-class="el-dialog-add-loudong" :visible.sync="dialog_add_loudong" :close-on-click-modal="false"
|
|
|
:close-on-press-escape="false" @close="dialog_close('form_add_loudong')">
|
|
|
- <!-- <el-form :model="form_add_loudong" ref="add_loudong_form" :rules="form_add_loudong_rules"> -->
|
|
|
- <el-form :model="form_add_loudong" ref="add_loudong_form">
|
|
|
+ <el-form :model="form_add_loudong" ref="add_loudong_form" :rules="form_add_loudong_rules">
|
|
|
<el-form-item label="校区:" :label-width="formLabelWidth">
|
|
|
<span>{{form_add_loudong.school}}</span>
|
|
|
</el-form-item>
|
|
|
@@ -548,23 +561,26 @@
|
|
|
startAirs,
|
|
|
stopAirs,
|
|
|
selAirsStatus,
|
|
|
- getDevices
|
|
|
+ getDevices,
|
|
|
+ delFloors
|
|
|
} from '@/api/serveAC';
|
|
|
export default {
|
|
|
data() {
|
|
|
- // var checkloudong = (rule, value, callback) => {
|
|
|
- // if (!value) {
|
|
|
- // return callback(new Error('请输入楼栋名称'));
|
|
|
- // }
|
|
|
- // setTimeout(() => {
|
|
|
- // var reg = /^[a-zA-Z0-9_\u4e00-\u9fa5]{2,10}$/
|
|
|
- // if (!reg.test(value)) {
|
|
|
- // callback(new Error('必须为2-10个汉字、数字、字母或下划线!'));
|
|
|
- // } else {
|
|
|
- // callback();
|
|
|
- // }
|
|
|
- // }, 100);
|
|
|
- // }
|
|
|
+ var checkloudong = (rule, value, callback) => {
|
|
|
+ if (!value) {
|
|
|
+ return callback(new Error('请输入楼栋名称'));
|
|
|
+ }
|
|
|
+ // setTimeout(() => {
|
|
|
+ // var reg = /^[a-zA-Z0-9_\u4e00-\u9fa5]{2,10}$/
|
|
|
+ // if (!reg.test(value)) {
|
|
|
+ // callback(new Error('必须为2-10个汉字、数字、字母或下划线!'));
|
|
|
+ // } else {
|
|
|
+ // callback();
|
|
|
+ // }
|
|
|
+ // }, 100);
|
|
|
+
|
|
|
+ callback();
|
|
|
+ }
|
|
|
var checklouceng = (rule, value, callback) => {
|
|
|
if (!value) {
|
|
|
return callback(new Error('请输入数字楼层号'));
|
|
|
@@ -683,11 +699,11 @@
|
|
|
school: '',
|
|
|
building: ''
|
|
|
},
|
|
|
- // form_add_loudong_rules: { // 添加楼栋表单验证
|
|
|
- // building: [{
|
|
|
- // validator: checkloudong
|
|
|
- // }]
|
|
|
- // },
|
|
|
+ form_add_loudong_rules: { // 添加楼栋表单验证
|
|
|
+ building: [{
|
|
|
+ validator: checkloudong
|
|
|
+ }]
|
|
|
+ },
|
|
|
// 添加楼层
|
|
|
dialog_add_louceng: false,
|
|
|
form_add_louceng: { // 添加楼层数据
|
|
|
@@ -911,7 +927,7 @@
|
|
|
this.$message.error('返回数据格式问题,code未获取到!')
|
|
|
return
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
if (res.code == 200) {
|
|
|
this.$set(this.currentData.rooms[roomIndex].tableData[rowIndex], 'onOffStatus',
|
|
|
res.is_on)
|
|
|
@@ -944,7 +960,7 @@
|
|
|
type: 'warning',
|
|
|
message: '已取消'
|
|
|
});
|
|
|
- });
|
|
|
+ });
|
|
|
} else if (open_close == 'close') {
|
|
|
this.$confirm('是否关闭设备:' + row.name + ' ' + row.device, '提示', {
|
|
|
confirmButtonText: '是的',
|
|
|
@@ -961,7 +977,7 @@
|
|
|
this.$message.error('返回数据格式问题,code未获取到!')
|
|
|
return
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
if (res.code == 200) {
|
|
|
this.$set(this.currentData.rooms[roomIndex].tableData[rowIndex], 'onOffStatus',
|
|
|
res.is_on)
|
|
|
@@ -1053,31 +1069,24 @@
|
|
|
let tmp = this.navData
|
|
|
for (var i = 0; i < tmp.length; i++) {
|
|
|
if (tmp[i].label == this.form_modify_room.school && typeof tmp[i]
|
|
|
- .children !==
|
|
|
- 'undefined' && tmp[i].children.length > 0) {
|
|
|
+ .children !== 'undefined' && tmp[i].children.length > 0) {
|
|
|
let tmp1 = tmp[i].children;
|
|
|
for (var j = 0; j < tmp1.length; j++) {
|
|
|
- if (tmp1[j].label == this.form_modify_room.building &&
|
|
|
- typeof tmp1[j]
|
|
|
- .children !== 'undefined' && tmp1[j].children.length > 0) {
|
|
|
+ if (tmp1[j].label == this.form_modify_room.building && typeof tmp1[j].children !== 'undefined' && tmp1[
|
|
|
+ j].children.length > 0) {
|
|
|
let tmp2 = tmp1[j].children;
|
|
|
for (var k = 0; k < tmp2.length; k++) {
|
|
|
- if (tmp2[k].label == this.form_modify_room.floor &&
|
|
|
- typeof tmp2[k]
|
|
|
- .rooms !== 'undefined' && tmp2[k].rooms.length > 0
|
|
|
+ if (tmp2[k].label == this.form_modify_room.floor && typeof tmp2[k].rooms !== 'undefined' &&
|
|
|
+ tmp2[k].rooms.length > 0
|
|
|
) {
|
|
|
let tmp3 = tmp2[k].rooms;
|
|
|
for (var p = 0; p < tmp3.length; p++) {
|
|
|
if (tmp3[p] == room) {
|
|
|
- this.navData[i].children[j].children[k]
|
|
|
- .rooms[p] =
|
|
|
- this
|
|
|
- .form_modify_room.building + '-' + this
|
|
|
- .form_modify_room.room;
|
|
|
+ this.navData[i].children[j].children[k].rooms[p] =
|
|
|
+ this.form_modify_room.building + '-' + this.form_modify_room.room;
|
|
|
}
|
|
|
}
|
|
|
- this.navData[i].children[j].children[k].rooms
|
|
|
- .sort();
|
|
|
+ this.navData[i].children[j].children[k].rooms.sort();
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
@@ -1133,15 +1142,12 @@
|
|
|
|
|
|
let tmp2 = tmp1[j].children
|
|
|
for (var k = 0; k < tmp2.length; k++) {
|
|
|
- if (tmp2[k].label == data[2] && typeof tmp2[k].rooms !==
|
|
|
- 'undefined' && tmp2[k].rooms.length > 0) {
|
|
|
+ if (tmp2[k].label == data[2] && typeof tmp2[k].rooms !== 'undefined' && tmp2[k].rooms.length > 0) {
|
|
|
|
|
|
let tmp3 = tmp2[k].rooms
|
|
|
for (var p = 0; p < tmp3.length; p++) {
|
|
|
if (tmp3[p] == room) {
|
|
|
-
|
|
|
- this.navData[i].children[j].children[k].rooms
|
|
|
- .splice(p, 1)
|
|
|
+ this.navData[i].children[j].children[k].rooms.splice(p, 1)
|
|
|
}
|
|
|
}
|
|
|
this.navData[i].children[j].children[k].rooms.sort()
|
|
|
@@ -1184,9 +1190,11 @@
|
|
|
if (school.length > 0) {
|
|
|
this.navData = []
|
|
|
let tmpSchool = []
|
|
|
+ // 每个校区追加楼栋
|
|
|
for (var i = 0; i < school.length; i++) {
|
|
|
let nData = []
|
|
|
let builds = school[i].builds
|
|
|
+ // 每栋中追加楼层
|
|
|
for (var j = 0; j < builds.length; j++) {
|
|
|
let tmpBuilds = {}
|
|
|
let tmpFloors = []
|
|
|
@@ -1207,13 +1215,17 @@
|
|
|
})
|
|
|
tmpBuilds.id = builds[j].id
|
|
|
tmpBuilds.label = builds[j].building
|
|
|
- tmpBuilds.isShow = true
|
|
|
+ tmpBuilds.isShow = false
|
|
|
tmpBuilds.children = []
|
|
|
tmpBuilds.children = tmpFloors
|
|
|
+ // 放入楼栋
|
|
|
nData.push(tmpBuilds)
|
|
|
}
|
|
|
// 楼栋排序
|
|
|
nData.sort((a, b) => a.label.localeCompare(b.label))
|
|
|
+ // 默认展开第1个楼栋
|
|
|
+ nData[0].isShow = true
|
|
|
+ // 放入校区
|
|
|
tmpSchool.push({
|
|
|
id: school[i].id,
|
|
|
label: school[i].school,
|
|
|
@@ -1448,6 +1460,76 @@
|
|
|
}, 500);
|
|
|
},
|
|
|
/**
|
|
|
+ * 删除楼层
|
|
|
+ * @param {Object} e
|
|
|
+ * @param {Object} id
|
|
|
+ * @param {Object} label
|
|
|
+ * @param {Object} rooms
|
|
|
+ */
|
|
|
+ del_louceng_click(e, id, label, rooms) {
|
|
|
+ // console.log(e, id, label, rooms);
|
|
|
+ // console.log(this.navData)
|
|
|
+ let ids = id.split('|');
|
|
|
+ let labels = label.split('|');
|
|
|
+ let _this = this;
|
|
|
+ this.$confirm('此操作将永久删除该楼层, 是否继续?', '提示', {
|
|
|
+ confirmButtonText: '确定',
|
|
|
+ cancelButtonText: '取消',
|
|
|
+ type: 'warning'
|
|
|
+ }).then(() => {
|
|
|
+ for (var i = 0; i < _this.navData.length; i++) {
|
|
|
+ if (_this.navData[i].id == ids[2]) {
|
|
|
+ // 校区
|
|
|
+ var xiaoqu = _this.navData[i].children;
|
|
|
+ for (var j = 0; j < xiaoqu.length; j++) {
|
|
|
+ // 楼栋
|
|
|
+ if (xiaoqu[j].id == ids[1]) {
|
|
|
+ var loudong = xiaoqu[j].children;
|
|
|
+ for (var k = 0; k < loudong.length; k++) {
|
|
|
+ // 楼层
|
|
|
+ if (loudong[k].id == ids[0]) {
|
|
|
+ // 删除楼层
|
|
|
+ // console.log(i, j, k);
|
|
|
+ if (_this.navData[i].children[j].children[k].rooms.length == 0) {
|
|
|
+ // 调用删除楼层接口
|
|
|
+ delFloors({
|
|
|
+ school: labels[2],
|
|
|
+ build: labels[1],
|
|
|
+ floors: labels[0]
|
|
|
+ }).then((res) => {
|
|
|
+ // console.log(res);
|
|
|
+ if (typeof res.code == 'undefined' || res.code == '') {
|
|
|
+ // this.$message.error('返回数据格式问题,code未获取到!')
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if (res.code == 200) {
|
|
|
+ _this.navData[i].children[j].children.splice(k, 1);
|
|
|
+ this.$message.success('楼层删除成功!');
|
|
|
+ } else {
|
|
|
+ _this.$message.error(res.message);
|
|
|
+ }
|
|
|
+ }).catch((err) => {
|
|
|
+ // console.log(err);
|
|
|
+ this.$message.error(err.message)
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ _this.$message.error('该楼层中有房间,暂不能删除!');
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }).catch(() => {
|
|
|
+ this.$message({
|
|
|
+ type: 'info',
|
|
|
+ message: '已取消删除楼层'
|
|
|
+ });
|
|
|
+ });
|
|
|
+ },
|
|
|
+ /**
|
|
|
* 刷新顶部数据
|
|
|
*/
|
|
|
flush_top_data() {
|
|
|
@@ -1754,8 +1836,7 @@
|
|
|
* 添加楼栋
|
|
|
*/
|
|
|
add_loudong(id, label) {
|
|
|
- // console.log(id);
|
|
|
- // console.log(label);
|
|
|
+ // console.log(id, label);
|
|
|
this.form_add_loudong.school = label
|
|
|
// 显示添加楼栋
|
|
|
this.dialog_add_loudong = true
|
|
|
@@ -2224,28 +2305,44 @@
|
|
|
|
|
|
.item-louceng {
|
|
|
display: flex;
|
|
|
- flex-direction: column;
|
|
|
+ // flex-direction: column;
|
|
|
+ justify-content: space-around;
|
|
|
margin-left: 40px;
|
|
|
|
|
|
.louceng {
|
|
|
display: flex;
|
|
|
align-items: center;
|
|
|
- justify-content: space-between;
|
|
|
+ // justify-content: space-between;
|
|
|
padding: 10px;
|
|
|
height: 30px;
|
|
|
+ width: 80%;
|
|
|
font-size: 18px;
|
|
|
cursor: pointer;
|
|
|
}
|
|
|
|
|
|
.louceng:hover {
|
|
|
- background-color: #5c8aff;
|
|
|
+ background-color: #0099FF;
|
|
|
color: #FFFFFF;
|
|
|
}
|
|
|
|
|
|
.louceng-clicked {
|
|
|
font-size: 20px;
|
|
|
font-weight: bold;
|
|
|
- background-color: #3e5afe;
|
|
|
+ background-color: #0066FF;
|
|
|
+ color: #FFFFFF;
|
|
|
+ }
|
|
|
+
|
|
|
+ .louceng-del {
|
|
|
+ display: flex;
|
|
|
+ align-items: center;
|
|
|
+ padding: 10px;
|
|
|
+ height: 30px;
|
|
|
+ font-size: 18px;
|
|
|
+ cursor: pointer;
|
|
|
+ }
|
|
|
+
|
|
|
+ .louceng-del:hover {
|
|
|
+ background-color: #ff4e51;
|
|
|
color: #FFFFFF;
|
|
|
}
|
|
|
}
|
|
|
@@ -2260,6 +2357,10 @@
|
|
|
margin-left: 5px;
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ .loudong-add-louceng:hover {
|
|
|
+ background-color: #CCCCCC;
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -2270,13 +2371,17 @@
|
|
|
.add-loudong {
|
|
|
display: flex;
|
|
|
align-items: center;
|
|
|
- padding: 10px 0 0 20px;
|
|
|
+ padding: 10px 0 10px 20px;
|
|
|
cursor: pointer;
|
|
|
|
|
|
.add-loudong-txt {
|
|
|
margin-left: 5px;
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ .add-loudong:hover {
|
|
|
+ background-color: #CCCCCC;
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
.cell {
|
|
|
@@ -2465,6 +2570,11 @@
|
|
|
cursor: pointer;
|
|
|
color: #ff0000;
|
|
|
}
|
|
|
+
|
|
|
+ .power-icon-off:focus,
|
|
|
+ .power-icon-on:focus {
|
|
|
+ outline: none;
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|