Browse Source

合流区参数

wangqin
王钦 6 months ago
parent
commit
bdd1d87b68
  1. 115
      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

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

@ -1,19 +1,18 @@
<template>
<Dialog v-model="modelVisible" title="设备操作" width="550px">
<Dialog v-model="modelVisible" title="设备操作" width="600px">
<div class="DeviceControlDialog">
<Form
column="2"
v-if="formList && formList.length"
class="form"
ref="FormConfigRef"
label-width='120px'
label-width='150px'
:formList="formList"
:value="formData"
/>
</div>
<template #footer>
<!-- 王思祥 回读待确认 2024-05-16 TODO-->
<Button @click.native="handleSubmit" :loading="submitting"> 发送 </Button>
<Button @click.native="handleSubmit"> 发送 </Button>
</template>
</Dialog>
</template>
@ -23,6 +22,8 @@
import Button from "@screen/components/Buttons/Button.vue";
import Dialog from "@screen/components/Dialog/index.vue";
import request from "@/utils/request";
import { Message } from 'element-ui'
import Form from "@screen/components/FormConfig";
export default {
name: "DeviceControlDialog",
@ -36,6 +37,12 @@ export default {
event: "update:value",
},
props: {
rebind: {
type: Function,
default: null
},
visible: Boolean,
dialogData: {
type: Object,
@ -80,36 +87,106 @@ export default {
"triggerTextDuration",
"normalTextDisplaySettings",
"vehicleDetectorSensitivity",
"calculationCycle"
"calculationCycle",
"firstTimePeriodStartTTime",
"firstTimePeriodEndTime",
"firstTimePeriodRedAndBlueFlash",
"firstTimePeriodScreenSwitch",
"firstTimePeriodWhetherToReport",
"firstTimePeriodHornSwitch",
"secondTimePeriodStartTTime",
"secondTimePeriodEndTime",
"secondTimePeriodRedAndBlueFlash",
"secondTimePeriodScreenSwitch",
"secondTimePeriodWhetherToReport",
"secondTimePeriodHornSwitch",
"thirdlyTimePeriodStartTTime",
"thirdlyTimePeriodEndTime",
"thirdlyTimePeriodRedAndBlueFlash",
"thirdlyTimePeriodScreenSwitch",
"thirdlyTimePeriodWhetherToReport",
"thirdlyTimePeriodHornSwitch"
]
}
},
methods:{
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() {
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.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 => {
const p = _.find(result.data,{property:e})
if(p) {
if(p.type === 'string' || p.type === 'long'){
this.formList.push( {
_formList.push( {
label: p.propertyName+':',
key: p.property,
})
}
else if(p.property==="colour"){
this.formList.push({
} 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"){
_formList.push({
label: p.propertyName+':',
key: p.property,
type: "select",
@ -118,9 +195,8 @@ export default {
options: this.enum_color
}
})
}
else if(p.property==="wordFlickerFrequency"){
this.formList.push({
} else if(p.property==="wordFlickerFrequency"){
_formList.push({
label: p.propertyName+':',
key: p.property,
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>
.DeviceControlDialog {
width: 510px;
width: 550px;
display: flex;
flex-direction: column;
gap: 15px;

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

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

Loading…
Cancel
Save