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