|
@ -1,19 +1,18 @@ |
|
|
<template> |
|
|
<template> |
|
|
<Dialog v-model="modelVisible" title="设备操作" width="550px"> |
|
|
<Dialog v-model="modelVisible" title="设备操作" width="600px"> |
|
|
<div class="DeviceControlDialog"> |
|
|
<div class="DeviceControlDialog"> |
|
|
<Form |
|
|
<Form |
|
|
column="2" |
|
|
column="2" |
|
|
v-if="formList && formList.length" |
|
|
v-if="formList && formList.length" |
|
|
class="form" |
|
|
class="form" |
|
|
ref="FormConfigRef" |
|
|
ref="FormConfigRef" |
|
|
label-width='120px' |
|
|
label-width='150px' |
|
|
:formList="formList" |
|
|
:formList="formList" |
|
|
:value="formData" |
|
|
:value="formData" |
|
|
/> |
|
|
/> |
|
|
</div> |
|
|
</div> |
|
|
<template #footer> |
|
|
<template #footer> |
|
|
<!-- 王思祥 回读待确认 2024-05-16 TODO--> |
|
|
<Button @click.native="handleSubmit"> 发送 </Button> |
|
|
<Button @click.native="handleSubmit" :loading="submitting"> 发送 </Button> |
|
|
|
|
|
</template> |
|
|
</template> |
|
|
</Dialog> |
|
|
</Dialog> |
|
|
</template> |
|
|
</template> |
|
@ -23,6 +22,8 @@ |
|
|
import Button from "@screen/components/Buttons/Button.vue"; |
|
|
import Button from "@screen/components/Buttons/Button.vue"; |
|
|
import Dialog from "@screen/components/Dialog/index.vue"; |
|
|
import Dialog from "@screen/components/Dialog/index.vue"; |
|
|
import request from "@/utils/request"; |
|
|
import request from "@/utils/request"; |
|
|
|
|
|
|
|
|
|
|
|
import { Message } from 'element-ui' |
|
|
import Form from "@screen/components/FormConfig"; |
|
|
import Form from "@screen/components/FormConfig"; |
|
|
export default { |
|
|
export default { |
|
|
name: "DeviceControlDialog", |
|
|
name: "DeviceControlDialog", |
|
@ -36,6 +37,12 @@ export default { |
|
|
event: "update:value", |
|
|
event: "update:value", |
|
|
}, |
|
|
}, |
|
|
props: { |
|
|
props: { |
|
|
|
|
|
|
|
|
|
|
|
rebind: { |
|
|
|
|
|
type: Function, |
|
|
|
|
|
default: null |
|
|
|
|
|
}, |
|
|
|
|
|
|
|
|
visible: Boolean, |
|
|
visible: Boolean, |
|
|
dialogData: { |
|
|
dialogData: { |
|
|
type: Object, |
|
|
type: Object, |
|
@ -80,36 +87,106 @@ export default { |
|
|
"triggerTextDuration", |
|
|
"triggerTextDuration", |
|
|
"normalTextDisplaySettings", |
|
|
"normalTextDisplaySettings", |
|
|
"vehicleDetectorSensitivity", |
|
|
"vehicleDetectorSensitivity", |
|
|
"calculationCycle" |
|
|
"calculationCycle", |
|
|
|
|
|
"firstTimePeriodStartTTime", |
|
|
|
|
|
"firstTimePeriodEndTime", |
|
|
|
|
|
"firstTimePeriodRedAndBlueFlash", |
|
|
|
|
|
"firstTimePeriodScreenSwitch", |
|
|
|
|
|
"firstTimePeriodWhetherToReport", |
|
|
|
|
|
"firstTimePeriodHornSwitch", |
|
|
|
|
|
"secondTimePeriodStartTTime", |
|
|
|
|
|
"secondTimePeriodEndTime", |
|
|
|
|
|
"secondTimePeriodRedAndBlueFlash", |
|
|
|
|
|
"secondTimePeriodScreenSwitch", |
|
|
|
|
|
"secondTimePeriodWhetherToReport", |
|
|
|
|
|
"secondTimePeriodHornSwitch", |
|
|
|
|
|
"thirdlyTimePeriodStartTTime", |
|
|
|
|
|
"thirdlyTimePeriodEndTime", |
|
|
|
|
|
"thirdlyTimePeriodRedAndBlueFlash", |
|
|
|
|
|
"thirdlyTimePeriodScreenSwitch", |
|
|
|
|
|
"thirdlyTimePeriodWhetherToReport", |
|
|
|
|
|
"thirdlyTimePeriodHornSwitch" |
|
|
] |
|
|
] |
|
|
} |
|
|
} |
|
|
}, |
|
|
}, |
|
|
methods:{ |
|
|
methods:{ |
|
|
handleSubmit(){ |
|
|
handleSubmit(){ |
|
|
this.$message.success('发送成功') |
|
|
const self = this; |
|
|
|
|
|
this.$refs.FormConfigRef.validate().then((data) => { |
|
|
|
|
|
|
|
|
|
|
|
data.numberOfDevices = this.dialogData.iotDeviceId.substr(this.dialogData.iotDeviceId.lastIndexOf('-')+1) |
|
|
|
|
|
request({ |
|
|
|
|
|
url: `/business/device/functions/${self.dialogData.iotDeviceId}/0b`, |
|
|
|
|
|
method: "POST", |
|
|
|
|
|
data: data |
|
|
|
|
|
}) |
|
|
|
|
|
.then(result => { |
|
|
|
|
|
if (result.code != 200) { |
|
|
|
|
|
Message.error("操作失败"); |
|
|
|
|
|
self.rebind() |
|
|
|
|
|
self.modelVisible = false |
|
|
|
|
|
return; |
|
|
|
|
|
}; |
|
|
|
|
|
Message.success("操作成功"); |
|
|
|
|
|
}) |
|
|
|
|
|
.catch(() => { |
|
|
|
|
|
Message.error("操作失败"); |
|
|
|
|
|
}) |
|
|
|
|
|
}) |
|
|
} |
|
|
} |
|
|
}, |
|
|
}, |
|
|
async created() { |
|
|
async created() { |
|
|
let devs = []; |
|
|
|
|
|
request({ |
|
|
request({ |
|
|
url: `/business/device/properties/latest/${this.dialogData.iotDeviceId}`, |
|
|
url: `/business/device/properties/latest/${this.dialogData.iotDeviceId}`, |
|
|
method: "get", |
|
|
method: "get", |
|
|
}).then(result => { |
|
|
}).then(result => { |
|
|
if (result.code != 200) return Message.error("操作失败"); |
|
|
if (result.code != 200) return Message.error("操作失败"); |
|
|
console.log(result.data) |
|
|
|
|
|
let n = _.find(result.data,{property:'numberOfPeriods'}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
let pv = ""; |
|
|
|
|
|
result.data.forEach(x=>{ |
|
|
|
|
|
pv += `${x.propertyName},${x.type},${x.property}.` |
|
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
let n = _.find(result.data,{property:'numberOfPeriods'}); |
|
|
|
|
|
let _formList = []; |
|
|
this.list.forEach(e => { |
|
|
this.list.forEach(e => { |
|
|
const p = _.find(result.data,{property:e}) |
|
|
const p = _.find(result.data,{property:e}) |
|
|
if(p) { |
|
|
if(p) { |
|
|
if(p.type === 'string' || p.type === 'long'){ |
|
|
if(p.type === 'string' || p.type === 'long'){ |
|
|
this.formList.push( { |
|
|
_formList.push( { |
|
|
label: p.propertyName+':', |
|
|
label: p.propertyName+':', |
|
|
key: p.property, |
|
|
key: p.property, |
|
|
}) |
|
|
}) |
|
|
|
|
|
} else if(p.type === 'enum' ){ |
|
|
|
|
|
if(p.property.indexOf('PeriodHornSwitch') !== -1 || |
|
|
|
|
|
p.property.indexOf('PeriodRedAndBlueFlash') !== -1 || |
|
|
|
|
|
p.property.indexOf('PeriodWhetherToReport') !== -1 || |
|
|
|
|
|
p.property.indexOf('firstTimePeriodScreenSwitch') !== -1 ){ // 号角开关 | 红蓝爆闪灯 |
|
|
|
|
|
_formList.push({ |
|
|
|
|
|
label: p.propertyName+':', |
|
|
|
|
|
key: p.property, |
|
|
|
|
|
type: "RadioGroup", |
|
|
|
|
|
options: { |
|
|
|
|
|
activeColor: "linear-gradient(180deg, #37E7FF 0%, #009BCC 100%)", |
|
|
|
|
|
options: [ |
|
|
|
|
|
{ |
|
|
|
|
|
key: "0", |
|
|
|
|
|
label: "关闭", |
|
|
|
|
|
}, |
|
|
|
|
|
{ |
|
|
|
|
|
key: "1", |
|
|
|
|
|
label: "开启", |
|
|
|
|
|
}, |
|
|
|
|
|
], |
|
|
|
|
|
}, |
|
|
|
|
|
}) |
|
|
|
|
|
} else if(p.property.indexOf('PeriodHornSwitch') !== -1){ |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
else if(p.property==="colour"){ |
|
|
|
|
|
this.formList.push({ |
|
|
|
|
|
|
|
|
} else if(p.property==="colour"){ |
|
|
|
|
|
_formList.push({ |
|
|
label: p.propertyName+':', |
|
|
label: p.propertyName+':', |
|
|
key: p.property, |
|
|
key: p.property, |
|
|
type: "select", |
|
|
type: "select", |
|
@ -118,9 +195,8 @@ export default { |
|
|
options: this.enum_color |
|
|
options: this.enum_color |
|
|
} |
|
|
} |
|
|
}) |
|
|
}) |
|
|
} |
|
|
} else if(p.property==="wordFlickerFrequency"){ |
|
|
else if(p.property==="wordFlickerFrequency"){ |
|
|
_formList.push({ |
|
|
this.formList.push({ |
|
|
|
|
|
label: p.propertyName+':', |
|
|
label: p.propertyName+':', |
|
|
key: p.property, |
|
|
key: p.property, |
|
|
type: "select", |
|
|
type: "select", |
|
@ -130,11 +206,10 @@ export default { |
|
|
} |
|
|
} |
|
|
}) |
|
|
}) |
|
|
} |
|
|
} |
|
|
this.formData[ p.property] =p.formatValue |
|
|
this.formData[p.property] = p.value |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
}) |
|
|
}) |
|
|
console.log(this.formList,this.formData) |
|
|
this.formList = _formList; |
|
|
}) |
|
|
}) |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -143,7 +218,7 @@ export default { |
|
|
|
|
|
|
|
|
<style lang="scss" scoped> |
|
|
<style lang="scss" scoped> |
|
|
.DeviceControlDialog { |
|
|
.DeviceControlDialog { |
|
|
width: 510px; |
|
|
width: 550px; |
|
|
display: flex; |
|
|
display: flex; |
|
|
flex-direction: column; |
|
|
flex-direction: column; |
|
|
gap: 15px; |
|
|
gap: 15px; |
|
|