feat(iot):调整一键开合闸接口,解决cron选择弹窗样式错乱问题

This commit is contained in:
fhysy 2025-02-17 16:15:13 +08:00
parent 5eaf34ed1b
commit 41d2b792ca
4 changed files with 98 additions and 13 deletions

View File

@ -133,6 +133,15 @@ export function setSwitchControl(data) {
});
}
// 开关控制 最新接口
export function setSwitchAllControl(data) {
return request({
url: "/iot/dev/opt/switchAll",
method: "post",
data: data
});
}
// 开关控制 最新接口
export function searchDevControl(data) {
return request({

View File

@ -27,8 +27,8 @@ import dataV from '@jiaminghi/data-view'
// import VueCron from 'vue-cron';
// 自定义表格工具扩展
import RightToolbar from "@/components/RightToolbar"
// import iView from 'iview'
// import 'iview/dist/styles/iview.css'
import iView from 'iview'
import 'iview/dist/styles/iview.css'
import VueAMap from 'vue-amap';
@ -61,7 +61,7 @@ Vue.prototype.msgInfo = function (msg) {
// 全局组件挂载
Vue.component('Pagination', Pagination)
Vue.component('RightToolbar', RightToolbar)
// Vue.use(iView)
Vue.use(iView)
Vue.use(dataV)
Vue.use(VueClipboard)
Vue.use(VueAMap);

View File

@ -148,7 +148,7 @@ import {
listProjectModel,
listProjectTableFilter,
} from "@/api/iot/project_new";
import { setSwitchControl,searchDevControl } from "@/api/iot/device";
import { setSwitchControl, searchDevControl, setSwitchAllControl } from "@/api/iot/device";
import { webSocketProjectGatewayUrl } from "@/config/env";
import moment from "moment";
export default {
@ -358,9 +358,46 @@ export default {
},
handleChildStatus(type) {
if (this.tableSelectList && this.tableSelectList.length > 0) {
this.handleSendSwitchDirect(type, this.tableSelectList.toString());
this.handleChildAllStatus(type);
}
},
// 线
handleChildAllStatus(type) {
this.$prompt("请输入登录密码", "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
inputPattern: /^[a-z A-z 0-9 $.]+/,
inputType: "password",
inputErrorMessage: "登录密码不能为空",
}).then(({ value }) => {
let params = {
data: {
// cmd: "set_switch",
params: {
switch: 1,
},
},
deviceId: "",
verifyKey: value,
};
switch (type) {
case "true":
params.data.params.switch = 1;
params.deviceId = this.gatewayDevice.deviceId;
break;
case "false":
params.data.params.switch = 0;
params.deviceId = this.gatewayDevice.deviceId;
break;
}
setSwitchAllControl(params).then((res) => {
this.msgSuccess("修改成功");
});
});
},
handleDevSearch() {
if (this.tableSelectList && this.tableSelectList.length > 0) {
this.handleSearchDevDirect( this.tableSelectList.toString());

View File

@ -351,7 +351,7 @@ import {
listChildrenDevice,
setSwitchControl,
setLivetimeControl,
searchDevControl
searchDevControl, setSwitchAllControl
} from "@/api/iot/device";
import {
devLiveWebSocketBaseUrl,
@ -489,15 +489,54 @@ export default {
},
handleAllStatus(type) {
if (this.childDeviceList.length > 0) {
this.childDeviceList.forEach(v => {
if (this.tSelectList.indexOf(v.deviceId) < 0) {
this.tSelectList.push(v.deviceId);
this.tSelectLabelList.push(v.deviceName);
}
});
this.handleChildStatus(type);
// this.childDeviceList.forEach(v => {
// if (this.tSelectList.indexOf(v.deviceId) < 0) {
// this.tSelectList.push(v.deviceId);
// this.tSelectLabelList.push(v.deviceName);
// }
// });
this.handleChildAllStatus(type);
}
},
// 线
handleChildAllStatus(type) {
// if (this.tSelectLabelList.legnth > 0) {
this.$prompt("请输入登录密码", "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
inputPattern: /^[a-z A-z 0-9 $.]+/,
inputType: "password",
inputErrorMessage: "登录密码不能为空"
}).then(({ value }) => {
let params = {
data: {
// cmd: "set_switch",
params: {
switch: 1
}
},
deviceId: "",
verifyKey: value
};
switch (type) {
case "true":
params.data.params.switch = 1;
params.deviceId = this.deviceInfo.deviceId;
break;
case "false":
params.data.params.switch = 0;
params.deviceId = this.deviceInfo.deviceId;
break;
}
setSwitchAllControl(params).then(res => {
this.msgSuccess("修改成功");
});
});
// }
},
handleDevSearch() {
this.$prompt("请输入登录密码", "提示", {
confirmButtonText: "确定",