|
|
@@ -391,7 +391,7 @@
|
|
|
</el-col>
|
|
|
</el-row>
|
|
|
<div class="pagination-table">
|
|
|
- <el-pagination @current-change="currentPageChange"
|
|
|
+ <el-pagination @current-change="currentPageChange" :hide-on-single-page="hideOnSinglePage"
|
|
|
:current-page.sync="pagination.currentPage" :page-size="pagination.pageSize"
|
|
|
layout="prev, pager, next, jumper" :total="pagination.total">
|
|
|
</el-pagination>
|
|
|
@@ -580,8 +580,7 @@
|
|
|
stopAirs,
|
|
|
selAirsStatus,
|
|
|
getDevices
|
|
|
- } from '@/api/serveAC'
|
|
|
- var deviceOptions = [];
|
|
|
+ } from '@/api/serveAC';
|
|
|
export default {
|
|
|
data() {
|
|
|
// var checkloudong = (rule, value, callback) => {
|
|
|
@@ -698,7 +697,8 @@
|
|
|
}
|
|
|
};
|
|
|
return {
|
|
|
- cao: this.$store.state.user.name, // 操作员
|
|
|
+ hideOnSinglePage: true, // 只有一页时是否隐藏
|
|
|
+ cao: this.$store.state.user.user_name, // 操作员
|
|
|
contact: this.$store.state.user.phone,
|
|
|
room_number: 0, // 房间数量
|
|
|
device_number: 0, // 设备数量
|
|
|
@@ -766,7 +766,7 @@
|
|
|
deviceName: '',
|
|
|
deviceIp: '',
|
|
|
checkedDevice: [],
|
|
|
- devices: deviceOptions,
|
|
|
+ devices: [],
|
|
|
duration_use: 0.00, // 使用时长
|
|
|
is_normal: '1', // 是否正常
|
|
|
is_on: '0' // 是否开启
|
|
|
@@ -857,11 +857,12 @@
|
|
|
}, {
|
|
|
loading: false,
|
|
|
text: ''
|
|
|
- }]
|
|
|
+ }],
|
|
|
+ deviceOptions: []
|
|
|
}
|
|
|
},
|
|
|
created() {
|
|
|
- // 获取消费记录,表格数据
|
|
|
+ // 获取表格数据
|
|
|
this.get_loudong_data()
|
|
|
// 默认选中第一个房间
|
|
|
let auto_click = setInterval(() => {
|
|
|
@@ -876,25 +877,32 @@
|
|
|
this.get_Devices();
|
|
|
},
|
|
|
mounted() {
|
|
|
- document.getElementsByClassName("el-pagination__jump")[0].childNodes[0].nodeValue = "跳至";
|
|
|
+ var obj = document.getElementsByClassName("el-pagination__jump")[0];
|
|
|
+ if (typeof obj == 'undefined') {
|
|
|
+ return;
|
|
|
+ } else {
|
|
|
+ obj[0].childNodes[0].nodeValue = "跳至";
|
|
|
+ }
|
|
|
},
|
|
|
methods: {
|
|
|
/**
|
|
|
- * 获取费率列表数据
|
|
|
+ * 获取所有的空调列表
|
|
|
*/
|
|
|
get_Devices() {
|
|
|
+ var _this = this;
|
|
|
// 开始发送请求,获取配置数据
|
|
|
getDevices().then((res) => {
|
|
|
// console.log(res.data);
|
|
|
if (res.code == 200) {
|
|
|
let resdata = res.data;
|
|
|
- deviceOptions = []
|
|
|
+ _this.deviceOptions = [];
|
|
|
for (var i = 0; i < resdata.length; i++) {
|
|
|
- deviceOptions.push(resdata[i].air_config);
|
|
|
+ _this.deviceOptions.push(resdata[i].air_config);
|
|
|
}
|
|
|
- deviceOptions.sort((a, b) => a.localeCompare(b))
|
|
|
+ _this.deviceOptions.sort((a, b) => a - b);
|
|
|
+ this.form_add_device.devices = _this.deviceOptions;
|
|
|
} else {
|
|
|
- deviceOptions = [];
|
|
|
+ _this.deviceOptions = [];
|
|
|
this.$message.warning('没有符合条件的数据!');
|
|
|
}
|
|
|
}).catch((err) => {
|
|
|
@@ -929,16 +937,13 @@
|
|
|
|
|
|
if (res.code == 200) {
|
|
|
this.$set(this.currentData.rooms[roomIndex].tableData[rowIndex], 'onOffStatus',
|
|
|
- res
|
|
|
- .is_on)
|
|
|
+ res.is_on)
|
|
|
if (res.is_normal == 1) {
|
|
|
this.$set(this.currentData.rooms[roomIndex].tableData[rowIndex],
|
|
|
- 'alarmStatus',
|
|
|
- '正常')
|
|
|
+ 'alarmStatus', '正常')
|
|
|
} else {
|
|
|
this.$set(this.currentData.rooms[roomIndex].tableData[rowIndex],
|
|
|
- 'alarmStatus',
|
|
|
- '离线')
|
|
|
+ 'alarmStatus', '离线')
|
|
|
}
|
|
|
// let _this = this;
|
|
|
// setTimeout(() => {
|
|
|
@@ -948,10 +953,14 @@
|
|
|
this.$message.error(res.message)
|
|
|
}
|
|
|
this.$set(this.airsLoading[roomIndex], 'loading', false);
|
|
|
+ // 刷新顶部数据
|
|
|
+ this.flush_top_data();
|
|
|
}).catch((err) => {
|
|
|
// console.log(err);
|
|
|
// this.$message.error(err.message)
|
|
|
this.$set(this.airsLoading[roomIndex], 'loading', false);
|
|
|
+ // 刷新顶部数据
|
|
|
+ this.flush_top_data();
|
|
|
})
|
|
|
} else if (open_close == 'close') {
|
|
|
this.$set(this.airsLoading[roomIndex], 'loading', true);
|
|
|
@@ -967,16 +976,13 @@
|
|
|
|
|
|
if (res.code == 200) {
|
|
|
this.$set(this.currentData.rooms[roomIndex].tableData[rowIndex], 'onOffStatus',
|
|
|
- res
|
|
|
- .is_on)
|
|
|
+ res.is_on)
|
|
|
if (res.is_normal == 1) {
|
|
|
this.$set(this.currentData.rooms[roomIndex].tableData[rowIndex],
|
|
|
- 'alarmStatus',
|
|
|
- '正常')
|
|
|
+ 'alarmStatus', '正常')
|
|
|
} else {
|
|
|
this.$set(this.currentData.rooms[roomIndex].tableData[rowIndex],
|
|
|
- 'alarmStatus',
|
|
|
- '离线')
|
|
|
+ 'alarmStatus', '离线')
|
|
|
}
|
|
|
// let _this = this;
|
|
|
// setTimeout(() => {
|
|
|
@@ -986,10 +992,14 @@
|
|
|
this.$message.error(res.message)
|
|
|
}
|
|
|
this.$set(this.airsLoading[roomIndex], 'loading', false);
|
|
|
+ // 刷新顶部数据
|
|
|
+ this.flush_top_data();
|
|
|
}).catch((err) => {
|
|
|
// console.log(err);
|
|
|
// this.$message.error(err.message)
|
|
|
this.$set(this.airsLoading[roomIndex], 'loading', false);
|
|
|
+ // 刷新顶部数据
|
|
|
+ this.flush_top_data();
|
|
|
})
|
|
|
}
|
|
|
},
|
|
|
@@ -1260,7 +1270,7 @@
|
|
|
for (var i = 0; i < data.length; i++) {
|
|
|
let room = {}
|
|
|
let param = this.btnActive
|
|
|
- if (param == 'all') {
|
|
|
+ if (param == 'all') { // 全部
|
|
|
room = {
|
|
|
name: data[i].air_name, // 名称
|
|
|
ip: data[i].air_ip, // 空调ip或id
|
|
|
@@ -1271,8 +1281,8 @@
|
|
|
onOffStatus: data[i].is_on, // 是否开启
|
|
|
userName: data[i].cao, // 操作员
|
|
|
contact: '待接口返回,待优化' // 联系方式
|
|
|
- }
|
|
|
- } else if (param == 'powerOn' && data[i].is_on == '1') {
|
|
|
+ };
|
|
|
+ } else if (param == 'powerOn' && data[i].is_on == '1') { // 开机
|
|
|
room = {
|
|
|
name: data[i].air_name, // 名称
|
|
|
ip: data[i].air_ip, // 空调ip或id
|
|
|
@@ -1283,8 +1293,8 @@
|
|
|
onOffStatus: data[i].is_on, // 是否开启
|
|
|
userName: data[i].cao, // 操作员
|
|
|
contact: '待接口返回,待优化' // 联系方式
|
|
|
- }
|
|
|
- } else if (param == 'powerOff' && data[i].is_on == '0') {
|
|
|
+ };
|
|
|
+ } else if (param == 'powerOff' && data[i].is_on == '0') { // 关机
|
|
|
room = {
|
|
|
name: data[i].air_name, // 名称
|
|
|
ip: data[i].air_ip, // 空调ip或id
|
|
|
@@ -1295,8 +1305,8 @@
|
|
|
onOffStatus: data[i].is_on, // 是否开启
|
|
|
userName: data[i].cao, // 操作员
|
|
|
contact: '待接口返回,待优化' // 联系方式
|
|
|
- }
|
|
|
- } else if (param == 'abnormal' && data[i].is_normal == '0') {
|
|
|
+ };
|
|
|
+ } else if (param == 'abnormal' && data[i].is_normal == '0') { // 离线
|
|
|
room = {
|
|
|
name: data[i].air_name, // 名称
|
|
|
ip: data[i].air_ip, // 空调ip或id
|
|
|
@@ -1307,7 +1317,7 @@
|
|
|
onOffStatus: data[i].is_on, // 是否开启
|
|
|
userName: data[i].cao, // 操作员
|
|
|
contact: '待接口返回,待优化' // 联系方式
|
|
|
- }
|
|
|
+ };
|
|
|
}
|
|
|
if (JSON.stringify(room) !== '{}') {
|
|
|
// 每个房间的设备循环添加
|
|
|
@@ -1366,6 +1376,9 @@
|
|
|
* @param {Object} e
|
|
|
*/
|
|
|
loudong_toggle(id, label) {
|
|
|
+ this.pagination.pageSize = 4;
|
|
|
+ this.pagination.currentPage = 1;
|
|
|
+ this.pagination.total = 0;
|
|
|
let ids = id.split('|')
|
|
|
let labels = label.split('|')
|
|
|
// console.log(ids);
|
|
|
@@ -1381,13 +1394,14 @@
|
|
|
* @param {Object} rooms
|
|
|
*/
|
|
|
louceng_click(e, id, label, rooms) {
|
|
|
+ // console.log(e, id, label, rooms);
|
|
|
this.listLoading = true;
|
|
|
let ids = id.split('|');
|
|
|
let labels = label.split('|');
|
|
|
// console.log(ids);
|
|
|
// console.log(labels);
|
|
|
// console.log(rooms);
|
|
|
- // 清空数据
|
|
|
+ // 清空当前页面活动数据
|
|
|
this.currentData = {
|
|
|
school: '',
|
|
|
building: '',
|
|
|
@@ -1410,6 +1424,14 @@
|
|
|
title_any_where: '',
|
|
|
clickElement: e.target
|
|
|
};
|
|
|
+ // 分页每次单价楼层时,都要初始化
|
|
|
+ this.pagination = {
|
|
|
+ pageSize: 4,
|
|
|
+ currentPage: 1,
|
|
|
+ total: 0
|
|
|
+ };
|
|
|
+ this.offline_device_number = 0; // 离线数量初始化
|
|
|
+ this.shutdown_device_number = 0; // 关机数量初始化
|
|
|
// 点击的楼层id
|
|
|
this.louceng_click_id = ids[0];
|
|
|
// 填充数据
|
|
|
@@ -1422,16 +1444,23 @@
|
|
|
// 获取开机、关机、异常的房间,空的不显示
|
|
|
this.open_close_abnormal(this.currentData.school, this.currentData.building, this.currentData.floor,
|
|
|
rooms);
|
|
|
- // 某层房间空调数
|
|
|
- this.getRoomsAndAirs(this.currentData.school, this.currentData.building, this.currentData.floor);
|
|
|
- // 某层空调开启和异常统计
|
|
|
- this.getOpeningAndAbnomal(this.currentData.school, this.currentData.building, this.currentData
|
|
|
- .floor);
|
|
|
+ // 刷新顶部数据
|
|
|
+ this.flush_top_data();
|
|
|
+ // 延迟取消加载loading
|
|
|
setTimeout(() => {
|
|
|
this.listLoading = false;
|
|
|
}, 500);
|
|
|
},
|
|
|
/**
|
|
|
+ * 刷新顶部数据
|
|
|
+ */
|
|
|
+ flush_top_data() {
|
|
|
+ // 某层房间、空调数
|
|
|
+ this.getRoomsAndAirs(this.currentData.school, this.currentData.building, this.currentData.floor);
|
|
|
+ // 某层空调开启和异常统计
|
|
|
+ this.getOpeningAndAbnomal(this.currentData.school, this.currentData.building, this.currentData.floor);
|
|
|
+ },
|
|
|
+ /**
|
|
|
* 获取开机、关机、异常房间数
|
|
|
* @param {Object} school
|
|
|
* @param {Object} build
|
|
|
@@ -1439,6 +1468,7 @@
|
|
|
* @param {Object} rooms
|
|
|
*/
|
|
|
open_close_abnormal(school, build, floors, rooms) {
|
|
|
+ // console.log(school, build, floors, rooms);
|
|
|
let _this = this,
|
|
|
len = rooms.length;
|
|
|
for (var i = 0; i < len; i++) {
|
|
|
@@ -1590,24 +1620,26 @@
|
|
|
}).then((res) => {
|
|
|
// console.log(res);
|
|
|
if (typeof res.code == 'undefined' || res.code == '') {
|
|
|
- this.$message.error('返回数据格式问题,code未获取到!')
|
|
|
- return
|
|
|
+ this.$message.error('返回数据格式问题,code未获取到!');
|
|
|
+ return;
|
|
|
}
|
|
|
|
|
|
if (res.code == 200) {
|
|
|
// 填充数据
|
|
|
- this.open_number = res.onNum
|
|
|
- this.warning_number = res.stateNum
|
|
|
+ this.open_number = res.onNum;
|
|
|
+ this.warning_number = res.stateNum;
|
|
|
} else {
|
|
|
- // this.$message.error(res.message)
|
|
|
+ this.open_number = 0;
|
|
|
+ this.warning_number = 0;
|
|
|
+ // this.$message.error(res.message);
|
|
|
}
|
|
|
}).catch((err) => {
|
|
|
// console.log(err);
|
|
|
- this.$message.error(err.message)
|
|
|
+ this.$message.error(err.message);
|
|
|
})
|
|
|
},
|
|
|
/**
|
|
|
- * 某层房间空调数
|
|
|
+ * 某层房间、空调数
|
|
|
* @param {Object} school
|
|
|
* @param {Object} build
|
|
|
* @param {Object} floors
|
|
|
@@ -1620,20 +1652,22 @@
|
|
|
}).then((res) => {
|
|
|
// console.log(res);
|
|
|
if (typeof res.code == 'undefined' || res.code == '') {
|
|
|
- this.$message.error('返回数据格式问题,code未获取到!')
|
|
|
- return
|
|
|
+ this.$message.error('返回数据格式问题,code未获取到!');
|
|
|
+ return;
|
|
|
}
|
|
|
|
|
|
if (res.code == 200) {
|
|
|
// 填充数据
|
|
|
- this.room_number = res.domNum
|
|
|
- this.device_number = res.airNum
|
|
|
+ this.room_number = res.domNum;
|
|
|
+ this.device_number = res.airNum;
|
|
|
} else {
|
|
|
- this.$message.error(res.message)
|
|
|
+ this.room_number = 0;
|
|
|
+ this.device_number = 0;
|
|
|
+ // this.$message.error(res.message);
|
|
|
}
|
|
|
}).catch((err) => {
|
|
|
// console.log(err);
|
|
|
- this.$message.error(err.message)
|
|
|
+ this.$message.error(err.message);
|
|
|
})
|
|
|
},
|
|
|
/**
|
|
|
@@ -1902,8 +1936,12 @@
|
|
|
this.$message.error(err.message)
|
|
|
})
|
|
|
},
|
|
|
- // 主题部分按钮的单击事件
|
|
|
+ /**
|
|
|
+ * 主题部分按钮的单击事件
|
|
|
+ * @param {Object} param
|
|
|
+ */
|
|
|
top_btn_click(param) {
|
|
|
+ // console.log(param);
|
|
|
this.btnActive = param;
|
|
|
if (param == 'all') {
|
|
|
this.currentData.clickElement.click();
|
|
|
@@ -2021,7 +2059,7 @@
|
|
|
deviceName: '',
|
|
|
deviceIp: '',
|
|
|
checkedDevice: [],
|
|
|
- devices: deviceOptions,
|
|
|
+ devices: [],
|
|
|
duration_use: 0.00, // 使用时长
|
|
|
is_normal: '0', // 是否正常
|
|
|
is_on: '0', // 是否开启
|