用能系统功能调整
This commit is contained in:
@@ -72,21 +72,21 @@ export function getDicTree() {
|
|||||||
}
|
}
|
||||||
export function getDicTreeAdd(data) {
|
export function getDicTreeAdd(data) {
|
||||||
return request({
|
return request({
|
||||||
url: '/system-boot/dic/add',
|
url: '/system-boot/dictTree/add',
|
||||||
method: 'post',
|
method: 'post',
|
||||||
data: data
|
data: data
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
export function getDicTreeUpdate(data) {
|
export function getDicTreeUpdate(data) {
|
||||||
return request({
|
return request({
|
||||||
url: '/system-boot/dic/update',
|
url: '/system-boot/dictTree/update',
|
||||||
method: 'put',
|
method: 'put',
|
||||||
data: data
|
data: data
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
export function getDicTreeDelete(data) {
|
export function getDicTreeDelete(data) {
|
||||||
return request({
|
return request({
|
||||||
url: '/system-boot/dic/delete',
|
url: '/system-boot/dictTree/delete',
|
||||||
method: 'delete',
|
method: 'delete',
|
||||||
params: data
|
params: data
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -202,14 +202,14 @@
|
|||||||
type="danger"
|
type="danger"
|
||||||
size="small"
|
size="small"
|
||||||
v-if="scope.row.type === 1"
|
v-if="scope.row.type === 1"
|
||||||
style="color: red"
|
style="color: #008000"
|
||||||
>开机策略</el-tag
|
>开机策略</el-tag
|
||||||
>
|
>
|
||||||
<el-tag
|
<el-tag
|
||||||
type="primary"
|
type="primary"
|
||||||
size="small"
|
size="small"
|
||||||
v-if="scope.row.type === 2"
|
v-if="scope.row.type === 2"
|
||||||
style="color: green"
|
style="color: #991717"
|
||||||
>关机策略</el-tag
|
>关机策略</el-tag
|
||||||
>
|
>
|
||||||
</template>
|
</template>
|
||||||
@@ -256,24 +256,24 @@
|
|||||||
}}</span>
|
}}</span>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column
|
<!-- <el-table-column
|
||||||
width="150"
|
width="150"
|
||||||
align="center"
|
align="center"
|
||||||
prop="wind"
|
prop="wind"
|
||||||
label="状态"
|
label="状态"
|
||||||
>
|
>
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<span type="primary" size="small">{{
|
<span type="primary" size="small">{{
|
||||||
statusGet(scope.row.status)
|
statusGet(scope.row.status)
|
||||||
}}</span>
|
}}</span>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<!-- <el-table-column align="center" prop="sjfw" label="涉及范围" >
|
<el-table-column align="center" prop="sjfw" label="涉及范围" >
|
||||||
<template slot-scope="scope">
|
<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==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>
|
<el-button v-if="scope.row.sjfw==1" type="primary" size="mini">查看</el-button>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column> -->
|
</el-table-column> -->
|
||||||
<el-table-column align="center" prop="caozuo" label="操作">
|
<el-table-column align="center" prop="caozuo" label="操作">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<el-button
|
<el-button
|
||||||
@@ -283,12 +283,18 @@
|
|||||||
>查看</el-button
|
>查看</el-button
|
||||||
>
|
>
|
||||||
<el-button
|
<el-button
|
||||||
v-if="scope.row.status === 0"
|
|
||||||
type="primary"
|
type="primary"
|
||||||
size="mini"
|
size="mini"
|
||||||
@click="edit(scope.row.id)"
|
@click="edit(scope.row.id)"
|
||||||
>修改</el-button
|
>修改</el-button
|
||||||
>
|
>
|
||||||
|
<el-button
|
||||||
|
v-if="scope.row.status === 1"
|
||||||
|
type="primary"
|
||||||
|
@click="stopAirStrategy(scope.row.id)"
|
||||||
|
size="mini"
|
||||||
|
>停止</el-button
|
||||||
|
>
|
||||||
<!-- <el-button
|
<!-- <el-button
|
||||||
v-if="scope.row.status !== 1"
|
v-if="scope.row.status !== 1"
|
||||||
type="primary"
|
type="primary"
|
||||||
@@ -303,20 +309,14 @@
|
|||||||
size="mini"
|
size="mini"
|
||||||
>执行</el-button
|
>执行</el-button
|
||||||
>
|
>
|
||||||
<el-button
|
|
||||||
v-if="scope.row.status === 1"
|
|
||||||
type="primary"
|
|
||||||
@click="stopAirStrategy(scope.row.id)"
|
|
||||||
size="mini"
|
|
||||||
>停止</el-button
|
|
||||||
>-->
|
|
||||||
<el-button
|
<el-button
|
||||||
v-if="scope.row.status === 2"
|
v-if="scope.row.status === 2"
|
||||||
@click="querydata(scope.row)"
|
@click="querydata(scope.row)"
|
||||||
type="primary"
|
type="primary"
|
||||||
size="mini"
|
size="mini"
|
||||||
>趋势查看
|
>趋势查看
|
||||||
</el-button>
|
</el-button>-->
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
</el-table>
|
</el-table>
|
||||||
|
|||||||
@@ -1330,64 +1330,7 @@ export default {
|
|||||||
this.get_bodyHeight();
|
this.get_bodyHeight();
|
||||||
this.connectMqtt();
|
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: {
|
methods: {
|
||||||
connectMqtt() {
|
connectMqtt() {
|
||||||
this.globalMqtt.ws = {};
|
let this_ = this
|
||||||
|
this_.globalMqtt.ws = {};
|
||||||
let mqttWs = null;
|
let mqttWs = null;
|
||||||
|
|
||||||
let userName = this.$store.state.user.userInfo.loginName;
|
let userName = this_.$store.state.user.userInfo.loginName;
|
||||||
const options = {
|
const options = {
|
||||||
qos: 2,
|
qos: 2,
|
||||||
clean: true,
|
clean: true,
|
||||||
@@ -1424,9 +1368,69 @@ export default {
|
|||||||
username: "t_user",
|
username: "t_user",
|
||||||
password: "njcnpqs",
|
password: "njcnpqs",
|
||||||
};
|
};
|
||||||
const url = "wss://pqmcn.com:8087/mqtt";
|
const url = "ws://192.168.1.24:8085/mqtt";
|
||||||
mqttWs = mqtt.connect(url, options);
|
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) {
|
getTreeText(data, level) {
|
||||||
@@ -2009,7 +2013,7 @@ window.echartsArr.push(myChart);
|
|||||||
switchChange(item, type) {
|
switchChange(item, type) {
|
||||||
console.log(item);
|
console.log(item);
|
||||||
console.log(type);
|
console.log(type);
|
||||||
console.log(this.devInfo.ndid);
|
|
||||||
|
|
||||||
let msg = {
|
let msg = {
|
||||||
mid: 1,
|
mid: 1,
|
||||||
@@ -2025,10 +2029,14 @@ window.echartsArr.push(myChart);
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
this.globalMqtt.ws.publish(
|
let topic = "/platform/devcmd/v1/" + this.devInfo.ndid;
|
||||||
"/platform/devcmd/v1/" + this.devInfo.ndid,
|
console.log(topic);
|
||||||
JSON.stringify(msg)
|
this.globalMqtt.ws.publish(topic, JSON.stringify(msg), { qos: 0 }, (err) => {
|
||||||
);
|
if (err) console.error("发送失败:", err);
|
||||||
|
else console.log("发送成功");
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
this.mqttSendMsg = msg;
|
this.mqttSendMsg = msg;
|
||||||
this.mqttSendCount = 0;
|
this.mqttSendCount = 0;
|
||||||
|
|||||||
@@ -10,7 +10,7 @@
|
|||||||
<el-button @click="queryData()" type="primary" size="mini" style="margin-left:1%;" icon="el-icon-search">查询</el-button> -->
|
<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 :inline="true" :model="form" class="demo-form-inline">
|
||||||
<el-form-item>
|
<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-item>
|
||||||
</el-form>
|
</el-form>
|
||||||
<el-select
|
<el-select
|
||||||
|
|||||||
Reference in New Issue
Block a user