Browse Source

首页疲劳唤醒修改

wangqin
zhoule 7 months ago
parent
commit
b8e6281390
  1. 182
      ruoyi-ui/src/views/JiHeExpressway/pages/Home/components/Dialogs/FatigueWakesUp/components/DeviceControlDialog.vue
  2. 1
      ruoyi-ui/src/views/JiHeExpressway/pages/Home/components/Dialogs/FatigueWakesUp/index.vue

182
ruoyi-ui/src/views/JiHeExpressway/pages/Home/components/Dialogs/FatigueWakesUp/components/DeviceControlDialog.vue

@ -3,133 +3,78 @@
<div class="DeviceControlDialog"> <div class="DeviceControlDialog">
<ElTabs v-model="activeName" class="tabs" @tab-click="tabClick"> <ElTabs v-model="activeName" class="tabs" @tab-click="tabClick">
<ElTabPane label="一般模式" name="first"> <ElTabPane label="一般模式" name="first">
<Form <Form v-model="formData" class="form" ref="FormConfigRef" :formList="formList1" column="1"
v-model="formData" labelWidth="120px" />
class="form"
ref="FormConfigRef"
:formList="formList1"
column="1"
labelWidth="120px"
/>
</ElTabPane> </ElTabPane>
<ElTabPane label="自定义模式" name="second"> <ElTabPane label="自定义模式" name="second">
<div style="display: flex; margin: 20px 0"> <!-- <div style="display: flex; margin: 20px 0">
<p style="width: 115px">工作时长():</p> <p style="width: 115px">工作时长():</p>
<el-input-number <el-input-number v-model="onWorkStatus2" :min="0" :max="999" label="工作时长(s分):"></el-input-number>
v-model="onWorkStatus2" </div> -->
:min="0"
:max="999"
label="工作时长(s分):"
></el-input-number>
</div>
<Table :data="tableData"> <Table :data="tableData">
<ElTableColumn prop="ds" label="段数"></ElTableColumn> <ElTableColumn prop="ds" label="段数"></ElTableColumn>
<ElTableColumn prop="time" width="120" label="时间(毫秒)"> <ElTableColumn prop="time" width="120" label="时间(毫秒)">
<template slot-scope="scope"> <template slot-scope="scope">
<div style="display: flex"> <div style="display: flex">
<el-input-number <el-input-number style="width: 120px" v-model="scope.row.time" :min="0"></el-input-number>
style="width: 120px"
v-model="scope.row.time"
:min="0"
></el-input-number>
</div> </div>
</template> </template>
</ElTableColumn> </ElTableColumn>
<ElTableColumn prop="A" label="线路A"> <ElTableColumn prop="A" label="线路A">
<template slot-scope="scope"> <template slot-scope="scope">
<el-switch <el-switch active-value="1" inactive-value="0" v-model="scope.row.A" active-color="#13ce66"
active-value="1" inactive-color="#C9C9C9">
inactive-value="0"
v-model="scope.row.A"
active-color="#13ce66"
inactive-color="#C9C9C9"
>
</el-switch> </el-switch>
</template> </template>
</ElTableColumn> </ElTableColumn>
<ElTableColumn prop="B" label="线路B"> <ElTableColumn prop="B" label="线路B">
<template slot-scope="scope"> <template slot-scope="scope">
<el-switch <el-switch active-value="1" inactive-value="0" v-model="scope.row.B" active-color="#13ce66"
active-value="1" inactive-color="#C9C9C9">
inactive-value="0"
v-model="scope.row.B"
active-color="#13ce66"
inactive-color="#C9C9C9"
>
</el-switch> </el-switch>
</template> </template>
</ElTableColumn> </ElTableColumn>
<ElTableColumn prop="C" label="线路C"> <ElTableColumn prop="C" label="线路C">
<template slot-scope="scope"> <template slot-scope="scope">
<el-switch <el-switch active-value="1" inactive-value="0" v-model="scope.row.C" active-color="#13ce66"
active-value="1" inactive-color="#C9C9C9">
inactive-value="0"
v-model="scope.row.C"
active-color="#13ce66"
inactive-color="#C9C9C9"
>
</el-switch> </el-switch>
</template> </template>
</ElTableColumn> </ElTableColumn>
<ElTableColumn prop="D" label="线路D"> <ElTableColumn prop="D" label="线路D">
<template slot-scope="scope"> <template slot-scope="scope">
<el-switch <el-switch active-value="1" inactive-value="0" v-model="scope.row.D" active-color="#13ce66"
active-value="1" inactive-color="#C9C9C9">
inactive-value="0"
v-model="scope.row.D"
active-color="#13ce66"
inactive-color="#C9C9C9"
>
</el-switch> </el-switch>
</template> </template>
</ElTableColumn> </ElTableColumn>
<ElTableColumn prop="E" label="线路E"> <ElTableColumn prop="E" label="线路E">
<template slot-scope="scope"> <template slot-scope="scope">
<el-switch <el-switch active-value="1" inactive-value="0" v-model="scope.row.E" active-color="#13ce66"
active-value="1" inactive-color="#C9C9C9">
inactive-value="0"
v-model="scope.row.E"
active-color="#13ce66"
inactive-color="#C9C9C9"
>
</el-switch> </el-switch>
</template> </template>
</ElTableColumn> </ElTableColumn>
<ElTableColumn prop="F" label="线路F"> <ElTableColumn prop="F" label="线路F">
<template slot-scope="scope"> <template slot-scope="scope">
<el-switch <el-switch active-value="1" inactive-value="0" v-model="scope.row.F" active-color="#13ce66"
active-value="1" inactive-color="#C9C9C9">
inactive-value="0"
v-model="scope.row.F"
active-color="#13ce66"
inactive-color="#C9C9C9"
>
</el-switch> </el-switch>
</template> </template>
</ElTableColumn> </ElTableColumn>
<ElTableColumn prop="G" label="线路G"> <ElTableColumn prop="G" label="线路G">
<template slot-scope="scope"> <template slot-scope="scope">
<el-switch <el-switch active-value="1" inactive-value="0" v-model="scope.row.G" active-color="#13ce66"
active-value="1" inactive-color="#C9C9C9">
inactive-value="0"
v-model="scope.row.G"
active-color="#13ce66"
inactive-color="#C9C9C9"
>
</el-switch> </el-switch>
</template> </template>
</ElTableColumn> </ElTableColumn>
<ElTableColumn prop="H" label="线路H"> <ElTableColumn prop="H" label="线路H">
<template slot-scope="scope"> <template slot-scope="scope">
<el-switch <el-switch active-value="1" inactive-value="0" v-model="scope.row.H" active-color="#13ce66"
active-value="1" inactive-color="#C9C9C9">
inactive-value="0"
v-model="scope.row.H"
active-color="#13ce66"
inactive-color="#C9C9C9"
>
</el-switch> </el-switch>
</template> </template>
</ElTableColumn> </ElTableColumn>
@ -139,10 +84,8 @@
</div> </div>
<template #footer> <template #footer>
<Button <Button style="background-color: rgba(0, 179, 204, 0.3)"
style="background-color: rgba(0, 179, 204, 0.3)" @click.native="(modelVisible = false), (submitting = false)">
@click.native="(modelVisible = false), (submitting = false)"
>
取消 取消
</Button> </Button>
<Button @click.native="handleSubmit" :loading="submitting"> 确定 </Button> <Button @click.native="handleSubmit" :loading="submitting"> 确定 </Button>
@ -173,6 +116,7 @@ export default {
props: { props: {
visible: Boolean, visible: Boolean,
deviceId: String, deviceId: String,
productId: String
}, },
data() { data() {
return { return {
@ -252,6 +196,10 @@ export default {
value: "6", value: "6",
label: "SOS模式", label: "SOS模式",
}, },
{
value: "7",
label: "自定义模式",
},
], ],
}, },
}, },
@ -341,16 +289,16 @@ export default {
async initData() { async initData() {
// //
let result = await this.requestURL("ASKMD"); let result = await this.requestURL("ASKMD");
if (result.data == 7) { // if (result.data == 7) {
this.activeName = "second"; // this.activeName = "second";
this.tabClick(); // this.tabClick();
} else { // } else {
this.formData.controlType = result.data + "" || "1"; this.formData.controlType = result.data + "" || "1";
// //
let resultTime = await this.requestURL("ASKTM"); let resultTime = await this.requestURL("ASKTM");
this.formData.onWorkStatus = resultTime.data || 0; this.formData.onWorkStatus = resultTime.data || 0;
this.activeName = "first"; this.activeName = "first";
} // }
}, },
async requestURL(functionId, options = {}) { async requestURL(functionId, options = {}) {
let result = await request({ let result = await request({
@ -384,6 +332,7 @@ export default {
tData.push({ ...data, ds: item.property }); tData.push({ ...data, ds: item.property });
} }
}); });
tData.sort((a, b) => a.ds.toUpperCase().localeCompare(b.ds.toUpperCase()));
this.tableData = tData; this.tableData = tData;
} else { } else {
// //
@ -415,36 +364,51 @@ export default {
this.tableData.forEach((it, index) => { this.tableData.forEach((it, index) => {
rData.push({ rData.push({
order: 7, functionId: "SETDF",
time: it.time, params: {
numberOfSegments: this.duan[index], order: 7,
A: Number(it.A), time: it.time,
B: Number(it.B), numberOfSegments: it.ds || this.duan[index],
C: Number(it.C), A: Number(it.A),
D: Number(it.D), B: Number(it.B),
E: Number(it.E), C: Number(it.C),
F: Number(it.F), D: Number(it.D),
G: Number(it.G), E: Number(it.E),
H: Number(it.H), F: Number(it.F),
G: Number(it.G),
H: Number(it.H),
}
}); });
}); });
// //
await request({ let res = await request({
url: `/business/device/batchFunctions`, url: `/business/device/batchFunctions`,
method: "post", method: "post",
// data: {
// deviceId: this.deviceId,
// functionId: "SETDF",
// params: rData,
// },
data: { data: {
deviceId: this.deviceId, devices: [{
functionId: "SETDF", iotDeviceId: this.deviceId,
params: rData, id: this.productId,
}, deviceType: 10
}],
functions: rData
}
}); });
//
let res = await this.requestURL("SETTM", { SET: this.onWorkStatus2 });
if (res.code == 200) { if (res.code == 200) {
Message.success("设置成功!"); Message.success("设置成功!");
this.$emit("update:value", false); this.$emit("update:value", false);
} }
//
// let res = await this.requestURL("SETTM", { SET: this.onWorkStatus2 });
// if (res.code == 200) {
// Message.success("");
// this.$emit("update:value", false);
// }
} }
}, },
}, },

1
ruoyi-ui/src/views/JiHeExpressway/pages/Home/components/Dialogs/FatigueWakesUp/index.vue

@ -29,6 +29,7 @@
<DeviceControlDialog <DeviceControlDialog
v-model="deviceControlVisible" v-model="deviceControlVisible"
:deviceId="dialogData.iotDeviceId" :deviceId="dialogData.iotDeviceId"
:productId="dialogData.id"
/> />
</Dialog> </Dialog>
</template> </template>

Loading…
Cancel
Save