From a20a38cca6d4be83b9184c1b2b3740a330d357bd Mon Sep 17 00:00:00 2001 From: qingzhengli <1204552371@qq.com> Date: Wed, 10 Apr 2024 16:20:40 +0800 Subject: [PATCH] =?UTF-8?q?feat=20=20enum=E4=BC=98=E5=8C=96=E5=90=88?= =?UTF-8?q?=E5=B9=B6=E9=87=8D=E5=A4=8D=E6=9E=9A=E4=B8=BE=E7=B1=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../event/plan/addAndEditDialog/index.vue | 71 +++------- .../src/views/JiHeExpressway/utils/enum.js | 127 ++---------------- 2 files changed, 30 insertions(+), 168 deletions(-) diff --git a/ruoyi-ui/src/views/JiHeExpressway/pages/control/event/plan/addAndEditDialog/index.vue b/ruoyi-ui/src/views/JiHeExpressway/pages/control/event/plan/addAndEditDialog/index.vue index 4e4f6b20..653eed22 100644 --- a/ruoyi-ui/src/views/JiHeExpressway/pages/control/event/plan/addAndEditDialog/index.vue +++ b/ruoyi-ui/src/views/JiHeExpressway/pages/control/event/plan/addAndEditDialog/index.vue @@ -4,47 +4,24 @@
- + 交通事件 感知事件 - + - - + + - - + + @@ -56,11 +33,7 @@
*执行操作:
- +
@@ -70,11 +43,7 @@
*恢复操作:
- + @@ -82,17 +51,9 @@ @@ -111,7 +72,7 @@ import { gzmsMap, eventSubClassMap, trafficKV, - perceptionKV, + WarningTypeList as perceptionKV, } from "@screen/utils/enum.js"; const typeMap = { @@ -141,7 +102,7 @@ export default { visible: Boolean, detail: { type: Object, - default: () => {}, + default: () => { }, }, }, data() { @@ -201,7 +162,7 @@ export default { }, }; }, - mounted() {}, + mounted() { }, computed: { modelVisible: { get() { @@ -212,7 +173,7 @@ export default { this.eventOptions = typeMap[this.detail.eventCategory]; this.mechanismOptions = eventSubClassMap[this.detail.eventCategory || 1][ - this.detail.eventType + this.detail.eventType ]; this.initData(this.detail.id); } else { @@ -327,7 +288,7 @@ export default { this.eventOptions = typeMap[value]; this.changeEventType(1); }, - handleChange() {}, + handleChange() { }, formatData(it, value = 1, id = "") { let data = { ...it, actionType: value, emergencyPlansId: id }; if ( diff --git a/ruoyi-ui/src/views/JiHeExpressway/utils/enum.js b/ruoyi-ui/src/views/JiHeExpressway/utils/enum.js index c96bd6bb..a04a0945 100644 --- a/ruoyi-ui/src/views/JiHeExpressway/utils/enum.js +++ b/ruoyi-ui/src/views/JiHeExpressway/utils/enum.js @@ -163,21 +163,7 @@ export const WarningType = { 99: "其他事件", }; -// 交通事件主类 -export const trafficType = { - 1: "交通事故", - 2: "车辆故障", - 3: "交通管制", - 4: "交通拥堵", - 5: "非法上路", - 6: "路障清除", - 7: "施工建设", - 8: "服务区异常", - 9: "设施设备隐患", - 10: "异常天气", - 11: "其他事件", -}; - +//========= 感知事件 主类(key vulue) [{value: 1, label: '交通拥堵'}]========= export const WarningTypeList = Object.keys(WarningType).map((key) => { return { value: key * 1, @@ -185,6 +171,11 @@ export const WarningTypeList = Object.keys(WarningType).map((key) => { }; }); +// 交通事件主类 {1: "交通事故" } 格式 +export const trafficType = Object.keys(EventTopics).reduce((prev, now) => { + return { ...prev, [EventTopics[now]]: now }; +}, {}); + // 感知事件主类的子类(上方) warningSubclass export const WarningSubclass = { 1: { @@ -262,104 +253,14 @@ export const WarningSubclass = { }, }; -//========= 交通事件 主类(key vulue)========= -export const trafficKV = [ - { - 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: "设施设备隐患", - }, - { - value: 10, - label: "异常天气", - }, - { - value: 11, - label: "其他事件", - }, -]; -//========= 感知事件 主类(key vulue)========= -export const perceptionKV = [ - { - 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: "护栏碰撞", - }, - { - value: 10, - label: "交通事故", - }, - { - value: 11, - label: "车辆故障", - }, - { - value: 99, - label: "其他事件", - }, -]; +//========= 交通事件 主类(key vulue) ========= +export const trafficKV = Object.keys(trafficType).map((key) => { + return { + value: key * 1, + label: trafficType[key], + }; +}); + //交通事件、感知事件 子类(key vulue)预案使用 export const eventSubClassMap = { 1: {