|
|
@@ -893,86 +893,110 @@
|
|
|
// console.log(row);
|
|
|
let air_ip = this.currentData.rooms[roomIndex].tableData[rowIndex].ip;
|
|
|
if (open_close == 'open') {
|
|
|
- this.$set(this.airsLoading[roomIndex], 'loading', true);
|
|
|
- this.$set(this.airsLoading[roomIndex], 'text', row.name + ' ' + row.device + ' 正在【开机】中...');
|
|
|
- let user = this.$store.state.user;
|
|
|
- startAirs({
|
|
|
- admin_name: user.name,
|
|
|
- password: user.pwd,
|
|
|
- air_ip: air_ip
|
|
|
- }).then((res) => {
|
|
|
- // console.log(res);
|
|
|
- if (typeof res.code == 'undefined' || res.code == '') {
|
|
|
- this.$message.error('返回数据格式问题,code未获取到!')
|
|
|
- return
|
|
|
- }
|
|
|
-
|
|
|
- if (res.code == 200) {
|
|
|
- this.$set(this.currentData.rooms[roomIndex].tableData[rowIndex], 'onOffStatus',
|
|
|
- res.is_on)
|
|
|
- if (res.is_normal == 1) {
|
|
|
- this.$set(this.currentData.rooms[roomIndex].tableData[rowIndex],
|
|
|
- 'alarmStatus', '正常')
|
|
|
+ this.$confirm('是否开启设备:' + row.name + ' ' + row.device, '提示', {
|
|
|
+ confirmButtonText: '是的',
|
|
|
+ cancelButtonText: '不用了',
|
|
|
+ type: 'warning'
|
|
|
+ }).then(() => {
|
|
|
+ this.$set(this.airsLoading[roomIndex], 'loading', true);
|
|
|
+ this.$set(this.airsLoading[roomIndex], 'text', row.name + ' ' + row.device + ' 正在【开机】中...');
|
|
|
+ let user = this.$store.state.user;
|
|
|
+ startAirs({
|
|
|
+ admin_name: user.name,
|
|
|
+ password: user.pwd,
|
|
|
+ air_ip: air_ip
|
|
|
+ }).then((res) => {
|
|
|
+ // console.log(res);
|
|
|
+ if (typeof res.code == 'undefined' || res.code == '') {
|
|
|
+ this.$message.error('返回数据格式问题,code未获取到!')
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ if (res.code == 200) {
|
|
|
+ this.$set(this.currentData.rooms[roomIndex].tableData[rowIndex], 'onOffStatus',
|
|
|
+ res.is_on)
|
|
|
+ if (res.is_normal == 1) {
|
|
|
+ this.$set(this.currentData.rooms[roomIndex].tableData[rowIndex],
|
|
|
+ 'alarmStatus', '正常')
|
|
|
+ } else {
|
|
|
+ this.$set(this.currentData.rooms[roomIndex].tableData[rowIndex],
|
|
|
+ 'alarmStatus', '离线')
|
|
|
+ }
|
|
|
+ // let _this = this;
|
|
|
+ // setTimeout(() => {
|
|
|
+ // _this.getAirsStatus(roomIndex, rowIndex, air_ip)
|
|
|
+ // }, 4000)
|
|
|
} else {
|
|
|
- this.$set(this.currentData.rooms[roomIndex].tableData[rowIndex],
|
|
|
- 'alarmStatus', '离线')
|
|
|
+ this.$message.error(res.message)
|
|
|
}
|
|
|
- // let _this = this;
|
|
|
- // setTimeout(() => {
|
|
|
- // _this.getAirsStatus(roomIndex, rowIndex, air_ip)
|
|
|
- // }, 4000)
|
|
|
- } else {
|
|
|
- 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();
|
|
|
- })
|
|
|
+ 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();
|
|
|
+ });
|
|
|
+ }).catch(() => {
|
|
|
+ this.$message({
|
|
|
+ type: 'warning',
|
|
|
+ message: '已取消'
|
|
|
+ });
|
|
|
+ });
|
|
|
} else if (open_close == 'close') {
|
|
|
- this.$set(this.airsLoading[roomIndex], 'loading', true);
|
|
|
- this.$set(this.airsLoading[roomIndex], 'text', row.name + ' ' + row.device + ' 正在【关机】中...');
|
|
|
- stopAirs({
|
|
|
- air_ip: air_ip
|
|
|
- }).then((res) => {
|
|
|
- // console.log(res);
|
|
|
- if (typeof res.code == 'undefined' || res.code == '') {
|
|
|
- this.$message.error('返回数据格式问题,code未获取到!')
|
|
|
- return
|
|
|
- }
|
|
|
-
|
|
|
- if (res.code == 200) {
|
|
|
- this.$set(this.currentData.rooms[roomIndex].tableData[rowIndex], 'onOffStatus',
|
|
|
- res.is_on)
|
|
|
- if (res.is_normal == 1) {
|
|
|
- this.$set(this.currentData.rooms[roomIndex].tableData[rowIndex],
|
|
|
- 'alarmStatus', '正常')
|
|
|
+ this.$confirm('是否关闭设备:' + row.name + ' ' + row.device, '提示', {
|
|
|
+ confirmButtonText: '是的',
|
|
|
+ cancelButtonText: '不用了',
|
|
|
+ type: 'warning'
|
|
|
+ }).then(() => {
|
|
|
+ this.$set(this.airsLoading[roomIndex], 'loading', true);
|
|
|
+ this.$set(this.airsLoading[roomIndex], 'text', row.name + ' ' + row.device + ' 正在【关机】中...');
|
|
|
+ stopAirs({
|
|
|
+ air_ip: air_ip
|
|
|
+ }).then((res) => {
|
|
|
+ // console.log(res);
|
|
|
+ if (typeof res.code == 'undefined' || res.code == '') {
|
|
|
+ this.$message.error('返回数据格式问题,code未获取到!')
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ if (res.code == 200) {
|
|
|
+ this.$set(this.currentData.rooms[roomIndex].tableData[rowIndex], 'onOffStatus',
|
|
|
+ res.is_on)
|
|
|
+ if (res.is_normal == 1) {
|
|
|
+ this.$set(this.currentData.rooms[roomIndex].tableData[rowIndex],
|
|
|
+ 'alarmStatus', '正常')
|
|
|
+ } else {
|
|
|
+ this.$set(this.currentData.rooms[roomIndex].tableData[rowIndex],
|
|
|
+ 'alarmStatus', '离线')
|
|
|
+ }
|
|
|
+ // let _this = this;
|
|
|
+ // setTimeout(() => {
|
|
|
+ // _this.getAirsStatus(roomIndex, rowIndex, air_ip)
|
|
|
+ // }, 4000)
|
|
|
} else {
|
|
|
- this.$set(this.currentData.rooms[roomIndex].tableData[rowIndex],
|
|
|
- 'alarmStatus', '离线')
|
|
|
+ this.$message.error(res.message)
|
|
|
}
|
|
|
- // let _this = this;
|
|
|
- // setTimeout(() => {
|
|
|
- // _this.getAirsStatus(roomIndex, rowIndex, air_ip)
|
|
|
- // }, 4000)
|
|
|
- } else {
|
|
|
- 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();
|
|
|
- })
|
|
|
+ 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();
|
|
|
+ });
|
|
|
+ }).catch(() => {
|
|
|
+ this.$message({
|
|
|
+ type: 'warning',
|
|
|
+ message: '已取消'
|
|
|
+ });
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ this.$message('未知开关');
|
|
|
}
|
|
|
},
|
|
|
/**
|