|
|
@ -1,5 +1,5 @@ |
|
|
|
<template> |
|
|
|
<Dialog v-model="modelVisible" title="新增预案"> |
|
|
|
<Dialog v-model="modelVisible" :title="title"> |
|
|
|
<div class="EventAddPlanDialog"> |
|
|
|
<ElForm :model="formData" inline :rules="rules" ref="ruleForm"> |
|
|
|
<div class="first"> |
|
|
@ -33,6 +33,7 @@ |
|
|
|
</el-option> |
|
|
|
</el-select> |
|
|
|
</el-form-item> |
|
|
|
|
|
|
|
<el-form-item |
|
|
|
v-if=" |
|
|
|
(formData.eventCategory == 1 && formData.eventType !== 8) || |
|
|
@ -81,26 +82,33 @@ |
|
|
|
</el-select> |
|
|
|
</el-form-item> |
|
|
|
</div> |
|
|
|
|
|
|
|
<div class="second"> |
|
|
|
<el-row> |
|
|
|
<el-col :span="2"> |
|
|
|
<div class="text">执行操作:</div> |
|
|
|
</el-col> |
|
|
|
<el-col :span="22"> |
|
|
|
<FormTable ref="secondFormTable"></FormTable> |
|
|
|
<FormTable |
|
|
|
ref="secondFormTable" |
|
|
|
:tableData="secondFormData" |
|
|
|
></FormTable> |
|
|
|
</el-col> |
|
|
|
</el-row> |
|
|
|
</div> |
|
|
|
<div class="third"> |
|
|
|
<el-row> |
|
|
|
<el-col :span="2"> |
|
|
|
<div class="text">恢复操作:</div> |
|
|
|
</el-col> |
|
|
|
<el-col :span="22"> |
|
|
|
<FormTable |
|
|
|
ref="thirdFormTable" |
|
|
|
:tableData="thirdFormData" |
|
|
|
></FormTable> |
|
|
|
</el-col> |
|
|
|
</el-row> |
|
|
|
</div> |
|
|
|
<!-- <div class="third"> |
|
|
|
<el-row> |
|
|
|
<el-col :span="2"> |
|
|
|
<div class="text">恢复操作:</div> |
|
|
|
</el-col> |
|
|
|
<el-col :span="22"> |
|
|
|
<FormTable></FormTable> |
|
|
|
</el-col> |
|
|
|
</el-row> |
|
|
|
</div> --> |
|
|
|
</ElForm> |
|
|
|
</div> |
|
|
|
|
|
|
@ -324,18 +332,29 @@ export default { |
|
|
|
}, |
|
|
|
data() { |
|
|
|
return { |
|
|
|
activeName: "TrafficAccident", |
|
|
|
title: "新增预案", |
|
|
|
dialogType: 1, |
|
|
|
planId: 0, |
|
|
|
submitting: false, |
|
|
|
formConfig: {}, |
|
|
|
formData: { |
|
|
|
eventCategory: 1, |
|
|
|
eventType: 1, |
|
|
|
triggeringCondition: 0, |
|
|
|
triggerMechanism: 1, |
|
|
|
}, |
|
|
|
index: 1, |
|
|
|
roads: [], |
|
|
|
direction: [], |
|
|
|
lwss: [], |
|
|
|
secondFormData: [ |
|
|
|
{ |
|
|
|
deviceType: 1, |
|
|
|
searchRule: 1, |
|
|
|
qbb: "安全行驶", |
|
|
|
}, |
|
|
|
], |
|
|
|
thirdFormData: [ |
|
|
|
{ |
|
|
|
deviceType: 1, |
|
|
|
searchRule: 1, |
|
|
|
qbb: "安全行驶", |
|
|
|
}, |
|
|
|
], |
|
|
|
eventOptions: [ |
|
|
|
{ |
|
|
|
value: 1, |
|
|
@ -423,86 +442,76 @@ export default { |
|
|
|
}, |
|
|
|
], |
|
|
|
rules: { |
|
|
|
planName: [{ required: true, message: "请输入预案名称" }], |
|
|
|
planName: [ |
|
|
|
{ required: true, message: "请输入预案名称", trigger: "blur" }, |
|
|
|
], |
|
|
|
eventType: [ |
|
|
|
{ required: true, message: "请选择事件类型", trigger: "change" }, |
|
|
|
], |
|
|
|
}, |
|
|
|
}; |
|
|
|
}, |
|
|
|
created() { |
|
|
|
// this.formConfig = tabConfigList[0].formConfig; |
|
|
|
this.initData().then(() => { |
|
|
|
this.handleChange({ index: 0 }); |
|
|
|
}); |
|
|
|
}, |
|
|
|
mounted() {}, |
|
|
|
computed: { |
|
|
|
modelVisible: { |
|
|
|
get() { |
|
|
|
if (this.visible) { |
|
|
|
if (Object.keys(this.detail).length > 0) { |
|
|
|
this.title = "修改预案"; |
|
|
|
this.dialogType = 2; |
|
|
|
this.initData(this.detail.id); |
|
|
|
} else { |
|
|
|
this.title = "新增预案"; |
|
|
|
this.dialogType = 1; |
|
|
|
this.formData = { |
|
|
|
eventCategory: 1, |
|
|
|
eventType: 1, |
|
|
|
triggerMechanism: 0, |
|
|
|
}; |
|
|
|
} |
|
|
|
} |
|
|
|
return this.visible; |
|
|
|
}, |
|
|
|
set(val) { |
|
|
|
this.$emit("close", val); |
|
|
|
}, |
|
|
|
}, |
|
|
|
getFormOptions() { |
|
|
|
return { |
|
|
|
column: 3, |
|
|
|
...this.formConfig.formOptions, |
|
|
|
}; |
|
|
|
}, |
|
|
|
}, |
|
|
|
methods: { |
|
|
|
initData() { |
|
|
|
return Promise.all([ |
|
|
|
//道路 |
|
|
|
request({ |
|
|
|
url: `/business/road/query`, |
|
|
|
method: "get", |
|
|
|
}) |
|
|
|
.then((result) => { |
|
|
|
if (result.code != 200) return Message.error(result?.msg); |
|
|
|
result.data.forEach((it) => { |
|
|
|
this.roads.push({ key: it.id, label: it.roadName }); |
|
|
|
}); |
|
|
|
}) |
|
|
|
.catch((err) => { |
|
|
|
Message.error("查询失败4", err); |
|
|
|
}), |
|
|
|
//方向字典 |
|
|
|
request({ |
|
|
|
url: `/system/dict/data/type/iot_event_direction`, |
|
|
|
method: "get", |
|
|
|
}) |
|
|
|
.then((result) => { |
|
|
|
if (result.code != 200) return Message.error(result?.msg); |
|
|
|
result.data.forEach((it) => { |
|
|
|
this.direction.push({ key: it.dictValue, label: it.dictLabel }); |
|
|
|
}); |
|
|
|
}) |
|
|
|
.catch((err) => { |
|
|
|
Message.error("查询失败5", err); |
|
|
|
}), |
|
|
|
//路网设施 1 收费站 2 桥梁 3 互通立交 4 枢纽立交 5 隧道 6 服务区 |
|
|
|
request({ |
|
|
|
url: `/business/facility/query`, |
|
|
|
method: "get", |
|
|
|
initData(id = 1) { |
|
|
|
request({ |
|
|
|
url: `/business/plans/list/${id}`, |
|
|
|
method: "get", |
|
|
|
}) |
|
|
|
.then((result) => { |
|
|
|
if (result.code != 200) return Message.error(result?.msg); |
|
|
|
let data = result.data; |
|
|
|
let dcExecuteAction = result.data.dcExecuteAction; |
|
|
|
|
|
|
|
this.planId = data.id; |
|
|
|
this.formData = { |
|
|
|
eventCategory: data.eventCategory, |
|
|
|
planName: data.planName, |
|
|
|
eventType: data.eventType, |
|
|
|
triggerMechanism: data.triggerMechanism, |
|
|
|
}; |
|
|
|
this.secondFormData = []; |
|
|
|
this.thirdFormData = []; |
|
|
|
dcExecuteAction.forEach((it) => { |
|
|
|
if (it.deviceList) { |
|
|
|
it.deviceList = it.deviceList.split(","); |
|
|
|
} |
|
|
|
if (it.actionType == 1) { |
|
|
|
this.secondFormData.push(it); |
|
|
|
} else if (it.actionType == 2) { |
|
|
|
this.thirdFormData.push(it); |
|
|
|
} |
|
|
|
}); |
|
|
|
}) |
|
|
|
.then((result) => { |
|
|
|
if (result.code != 200) return Message.error(result?.msg); |
|
|
|
result.data.forEach((it) => |
|
|
|
this.lwss.push({ |
|
|
|
key: it.id, |
|
|
|
label: it.facilityName, |
|
|
|
type: it.facilityType, |
|
|
|
}) |
|
|
|
); |
|
|
|
}) |
|
|
|
.catch((err) => { |
|
|
|
console.log("err", err); |
|
|
|
Message.error("查询失败6", err); |
|
|
|
}), |
|
|
|
]); |
|
|
|
.catch((err) => { |
|
|
|
console.log(err); |
|
|
|
Message.error("查询事件预案列表失败", err); |
|
|
|
}); |
|
|
|
}, |
|
|
|
changeEventType(value = 1) { |
|
|
|
this.mechanismOptions = |
|
|
@ -586,41 +595,86 @@ export default { |
|
|
|
handleSubmit() { |
|
|
|
this.$refs["ruleForm"].validate((valid) => { |
|
|
|
if (valid) { |
|
|
|
this.submitting = true; |
|
|
|
console.log("formData", this.formData); |
|
|
|
this.modelVisible = false; |
|
|
|
this.submitting = false; |
|
|
|
// this.$emit('queryData',true) |
|
|
|
console.log(this.$refs["secondFormTable"].tableData); |
|
|
|
return; |
|
|
|
// this.submitting = false; |
|
|
|
let secondFormTable = this.$refs["secondFormTable"].tableData || []; |
|
|
|
let thirdFormTable = this.$refs["thirdFormTable"].tableData || []; |
|
|
|
let dcArr = []; |
|
|
|
secondFormTable.forEach((it) => { |
|
|
|
if ( |
|
|
|
it.deviceList && |
|
|
|
typeof it.deviceList !== "string" && |
|
|
|
it.deviceList.length > 0 |
|
|
|
) { |
|
|
|
it.deviceList = it.deviceList.join(","); |
|
|
|
} else { |
|
|
|
it.deviceList = ""; |
|
|
|
} |
|
|
|
dcArr.push({ ...it, actionType: 1 }); |
|
|
|
}); |
|
|
|
thirdFormTable.forEach((it) => { |
|
|
|
if ( |
|
|
|
it.deviceList && |
|
|
|
typeof it.deviceList !== "string" && |
|
|
|
it.deviceList.length > 0 |
|
|
|
) { |
|
|
|
it.deviceList = it.deviceList.join(","); |
|
|
|
} else { |
|
|
|
it.deviceList = ""; |
|
|
|
} |
|
|
|
dcArr.push({ ...it, actionType: 2 }); |
|
|
|
}); |
|
|
|
|
|
|
|
request({ |
|
|
|
url: `/dc/system/event`, |
|
|
|
method: "post", |
|
|
|
data: { |
|
|
|
...formData, |
|
|
|
eventType: Number(this.index) + 1, |
|
|
|
eventState: 0, |
|
|
|
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; |
|
|
|
console.log({ |
|
|
|
...this.formData, |
|
|
|
dcExecuteAction: dcArr, |
|
|
|
}); |
|
|
|
// return; |
|
|
|
if (this.dialogType == 1) { |
|
|
|
//新增 |
|
|
|
request({ |
|
|
|
url: `/business/plans`, |
|
|
|
method: "post", |
|
|
|
data: { |
|
|
|
...this.formData, |
|
|
|
dcExecuteAction: dcArr, |
|
|
|
}, |
|
|
|
}) |
|
|
|
.catch(() => { |
|
|
|
Message.error("提交失败"); |
|
|
|
.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, |
|
|
|
}, |
|
|
|
}) |
|
|
|
.finally(() => { |
|
|
|
this.submitting = false; |
|
|
|
this.$emit("queryData", true); |
|
|
|
}); |
|
|
|
.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); |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
}, |
|
|
|