空调轮询机制改为5分钟,空调控制增加轮询机制5分钟,修正楼控空调funcCat参数缺失bug

main
zhangqun 3 years ago
parent 79ee4f9eb4
commit 6118144cd3
  1. 163
      src/components/monitoring/conditioner.vue

@ -69,12 +69,12 @@
<img class="icon" src="../../../public/img/monitoring/electricity/lx.png" v-if="item.warnStatus == '2'" /> <img class="icon" src="../../../public/img/monitoring/electricity/lx.png" v-if="item.warnStatus == '2'" />
<img class="icon" src="../../../public/img/monitoring/electricity/bj.png" v-else /> <img class="icon" src="../../../public/img/monitoring/electricity/bj.png" v-else />
<span class="message" v-text="item.name" :style="{ <span class="message" v-text="item.name" :style="{
color:item.warnStatus == 2 ? 'white' : item.warnStatus == 1 ? '#ff0000' : 'white', color: item.warnStatus == 2 ? 'white' : item.warnStatus == 1 ? '#ff0000' : 'white',
}" :title="item.name"></span> }" :title="item.name"></span>
</div> </div>
<span></span> <span></span>
<span class="data" :style="{ <span class="data" :style="{
color:item.warnStatus == 2 ? 'white' : item.warnStatus == 1 ? '#ff0000' : 'white', color: item.warnStatus == 2 ? 'white' : item.warnStatus == 1 ? '#ff0000' : 'white',
}" :title="item.warnContent">{{ item.warnContent }}</span> }" :title="item.warnContent">{{ item.warnContent }}</span>
<span class=""></span> <span class=""></span>
<span class="time" <span class="time"
@ -105,7 +105,7 @@
<span class="btn" @click="searchDevice" style="cursor: pointer;">查询</span> <span class="btn" @click="searchDevice" style="cursor: pointer;">查询</span>
</div> --> </div> -->
<div class="tabBox"> <div class="tabBox">
<el-table :data="tableData" style="width: 100%; max-height: 220px" @row-contextmenu="tableContext"> <el-table :data="tableData" style="width: 100%; max-height: 220px" @row-contextmenu="tableContext">
<el-table-column label="设备名称" min-width="100px" style="cursor: pointer"> <el-table-column label="设备名称" min-width="100px" style="cursor: pointer">
<template slot-scope="scope"> <template slot-scope="scope">
<div class="flex-center-center" @click="clickConditions(scope.row)" style="cursor: pointer"> <div class="flex-center-center" @click="clickConditions(scope.row)" style="cursor: pointer">
@ -123,9 +123,9 @@
<template slot-scope="scope"> <template slot-scope="scope">
<span @click="clickConditions(scope.row)" style="cursor: pointer" <span @click="clickConditions(scope.row)" style="cursor: pointer"
:style="{ color: scope.row.open == 1 ? 'white' : '#9d9d9d' }">{{ scope.row.temCur ? scope.row.temCur : :style="{ color: scope.row.open == 1 ? 'white' : '#9d9d9d' }">{{ scope.row.temCur ? scope.row.temCur :
"--" "--"
}}/{{ }}/{{
scope.row.temSetting ? scope.row.temSetting : "--" scope.row.temSetting ? scope.row.temSetting : "--"
}}</span> }}</span>
</template> </template>
</el-table-column> </el-table-column>
@ -134,10 +134,10 @@
<template slot-scope="scope"> <template slot-scope="scope">
<span @click="clickConditions(scope.row)" style="cursor: pointer" <span @click="clickConditions(scope.row)" style="cursor: pointer"
:style="{ color: scope.row.open == 1 ? 'white' : '#9d9d9d' }">{{ :style="{ color: scope.row.open == 1 ? 'white' : '#9d9d9d' }">{{
Number(scope.row.build) + Number(scope.row.build) +
"号楼" + "号楼" +
Number(scope.row.floored) + Number(scope.row.floored) +
"层" "层"
}}</span> }}</span>
</template> </template>
</el-table-column> </el-table-column>
@ -174,25 +174,25 @@
<div class="flex-center-between" style="padding: 0 1rem"> <div class="flex-center-between" style="padding: 0 1rem">
<div class="open-txt"> <div class="open-txt">
{{ testObject1.name }} {{ testObject1.name }}
<span v-if="testObject1.funcCat == 1">{{ <!-- <span v-if="testObject1.funcCat == 1">{{
testObject1.mode == 0 testObject1.mode == 0
? "通风" ? "通风"
: testObject1.mode == 1 : testObject1.mode == 1
? "制热" ? "制热"
: "制冷" : "制冷"
}}</span> }}</span> -->
<span v-if="testObject1.funcCat == 3">{{ <span v-if="testObject1.funcCat == 3">{{
testObject1.mode == 0 testObject1.mode == 0
? "内机制热" ? "内机制热"
: testObject1.mode == 1 : testObject1.mode == 1
? "内机地暖同时制热" ? "内机地暖同时制热"
: testObject1.mode == 2 : testObject1.mode == 2
? "地暖制热" ? "地暖制热"
: testObject1.mode == 3 : testObject1.mode == 3
? "制冷" ? "制冷"
: testObject1.mode == 9 : testObject1.mode == 9
? "通风" ? "通风"
: "" : ""
}}</span> }}</span>
</div> </div>
<div> <div>
@ -225,21 +225,21 @@
当前风速 当前风速
<span v-if="testObject1.funcCat == 1">{{ <span v-if="testObject1.funcCat == 1">{{
testObject1.speed == 0 testObject1.speed == 0
? "低速" ? "低速"
: testObject1.speed == 1 : testObject1.speed == 1
? "中速" ? "中速"
: testObject1.speed == 2 : testObject1.speed == 2
? "高速" ? "高速"
: "自动" : "自动"
}}</span> }}</span>
<span v-if="testObject1.funcCat == 3">{{ <span v-if="testObject1.funcCat == 3">{{
testObject1.speed == 1 testObject1.speed == 1
? "低速" ? "低速"
: testObject1.speed == 2 : testObject1.speed == 2
? "中速" ? "中速"
: testObject1.speed == 3 : testObject1.speed == 3
? "高速" ? "高速"
: "自动" : "自动"
}}</span> }}</span>
</div> </div>
</div> </div>
@ -267,21 +267,21 @@
当前风速 当前风速
<span v-if="testObject1.funcCat == 1">{{ <span v-if="testObject1.funcCat == 1">{{
testObject1.speed == 0 testObject1.speed == 0
? "低速" ? "低速"
: testObject1.speed == 1 : testObject1.speed == 1
? "中速" ? "中速"
: testObject1.speed == 2 : testObject1.speed == 2
? "高速" ? "高速"
: "自动" : "自动"
}}</span> }}</span>
<span v-if="testObject1.funcCat == 3">{{ <span v-if="testObject1.funcCat == 3">{{
testObject1.speed == 1 testObject1.speed == 1
? "低速" ? "低速"
: testObject1.speed == 2 : testObject1.speed == 2
? "中速" ? "中速"
: testObject1.speed == 3 : testObject1.speed == 3
? "高速" ? "高速"
: "自动" : "自动"
}}</span> }}</span>
</div> </div>
</div> </div>
@ -400,6 +400,7 @@ export default {
noramlTotal: 0,// noramlTotal: 0,//
warnEquip: 0,// warnEquip: 0,//
equipWarn: 0,// equipWarn: 0,//
intervalStatus: null,//1
}; };
}, },
watch: { watch: {
@ -410,11 +411,14 @@ export default {
if (this.setInterval) { if (this.setInterval) {
clearInterval(this.setInterval); clearInterval(this.setInterval);
} }
if (this.intervalStatus) {
clearInterval(this.intervalStatus);
}
this.setInterval = setInterval(() => { this.setInterval = setInterval(() => {
this.getConditions(); // this.getConditions(); //
this.getAirWarnList();// this.getAirWarnList();//
}, 3600000); }, 5 * 60 * 1000);
this.getConditions(); // this.getConditions(); //
}, },
@ -485,7 +489,7 @@ export default {
}, 300); }, 300);
bfHelper.setOpacityFun(); bfHelper.setOpacityFun();
} else { } else {
console.log(build,floor,"=======================") console.log(build, floor, "=======================")
if (floor.indexOf("undefined") == -1) { if (floor.indexOf("undefined") == -1) {
setTimeout(() => { setTimeout(() => {
this.setTowerKT("0" + build, "0" + floor); this.setTowerKT("0" + build, "0" + floor);
@ -537,6 +541,9 @@ export default {
if (this.setInterval) { if (this.setInterval) {
clearInterval(this.setInterval); clearInterval(this.setInterval);
} }
if (this.intervalStatus) {
clearInterval(this.intervalStatus);
}
}, },
created() { created() {
this.getConditions(); // this.getConditions(); //
@ -544,11 +551,11 @@ export default {
this.setInterval = setInterval(() => { this.setInterval = setInterval(() => {
this.getConditions(); // this.getConditions(); //
this.getAirWarnList();// this.getAirWarnList();//
}, 3600000); }, 5 * 60 * 1000);//5
}, },
mounted() { mounted() {
let dom = document.getElementById('condi_box'); let dom = document.getElementById('condi_box');
dom.addEventListener('contextmenu', (event)=> { dom.addEventListener('contextmenu', (event) => {
event.preventDefault(); // event.preventDefault(); //
const routerUrl = this.$router.resolve({ path: '/equipment/index', query: { classCode: '0900' } }); const routerUrl = this.$router.resolve({ path: '/equipment/index', query: { classCode: '0900' } });
window.open(routerUrl.href, "_blank"); window.open(routerUrl.href, "_blank");
@ -557,13 +564,13 @@ export default {
}, },
methods: { methods: {
tableContext(row,column, event){ tableContext(row, column, event) {
event.preventDefault(); // event.preventDefault(); //
const routerUrl = this.$router.resolve({ path: '/equipment/index', query: {code: row.code } }); const routerUrl = this.$router.resolve({ path: '/equipment/index', query: { code: row.code } });
window.open(routerUrl.href, "_blank"); window.open(routerUrl.href, "_blank");
// this.dialogVisible = true // this.dialogVisible = true
// console.log(row) // console.log(row)
}, },
// - // -
doCancelWarn(item) { doCancelWarn(item) {
getCancelWarn(item.id).then((res) => { getCancelWarn(item.id).then((res) => {
@ -646,6 +653,9 @@ export default {
this.total = 0; // this.total = 0; //
this.build = i; this.build = i;
this.floor = j; this.floor = j;
if (this.intervalStatus) {
clearInterval(this.intervalStatus);
}
if (this.bimModel == 1) { if (this.bimModel == 1) {
commonValue.getUpdateMap("water", i, j); commonValue.getUpdateMap("water", i, j);
this.removeEvent(); this.removeEvent();
@ -919,7 +929,8 @@ export default {
this.testObject1.open = 1; this.testObject1.open = 1;
var arr = bfHelper.getAll(); var arr = bfHelper.getAll();
bfHelper.clearTags(); bfHelper.clearTags();
if (arr.length < 2) {getOAContent if (arr.length < 2) {
getOAContent
bfHelper.customTag( bfHelper.customTag(
{ {
x: this.testObject1.xmove, x: this.testObject1.xmove,
@ -1053,6 +1064,9 @@ export default {
code = e.target.id.substring(7); code = e.target.id.substring(7);
} }
if (code) { if (code) {
if (this.intervalStatus) {
clearInterval(this.intervalStatus);
}
let funcCatObj = this.allDatas.find(item => { return item.code == code }); let funcCatObj = this.allDatas.find(item => { return item.code == code });
if (funcCatObj && funcCatObj.funcCat == 3) { if (funcCatObj && funcCatObj.funcCat == 3) {
//lora //lora
@ -1070,16 +1084,18 @@ export default {
this.isControl = true; this.isControl = true;
this.clickCode = code; this.clickCode = code;
} }
this.doIntervalStatus(code, 3);
}) })
return; return;
} }
getConditionData(code).then((res) => { getConditionData(code).then((res) => {
if (res.data.code == 200) { if (res.data.code == 200) {
this.testObject1 = res.data.data; this.testObject1 = res.data.data;
if(this.testObject1.getConditionData == 2){ if (this.testObject1.getConditionData == 2) {
// //
return; return;
} }
this.testObject1.funcCat = 1;
if ( if (
e.target.id == "condition-" + code || e.target.id == "condition-" + code ||
e.target.id == "temper-" + code || e.target.id == "temper-" + code ||
@ -1091,15 +1107,34 @@ export default {
this.isControl = true; this.isControl = true;
this.clickCode = code; this.clickCode = code;
} }
this.doIntervalStatus(code, 1);
} }
}); });
} }
}, },
//1
doIntervalStatus(code, type) {
this.intervalStatus = setInterval(() => {
if (type == 3) {
queryLoraAll(code).then(res => {
this.testObject1 = res.data.data;
this.testObject1.funcCat = 3;
})
} else if (type == 1) {
getConditionData(code).then((res) => {
if (res.data.code == 200) {
this.testObject1 = res.data.data;
this.testObject1.funcCat = 1;
}
});
}
}, 5 * 60 * 1000);
},
removeEvent() { removeEvent() {
window.removeEventListener("click", this.addEvent); window.removeEventListener("click", this.addEvent);
}, },
getContent(testObject) { getContent(testObject) {
// console.log(this.clickCode,testObject.code) // console.log(this.clickCode,testObject)
let button = require("../../../public/img/monitoring/electricity/off-button.png"); let button = require("../../../public/img/monitoring/electricity/off-button.png");
let greenWind = require("../../../public/img/monitoring/electricity/green-wind.png"); let greenWind = require("../../../public/img/monitoring/electricity/green-wind.png");
let decrease = require("../../../public/img/monitoring/electricity/jian.png"); let decrease = require("../../../public/img/monitoring/electricity/jian.png");
@ -1124,7 +1159,7 @@ export default {
}">${testObject.temCur}</span><span id="tempac-${testObject.code }">${testObject.temCur}</span><span id="tempac-${testObject.code
}"> </span> }"> </span>
</span> </span>
<span style="font-size:14px;display:${testObject.code == this.clickCode ? "inline-block" : "none" <span style="font-size:16px;display:${testObject.code == this.clickCode ? "inline-block" : "none"
}" id="temper-${testObject.code}">${testObject.name}</span> }" id="temper-${testObject.code}">${testObject.name}</span>
</div> </div>
</div> </div>

Loading…
Cancel
Save