Browse Source

Merge branch 'develop' of http://39.106.31.193:9211/mengff/jihe-hs into develop

wangqin
qingzhengli 11 months ago
parent
commit
e706ea4048
  1. 309
      ruoyi-ui/src/views/JiHeExpressway/pages/control/event/event/EventDetailDialog/eventPlanDialog/index.vue
  2. 2
      ruoyi-ui/src/views/JiHeExpressway/pages/control/event/event/EventDetailDialog/index.vue

309
ruoyi-ui/src/views/JiHeExpressway/pages/control/event/event/EventDetailDialog/eventPlanDialog/index.vue

@ -1,34 +1,32 @@
<template> <template>
<Dialog v-model="modelVisible" :title="title"> <Dialog v-model="modelVisible" :title="title">
<div class="EventAddPlanDialog"> <div class="EventAddPlanDialog">
<ElForm :model="formData" inline :rules="rules" ref="ruleForm"> <div class="first">
<div class="first"> <el-radio-group v-model="planName" @input="changeRadio">
<el-radio-group v-model="planName"> <el-radio-button v-for="item in info" :key="item.id" :label="item.planName"></el-radio-button>
<el-radio-button v-for="item in info" :key="item.id" :label="item.planName"></el-radio-button> </el-radio-group>
</el-radio-group> </div>
</div>
<div class="second"> <div class="second">
<el-row> <el-row>
<el-col :span="2"> <el-col :span="2">
<div class="text">联动设备:</div> <div class="text">联动设备:</div>
</el-col> </el-col>
<el-col :span="22"> <el-col :span="22">
<FormTable ref="secondFormTable" :tableData="secondFormData"></FormTable> <FormTable ref="secondFormTable" :tableData="secondFormData"></FormTable>
</el-col> </el-col>
</el-row> </el-row>
</div> </div>
<div class="third"> <div class="third">
<el-row> <el-row>
<el-col :span="2"> <el-col :span="2">
<div class="text">恢复操作:</div> <div class="text">恢复操作:</div>
</el-col> </el-col>
<el-col :span="22"> <el-col :span="22">
<FormTable ref="thirdFormTable" :tableData="thirdFormData"></FormTable> <FormTable ref="thirdFormTable" :tableData="thirdFormData"></FormTable>
</el-col> </el-col>
</el-row> </el-row>
</div> </div>
</ElForm>
</div> </div>
<template #footer> <template #footer>
@ -47,6 +45,7 @@ import Button from '@screen/components/Buttons/Button.vue';
import request from '@/utils/request'; import request from '@/utils/request';
import { Message } from "element-ui"; import { Message } from "element-ui";
import { throttle } from "lodash" import { throttle } from "lodash"
import { isDate } from 'mathjs';
export default { export default {
@ -77,12 +76,8 @@ export default {
title: '事件确认', title: '事件确认',
dialogType: 1, dialogType: 1,
planId: 0, planId: 0,
plans: [],
submitting: false, submitting: false,
formData: {
eventCategory: 1,
eventType: 1,
triggerMechanism: 1
},
secondFormData: [{ secondFormData: [{
deviceType: 1, deviceType: 1,
searchRule: 1, searchRule: 1,
@ -180,15 +175,6 @@ export default {
label: '小于(<)' label: '小于(<)'
}, },
], ],
rules: {
planName: [
{ required: true, message: '请输入预案名称', trigger: 'blur' },
],
eventType: [
{ required: true, message: '请选择事件类型', trigger: 'change' }
],
}
} }
}, },
mounted() { mounted() {
@ -198,8 +184,10 @@ export default {
modelVisible: { modelVisible: {
get() { get() {
if (this.visible) { if (this.visible) {
this.planName = this.info[0]?.planName || ''; if (this.info.length > 0) {
this.dcExecuteAction = this.info[0]?.dcExecuteAction || []; this.planName = this.info[0]?.planName || '';
this.initData(this.info[0]);
}
} }
return this.visible; return this.visible;
}, },
@ -210,26 +198,37 @@ export default {
}, },
methods: { methods: {
initData(data) { initData(data) {
this.planId = data.id; console.log('data', data)
this.formData = { if (!data) return;
eventCategory: data.eventCategory, // this.planId = data.id;
planName: data.planName, let dcExecuteAction = data.dcExecuteAction;
eventType: data.eventType, let secondFormData = [];
triggerMechanism: data.triggerMechanism, let thirdFormData = [];
} dcExecuteAction.forEach(it => {
this.secondFormData = []; let action = { ...it };
this.thirdFormData = []; if (it.otherConfig) {
dcExecuteAction.forEach(it => { let config = JSON.parse(it.otherConfig);
if (it.deviceList) { let qbb = ''
it.deviceList = it.deviceList.split(','); if (config.id) {
qbb = config.content;
config = { dcInfoBoardTemplate: config };
} }
if (it.actionType == 1) { // if (config.state) {
this.secondFormData.push(it); // config.gzms = config.state
} else if (it.actionType == 2) { // }
this.thirdFormData.push(it); action = { ...it, ...config, qbb: qbb };
} }
}) if (it.deviceList) {
action.deviceList = it.deviceList.split(',').map(str => Number(str));
}
if (it.actionType == 1) {
secondFormData.push(action);
} else if (it.actionType == 2) {
thirdFormData.push(action);
}
})
this.secondFormData = secondFormData;
this.thirdFormData = thirdFormData;
}, },
async loadData() { async loadData() {
if (this.deviceData.length <= 0) { if (this.deviceData.length <= 0) {
@ -238,91 +237,20 @@ export default {
method: "get", method: "get",
}) })
if (result.code != 200) return Message.error(result?.msg); if (result.code != 200) return Message.error(result?.msg);
console.log('123'); // console.log('123');
this.deviceData = result.data; this.deviceData = result.data;
// return result.data; // return result.data;
} }
return this.deviceData; return this.deviceData;
}, },
changeEventType(value = 1) { changeRadio(value) {
this.mechanismOptions = optionsMap[this.formData.eventCategory || 1][value]; console.log('va', value)
}, let plan = this.info.find(it => it.planName == value);
changeRadio(value = 1) { console.log('plan', plan)
const optionsMap = { this.initData(plan);
1: [{
value: 1,
label: '异常天气'
},
{
value: 2,
label: '交通事故'
},
{
value: 3,
label: '非法上路'
},
{
value: 4,
label: '车辆故障'
},
{
value: 5,
label: '交通拥堵'
},
{
value: 6,
label: '交通管制'
},
{
value: 7,
label: '服务区异常'
},
{
value: 8,
label: '施工建设'
},
{
value: 9,
label: '路障清除'
}],
2: [{
value: 1,
label: '异常天气'
},
{
value: 2,
label: '拥堵'
},
{
value: 3,
label: '非机动车'
},
{
value: 4,
label: '行人'
},
{
value: 5,
label: '烟火'
},
{
value: 6,
label: '抛洒物'
},
{
value: 7,
label: '逆行'
},
]
}
this.eventOptions = optionsMap[value];
this.changeEventType();
},
handleChange() {
}, },
formatData(it, value = 1) { formatData(it, value = 1) {
let data = { ...it, actionType: value } let data = { ...it, actionType: value, emergencyPlansId: id }
if (it.deviceList && typeof it.deviceList !== 'string' && it.deviceList.length > 0) { if (it.deviceList && typeof it.deviceList !== 'string' && it.deviceList.length > 0) {
data.deviceList = it.deviceList.join(','); data.deviceList = it.deviceList.join(',');
} else { } else {
@ -334,12 +262,16 @@ export default {
if (it.controlModel) { if (it.controlModel) {
let other = { let other = {
controlModel: it.controlModel, controlModel: it.controlModel,
controlModelName: controlModelMap[it.controlModel],
state: it.state, state: it.state,
name: gzztMap[it.state]
} }
if (it.time && it?.time[0]) { if (it.time && it?.time[0]) {
other = { other = {
controlModel: it.controlModel, controlModel: it.controlModel,
controlModelName: controlModelMap[it.controlModel],
state: it.state, state: it.state,
name: gzztMap[it.state],
startTime: it.time[0], startTime: it.time[0],
endTime: it.time[1] endTime: it.time[1]
} }
@ -349,74 +281,55 @@ export default {
if (it.gzms) { if (it.gzms) {
data.otherConfig = JSON.stringify({ data.otherConfig = JSON.stringify({
state: it.gzms, state: it.gzms,
name: gzmsMap[it.gzms],
operationDuration: it.operationDuration, operationDuration: it.operationDuration,
}) })
} }
return data; return data;
}, },
handleSubmit() { handleSubmit() {
this.$refs['ruleForm'].validate((valid) => { // this.submitting = false;
if (valid) { let secondFormTable = this.$refs['secondFormTable'].tableData || [];
// this.submitting = false; let thirdFormTable = this.$refs['thirdFormTable'].tableData || [];
let secondFormTable = this.$refs['secondFormTable'].tableData || []; console.log('12', thirdFormTable);
let thirdFormTable = this.$refs['thirdFormTable'].tableData || []; let dcArr = [];
let dcArr = []; let id = '';
secondFormTable.forEach(it => { if (this.dialogType == 2) id = this.planId;
dcArr.push(this.formatData(it, 1)); secondFormTable.forEach(it => {
}) dcArr.push(this.formatData(it, 1, id));
thirdFormTable.forEach(it => { })
dcArr.push(this.formatData(it, 2)); thirdFormTable.forEach(it => {
}) dcArr.push(this.formatData(it, 2, id));
})
console.log({
...this.formData,
dcExecuteAction: dcArr
})
// return;
if (this.dialogType == 1) {//
request({
url: `/business/plans`,
method: "post",
data: {
...this.formData,
dcExecuteAction: dcArr
}
}).then((result) => {
if (result.code != 200) return Message.error(result?.msg);
Message.success("提交成功");
this.modelVisible = false;
}).catch(() => {
Message.error("提交失败");
}).finally(() => {
this.submitting = false;
this.$emit('reInitData', true);
})
} else if (this.dialogType == 2) {//
request({
url: `/business/plans`,
method: "put",
data: {
...this.formData,
id: this.planId,
dcExecuteAction: dcArr
}
}).then((result) => {
if (result.code != 200) return Message.error(result?.msg);
Message.success("提交成功");
this.modelVisible = false;
}).catch(() => {
Message.error("提交失败");
}).finally(() => {
this.submitting = false;
this.$emit('reInitData', true);
})
} console.log({
dcExecuteAction: dcArr
})
return;
if (this.dialogType == 1) {//
} else if (this.dialogType == 2) {//
// request({
// url: `/business/plans`,
// method: "put",
// data: {
// ...this.formData,
// id: this.planId,
// dcExecuteAction: dcArr
// }
// }).then((result) => {
// if (result.code != 200) return Message.error(result?.msg);
// Message.success("");
// this.modelVisible = false;
// }).catch(() => {
// Message.error("");
// }).finally(() => {
// this.submitting = false;
// this.$emit('reInitData', true);
// })
} }
})
} }
} }

2
ruoyi-ui/src/views/JiHeExpressway/pages/control/event/event/EventDetailDialog/index.vue

@ -187,7 +187,6 @@ export default {
}, },
onSubmit() { onSubmit() {
this.isShowDialog = true;
let url = '/business/plans/list/warning/type' let url = '/business/plans/list/warning/type'
if (this.activeName == '-1') { if (this.activeName == '-1') {
url = '/business/plans/list/warning/type' url = '/business/plans/list/warning/type'
@ -201,6 +200,7 @@ export default {
}).then(result => { }).then(result => {
if (result.code != 200) return Message.error(result?.msg); if (result.code != 200) return Message.error(result?.msg);
this.info = result.data; this.info = result.data;
this.isShowDialog = true;
}) })
} }

Loading…
Cancel
Save