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. 349
      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

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

@ -20,19 +20,17 @@
</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-option>
</el-select>
</el-form-item>
</div>
<div class="second">
<el-row>
<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 :span="22">
<FormTable ref="secondFormTable" :tableData="secondFormData" :type="1"></FormTable>
@ -42,7 +40,7 @@
<div class="third">
<el-row>
<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 :span="22">
<FormTable ref="thirdFormTable" :tableData="thirdFormData" :type="2"></FormTable>
@ -53,22 +51,29 @@
</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>
<script>
import Dialog from "@screen/components/Dialog/index";
import Form from '@screen/components/FormConfig';
import FormTable from '../formTable/index';
import Button from '@screen/components/Buttons/Button.vue';
import request from '@/utils/request';
import Form from "@screen/components/FormConfig";
import FormTable from "../formTable/index";
import Button from "@screen/components/Buttons/Button.vue";
import request from "@/utils/request";
import { Message } from "element-ui";
import { throttle } from "lodash"
import { controlModelMap, gzztMap, gzmsMap, eventSubClassMap, trafficKV, perceptionKV } from "@screen/utils/enum.js";
import { throttle } from "lodash";
import {
controlModelMap,
gzztMap,
gzmsMap,
eventSubClassMap,
trafficKV,
perceptionKV,
} from "@screen/utils/enum.js";
const typeMap = {
1: trafficKV,
@ -76,16 +81,16 @@ const typeMap = {
};
export default {
name: 'addAndEditDialog',
name: "addAndEditDialog",
components: {
Dialog,
Form,
Button,
FormTable
FormTable,
},
model: {
prop: 'visible',
event: 'close'
prop: "visible",
event: "close",
},
provide() {
return {
@ -97,30 +102,34 @@ export default {
visible: Boolean,
detail: {
type: Object,
default: () => { }
}
default: () => { },
},
},
data() {
return {
title: '新增预案',
title: "新增预案",
dialogType: 1,
planId: 0,
submitting: false,
formData: {
eventCategory: 1,
eventType: 1,
triggerMechanism: ''
triggerMechanism: "",
},
secondFormData: [{
deviceType: 1,
searchRule: 1,
qbb: ''
}],
thirdFormData: [{
deviceType: 1,
searchRule: 1,
qbb: ''
}],
secondFormData: [
{
deviceType: 1,
searchRule: 1,
qbb: "",
},
],
thirdFormData: [
{
deviceType: 1,
searchRule: 1,
qbb: "",
},
],
deviceData: [],
eventOptions: trafficKV,
mechanismOptions: [
@ -146,55 +155,56 @@ export default {
},
],
rules: {
planName: [
{ required: true, message: '请输入预案名称', trigger: 'blur' },
],
planName: [{ required: true, message: "请输入预案名称" }],
eventType: [
{ required: true, message: '请选择事件类型', trigger: 'change' }
{ required: true, message: "请选择事件类型", trigger: "change" },
],
}
}
},
mounted() {
},
};
},
mounted() { },
computed: {
modelVisible: {
get() {
if (this.visible) {
if (Object.keys(this.detail).length > 0) {
this.title = '修改预案';
this.title = "修改预案";
this.dialogType = 2;
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);
} else {
this.title = '新增预案';
this.title = "新增预案";
this.dialogType = 1;
this.formData = {
eventCategory: 1,
eventType: 1,
triggerMechanism: ''
}
this.secondFormData = [{
deviceType: 1,
searchRule: 1,
qbb: ''
}];
this.thirdFormData = [{
deviceType: 1,
searchRule: 1,
qbb: ''
}];
triggerMechanism: "",
};
this.secondFormData = [
{
deviceType: 1,
searchRule: 1,
qbb: "",
},
];
this.thirdFormData = [
{
deviceType: 1,
searchRule: 1,
qbb: "",
},
];
}
}
return this.visible;
},
set(val) {
this.$emit('close', val)
}
this.$emit("close", val);
},
},
},
methods: {
@ -202,92 +212,104 @@ export default {
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;
})
.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 => {
let action = {};
if (it.otherConfig) {
let config = JSON.parse(it.otherConfig);
let qbb = ''
if (config.id) {
qbb = config.content;
config = { dcInfoBoardTemplate: config };
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) => {
let action = {};
if (it.otherConfig) {
let config = JSON.parse(it.otherConfig);
let qbb = "";
if (config.id) {
qbb = config.content;
config = { dcInfoBoardTemplate: config };
}
// if (config.state) {
// config.gzms = config.state
// }
action = { ...it, ...config, qbb: qbb };
}
// if (config.state) {
// config.gzms = config.state
// }
action = { ...it, ...config, qbb: qbb };
}
if (it.deviceList) {
action.deviceList = it.deviceList.split(',').map(str => Number(str));
}
if (it.actionType == 1) {
this.secondFormData.push(action);
} else if (it.actionType == 2) {
this.thirdFormData.push(action);
}
if (it.deviceList) {
action.deviceList = it.deviceList
.split(",")
.map((str) => Number(str));
}
if (it.actionType == 1) {
this.secondFormData.push(action);
} else if (it.actionType == 2) {
this.thirdFormData.push(action);
}
});
console.log("secondFormData", this.secondFormData);
})
// console.log('secondFormData', this.secondFormData)
}).catch((err) => {
console.log(err)
Message.error("查询事件预案列表失败", err);
})
// }).catch((err) => {
// console.log(err)
// Message.error("", err);
// })
.catch((err) => {
console.log(err);
Message.error("查询事件预案列表失败", err);
});
},
async loadData(deviceType = 1) {
this.deviceData = [];
let result = await request({
url: `business/device/query?deviceType=${deviceType}`,
method: "get",
})
});
if (result.code != 200) return Message.error(result?.msg);
if (deviceType == 1) {
this.deviceData = result.data.filter(it => it.childType !== '1-1')
this.deviceData = result.data.filter((it) => it.childType !== "1-1");
} else {
this.deviceData = result.data;
}
return this.deviceData;
},
changeEventType(value = 1) {
this.mechanismOptions = eventSubClassMap[this.formData.eventCategory || 1][value];
this.mechanismOptions =
eventSubClassMap[this.formData.eventCategory || 1][value];
},
changeRadio(value = 1) {
this.formData.triggerMechanism = '';
this.formData.triggerMechanism = "";
this.eventOptions = typeMap[value];
this.changeEventType(1);
},
handleChange() {
},
formatData(it, value = 1, id = '') {
let data = { ...it, actionType: value, emergencyPlansId: id }
if (it.deviceList && typeof it.deviceList !== 'string' && it.deviceList.length > 0) {
data.deviceList = it.deviceList.join(',');
handleChange() { },
formatData(it, value = 1, id = "") {
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,
@ -295,26 +317,26 @@ 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() {
this.$refs['ruleForm'].validate((valid) => {
this.$refs["ruleForm"].validate((valid) => {
if (valid) {
// this.submitting = false;
let secondFormTable = this.$refs['secondFormTable'].tableData || [];
let thirdFormTable = this.$refs['thirdFormTable'].tableData || [];
let secondFormTable = this.$refs["secondFormTable"].tableData || [];
let thirdFormTable = this.$refs["thirdFormTable"].tableData || [];
// let flg = false;
// for (let item of secondFormTable) {
// if (this.areAllValuesEmpty(item)) { flg = true; break };
@ -327,86 +349,89 @@ export default {
// console.log('12', secondFormTable);
// console.log('34', thirdFormTable);
let dcArr = [];
let id = '';
let id = "";
if (this.dialogType == 2) id = this.planId;
secondFormTable.forEach(it => {
secondFormTable.forEach((it) => {
dcArr.push(this.formatData(it, 1, id));
})
thirdFormTable.forEach(it => {
});
thirdFormTable.forEach((it) => {
dcArr.push(this.formatData(it, 2, id));
})
});
console.log({
...this.formData,
dcExecuteAction: dcArr
})
dcExecuteAction: dcArr,
});
// return;
if (this.dialogType == 1) {//
if (this.dialogType == 1) {
//
request({
url: `/business/plans`,
method: "post",
data: {
...this.formData,
dcExecuteAction: dcArr
}
}).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);
dcExecuteAction: dcArr,
},
})
} else if (this.dialogType == 2) {//
.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
}
}).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);
dcExecuteAction: dcArr,
},
})
.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);
});
}
}
})
});
},
areAllValuesEmpty(obj) {
console.log('ass', obj)
console.log("ass", obj);
return Object.keys(obj).every(function (key) {
const value = obj[key];
return (
value == null ||
value === '' ||
value === "" ||
(Array.isArray(value) && value.length === 0) ||
(value instanceof Object && Object.keys(value).length === 0)
);
});
}
}
}
},
},
};
</script>
<style lang="scss" scoped>
.fade-enter-active,
.fade-leave-active {
transition: opacity .24s;
transition: opacity 0.24s;
}
.fade-enter,

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

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

Loading…
Cancel
Save