Browse Source

合流区参数

wangqin
王钦 6 months ago
parent
commit
bdd1d87b68
  1. 117
      ruoyi-ui/src/views/JiHeExpressway/pages/Home/components/Dialogs/ConfluenceArea/components/DeviceControlDialog.vue
  2. 43
      ruoyi-ui/src/views/JiHeExpressway/pages/Home/components/Dialogs/ConfluenceArea/components/DeviceParams.vue
  3. 13
      ruoyi-ui/src/views/JiHeExpressway/pages/Home/components/Dialogs/ConfluenceArea/index.vue

117
ruoyi-ui/src/views/JiHeExpressway/pages/Home/components/Dialogs/ConfluenceArea/components/DeviceControlDialog.vue

@ -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 pv = "";
result.data.forEach(x=>{
pv += `${x.propertyName},${x.type},${x.property}.`
})
let n = _.find(result.data,{property:'numberOfPeriods'}); 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' ){
else if(p.property==="colour"){ if(p.property.indexOf('PeriodHornSwitch') !== -1 ||
this.formList.push({ 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"){
_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,12 +218,12 @@ 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;
min-height: 360px; min-height: 360px;
.tips { .tips {
font-size: 12px; font-size: 12px;
} }

43
ruoyi-ui/src/views/JiHeExpressway/pages/Home/components/Dialogs/ConfluenceArea/components/DeviceParams.vue

@ -46,28 +46,31 @@ export default {
} }
}, },
async created() { async created() {
this.devicesList = []; this.bind();
let devs = [];
request({
url: `/business/device/properties/latest/${this.dialogData.iotDeviceId}`,
method: "get",
}).then(result => {
if (result.code != 200) return Message.error("操作失败");
result.data.forEach(item => {
if (item.propertyName) {
devs.push({
label: item.propertyName,
key: item.property,
gridColumn: 3,
});
this.devicesData[item.property] = item.formatValue;
}
});
this.devicesList = devs;
})
}, },
methods: { methods: {
bind(){
this.devicesList = [];
let devs = [];
request({
url: `/business/device/properties/latest/${this.dialogData.iotDeviceId}`,
method: "get",
}).then(result => {
if (result.code != 200) return Message.error("操作失败");
console.log('------------',result)
result.data.forEach(item => {
if (item.propertyName) {
devs.push({
label: item.propertyName,
key: item.property,
gridColumn: 3,
});
this.devicesData[item.property] = item.formatValue;
}
});
this.devicesList = devs;
})
},
async handleSwitcherChange(value, data) { async handleSwitcherChange(value, data) {
let str = data.state ? "关闭" : "开启"; let str = data.state ? "关闭" : "开启";
let deviceName = ""; let deviceName = "";

13
ruoyi-ui/src/views/JiHeExpressway/pages/Home/components/Dialogs/ConfluenceArea/index.vue

@ -8,7 +8,7 @@
<Descriptions :list="list" :data="data" style="gap: 18px" /> <Descriptions :list="list" :data="data" style="gap: 18px" />
</ElTabPane> </ElTabPane>
<ElTabPane label="设备参数" name="second"> <ElTabPane label="设备参数" name="second">
<DeviceParams disabled :dialogData="dialogData" /> <DeviceParams ref="refParam" disabled :dialogData="dialogData" />
</ElTabPane> </ElTabPane>
<ElTabPane label="在线率统计" name="third"> <ElTabPane label="在线率统计" name="third">
<LineChart v-if="activeName === 'third'" :productId="dialogData.id" style="height: 180px" /> <LineChart v-if="activeName === 'third'" :productId="dialogData.id" style="height: 180px" />
@ -21,7 +21,7 @@
</Button> </Button>
</template> </template>
<DeviceControlDialog v-model="deviceControlVisible" :dialogData="dialogData" /> <DeviceControlDialog :rebind="rebind" v-model="deviceControlVisible" :dialogData="dialogData" />
</Dialog> </Dialog>
</template> </template>
@ -48,6 +48,7 @@ export default {
mixins: [dialogDelayVisible], mixins: [dialogDelayVisible],
components: { components: {
Dialog, Dialog,
Descriptions, Descriptions,
LineChart, LineChart,
Video, Video,
@ -57,6 +58,7 @@ export default {
}, },
data() { data() {
return { return {
refParam:null,
activeName: "first", activeName: "first",
releaseVisible: false, releaseVisible: false,
deviceControlVisible: false, deviceControlVisible: false,
@ -93,10 +95,6 @@ export default {
enum: "DeviceTypeEnum", enum: "DeviceTypeEnum",
// visible: false, // visible: false,
}, },
// {
// label: "",
// key: "deviceStateLiteral",
// },
{ {
label: "设备厂商", label: "设备厂商",
key: "manufacturer", key: "manufacturer",
@ -118,6 +116,9 @@ export default {
if (roadInfo) this.data.roadName = roadInfo.roadName; if (roadInfo) this.data.roadName = roadInfo.roadName;
}, },
methods: { methods: {
rebind(){
this.$refs.refParam.bind()
},
async getDeviceInfo() { async getDeviceInfo() {
return request({ return request({
url: `/business/device/properties/latest/${this.dialogData.iotDeviceId || "10.0.36.143-1883" url: `/business/device/properties/latest/${this.dialogData.iotDeviceId || "10.0.36.143-1883"

Loading…
Cancel
Save