Browse Source

事件修改

wangqin
zhoule 7 months ago
parent
commit
53df2ff9f2
  1. 217
      ruoyi-ui/src/views/JiHeExpressway/pages/control/event/commandDispatch/Cards/EventInformation/components/EditEventInformationDialog/index.vue

217
ruoyi-ui/src/views/JiHeExpressway/pages/control/event/commandDispatch/Cards/EventInformation/components/EditEventInformationDialog/index.vue

@ -1,10 +1,10 @@
<template> <template>
<Dialog v-model="modelVisible" title="修改事件信息" width="1100px" top="10%"> <Dialog v-model="modelVisible" title="修改事件信息" width="1100px" top="10%">
<div class="EditEventInformationDialog"> <div class="EditEventInformationDialog">
<Form class="form" :formList="formConfigList" v-model="fData" labelWidth="120px" /> <Form class="form" ref="FormConfigRef" :formList="formConfigList" v-model="fData" labelWidth="120px" />
<div class="footer"> <div class="footer">
<Button @click.native="onSubmit">保存</Button> <Button @click.native="onSubmit" :loading="submitting">保存</Button>
<Button style="background: #c9c9c9" @click.native="modelVisible = false">关闭</Button> <Button style="background: #c9c9c9" @click.native="modelVisible = false">关闭</Button>
</div> </div>
</div> </div>
@ -17,6 +17,7 @@ import Form from "@screen/components/FormConfig";
import Button from "@screen/components/Buttons/Button.vue"; import Button from "@screen/components/Buttons/Button.vue";
import request from "@/utils/request"; import request from "@/utils/request";
import { tabConfigList } from "./data.js"; import { tabConfigList } from "./data.js";
import { Message } from "element-ui";
const eventInfo = { const eventInfo = {
id: "60f022d95a7c4b6cada2d780246543d8", id: "60f022d95a7c4b6cada2d780246543d8",
@ -132,9 +133,10 @@ export default {
}, },
data() { data() {
return { return {
formConfigList: {}, formConfigList: [],
// tabConfigList, submitting: false,
fData: {}, fData: {},
resultEventData: {},
eventId: '1a91d65cc31f4a9d90122888edb31043', eventId: '1a91d65cc31f4a9d90122888edb31043',
roads: [], roads: [],
direction: [], direction: [],
@ -159,78 +161,161 @@ export default {
}, },
methods: { methods: {
initData() { async initData() {
let configList = tabConfigList.find(item => item.label == '交通事故') let infoData = await request({
this.formConfigList = configList.formConfig.list url: `/dc/system/event/eventSubclass/1/60f022d95a7c4b6cada2d780246543d8`,//
let info = eventInfo; method: "get",
if (info.stakeMark instanceof Array) { })
if (infoData.code != 200) return Message.error(infoData?.msg);
this.resultEventData = { ...infoData.data };
let info = infoData.data;
if (typeof info.stakeMark == 'string') {
let numbers = info.stakeMark.match(/\d+/g).map(Number); let numbers = info.stakeMark.match(/\d+/g).map(Number);
// console.log('numbers', numbers);
info.stakeMark = numbers; info.stakeMark = numbers;
} }
this.fData = info;
let configList = tabConfigList.find(item => item.label == this.fData.eventName)
this.formConfigList = configList.formConfig.list
this.fData = info; await Promise.all([
// Promise.all([ //
// // request({
// request({ url: `/business/road/query`,
// url: `/business/road/query`, method: "get",
// method: "get", })
// }) .then((result) => {
// .then((result) => { if (result.code != 200) return Message.error(result?.msg);
// if (result.code != 200) return Message.error(result?.msg); this.roads = [];
// result.data.forEach((it) => { result.data.forEach((it) => {
// this.roads.push({ key: it.id, label: it.roadName }); this.roads.push({ key: it.id, label: it.roadName });
// }); });
// }) })
// .catch((err) => { .catch((err) => {
// Message.error("4", err); Message.error("查询失败4", err);
// }), }),
// // //
// request({ request({
// url: `/system/dict/data/type/iot_event_direction`, url: `/system/dict/data/type/iot_event_direction`,
// method: "get", method: "get",
// }) })
// .then((result) => { .then((result) => {
// if (result.code != 200) return Message.error(result?.msg); if (result.code != 200) return Message.error(result?.msg);
// result.data.forEach((it) => { this.direction = []
// this.direction.push({ key: it.dictValue, label: it.dictLabel }); result.data.forEach((it) => {
// }); this.direction.push({ key: it.dictValue, label: it.dictLabel });
// }) });
// .catch((err) => { })
// Message.error("5", err); .catch((err) => {
// }), Message.error("查询失败5", err);
// // 1 2 3 4 5 6 }),
// request({ // 1 2 3 4 5 6
// url: `/business/facility/query`, request({
// method: "get", url: `/business/facility/query`,
// }) method: "get",
// .then((result) => { })
// if (result.code != 200) return Message.error(result?.msg); .then((result) => {
// result.data.forEach((it) => if (result.code != 200) return Message.error(result?.msg);
// this.lwss.push({ this.lwss = [];
// key: it.id, result.data.forEach((it) =>
// label: it.facilityName, this.lwss.push({
// type: it.facilityType, key: it.id,
// }) label: it.facilityName,
// ); type: it.facilityType,
// }) })
// .catch((err) => { );
// console.log("err", err); })
// Message.error("6", err); .catch((err) => {
// }), console.log("err", err);
// ]); Message.error("查询失败6", err);
// request({ }),
// url: `/dc/system/event/eventSubclass/1/60f022d95a7c4b6cada2d780246543d8`,// ])
// method: "get",
// }).then(async (result) => {
// if (result.code != 200) return Message.error(result?.msg);
// // this.formData = result.data;
// })
this.formConfigList.forEach((it) => {
if (it.key == "direction") {
it.options.options = this.direction;
}
if (it.key == "roadId") {
it.options.options = this.roads;
}
if (it.key == "dcEventServiceArea.facilityId") {
it.options.options = this.lwss.filter((ss) => ss.type == 6);
}
});
}, },
onSubmit() { onSubmit() {
this.$refs.FormConfigRef.validate().then((formData) => {
this.submitting = true;
let eventType = this.resultEventData.eventType;
formData.eventType == eventType;
if ((eventType == 1 || eventType == 2) && Array.isArray(formData.lang)) {
formData.lang = formData.lang.join(",");
}
if (eventType == 3 && formData.dcEventTrafficControl.facilityId instanceof Array) {
let ids = formData.dcEventTrafficControl.facilityId;
formData.dcEventTrafficControl.facilityIds = ids
formData.dcEventTrafficControl.facilityId = ''
}
if (formData.endStakeMark && formData.endStakeMark[0] != null) {
let endStakeMark = formData.endStakeMark;
let strMark = endStakeMark && endStakeMark.length > 0 ? "K" + endStakeMark[0] + "+" + endStakeMark[1] : "";
if (eventType == 4) {
formData.dcEventTrafficCongestion.endStakeMark = strMark;
}
if (eventType == 7) {
formData.dcEventConstruction.endStakeMark = strMark;
}
if (eventType == 10) {
formData.dcEventAbnormalWeather.endStakeMark = strMark;
}
formData.endStakeMark = "";
} else {
formData.endStakeMark = "";
}
let stakeMark = formData.stakeMark;
// console.log('formData', {
// ...formData,
// id: this.resultEventData.id,
// eventState: this.resultEventData.eventState,
// stakeMark: (stakeMark && stakeMark[0] != null) ? ((stakeMark && stakeMark.length > 0) ? ('K' + stakeMark[0] + '+' + stakeMark[1]) : '') : '',
// })
// this.submitting = false;
// return;
request({
url: `/dc/system/event`,
method: "put",
data: {
...formData,
id: this.resultEventData.id,
eventState: this.resultEventData.eventState,
stakeMark:
stakeMark && stakeMark[0] != null
? stakeMark && stakeMark.length > 0
? "K" + stakeMark[0] + "+" + stakeMark[1]
: ""
: "",
},
})
.then((result) => {
if (result.code != 200) return Message.error(result?.msg);
Message.success("提交成功");
this.modelVisible = false; this.modelVisible = false;
})
.catch(() => {
Message.error("提交失败");
})
.finally(() => {
this.submitting = false;
});
});
} }
} }
}; };

Loading…
Cancel
Save