Browse Source

Merge branch 'develop' of http://39.106.31.193:9211/mengff/jihe-hs into develop

wangqin
zhoule 11 months ago
parent
commit
05eeab89e7
  1. 257
      ruoyi-ui/src/views/JiHeExpressway/pages/control/event/plan/addAndEditDialog/index.vue
  2. 2
      ruoyi-ui/src/views/JiHeExpressway/pages/perception/trafficFlow/components/heightway/index.vue

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

@ -20,19 +20,17 @@
</el-form-item> </el-form-item>
<el-form-item label="触发类型:" prop="triggerMechanism"> <el-form-item label="触发类型:" prop="triggerMechanism">
<el-select v-model="formData.triggerMechanism" placeholder="请选择触发类型"> <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 v-for="item in mechanismOptions" :key="item.value" :label="item.label" :value="item.value">
</el-option> </el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
</div> </div>
<div class="second"> <div class="second">
<el-row> <el-row>
<el-col :span="2"> <el-col :span="2">
<div class="text"><i style="color: red;">*</i>执行操作:</div> <div class="text"><i style="color: red">*</i>执行操作:</div>
</el-col> </el-col>
<el-col :span="22"> <el-col :span="22">
<FormTable ref="secondFormTable" :tableData="secondFormData" :type="1"></FormTable> <FormTable ref="secondFormTable" :tableData="secondFormData" :type="1"></FormTable>
@ -42,7 +40,7 @@
<div class="third"> <div class="third">
<el-row> <el-row>
<el-col :span="2"> <el-col :span="2">
<div class="text"><i style="color: red;">*</i>恢复操作:</div> <div class="text"><i style="color: red">*</i>恢复操作:</div>
</el-col> </el-col>
<el-col :span="22"> <el-col :span="22">
<FormTable ref="thirdFormTable" :tableData="thirdFormData" :type="2"></FormTable> <FormTable ref="thirdFormTable" :tableData="thirdFormData" :type="2"></FormTable>
@ -53,22 +51,29 @@
</div> </div>
<template #footer> <template #footer>
<Button style="background: #C9C9C9;padding:0 24px;" <Button style="background: #c9c9c9; padding: 0 24px"
@click.native="modelVisible = false, submitting = false">取消</Button> @click.native="(modelVisible = false), (submitting = false)">取消</Button>
<Button style="padding:0 24px;" @click.native="handleSubmit" :loading="submitting">保存</Button> <Button style="padding: 0 24px" @click.native="handleSubmit" :loading="submitting">保存</Button>
</template> </template>
</Dialog> </Dialog>
</template> </template>
<script> <script>
import Dialog from "@screen/components/Dialog/index"; import Dialog from "@screen/components/Dialog/index";
import Form from '@screen/components/FormConfig'; import Form from "@screen/components/FormConfig";
import FormTable from '../formTable/index'; import FormTable from "../formTable/index";
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 { Message } from "element-ui"; import { Message } from "element-ui";
import { throttle } from "lodash" import { throttle } from "lodash";
import { controlModelMap, gzztMap, gzmsMap, eventSubClassMap, trafficKV, perceptionKV } from "@screen/utils/enum.js"; import {
controlModelMap,
gzztMap,
gzmsMap,
eventSubClassMap,
trafficKV,
perceptionKV,
} from "@screen/utils/enum.js";
const typeMap = { const typeMap = {
1: trafficKV, 1: trafficKV,
@ -76,16 +81,16 @@ const typeMap = {
}; };
export default { export default {
name: 'addAndEditDialog', name: "addAndEditDialog",
components: { components: {
Dialog, Dialog,
Form, Form,
Button, Button,
FormTable FormTable,
}, },
model: { model: {
prop: 'visible', prop: "visible",
event: 'close' event: "close",
}, },
provide() { provide() {
return { return {
@ -97,30 +102,34 @@ export default {
visible: Boolean, visible: Boolean,
detail: { detail: {
type: Object, type: Object,
default: () => { } default: () => { },
} },
}, },
data() { data() {
return { return {
title: '新增预案', title: "新增预案",
dialogType: 1, dialogType: 1,
planId: 0, planId: 0,
submitting: false, submitting: false,
formData: { formData: {
eventCategory: 1, eventCategory: 1,
eventType: 1, eventType: 1,
triggerMechanism: '' triggerMechanism: "",
}, },
secondFormData: [{ secondFormData: [
{
deviceType: 1, deviceType: 1,
searchRule: 1, searchRule: 1,
qbb: '' qbb: "",
}], },
thirdFormData: [{ ],
thirdFormData: [
{
deviceType: 1, deviceType: 1,
searchRule: 1, searchRule: 1,
qbb: '' qbb: "",
}], },
],
deviceData: [], deviceData: [],
eventOptions: trafficKV, eventOptions: trafficKV,
mechanismOptions: [ mechanismOptions: [
@ -146,55 +155,56 @@ export default {
}, },
], ],
rules: { rules: {
planName: [ planName: [{ required: true, message: "请输入预案名称" }],
{ required: true, message: '请输入预案名称', trigger: 'blur' },
],
eventType: [ eventType: [
{ required: true, message: '请选择事件类型', trigger: 'change' } { required: true, message: "请选择事件类型", trigger: "change" },
], ],
}
}
}, },
mounted() { };
}, },
mounted() { },
computed: { computed: {
modelVisible: { modelVisible: {
get() { get() {
if (this.visible) { if (this.visible) {
if (Object.keys(this.detail).length > 0) { if (Object.keys(this.detail).length > 0) {
this.title = '修改预案'; this.title = "修改预案";
this.dialogType = 2; this.dialogType = 2;
this.eventOptions = typeMap[this.detail.eventCategory]; this.eventOptions = typeMap[this.detail.eventCategory];
this.mechanismOptions = eventSubClassMap[this.detail.eventCategory || 1][this.detail.eventType]; this.mechanismOptions =
eventSubClassMap[this.detail.eventCategory || 1][
this.detail.eventType
];
this.initData(this.detail.id); this.initData(this.detail.id);
} else { } else {
this.title = '新增预案'; this.title = "新增预案";
this.dialogType = 1; this.dialogType = 1;
this.formData = { this.formData = {
eventCategory: 1, eventCategory: 1,
eventType: 1, eventType: 1,
triggerMechanism: '' triggerMechanism: "",
} };
this.secondFormData = [{ this.secondFormData = [
{
deviceType: 1, deviceType: 1,
searchRule: 1, searchRule: 1,
qbb: '' qbb: "",
}]; },
this.thirdFormData = [{ ];
this.thirdFormData = [
{
deviceType: 1, deviceType: 1,
searchRule: 1, searchRule: 1,
qbb: '' qbb: "",
}]; },
];
} }
} }
return this.visible; return this.visible;
}, },
set(val) { set(val) {
this.$emit('close', val) this.$emit("close", val);
} },
}, },
}, },
methods: { methods: {
@ -202,7 +212,8 @@ export default {
request({ request({
url: `/business/plans/list/${id}`, url: `/business/plans/list/${id}`,
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);
let data = result.data; let data = result.data;
let dcExecuteAction = result.data.dcExecuteAction; let dcExecuteAction = result.data.dcExecuteAction;
@ -213,14 +224,14 @@ export default {
planName: data.planName, planName: data.planName,
eventType: data.eventType, eventType: data.eventType,
triggerMechanism: data.triggerMechanism, triggerMechanism: data.triggerMechanism,
} };
this.secondFormData = []; this.secondFormData = [];
this.thirdFormData = []; this.thirdFormData = [];
dcExecuteAction.forEach(it => { dcExecuteAction.forEach((it) => {
let action = {}; let action = {};
if (it.otherConfig) { if (it.otherConfig) {
let config = JSON.parse(it.otherConfig); let config = JSON.parse(it.otherConfig);
let qbb = '' let qbb = "";
if (config.id) { if (config.id) {
qbb = config.content; qbb = config.content;
config = { dcInfoBoardTemplate: config }; config = { dcInfoBoardTemplate: config };
@ -231,63 +242,74 @@ export default {
action = { ...it, ...config, qbb: qbb }; action = { ...it, ...config, qbb: qbb };
} }
if (it.deviceList) { 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) { if (it.actionType == 1) {
this.secondFormData.push(action); this.secondFormData.push(action);
} else if (it.actionType == 2) { } else if (it.actionType == 2) {
this.thirdFormData.push(action); this.thirdFormData.push(action);
} }
});
console.log("secondFormData", this.secondFormData);
}) })
// console.log('secondFormData', this.secondFormData) // console.log('secondFormData', this.secondFormData)
}).catch((err) => { // }).catch((err) => {
console.log(err) // console.log(err)
Message.error("查询事件预案列表失败", err); // Message.error("", err);
}) // })
.catch((err) => {
console.log(err);
Message.error("查询事件预案列表失败", err);
});
}, },
async loadData(deviceType = 1) { async loadData(deviceType = 1) {
this.deviceData = []; this.deviceData = [];
let result = await request({ let result = await request({
url: `business/device/query?deviceType=${deviceType}`, url: `business/device/query?deviceType=${deviceType}`,
method: "get", method: "get",
}) });
if (result.code != 200) return Message.error(result?.msg); if (result.code != 200) return Message.error(result?.msg);
if (deviceType == 1) { if (deviceType == 1) {
this.deviceData = result.data.filter(it => it.childType !== '1-1') this.deviceData = result.data.filter((it) => it.childType !== "1-1");
} else { } else {
this.deviceData = result.data; this.deviceData = result.data;
} }
return this.deviceData; return this.deviceData;
}, },
changeEventType(value = 1) { changeEventType(value = 1) {
this.mechanismOptions = eventSubClassMap[this.formData.eventCategory || 1][value]; this.mechanismOptions =
eventSubClassMap[this.formData.eventCategory || 1][value];
}, },
changeRadio(value = 1) { changeRadio(value = 1) {
this.formData.triggerMechanism = ''; this.formData.triggerMechanism = "";
this.eventOptions = typeMap[value]; this.eventOptions = typeMap[value];
this.changeEventType(1); this.changeEventType(1);
}, },
handleChange() { handleChange() { },
formatData(it, value = 1, id = "") {
}, let data = { ...it, actionType: value, emergencyPlansId: id };
formatData(it, value = 1, id = '') { if (
let data = { ...it, actionType: value, emergencyPlansId: id } it.deviceList &&
if (it.deviceList && typeof it.deviceList !== 'string' && it.deviceList.length > 0) { typeof it.deviceList !== "string" &&
data.deviceList = it.deviceList.join(','); it.deviceList.length > 0
) {
data.deviceList = it.deviceList.join(",");
} else { } else {
data.deviceList = ''; data.deviceList = "";
} }
if (it.content) { if (it.content) {
data.otherConfig = JSON.stringify({ content: it.content }) data.otherConfig = JSON.stringify({ content: it.content });
} }
if (it.controlModel) { if (it.controlModel) {
let other = { let other = {
controlModel: it.controlModel, controlModel: it.controlModel,
controlModelName: controlModelMap[it.controlModel], controlModelName: controlModelMap[it.controlModel],
state: it.state, state: it.state,
name: gzztMap[it.state] name: gzztMap[it.state],
} };
if (it.time && it?.time[0]) { if (it.time && it?.time[0]) {
other = { other = {
controlModel: it.controlModel, controlModel: it.controlModel,
@ -295,26 +317,26 @@ export default {
state: it.state, state: it.state,
name: gzztMap[it.state], name: gzztMap[it.state],
startTime: it.time[0], 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) { if (it.gzms) {
data.otherConfig = JSON.stringify({ data.otherConfig = JSON.stringify({
state: it.gzms, state: it.gzms,
name: gzmsMap[it.gzms], name: gzmsMap[it.gzms],
operationDuration: it.operationDuration, operationDuration: it.operationDuration,
}) });
} }
return data; return data;
}, },
handleSubmit() { handleSubmit() {
this.$refs['ruleForm'].validate((valid) => { this.$refs["ruleForm"].validate((valid) => {
if (valid) { if (valid) {
// this.submitting = false; // this.submitting = false;
let secondFormTable = this.$refs['secondFormTable'].tableData || []; let secondFormTable = this.$refs["secondFormTable"].tableData || [];
let thirdFormTable = this.$refs['thirdFormTable'].tableData || []; let thirdFormTable = this.$refs["thirdFormTable"].tableData || [];
// let flg = false; // let flg = false;
// for (let item of secondFormTable) { // for (let item of secondFormTable) {
// if (this.areAllValuesEmpty(item)) { flg = true; break }; // if (this.areAllValuesEmpty(item)) { flg = true; break };
@ -327,86 +349,89 @@ export default {
// console.log('12', secondFormTable); // console.log('12', secondFormTable);
// console.log('34', thirdFormTable); // console.log('34', thirdFormTable);
let dcArr = []; let dcArr = [];
let id = ''; let id = "";
if (this.dialogType == 2) id = this.planId; if (this.dialogType == 2) id = this.planId;
secondFormTable.forEach(it => { secondFormTable.forEach((it) => {
dcArr.push(this.formatData(it, 1, id)); dcArr.push(this.formatData(it, 1, id));
}) });
thirdFormTable.forEach(it => { thirdFormTable.forEach((it) => {
dcArr.push(this.formatData(it, 2, id)); dcArr.push(this.formatData(it, 2, id));
}) });
console.log({ console.log({
...this.formData, ...this.formData,
dcExecuteAction: dcArr dcExecuteAction: dcArr,
}) });
// return; // return;
if (this.dialogType == 1) {// if (this.dialogType == 1) {
//
request({ request({
url: `/business/plans`, url: `/business/plans`,
method: "post", method: "post",
data: { data: {
...this.formData, ...this.formData,
dcExecuteAction: dcArr dcExecuteAction: dcArr,
} },
}).then((result) => { })
.then((result) => {
if (result.code != 200) return Message.error(result?.msg); if (result.code != 200) return Message.error(result?.msg);
Message.success("提交成功"); Message.success("提交成功");
this.modelVisible = false; this.modelVisible = false;
}).catch(() => { })
.catch(() => {
Message.error("提交失败"); Message.error("提交失败");
}).finally(() => {
this.submitting = false;
this.$emit('reInitData', true);
}) })
} else if (this.dialogType == 2) {// .finally(() => {
this.submitting = false;
this.$emit("reInitData", true);
});
} else if (this.dialogType == 2) {
//
request({ request({
url: `/business/plans`, url: `/business/plans`,
method: "put", method: "put",
data: { data: {
...this.formData, ...this.formData,
id: this.planId, id: this.planId,
dcExecuteAction: dcArr dcExecuteAction: dcArr,
} },
}).then((result) => { })
.then((result) => {
if (result.code != 200) return Message.error(result?.msg); if (result.code != 200) return Message.error(result?.msg);
Message.success("提交成功"); Message.success("提交成功");
this.modelVisible = false; this.modelVisible = false;
}).catch(() => { })
.catch(() => {
Message.error("提交失败"); Message.error("提交失败");
}).finally(() => {
this.submitting = false;
this.$emit('reInitData', true);
}) })
.finally(() => {
this.submitting = false;
this.$emit("reInitData", true);
});
} }
} }
});
})
}, },
areAllValuesEmpty(obj) { areAllValuesEmpty(obj) {
console.log('ass', obj) console.log("ass", obj);
return Object.keys(obj).every(function (key) { return Object.keys(obj).every(function (key) {
const value = obj[key]; const value = obj[key];
return ( return (
value == null || value == null ||
value === '' || value === "" ||
(Array.isArray(value) && value.length === 0) || (Array.isArray(value) && value.length === 0) ||
(value instanceof Object && Object.keys(value).length === 0) (value instanceof Object && Object.keys(value).length === 0)
); );
}); });
} },
} },
} };
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.fade-enter-active, .fade-enter-active,
.fade-leave-active { .fade-leave-active {
transition: opacity .24s; transition: opacity 0.24s;
} }
.fade-enter, .fade-enter,

2
ruoyi-ui/src/views/JiHeExpressway/pages/perception/trafficFlow/components/heightway/index.vue

@ -255,7 +255,7 @@ export default {
.btnSearch { .btnSearch {
background-color: #00b3cc; background-color: #00b3cc;
// margin-left: 10px; // margin-left: 10px;
padding: 6px 15px; padding: 6px 13px;
font-size: 13px; font-size: 13px;
} }
.btnReset { .btnReset {

Loading…
Cancel
Save