Browse Source

feat enum优化合并重复枚举类

wangqin
qingzhengli 8 months ago
parent
commit
a20a38cca6
  1. 63
      ruoyi-ui/src/views/JiHeExpressway/pages/control/event/plan/addAndEditDialog/index.vue
  2. 125
      ruoyi-ui/src/views/JiHeExpressway/utils/enum.js

63
ruoyi-ui/src/views/JiHeExpressway/pages/control/event/plan/addAndEditDialog/index.vue

@ -4,47 +4,24 @@
<ElForm :model="formData" inline :rules="rules" ref="ruleForm">
<div class="first">
<el-form-item prop="eventCategory">
<el-radio-group
v-model="formData.eventCategory"
@input="changeRadio"
>
<el-radio-group v-model="formData.eventCategory" @input="changeRadio">
<el-radio-button :label="1">交通事件</el-radio-button>
<el-radio-button :label="2">感知事件</el-radio-button>
</el-radio-group>
</el-form-item>
<el-form-item required label="预案名称:" prop="planName">
<el-input
v-model="formData.planName"
placeholder="请输入预案名称"
></el-input>
<el-input v-model="formData.planName" placeholder="请输入预案名称"></el-input>
</el-form-item>
<el-form-item required label="事件类型:" prop="eventType">
<el-select
v-model="formData.eventType"
placeholder="请选择事件类型"
@change="changeEventType"
>
<el-option
v-for="item in eventOptions"
:key="item.value"
:label="item.label"
:value="item.value"
>
<el-select v-model="formData.eventType" placeholder="请选择事件类型" @change="changeEventType">
<el-option v-for="item in eventOptions" :key="item.value" :label="item.label" :value="item.value">
</el-option>
</el-select>
</el-form-item>
<el-form-item label="触发类型:" prop="triggerMechanism">
<el-select
v-model="formData.triggerMechanism"
placeholder="请选择触发类型"
>
<el-option
v-for="item in mechanismOptions"
:key="item.value"
:label="item.label"
:value="item.value"
>
<el-select v-model="formData.triggerMechanism" placeholder="请选择触发类型">
<el-option v-for="item in mechanismOptions" :key="item.value" :label="item.label" :value="item.value">
</el-option>
</el-select>
</el-form-item>
@ -56,11 +33,7 @@
<div class="text"><i style="color: red">*</i>执行操作:</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>
@ -70,11 +43,7 @@
<div class="text"><i style="color: red">*</i>恢复操作:</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>
@ -82,17 +51,9 @@
</div>
<template #footer>
<Button
style="background: #c9c9c9; padding: 0 24px"
@click.native="(modelVisible = false), (submitting = false)"
>取消</Button
>
<Button
style="padding: 0 24px"
@click.native="handleSubmit"
: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" :loading="submitting">保存</Button>
</template>
</Dialog>
</template>
@ -111,7 +72,7 @@ import {
gzmsMap,
eventSubClassMap,
trafficKV,
perceptionKV,
WarningTypeList as perceptionKV,
} from "@screen/utils/enum.js";
const typeMap = {

125
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: {
@ -263,103 +254,13 @@ 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: "其他事件",
},
];
export const trafficKV = Object.keys(trafficType).map((key) => {
return {
value: key * 1,
label: trafficType[key],
};
});
//交通事件、感知事件 子类(key vulue)预案使用
export const eventSubClassMap = {
1: {

Loading…
Cancel
Save