用能系统功能调整

This commit is contained in:
2025-07-24 11:40:23 +08:00
parent c88484caf7
commit 39093641d8
4 changed files with 108 additions and 100 deletions

View File

@@ -72,21 +72,21 @@ export function getDicTree() {
}
export function getDicTreeAdd(data) {
return request({
url: '/system-boot/dic/add',
url: '/system-boot/dictTree/add',
method: 'post',
data: data
})
}
export function getDicTreeUpdate(data) {
return request({
url: '/system-boot/dic/update',
url: '/system-boot/dictTree/update',
method: 'put',
data: data
})
}
export function getDicTreeDelete(data) {
return request({
url: '/system-boot/dic/delete',
url: '/system-boot/dictTree/delete',
method: 'delete',
params: data
})

View File

@@ -202,14 +202,14 @@
type="danger"
size="small"
v-if="scope.row.type === 1"
style="color: red"
style="color: #008000"
>开机策略</el-tag
>
<el-tag
type="primary"
size="small"
v-if="scope.row.type === 2"
style="color: green"
style="color: #991717"
>关机策略</el-tag
>
</template>
@@ -256,24 +256,24 @@
}}</span>
</template>
</el-table-column>
<el-table-column
width="150"
align="center"
prop="wind"
label="状态"
>
<template slot-scope="scope">
<span type="primary" size="small">{{
statusGet(scope.row.status)
}}</span>
</template>
</el-table-column>
<!-- <el-table-column align="center" prop="sjfw" label="涉及范围" >
<template slot-scope="scope">
<el-button v-if="scope.row.sjfw==0" @click="confingview(scope.row)" type="primary" size="mini">配置</el-button>
<el-button v-if="scope.row.sjfw==1" type="primary" size="mini">查看</el-button>
</template>
</el-table-column> -->
<!-- <el-table-column
width="150"
align="center"
prop="wind"
label="状态"
>
<template slot-scope="scope">
<span type="primary" size="small">{{
statusGet(scope.row.status)
}}</span>
</template>
</el-table-column>
<el-table-column align="center" prop="sjfw" label="涉及范围" >
<template slot-scope="scope">
<el-button v-if="scope.row.sjfw==0" @click="confingview(scope.row)" type="primary" size="mini">配置</el-button>
<el-button v-if="scope.row.sjfw==1" type="primary" size="mini">查看</el-button>
</template>
</el-table-column> -->
<el-table-column align="center" prop="caozuo" label="操作">
<template slot-scope="scope">
<el-button
@@ -283,12 +283,18 @@
>查看</el-button
>
<el-button
v-if="scope.row.status === 0"
type="primary"
size="mini"
@click="edit(scope.row.id)"
>修改</el-button
>
<el-button
v-if="scope.row.status === 1"
type="primary"
@click="stopAirStrategy(scope.row.id)"
size="mini"
>停止</el-button
>
<!-- <el-button
v-if="scope.row.status !== 1"
type="primary"
@@ -303,20 +309,14 @@
size="mini"
>执行</el-button
>
<el-button
v-if="scope.row.status === 1"
type="primary"
@click="stopAirStrategy(scope.row.id)"
size="mini"
>停止</el-button
>-->
<el-button
v-if="scope.row.status === 2"
@click="querydata(scope.row)"
type="primary"
size="mini"
>趋势查看
</el-button>
</el-button>-->
</template>
</el-table-column>
</el-table>

View File

@@ -1330,64 +1330,7 @@ export default {
this.get_bodyHeight();
this.connectMqtt();
this.globalMqtt.ws.on("connect", (e) => {
this.$message.success("连接mqtt服务器成功!");
console.log("mqtt客户端已连接....");
this.globalMqtt.ws.subscribe("/platform/devack/#");
});
this.globalMqtt.ws.on("error", (error) => {
console.log("mqtt连接失败...", error);
this.mqtt.end();
});
this.globalMqtt.ws.on("close", function () {
console.log("mqtt客户端已断开连接.....");
});
let index = 0;
this.globalMqtt.ws.on("message", (topic, message) => {
let that = this;
if (message) {
let json = JSON.parse(message);
if (json.code === 200) {
if (json.param.action === "ACInMode") {
this.$message.success("内机模式调节成功!");
} else if (json.param.action === "ACInSpeed") {
this.$message.success("内机风速调节成功!");
} else if (json.param.action === "ACInSetTmp") {
this.$message.success("内机温度调节成功!");
} else if (json.param.action === "ACInStat") {
this.$message.success("内机开关机操作成功!");
} else {
this.$message.success("操作成功!");
}
window.setTimeout(function () {
that.getStatisTemplateById();
}, 10000);
} else {
this.$message.error(json.msg);
if (this.userIndex === json.userId) {
this.mqttSendCount++;
if (this.mqttSendCount > 2) {
return;
} else {
this.globalMqtt.ws.publish(
"/platform/devcmd/v1/" + this.devInfo.ndid,
JSON.stringify(this.mqttSendMsg)
);
}
console.log("错误+++进行重发" + this.mqttSendCount);
}
}
this.buttonDisable = false;
}
console.log("收到消息:" + topic + message);
});
//如果别的页面路由过来的进行路由参数处理
},
@@ -1412,10 +1355,11 @@ export default {
},
methods: {
connectMqtt() {
this.globalMqtt.ws = {};
let this_ = this
this_.globalMqtt.ws = {};
let mqttWs = null;
let userName = this.$store.state.user.userInfo.loginName;
let userName = this_.$store.state.user.userInfo.loginName;
const options = {
qos: 2,
clean: true,
@@ -1424,9 +1368,69 @@ export default {
username: "t_user",
password: "njcnpqs",
};
const url = "wss://pqmcn.com:8087/mqtt";
const url = "ws://192.168.1.24:8085/mqtt";
mqttWs = mqtt.connect(url, options);
this.globalMqtt.setWs(mqttWs);
this_.globalMqtt.setWs(mqttWs);
this_.globalMqtt.ws.on("connect", (e) => {
this_.$message.success("连接mqtt服务器成功!");
console.log("mqtt客户端已连接....");
this_.globalMqtt.ws.subscribe("/platform/devack/#");
});
this_.globalMqtt.ws.on("error", (error) => {
console.log("mqtt连接失败...", error);
this.mqtt.end();
});
this_.globalMqtt.ws.on("close", function () {
console.log("mqtt客户端已断开连接.....");
});
this_.globalMqtt.ws.on("message", (topic, message) => {
let that = this;
if (message) {
let json = JSON.parse(message);
if (json.code === 200) {
if (json.param.action === "ACInMode") {
this_.$message.success("内机模式调节成功!");
} else if (json.param.action === "ACInSpeed") {
this_.$message.success("内机风速调节成功!");
} else if (json.param.action === "ACInSetTmp") {
this_.$message.success("内机温度调节成功!");
} else if (json.param.action === "ACInStat") {
this_.$message.success("内机开关机操作成功!");
} else {
this_.$message.success("操作成功!");
}
window.setTimeout(function () {
that.getStatisTemplateById();
}, 10000);
} else {
this_.$message.error(json.msg);
if (this_.userIndex === json.userId) {
this_.mqttSendCount++;
if (this_.mqttSendCount > 2) {
return;
} else {
this_.globalMqtt.ws.publish(
"/platform/devcmd/v1/" + this.devInfo.ndid,
JSON.stringify(this.mqttSendMsg)
);
}
console.log("错误+++进行重发" + this.mqttSendCount);
}
}
this_.buttonDisable = false;
}
console.log("收到消息:" + topic + message);
});
},
//子节点树点击事件
getTreeText(data, level) {
@@ -1694,7 +1698,7 @@ export default {
},
querfromdata(data, timehbValue, type, interval) {
this.interval = interval;
this.timeRange = data;
if (type == 1) {
@@ -2009,7 +2013,7 @@ window.echartsArr.push(myChart);
switchChange(item, type) {
console.log(item);
console.log(type);
console.log(this.devInfo.ndid);
let msg = {
mid: 1,
@@ -2025,10 +2029,14 @@ window.echartsArr.push(myChart);
},
};
this.globalMqtt.ws.publish(
"/platform/devcmd/v1/" + this.devInfo.ndid,
JSON.stringify(msg)
);
let topic = "/platform/devcmd/v1/" + this.devInfo.ndid;
console.log(topic);
this.globalMqtt.ws.publish(topic, JSON.stringify(msg), { qos: 0 }, (err) => {
if (err) console.error("发送失败:", err);
else console.log("发送成功");
})
this.mqttSendMsg = msg;
this.mqttSendCount = 0;

View File

@@ -10,7 +10,7 @@
<el-button @click="queryData()" type="primary" size="mini" style="margin-left:1%;" icon="el-icon-search">查询</el-button> -->
<el-form :inline="true" :model="form" class="demo-form-inline">
<el-form-item>
<el-button @click="AddTypeClick" type="primary" icon="el-icon-plus">新增字典类型</el-button>
<el-button @click="AddTypeClick" type="primary" icon="el-icon-plus">新增字典类型</el-button>
</el-form-item>
</el-form>
<el-select