|
|
|
@ -1,9 +1,13 @@ |
|
|
|
<template> |
|
|
|
<Dialog v-model="modelVisible" :title="title"> |
|
|
|
<Dialog v-model="modelVisible" :title="title" width="35vw"> |
|
|
|
<div class="EventAddPlanDialog"> |
|
|
|
<div class="first"> |
|
|
|
<el-radio-group v-model="planName" @input="changeRadio"> |
|
|
|
<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> |
|
|
|
</div> |
|
|
|
|
|
|
|
@ -13,7 +17,11 @@ |
|
|
|
<div class="text">联动设备:</div> |
|
|
|
</el-col> |
|
|
|
<el-col :span="22"> |
|
|
|
<FormTable ref="secondFormTable" :tableData="secondFormData" :type="1"></FormTable> |
|
|
|
<FormTable |
|
|
|
ref="secondFormTable" |
|
|
|
:tableData="secondFormData" |
|
|
|
:type="1" |
|
|
|
></FormTable> |
|
|
|
</el-col> |
|
|
|
</el-row> |
|
|
|
</div> |
|
|
|
@ -23,7 +31,11 @@ |
|
|
|
<div class="text">恢复操作:</div> |
|
|
|
</el-col> |
|
|
|
<el-col :span="22"> |
|
|
|
<FormTable ref="thirdFormTable" :tableData="thirdFormData" :type="2"></FormTable> |
|
|
|
<FormTable |
|
|
|
ref="thirdFormTable" |
|
|
|
:tableData="thirdFormData" |
|
|
|
:type="2" |
|
|
|
></FormTable> |
|
|
|
</el-col> |
|
|
|
</el-row> |
|
|
|
</div> |
|
|
|
@ -32,72 +44,88 @@ |
|
|
|
<template #footer> |
|
|
|
<!-- <Button v-if="isDisBtn" style="padding:0 24px; pointer-events: none; background-color: #C9C9C9;" |
|
|
|
@click.native="handleRestore" :loading="submitting">强制恢复</Button> --> |
|
|
|
<Button style="padding:0 24px;" @click.native="handleSubmit(2)" :loading="submitting">强制恢复</Button> |
|
|
|
<Button style="padding:0 24px;" @click.native="handleSubmit(1)" :loading="submitting">确认</Button> |
|
|
|
<Button style="background: #C9C9C9;padding:0 24px;" |
|
|
|
@click.native="modelVisible = false, submitting = false">取消</Button> |
|
|
|
<Button |
|
|
|
style="padding: 0 24px" |
|
|
|
@click.native="handleSubmit(2)" |
|
|
|
:loading="submitting" |
|
|
|
>强制恢复</Button |
|
|
|
> |
|
|
|
<Button |
|
|
|
style="padding: 0 24px" |
|
|
|
@click.native="handleSubmit(1)" |
|
|
|
:loading="submitting" |
|
|
|
>确认</Button |
|
|
|
> |
|
|
|
<Button |
|
|
|
style="background: #c9c9c9; padding: 0 24px" |
|
|
|
@click.native="(modelVisible = false), (submitting = false)" |
|
|
|
>取消</Button |
|
|
|
> |
|
|
|
</template> |
|
|
|
</Dialog> |
|
|
|
</template> |
|
|
|
|
|
|
|
<script> |
|
|
|
import Dialog from "@screen/components/Dialog/index"; |
|
|
|
import FormTable from '../formTable/index.vue'; |
|
|
|
import Button from '@screen/components/Buttons/Button.vue'; |
|
|
|
import request from '@/utils/request'; |
|
|
|
import FormTable from "../formTable/index.vue"; |
|
|
|
import Button from "@screen/components/Buttons/Button.vue"; |
|
|
|
import request from "@/utils/request"; |
|
|
|
import { Message } from "element-ui"; |
|
|
|
import { throttle } from "lodash" |
|
|
|
|
|
|
|
import { throttle } from "lodash"; |
|
|
|
|
|
|
|
export default { |
|
|
|
name: 'eventPlanDialog', |
|
|
|
name: "eventPlanDialog", |
|
|
|
components: { |
|
|
|
Dialog, |
|
|
|
Button, |
|
|
|
FormTable |
|
|
|
FormTable, |
|
|
|
}, |
|
|
|
model: { |
|
|
|
prop: 'visible', |
|
|
|
event: 'close' |
|
|
|
prop: "visible", |
|
|
|
event: "close", |
|
|
|
}, |
|
|
|
provide() { |
|
|
|
return { |
|
|
|
loadData: throttle(this.loadData, 1000), |
|
|
|
getAutomatic: this.getTemplateAutomatic, |
|
|
|
getOriginal: this.getBoardOriginal |
|
|
|
} |
|
|
|
getOriginal: this.getBoardOriginal, |
|
|
|
}; |
|
|
|
}, |
|
|
|
props: { |
|
|
|
visible: Boolean, |
|
|
|
activeName: String, |
|
|
|
info: { |
|
|
|
type: Array, |
|
|
|
default: () => [] |
|
|
|
default: () => [], |
|
|
|
}, |
|
|
|
eventFormData: { |
|
|
|
type: Object, |
|
|
|
default: () => { } |
|
|
|
} |
|
|
|
default: () => {}, |
|
|
|
}, |
|
|
|
}, |
|
|
|
data() { |
|
|
|
return { |
|
|
|
title: '事件确认', |
|
|
|
title: "事件确认", |
|
|
|
isDisBtn: true, |
|
|
|
dialogType: 1, |
|
|
|
planId: 0, |
|
|
|
planInfo: {}, |
|
|
|
submitting: false, |
|
|
|
secondFormData: [{ |
|
|
|
secondFormData: [ |
|
|
|
{ |
|
|
|
deviceType: 1, |
|
|
|
searchRule: 1, |
|
|
|
qbb: '' |
|
|
|
}], |
|
|
|
thirdFormData: [{ |
|
|
|
qbb: "", |
|
|
|
}, |
|
|
|
], |
|
|
|
thirdFormData: [ |
|
|
|
{ |
|
|
|
deviceType: 1, |
|
|
|
searchRule: 1, |
|
|
|
qbb: '' |
|
|
|
}], |
|
|
|
planName: '', |
|
|
|
qbb: "", |
|
|
|
}, |
|
|
|
], |
|
|
|
planName: "", |
|
|
|
automaticInfo: {}, |
|
|
|
dcExecuteAction: [], |
|
|
|
deviceData: [], |
|
|
|
@ -106,77 +134,79 @@ export default { |
|
|
|
eventOptions: [ |
|
|
|
{ |
|
|
|
value: 1, |
|
|
|
label: '异常天气' |
|
|
|
label: "异常天气", |
|
|
|
}, |
|
|
|
{ |
|
|
|
value: 2, |
|
|
|
label: '交通事故' |
|
|
|
label: "交通事故", |
|
|
|
}, |
|
|
|
{ |
|
|
|
value: 3, |
|
|
|
label: '非法上路' |
|
|
|
label: "非法上路", |
|
|
|
}, |
|
|
|
{ |
|
|
|
value: 4, |
|
|
|
label: '车辆故障' |
|
|
|
label: "车辆故障", |
|
|
|
}, |
|
|
|
{ |
|
|
|
value: 5, |
|
|
|
label: '交通拥堵' |
|
|
|
label: "交通拥堵", |
|
|
|
}, |
|
|
|
{ |
|
|
|
value: 6, |
|
|
|
label: '交通管制' |
|
|
|
label: "交通管制", |
|
|
|
}, |
|
|
|
{ |
|
|
|
value: 7, |
|
|
|
label: '服务区异常' |
|
|
|
label: "服务区异常", |
|
|
|
}, |
|
|
|
{ |
|
|
|
value: 8, |
|
|
|
label: '施工建设' |
|
|
|
label: "施工建设", |
|
|
|
}, |
|
|
|
{ |
|
|
|
value: 9, |
|
|
|
label: '路障清除' |
|
|
|
} |
|
|
|
label: "路障清除", |
|
|
|
}, |
|
|
|
], |
|
|
|
mechanismOptions: [{ |
|
|
|
mechanismOptions: [ |
|
|
|
{ |
|
|
|
value: 1, |
|
|
|
label: '雨' |
|
|
|
label: "雨", |
|
|
|
}, |
|
|
|
{ |
|
|
|
value: 2, |
|
|
|
label: '雪' |
|
|
|
label: "雪", |
|
|
|
}, |
|
|
|
{ |
|
|
|
value: 3, |
|
|
|
label: '雾' |
|
|
|
label: "雾", |
|
|
|
}, |
|
|
|
{ |
|
|
|
value: 4, |
|
|
|
label: '大风' |
|
|
|
label: "大风", |
|
|
|
}, |
|
|
|
{ |
|
|
|
value: 5, |
|
|
|
label: '低温寒潮' |
|
|
|
label: "低温寒潮", |
|
|
|
}, |
|
|
|
{ |
|
|
|
value: 6, |
|
|
|
label: '路面积雪' |
|
|
|
label: "路面积雪", |
|
|
|
}, |
|
|
|
{ |
|
|
|
value: 7, |
|
|
|
label: '路面结冰' |
|
|
|
label: "路面结冰", |
|
|
|
}, |
|
|
|
{ |
|
|
|
value: 8, |
|
|
|
label: '路面积水' |
|
|
|
label: "路面积水", |
|
|
|
}, |
|
|
|
{ |
|
|
|
value: 9, |
|
|
|
label: '其他' |
|
|
|
}], |
|
|
|
label: "其他", |
|
|
|
}, |
|
|
|
], |
|
|
|
conditionOptions: [ |
|
|
|
// { |
|
|
|
// value: 1, |
|
|
|
@ -184,20 +214,18 @@ export default { |
|
|
|
// }, |
|
|
|
{ |
|
|
|
value: 1, |
|
|
|
label: '小于(<)' |
|
|
|
label: "小于(<)", |
|
|
|
}, |
|
|
|
], |
|
|
|
} |
|
|
|
}, |
|
|
|
mounted() { |
|
|
|
|
|
|
|
}; |
|
|
|
}, |
|
|
|
mounted() {}, |
|
|
|
computed: { |
|
|
|
modelVisible: { |
|
|
|
get() { |
|
|
|
if (this.visible) { |
|
|
|
if (this.info.length > 0) { |
|
|
|
this.planName = this.info[0]?.planName || ''; |
|
|
|
this.planName = this.info[0]?.planName || ""; |
|
|
|
this.planInfo = this.info[0]; |
|
|
|
this.initData(this.info[0]); |
|
|
|
} |
|
|
|
@ -205,23 +233,23 @@ export default { |
|
|
|
return this.visible; |
|
|
|
}, |
|
|
|
set(val) { |
|
|
|
this.$emit('close', val) |
|
|
|
} |
|
|
|
this.$emit("close", val); |
|
|
|
}, |
|
|
|
}, |
|
|
|
}, |
|
|
|
methods: { |
|
|
|
initData(data) { |
|
|
|
console.log('data', data) |
|
|
|
console.log("data", data); |
|
|
|
if (!data) return; |
|
|
|
// this.planId = data.id; |
|
|
|
let dcExecuteAction = data.dcExecuteAction; |
|
|
|
let secondFormData = []; |
|
|
|
let thirdFormData = []; |
|
|
|
dcExecuteAction.forEach(it => { |
|
|
|
dcExecuteAction.forEach((it) => { |
|
|
|
let action = { ...it }; |
|
|
|
if (it.otherConfig) { |
|
|
|
let config = JSON.parse(it.otherConfig); |
|
|
|
let qbb = '' |
|
|
|
let qbb = ""; |
|
|
|
if (config.id) { |
|
|
|
qbb = config.content; |
|
|
|
config = { dcInfoBoardTemplate: config }; |
|
|
|
@ -232,14 +260,19 @@ export default { |
|
|
|
action = { ...it, ...config, qbb: qbb }; |
|
|
|
} |
|
|
|
if (it.deviceList) { |
|
|
|
action.deviceList = it.deviceList.split(',').map(str => Number(str)); |
|
|
|
action.deviceList = it.deviceList |
|
|
|
.split(",") |
|
|
|
.map((str) => Number(str)); |
|
|
|
} |
|
|
|
if (it.actionType == 1) { |
|
|
|
secondFormData.push(action); |
|
|
|
} else if (it.actionType == 2) { |
|
|
|
thirdFormData.push({ ...action, qbb: '默认恢复该情报板上次常态化信息' }); |
|
|
|
thirdFormData.push({ |
|
|
|
...action, |
|
|
|
qbb: "默认恢复该情报板上次常态化信息", |
|
|
|
}); |
|
|
|
} |
|
|
|
}) |
|
|
|
}); |
|
|
|
this.secondFormData = secondFormData; |
|
|
|
this.thirdFormData = thirdFormData; |
|
|
|
}, |
|
|
|
@ -248,7 +281,7 @@ export default { |
|
|
|
let result = await request({ |
|
|
|
url: `business/device/query?deviceType=2`, |
|
|
|
method: "get", |
|
|
|
}) |
|
|
|
}); |
|
|
|
if (result.code != 200) return Message.error(result?.msg); |
|
|
|
// console.log('123'); |
|
|
|
this.deviceData = result.data; |
|
|
|
@ -257,101 +290,113 @@ export default { |
|
|
|
return this.deviceData; |
|
|
|
}, |
|
|
|
async getTemplateAutomatic() { |
|
|
|
let url = ''; |
|
|
|
let url = ""; |
|
|
|
let data = {}; |
|
|
|
let otherConfig = {}; |
|
|
|
let plan = this.info.find(it => it.planName == this.planName); |
|
|
|
console.log('plan', plan) |
|
|
|
let action = plan.dcExecuteAction.find(it => it.actionType == 1 && it.deviceType == 2); |
|
|
|
let plan = this.info.find((it) => it.planName == this.planName); |
|
|
|
console.log("plan", plan); |
|
|
|
let action = plan.dcExecuteAction.find( |
|
|
|
(it) => it.actionType == 1 && it.deviceType == 2 |
|
|
|
); |
|
|
|
if (action) { |
|
|
|
otherConfig = JSON.parse(action.otherConfig); |
|
|
|
if (this.activeName == '-1') {//感知 |
|
|
|
url = '/business/plans/warning/confirm'; |
|
|
|
if (this.activeName == "-1") { |
|
|
|
//感知 |
|
|
|
url = "/business/plans/warning/confirm"; |
|
|
|
data = { |
|
|
|
dcInfoBoardTemplate: otherConfig, |
|
|
|
dcWarning: this.eventFormData |
|
|
|
} |
|
|
|
} else {//交通 |
|
|
|
url = '/business/plans/event/automatic'; |
|
|
|
dcWarning: this.eventFormData, |
|
|
|
}; |
|
|
|
} else { |
|
|
|
//交通 |
|
|
|
url = "/business/plans/event/automatic"; |
|
|
|
data = { |
|
|
|
dcInfoBoardTemplate: otherConfig, |
|
|
|
dcEvent: this.eventFormData |
|
|
|
} |
|
|
|
dcEvent: this.eventFormData, |
|
|
|
}; |
|
|
|
} |
|
|
|
const result = await request({ |
|
|
|
url: url, |
|
|
|
method: "post", |
|
|
|
data: data |
|
|
|
}) |
|
|
|
data: data, |
|
|
|
}); |
|
|
|
if (result.code != 200) return Message.error(result?.msg); |
|
|
|
this.automaticData = result.data; |
|
|
|
} else { |
|
|
|
console.log('没有情报板,不调用接口'); |
|
|
|
console.log("没有情报板,不调用接口"); |
|
|
|
this.automaticData = {}; |
|
|
|
} |
|
|
|
return this.automaticData; |
|
|
|
}, |
|
|
|
async getBoardOriginal() { |
|
|
|
let url = ''; |
|
|
|
let url = ""; |
|
|
|
let data = {}; |
|
|
|
let plan = this.info.find(it => it.planName == this.planName); |
|
|
|
console.log('plan1', plan) |
|
|
|
let action = plan.dcExecuteAction.find(it => it.actionType == 1 && it.deviceType == 2); |
|
|
|
let plan = this.info.find((it) => it.planName == this.planName); |
|
|
|
console.log("plan1", plan); |
|
|
|
let action = plan.dcExecuteAction.find( |
|
|
|
(it) => it.actionType == 1 && it.deviceType == 2 |
|
|
|
); |
|
|
|
if (action) { |
|
|
|
if (this.activeName == '-1') {//感知 |
|
|
|
url = '/business/plans/warning/board/confirm'; |
|
|
|
if (this.activeName == "-1") { |
|
|
|
//感知 |
|
|
|
url = "/business/plans/warning/board/confirm"; |
|
|
|
data = { |
|
|
|
dcEmergencyPlans: { |
|
|
|
...plan, |
|
|
|
executeAction: action |
|
|
|
executeAction: action, |
|
|
|
}, |
|
|
|
dcWarning: this.eventFormData |
|
|
|
} |
|
|
|
} else {//交通 |
|
|
|
url = '/business/plans/event/board/confirm'; |
|
|
|
dcWarning: this.eventFormData, |
|
|
|
}; |
|
|
|
} else { |
|
|
|
//交通 |
|
|
|
url = "/business/plans/event/board/confirm"; |
|
|
|
data = { |
|
|
|
dcEmergencyPlans: { |
|
|
|
...plan, |
|
|
|
executeAction: action |
|
|
|
executeAction: action, |
|
|
|
}, |
|
|
|
dcEvent: this.eventFormData |
|
|
|
} |
|
|
|
dcEvent: this.eventFormData, |
|
|
|
}; |
|
|
|
} |
|
|
|
const result = await request({ |
|
|
|
url: url, |
|
|
|
method: "post", |
|
|
|
data: data |
|
|
|
}) |
|
|
|
data: data, |
|
|
|
}); |
|
|
|
if (result.code != 200) return Message.error(result?.msg); |
|
|
|
this.boardOriginalData = result.data; |
|
|
|
} else { |
|
|
|
console.log('没有情报板,不调用接口'); |
|
|
|
console.log("没有情报板,不调用接口"); |
|
|
|
this.boardOriginalData = {}; |
|
|
|
} |
|
|
|
return this.boardOriginalData; |
|
|
|
}, |
|
|
|
changeRadio(value) { |
|
|
|
let plan = this.info.find(it => it.planName == value); |
|
|
|
let plan = this.info.find((it) => it.planName == value); |
|
|
|
this.planInfo = plan; |
|
|
|
this.initData(plan); |
|
|
|
}, |
|
|
|
formatData(it, value = 1) { |
|
|
|
let data = { ...it, actionType: value, emergencyPlansId: id } |
|
|
|
if (it.deviceList && typeof it.deviceList !== 'string' && it.deviceList.length > 0) { |
|
|
|
data.deviceList = it.deviceList.join(','); |
|
|
|
let data = { ...it, actionType: value, emergencyPlansId: id }; |
|
|
|
if ( |
|
|
|
it.deviceList && |
|
|
|
typeof it.deviceList !== "string" && |
|
|
|
it.deviceList.length > 0 |
|
|
|
) { |
|
|
|
data.deviceList = it.deviceList.join(","); |
|
|
|
} else { |
|
|
|
data.deviceList = ''; |
|
|
|
data.deviceList = ""; |
|
|
|
} |
|
|
|
if (it.content) { |
|
|
|
data.otherConfig = JSON.stringify({ content: it.content }) |
|
|
|
data.otherConfig = JSON.stringify({ content: it.content }); |
|
|
|
} |
|
|
|
if (it.controlModel) { |
|
|
|
let other = { |
|
|
|
controlModel: it.controlModel, |
|
|
|
controlModelName: controlModelMap[it.controlModel], |
|
|
|
state: it.state, |
|
|
|
name: gzztMap[it.state] |
|
|
|
} |
|
|
|
name: gzztMap[it.state], |
|
|
|
}; |
|
|
|
if (it.time && it?.time[0]) { |
|
|
|
other = { |
|
|
|
controlModel: it.controlModel, |
|
|
|
@ -359,71 +404,72 @@ export default { |
|
|
|
state: it.state, |
|
|
|
name: gzztMap[it.state], |
|
|
|
startTime: it.time[0], |
|
|
|
endTime: it.time[1] |
|
|
|
} |
|
|
|
endTime: it.time[1], |
|
|
|
}; |
|
|
|
} |
|
|
|
data.otherConfig = JSON.stringify(other) |
|
|
|
data.otherConfig = JSON.stringify(other); |
|
|
|
} |
|
|
|
if (it.gzms) { |
|
|
|
data.otherConfig = JSON.stringify({ |
|
|
|
state: it.gzms, |
|
|
|
name: gzmsMap[it.gzms], |
|
|
|
operationDuration: it.operationDuration, |
|
|
|
}) |
|
|
|
}); |
|
|
|
} |
|
|
|
return data; |
|
|
|
}, |
|
|
|
handleSubmit(value = 1) { |
|
|
|
// this.submitting = false; |
|
|
|
let plan = { ...this.planInfo }; |
|
|
|
let actions = plan.dcExecuteAction.filter(it => it.actionType == value); |
|
|
|
let actions = plan.dcExecuteAction.filter((it) => it.actionType == value); |
|
|
|
plan.dcExecuteAction = actions; |
|
|
|
|
|
|
|
let reqData = { |
|
|
|
operationType: value,//1-执行操作 2-恢复操作 |
|
|
|
operationType: value, //1-执行操作 2-恢复操作 |
|
|
|
dcEmergencyPlans: plan, |
|
|
|
dcEvent: this.eventFormData |
|
|
|
dcEvent: this.eventFormData, |
|
|
|
}; |
|
|
|
|
|
|
|
let url = ''; |
|
|
|
if (this.activeName == '-1') {//感知 |
|
|
|
url = '/business/plans/warning/confirm'; |
|
|
|
reqData = { ...reqData, dcWarning: { ...reqData.dcEvent } } |
|
|
|
} else {//交通 |
|
|
|
url = '/business/plans/event/confirm'; |
|
|
|
let url = ""; |
|
|
|
if (this.activeName == "-1") { |
|
|
|
//感知 |
|
|
|
url = "/business/plans/warning/confirm"; |
|
|
|
reqData = { ...reqData, dcWarning: { ...reqData.dcEvent } }; |
|
|
|
} else { |
|
|
|
//交通 |
|
|
|
url = "/business/plans/event/confirm"; |
|
|
|
} |
|
|
|
console.log('reqData', reqData) |
|
|
|
console.log("reqData", reqData); |
|
|
|
// return; |
|
|
|
request({ |
|
|
|
url: url, |
|
|
|
method: "post", |
|
|
|
data: reqData |
|
|
|
}).then((result) => { |
|
|
|
data: reqData, |
|
|
|
}) |
|
|
|
.then((result) => { |
|
|
|
if (result.code != 200) return Message.error(result?.msg); |
|
|
|
Message.success("提交成功"); |
|
|
|
this.$emit('close', false); |
|
|
|
this.$emit("close", false); |
|
|
|
setTimeout(() => { |
|
|
|
this.$emit('reInitData', true); |
|
|
|
}, 100) |
|
|
|
}).catch(() => { |
|
|
|
this.$emit("reInitData", true); |
|
|
|
}, 100); |
|
|
|
}) |
|
|
|
.catch(() => { |
|
|
|
Message.error("提交失败"); |
|
|
|
}).finally(() => { |
|
|
|
this.submitting = false; |
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
.finally(() => { |
|
|
|
this.submitting = false; |
|
|
|
}); |
|
|
|
}, |
|
|
|
handleRestore() { |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
handleRestore() {}, |
|
|
|
}, |
|
|
|
}; |
|
|
|
</script> |
|
|
|
|
|
|
|
<style lang="scss" scoped> |
|
|
|
.fade-enter-active, |
|
|
|
.fade-leave-active { |
|
|
|
transition: opacity .24s; |
|
|
|
transition: opacity 0.24s; |
|
|
|
} |
|
|
|
|
|
|
|
.fade-enter, |
|
|
|
|