lora面板控制逻辑开发

dev
xuechunyuan 3 years ago
parent eb7cccfa8f
commit 3571cd93a8
  1. BIN
      public/img/monitoring/electricity/condition_mb.png
  2. 55
      src/api/garden/monitoring.js
  3. 213
      src/components/monitoring/conditioner.vue
  4. 1
      vue.config.js

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

@ -446,6 +446,61 @@ export const setConditionSpeedDown = (code, value) => {
}, },
}); });
}; };
//lora面板
//设置温度
export const setLoraTemp = (equipCode, tempVal) => {
return request({
url: "/api/blade-desk/lora/air-conditioner/change-temp",
method: "get",
params: {
equipCode,
tempVal,
},
});
};
//设置开关状态
export const setLoraStatus = (equipCode, statusVal) => {
return request({
url: "/api/blade-desk/lora/air-conditioner/change-status",
method: "get",
params: {
equipCode,
statusVal,
},
});
};
//设置模式
export const setLoraModel = (equipCode, value) => {
return request({
url: "/api/blade-desk/lora/air-conditioner/change-model",
method: "get",
params: {
equipCode,
modeVal,
},
});
};
//设置风速
export const setLoraSpeed = (equipCode, speedVal) => {
return request({
url: "/api/blade-desk/lora/air-conditioner/change-speed",
method: "get",
params: {
equipCode,
speedVal,
},
});
};
//设置风速
export const queryLoraAll = (equipCode) => {
return request({
url: "/api/blade-desk/lora/air-conditioner/read-all",
method: "get",
params: {
equipCode,
},
});
};
// 获取楼平均温度 // 获取楼平均温度
export const getFloorTemp = (area) => { export const getFloorTemp = (area) => {

@ -22,7 +22,7 @@
<div class="state flex-center-center"> <div class="state flex-center-center">
<div class="zc flex-center" style="font-family: fantasy"> <div class="zc flex-center" style="font-family: fantasy">
<span style="margin-left: 72px">{{ <span style="margin-left: 72px">{{
normalTotal normalTotal
}}</span> }}</span>
</div> </div>
<div class="lx flex-center" style="font-family: fantasy"> <div class="lx flex-center" style="font-family: fantasy">
@ -84,7 +84,7 @@
<span class=""></span> <span class=""></span>
<span class="time" <span class="time"
:style="{ color: item.status == 90000 ? '' : item.status == 90001 ? '#a5bbe5' : '#ff0000' }">{{ :style="{ color: item.status == 90000 ? '' : item.status == 90001 ? '#a5bbe5' : '#ff0000' }">{{
item.warnDate.substring(5, 16) item.warnDate.substring(5, 16)
}}</span> }}</span>
</div> </div>
</div> </div>
@ -127,10 +127,11 @@
<el-table-column label="温度(实际/设定)" style="cursor: pointer"> <el-table-column label="温度(实际/设定)" style="cursor: pointer">
<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>
@ -139,10 +140,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>
@ -179,12 +180,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>{{ <span v-if="testObject1.funcCat == 1">{{
testObject1.mode == 0 testObject1.mode == 0
? "通风" ? "通风"
: testObject1.mode == 1 : testObject1.mode == 1
? "制热" ? "制热"
: "制冷" : "制冷"
}}</span>
<span v-if="testObject1.funcCat == 3">{{
testObject1.mode == 0
? "内机制热"
: testObject1.mode == 1
? "内机地暖同时制热"
: testObject1.mode == 2
? "地暖制热"
: testObject1.mode == 3
? "制冷"
: testObject1.mode == 9
? "通风"
: "内机地暖同时制热"
}}</span> }}</span>
</div> </div>
<div> <div>
@ -195,13 +209,13 @@
</div> </div>
</div> </div>
<div class="conditios-block" v-if="testObject1.open == 1"> <div class="conditios-block" v-if="testObject1.open == 1">
<div class="conditios-block-temper" v-if="testObject1.mode == 0" style="justify-content: center"> <div class="conditios-block-temper" v-if="testObject1.mode == 0 || testObject1.mode == 9" style="justify-content: center">
<img src="../../../public/img/monitoring/electricity/green-wind.png" alt="" /> <img src="../../../public/img/monitoring/electricity/green-wind.png" alt="" />
</div> </div>
<div class="conditios-block-temper" v-else> <div class="conditios-block-temper" v-else>
<img src="../../../public/img/monitoring/electricity/jian.png" alt="" @click="descreaseTemper" /> <img src="../../../public/img/monitoring/electricity/jian.png" alt="" @click="descreaseTemper" />
<span><span style="font-size: 40px; font-family: fantasy">{{ <span><span style="font-size: 40px; font-family: fantasy">{{
testObject1.temSetting testObject1.temSetting
}}</span></span> }}</span></span>
<img src="../../../public/img/monitoring/electricity/jia.png" alt="" @click="plusTemper" /> <img src="../../../public/img/monitoring/electricity/jia.png" alt="" @click="plusTemper" />
</div> </div>
@ -214,26 +228,36 @@
<div class="conditios-block-temper1-right"> <div class="conditios-block-temper1-right">
<img src="../../../public/img/monitoring/electricity/wind-line.png" alt="" /> <img src="../../../public/img/monitoring/electricity/wind-line.png" alt="" />
当前风速 当前风速
<span>{{ <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 v-if="testObject1.funcCat == 3">{{
testObject1.speed == 1
? "低速"
: testObject1.speed == 2
? "中速"
: testObject1.speed == 3
? "高速"
: "自动"
}}</span> }}</span>
</div> </div>
</div> </div>
</div> </div>
<div class="conditios-block" v-if="testObject1.open == 2"> <div class="conditios-block" v-if="testObject1.open == 2">
<div class="conditios-block-temper" v-if="testObject1.mode == 0" style="justify-content: center"> <div class="conditios-block-temper" v-if="testObject1.mode == 0 || testObject1.mode == 9"
style="justify-content: center">
<img src="../../../public/img/monitoring/electricity/gray-wind.png" alt="" /> <img src="../../../public/img/monitoring/electricity/gray-wind.png" alt="" />
</div> </div>
<div class="conditios-block-temper" v-else> <div class="conditios-block-temper" v-else>
<img src="../../../public/img/monitoring/electricity/gray-jian.png" alt="" @click="descreaseTemper" /> <img src="../../../public/img/monitoring/electricity/gray-jian.png" alt="" @click="descreaseTemper" />
<span style="color: #7da0d1"><span style="font-size: 40px; font-family: fantasy">{{ <span style="color: #7da0d1"><span style="font-size: 40px; font-family: fantasy">{{
testObject1.temSetting testObject1.temSetting
}}</span></span> }}</span></span>
<img src="../../../public/img/monitoring/electricity/gray-jia.png" alt="" @click="plusTemper" /> <img src="../../../public/img/monitoring/electricity/gray-jia.png" alt="" @click="plusTemper" />
</div> </div>
@ -246,14 +270,23 @@
<div class="conditios-block-temper1-right"> <div class="conditios-block-temper1-right">
<img src="../../../public/img/monitoring/electricity/wind-line.png" alt="" /> <img src="../../../public/img/monitoring/electricity/wind-line.png" alt="" />
当前风速 当前风速
<span>{{ <span v-if="testObject1.funcCat == 1">{{
testObject1.speed == 0 testObject1.speed == 0
? "低速" ? "低速"
: testObject1.windSpeed == 1 : testObject1.speed == 1
? "中速" ? "中速"
: testObject1.windSpeed == 2 : testObject1.speed == 2
? "高速" ? "高速"
: "自动" : "自动"
}}</span>
<span v-if="testObject1.funcCat == 3">{{
testObject1.speed == 1
? "低速"
: testObject1.speed == 2
? "中速"
: testObject1.speed == 3
? "高速"
: "自动"
}}</span> }}</span>
</div> </div>
</div> </div>
@ -279,6 +312,11 @@ import {
getLifList, getLifList,
getAirWarnList,// getAirWarnList,//
getCancelWarn,// getCancelWarn,//
setLoraTemp,//lora
setLoraStatus,//lora0 1
setLoraModel,//lora0: 1:() 2:: 3: 9:|
setLoraSpeed,//lora1 2 3 4
queryLoraAll,//lora###
} from "@/api/garden/monitoring"; } from "@/api/garden/monitoring";
import clickCp from "./clickCp"; import clickCp from "./clickCp";
import backHome from "./backHome"; import backHome from "./backHome";
@ -614,7 +652,7 @@ export default {
z: item.zmove, z: item.zmove,
}, },
null, null,
item.funcCat == 1 ? this.getContent(item) : this.getOAContent(item) item.funcCat == 1 ? this.getContent(item) : item.funcCat == 2 ? this.getOAContent(item) : this.getMbContent(item)
); );
}); });
} else { } else {
@ -630,6 +668,12 @@ export default {
// //
if (this.testObject1.open == 1) { if (this.testObject1.open == 1) {
this.testObject1.mode = mode; this.testObject1.mode = mode;
if (this.testObject1.funcCat == 3) {
//lora
setLoraModel(this.testObject1.code, this.testObject1.mode).then(res => {
})
return;
}
var arr = bfHelper.getAll(); var arr = bfHelper.getAll();
bfHelper.clearTags(); bfHelper.clearTags();
if (arr.length < 2) { if (arr.length < 2) {
@ -677,6 +721,18 @@ export default {
if (this.testObject1.temSetting <= 16) { if (this.testObject1.temSetting <= 16) {
this.testObject1.temSetting = 16; this.testObject1.temSetting = 16;
} }
if (this.testObject1.funcCat == 3) {
//lora
setLoraTemp(this.testObject1.code, this.testObject1.temSetting).then(res => {
if (res.data.code == 200) {
this.$message.success('温度设置成功');
}else{
this.$message.error('温度设置失败');
this.testObject1.temSetting++;
}
})
return;
}
setConditionTemDown( setConditionTemDown(
this.testObject1.code, this.testObject1.code,
this.testObject1.temSetting this.testObject1.temSetting
@ -698,6 +754,18 @@ export default {
if (this.testObject1.temSetting >= 30) { if (this.testObject1.temSetting >= 30) {
this.testObject1.temSetting = 30; this.testObject1.temSetting = 30;
} }
if (this.testObject1.funcCat == 3) {
//lora
setLoraTemp(this.testObject1.code, this.testObject1.temSetting).then(res => {
if (res.data.code == 200) {
this.$message.success('温度设置成功');
}else{
this.$message.error('温度设置失败');
this.testObject1.temSetting--;
}
})
return;
}
setConditionTemUp( setConditionTemUp(
this.testObject1.code, this.testObject1.code,
this.testObject1.temSetting this.testObject1.temSetting
@ -716,6 +784,12 @@ export default {
if (this.testObject1.speed <= 0) { if (this.testObject1.speed <= 0) {
this.testObject1.speed = 0; this.testObject1.speed = 0;
} }
if (this.testObject1.funcCat == 3) {
//lora
setLoraSpeed(this.testObject1.code, this.testObject1.speed).then(res => {
})
return;
}
setConditionSpeedDown( setConditionSpeedDown(
this.testObject1.code, this.testObject1.code,
this.testObject1.speed this.testObject1.speed
@ -733,6 +807,12 @@ export default {
if (this.testObject1.speed >= 3) { if (this.testObject1.speed >= 3) {
this.testObject1.speed = 3; this.testObject1.speed = 3;
} }
if (this.testObject1.funcCat == 3) {
//lora
setLoraSpeed(this.testObject1.code, this.testObject1.speed).then(res => {
})
return;
}
setConditionSpeedUp(this.testObject1.code, this.testObject1.speed).then( setConditionSpeedUp(this.testObject1.code, this.testObject1.speed).then(
(res) => { (res) => {
if (res.data.code == 200) { if (res.data.code == 200) {
@ -746,6 +826,13 @@ export default {
if (this.testObject1.agentCtrl == 0) { if (this.testObject1.agentCtrl == 0) {
this.$message.error("暂无设备控制权限!"); this.$message.error("暂无设备控制权限!");
} else { } else {
if (this.testObject1.funcCat == 3) {
//lora
setLoraStatus(this.testObject1.code, 0).then(res => {
this.testObject1.open = 2;
})
return;
}
getConditionClose(this.testObject1.code).then((res) => { getConditionClose(this.testObject1.code).then((res) => {
if (res.data.code == 200) { if (res.data.code == 200) {
if (res.data.data) { if (res.data.data) {
@ -790,6 +877,13 @@ export default {
if (this.testObject1.agentCtrl == 0) { if (this.testObject1.agentCtrl == 0) {
this.$message.error("暂无设备控制权限!"); this.$message.error("暂无设备控制权限!");
} else { } else {
if (this.testObject1.funcCat == 3) {
//lora
setLoraStatus(this.testObject1.code, 1).then(res => {
this.testObject1.open = 1;
})
return;
}
getConditionOpen(this.testObject1.code).then((res) => { getConditionOpen(this.testObject1.code).then((res) => {
if (res.data.code == 200) { if (res.data.code == 200) {
if (res.data.data) { if (res.data.data) {
@ -797,7 +891,7 @@ 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) {
bfHelper.customTag( bfHelper.customTag(
{ {
x: this.testObject1.xmove, x: this.testObject1.xmove,
@ -805,7 +899,7 @@ export default {
z: this.testObject1.zmove, z: this.testObject1.zmove,
}, },
null, null,
this.testObject1.funcCat == 1 ? this.getContent(this.testObject1) : this.getOAContent(this.testObject1) this.testObject1.funcCat == 1 ? this.getContent(this.testObject1) : this.testObject1.funcCat == 1 ? this.getOAContent(this.testObject1) : this.getMbContent(this.testObject1)
); );
} else { } else {
this.allDatas.forEach((item) => { this.allDatas.forEach((item) => {
@ -819,7 +913,7 @@ export default {
z: item.zmove, z: item.zmove,
}, },
null, null,
item.funcCat == 1 ? this.getContent(item) : this.getOAContent(item) item.funcCat == 1 ? this.getContent(item) : item.funcCat == 1 ? this.getOAContent(item) : this.getMbContent(item)
); );
}); });
} }
@ -896,8 +990,9 @@ export default {
bfHelper.customTag( bfHelper.customTag(
this.position, this.position,
null, null,
row.funcCat == 1 ? this.getContent(this.testObject1) : this.getOAContent(this.testObject1) row.funcCat == 1 ? this.getContent(this.testObject1) : row.funcCat == 2 ? this.getOAContent(this.testObject1) : this.getMbContent(this.testObject1)
); );
this.removeEvent();
window.addEventListener("click", this.addEvent); window.addEventListener("click", this.addEvent);
this.conditionNum = 1; this.conditionNum = 1;
} }
@ -911,6 +1006,10 @@ export default {
// }, // },
addEvent(e) { addEvent(e) {
let code = null; let code = null;
let funcCat = null;
if (e.target.id.indexOf("funcCat") != -1) {
funcCat = e.target.id.substring(7);
}
if (e.target.id.indexOf("condition") != -1) { if (e.target.id.indexOf("condition") != -1) {
code = e.target.id.substring(10); code = e.target.id.substring(10);
} }
@ -930,10 +1029,24 @@ export default {
code = e.target.id.substring(7); code = e.target.id.substring(7);
} }
if (code) { if (code) {
if (funcCat == 3) {
//lora
queryLoraAll(code).then(res => {
this.testObject1 = res.data.data;
if (
e.target.id == "condition-" + code ||
e.target.id == "funcCat-" + code
) {
this.isControl = true;
this.clickCode = code;
}
})
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.funcCat == 2 || this.testObject1.open != -1) {
// //
return; return;
} }
@ -1005,6 +1118,26 @@ export default {
return content; return content;
}, },
//
getMbContent(testObject) {
// console.log('',testObject)
testObject.xmove = '181933.38275619797';
testObject.ymove = '83300.38516883833';
testObject.zmove = '0.5150140523837763';
let bgImg1 = require("../../../public/img/monitoring/electricity/condition_mb.png");
let content = `<div id="funcCat-${testObject.funcCat}" class="lift-block" style="position:relative;width:100px">
<div style="background:#07a7ff url(${bgImg1}) 5px center no-repeat;width:100px;height:34px;color:white;font-size:18px;" id="temped-${testObject.code
}">
<div id="condition-${testObject.code
}" style="width:60px;position:absolute;height:34px;line-height: 34px;left:40px;top:0;cursor: pointer">
<span style="font-size:18px;font-family:fantasy;">${testObject.name}</span>
</div>
</div>
</div>`;
return content;
},
// //
getOAContent(objData) { getOAContent(objData) {
let content = `<div class="leadTips" style="transform: translateY(-72px);"> let content = `<div class="leadTips" style="transform: translateY(-72px);">

@ -32,6 +32,7 @@ module.exports = {
// target: 'http://192.168.0.105:80', // target: 'http://192.168.0.105:80',
// target: "http://192.168.43.35", // target: "http://192.168.43.35",
// target: 'http://192.168.1.106', // target: 'http://192.168.1.106',
// target: "http://192.168.1.3",
target: "http://10.90.100.204", target: "http://10.90.100.204",
// target: "http://rsvz4t.natappfree.cc", // target: "http://rsvz4t.natappfree.cc",
//远程演示服务地址,可用于直接启动项目 //远程演示服务地址,可用于直接启动项目

Loading…
Cancel
Save