Browse Source

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

wangqin
qingzhengli 9 months ago
parent
commit
80bf1e7a23
  1. 185
      ruoyi-ui/src/views/JiHeExpressway/pages/control/event/plan/addAndEditDialog/index.vue
  2. 99
      ruoyi-ui/src/views/JiHeExpressway/pages/control/event/plan/data.js
  3. 138
      ruoyi-ui/src/views/JiHeExpressway/pages/control/event/plan/formTable/index.vue
  4. 27
      ruoyi-ui/src/views/JiHeExpressway/pages/control/event/plan/index.vue

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

@ -1,5 +1,5 @@
<template>
<Dialog v-model="modelVisible" title="新增预案">
<Dialog v-model="modelVisible" :title="title">
<div class="EventAddPlanDialog">
<ElForm :model="formData" inline :rules="rules" ref="ruleForm">
<div class="first">
@ -19,6 +19,7 @@
</el-option>
</el-select>
</el-form-item>
<el-form-item
v-if="(formData.eventCategory == 1 && formData.eventType !== 8) || formData.eventCategory == 2"
label="触发类型:" prop="triggerMechanism">
@ -52,26 +53,27 @@
</el-form-item>
</div>
<div class="second">
<el-row>
<el-col :span="2">
<div class="text">执行操作:</div>
</el-col>
<el-col :span="22">
<FormTable ref="secondFormTable"></FormTable>
<FormTable ref="secondFormTable" :tableData="secondFormData"></FormTable>
</el-col>
</el-row>
</div>
<!-- <div class="third">
<div class="third">
<el-row>
<el-col :span="2">
<div class="text">恢复操作:</div>
</el-col>
<el-col :span="22">
<FormTable></FormTable>
<FormTable ref="thirdFormTable" :tableData="thirdFormData"></FormTable>
</el-col>
</el-row>
</div> -->
</div>
</ElForm>
</div>
@ -287,18 +289,25 @@ export default {
},
data() {
return {
activeName: "TrafficAccident",
title: '新增预案',
dialogType: 1,
planId: 0,
submitting: false,
formConfig: {},
formData: {
eventCategory: 1,
eventType: 1,
triggeringCondition: 0
triggerMechanism: 1
},
index: 1,
roads: [],
direction: [],
lwss: [],
secondFormData: [{
deviceType: 1,
searchRule: 1,
qbb: '安全行驶'
}],
thirdFormData: [{
deviceType: 1,
searchRule: 1,
qbb: '安全行驶'
}],
eventOptions: [
{
value: 1,
@ -394,68 +403,70 @@ export default {
}
}
},
created() {
// this.formConfig = tabConfigList[0].formConfig;
this.initData().then(() => {
this.handleChange({ index: 0 })
})
mounted() {
},
computed: {
modelVisible: {
get() {
if (this.visible) {
if (Object.keys(this.detail).length > 0) {
this.title = '修改预案';
this.dialogType = 2;
this.initData(this.detail.id);
} else {
this.title = '新增预案';
this.dialogType = 1;
this.formData = {
eventCategory: 1,
eventType: 1,
triggerMechanism: 0
}
}
}
return this.visible;
},
set(val) {
this.$emit('close', val)
}
},
getFormOptions() {
return {
column: 3,
...this.formConfig.formOptions
}
}
},
methods: {
initData() {
return Promise.all([
//
initData(id = 1) {
request({
url: `/business/road/query`,
url: `/business/plans/list/${id}`,
method: "get",
}).then((result) => {
if (result.code != 200) return Message.error(result?.msg);
result.data.forEach(it => {
this.roads.push({ key: it.id, label: it.roadName })
})
}).catch((err) => {
Message.error("查询失败4", err);
}),
//
request({
url: `/system/dict/data/type/iot_event_direction`,
method: "get",
}).then((result) => {
if (result.code != 200) return Message.error(result?.msg);
result.data.forEach(it => {
this.direction.push({ key: it.dictValue, label: it.dictLabel })
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 => {
if (it.deviceList) {
it.deviceList = it.deviceList.split(',');
}
if (it.actionType == 1) {
this.secondFormData.push(it);
} else if (it.actionType == 2) {
this.thirdFormData.push(it);
}
})
}).catch((err) => {
Message.error("查询失败5", err);
}),
// 1 2 3 4 5 6
request({
url: `/business/facility/query`,
method: "get"
}).then((result) => {
if (result.code != 200) return Message.error(result?.msg);
result.data.forEach(it => this.lwss.push({ key: it.id, label: it.facilityName, type: it.facilityType }))
}).catch((err) => {
console.log('err', err)
Message.error("查询失败6", err);
console.log(err)
Message.error("查询事件预案列表失败", err);
})
])
},
changeEventType(value = 1) {
this.mechanismOptions = optionsMap[this.formData.eventCategory || 1][value];
@ -537,22 +548,39 @@ export default {
handleSubmit() {
this.$refs['ruleForm'].validate((valid) => {
if (valid) {
this.submitting = true;
console.log('formData', this.formData)
this.modelVisible = false;
this.submitting = false;
// this.$emit('queryData',true)
console.log(this.$refs['secondFormTable'].tableData)
return;
// this.submitting = false;
let secondFormTable = this.$refs['secondFormTable'].tableData || [];
let thirdFormTable = this.$refs['thirdFormTable'].tableData || [];
let dcArr = [];
secondFormTable.forEach(it => {
if (it.deviceList && typeof it.deviceList !== 'string' && it.deviceList.length > 0) {
it.deviceList = it.deviceList.join(',');
} else {
it.deviceList = ''
}
dcArr.push({ ...it, actionType: 1 });
})
thirdFormTable.forEach(it => {
if (it.deviceList && typeof it.deviceList !== 'string' && it.deviceList.length > 0) {
it.deviceList = it.deviceList.join(',');
} else {
it.deviceList = ''
}
dcArr.push({ ...it, actionType: 2 });
})
console.log({
...this.formData,
dcExecuteAction: dcArr
})
// return;
if (this.dialogType == 1) {//
request({
url: `/dc/system/event`,
url: `/business/plans`,
method: "post",
data: {
...formData,
eventType: Number(this.index) + 1,
eventState: 0,
stakeMark: (stakeMark && stakeMark[0] != null) ? ((stakeMark && stakeMark.length > 0) ? ('K' + stakeMark[0] + '+' + stakeMark[1]) : '') : '',
...this.formData,
dcExecuteAction: dcArr
}
}).then((result) => {
if (result.code != 200) return Message.error(result?.msg);
@ -562,8 +590,31 @@ export default {
Message.error("提交失败");
}).finally(() => {
this.submitting = false;
this.$emit('queryData', true);
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);
})
}
}
})

99
ruoyi-ui/src/views/JiHeExpressway/pages/control/event/plan/data.js

@ -3,77 +3,54 @@ import { merge, cloneDeep } from "lodash";
export const searchFormList = [
{
label: "事件状态:",
key: "eventState",
type: "RadioGroup",
options: {
options: [
{
key: "0",
label: "未解决",
},
{
key: "1",
label: "已解决",
},
{
key: "2",
label: "已关闭",
},
],
label: "预案名称:",
key: "planName",
},
},
PresetFormItems.eventSources,
PresetFormItems.eventType,
{
label: "方向:",
key: "direction",
label: "事件分类:",
key: "eventCategory",
type: "RadioGroup",
options: {
options: [
{
key: "济南方向",
label: "济南方向",
},
{
key: "菏泽方向",
label: "菏泽方向",
key: "1",
label: "交通事件",
},
{
key: "双向",
label: "双向",
key: "2",
label: "感知事件",
},
],
},
},
{
label: "时间范围:",
key: "daterange",
required: false,
type: "datePicker",
options: {
type: "daterange",
format: "yyyy-MM-dd HH:mm:ss",
valueFormat: "yyyy-MM-dd HH:mm:ss",
},
},
{
...PresetFormItems.station,
label: "开始桩号:",
required: false,
},
merge(cloneDeep(PresetFormItems.station), {
options: {
options: [
{
key: "endStakeMark[0]",
},
{
key: "endStakeMark[1]",
},
],
},
label: "结束桩号:",
required: false,
}),
// {
// label: "时间范围:",
// key: "daterange",
// required: false,
// type: "datePicker",
// options: {
// type: "daterange",
// format: "yyyy-MM-dd HH:mm:ss",
// valueFormat: "yyyy-MM-dd HH:mm:ss",
// },
// },
// {
// ...PresetFormItems.station,
// label: "开始桩号:",
// required: false,
// },
// merge(cloneDeep(PresetFormItems.station), {
// options: {
// options: [
// {
// key: "endStakeMark[0]",
// },
// {
// key: "endStakeMark[1]",
// },
// ],
// },
// label: "结束桩号:",
// required: false,
// }),
];

138
ruoyi-ui/src/views/JiHeExpressway/pages/control/event/plan/formTable/index.vue

@ -11,26 +11,30 @@
</template>
</ElTableColumn>
<ElTableColumn prop="phrases2" width="260">
<ElTableColumn prop="searchRule" width="260">
<template slot-scope="scope">
<el-select v-if="scope.row.deviceType == 1" v-model="scope.row.phrases2" placeholder="检索规则条件">
<el-select v-if="scope.row.deviceType == 1" v-model="scope.row.searchRule" placeholder="检索规则条件">
<el-option v-for="item in zyOptions" :key="item.value" :label="item.label" :value="item.value">
</el-option>
</el-select>
<div v-if="scope.row.deviceType == 2" class="plhx">
<el-select v-model="scope.row.phrases1" placeholder="">
<el-option label="事发上游最近" :value="1"></el-option>
<el-select v-model="scope.row.searchRule" placeholder="">
<el-option v-for="item in zyOptions" :key="item.value" :label="item.label"
:value="item.value">
</el-option>
</el-select>
<el-input-number v-model="scope.row.phrases2" :min="0" :max="9999"
<el-input-number v-model="scope.row.number" :min="0" :max="9999"
style="width: 130px;"></el-input-number>
</div>
<div v-if="scope.row.deviceType == 3 || scope.row.deviceType == 4" class="plhx">
<el-select v-model="scope.row.phrases1" placeholder="">
<el-option label="最近公里数" :value="1"></el-option>
<el-select v-model="scope.row.searchRule" placeholder="">
<el-option v-for="item in zyOptions" :key="item.value" :label="item.label"
:value="item.value">
</el-option>
</el-select>
<el-input-number v-model="scope.row.phrases2" :min="0" :max="9999"
<el-input-number v-model="scope.row.number" :min="0" :max="9999"
style="width: 130px;"></el-input-number>
<p style="width: 56px;">公里</p>
</div>
@ -38,42 +42,42 @@
</template>
</ElTableColumn>
<ElTableColumn prop="phrases3" width="370">
<ElTableColumn prop="deviceList" width="370">
<template slot-scope="scope">
<div v-if="scope.row.deviceType == 1" class="mjs">
<el-select v-model="scope.row.phrases3" placeholder="" multiple collapse-tags>
<el-select v-model="scope.row.deviceList" placeholder="" multiple collapse-tags>
<el-option v-for="item in options" :key="item.value" :label="item.label"
:value="item.value">
</el-option>
</el-select>
<el-input placeholder="请选择" v-model="scope.row.phrases4" readonly>
<el-input placeholder="请选择" v-model="scope.row.qbb" readonly>
<i slot="suffix" class="el-input__icon el-icon-search"></i>
</el-input>
</div>
<div v-if="scope.row.deviceType == 2" class="mjs">
<el-select v-model="scope.row.phrases4" placeholder="">
<el-select v-model="scope.row.gzms" placeholder="">
<el-option label="工作模式" :value="1"></el-option>
</el-select>
<el-select v-model="scope.row.phrases6" placeholder="">
<el-select v-model="scope.row.czsc" placeholder="">
<el-option label="操作时长" :value="1"></el-option>
</el-select>
</div>
<div v-if="scope.row.deviceType == 3" class="mjs">
<el-select v-model="scope.row.phrases4" placeholder="">
<el-select v-model="scope.row.kzms" placeholder="">
<el-option label="控制模式" :value="1"></el-option>
</el-select>
<el-select v-model="scope.row.phrases5" placeholder="">
<el-select v-model="scope.row.sj" placeholder="">
<el-option label="选择时间" :value="1"></el-option>
</el-select>
<el-select v-model="scope.row.phrases6" placeholder="">
<el-select v-model="scope.row.gzzt" placeholder="">
<el-option label="工作状态" :value="1"></el-option>
</el-select>
</div>
<div v-if="scope.row.deviceType == 4" class="mjs">
<el-input v-model="scope.row.phrases4" placeholder="请输入发布内容"></el-input>
<el-input v-model="scope.row.fbnr" placeholder="请输入发布内容"></el-input>
</div>
</template>
@ -112,20 +116,24 @@ export default {
props: {
visible: Boolean,
eventType: Number,
// process: {
// type: Array,
// default: () => []
// }
tableData: {
type: Array,
default: () => [{
deviceType: 1,
searchRule: 1,
qbb: '安全行驶'
}]
}
},
data() {
return {
tableData: [
{
deviceType: 1,
phrases2: 1,
phrases4: '安全行驶'
}
],
// tableData: [
// {
// deviceType: 1,
// searchRule: 1,
// qbb: ''
// }
// ],
deviceOptions: [
{
value: 1,
@ -208,53 +216,14 @@ export default {
}
},
methods: {
getProcess() {
this.tableData = [];
request({
url: `/business/dcEventType/${this.eventType}`,
method: "get",
}).then(result => {
if (result.code != 200) return Message.error(result.msg);
//
this.process = [];
this.tableData = [];
result.data.processConfigList?.forEach((it, index) => {
let commonPhrasesArr = it.commonPhrases ? it.commonPhrases.split(',') : [''];
let phrs = [];
commonPhrasesArr?.forEach(phr => {
phrs.push({ id: it.id, phrases: phr })
})
this.process.push({
...it,
phrs: phrs,
label: it.processNode,
isActive: index == 0 ? true : false,
})
if (index == 0) {
this.id = it.id;
this.tableData = phrs;
}
})
})
},
changeDeviceType(value) {
this.deviceType = value;
},
getTableData() {
let rows = this.process.find(item => item.id == this.id);
return rows?.phrs || [];
},
updateTableData(id = 1) {
this.id = id;
this.tableData = [];
let pros = this.process.find(item => item.id == id);
this.tableData = pros.phrs;
},
onAdd(id) {
this.tableData.push({
id: id,
phrases: ''
deviceType: 1,
// searchRule: 1,
// qbb: ''
})
},
onDel(index) {
@ -263,35 +232,6 @@ export default {
}
this.tableData.splice(index, 1)
},
submitTable() {
let data = []
this.process.forEach((lc) => {
let commonPhrases = [];
lc.phrs.forEach(phr => { if (phr.phrases) commonPhrases.push(phr.phrases) })
data.push({
commonPhrases: commonPhrases.join(','),
id: lc.id,
eventType: lc.eventType,
nodeNode: lc.nodeNode,
processNode: lc.processNode
})
})
console.log('data', data)
// return;
request({
url: `/business/dcEventType/updateDcProcessConfig`,
method: "post",
data: {
eventType: this.eventType,
processConfigList: data
}
}).then(result => {
if (result.code != 200) return Message.error(result.msg);
Message.success(result.msg);
this.modelVisible = false;
this.$emit('reInitData', true)
})
}
}
}
</script>

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

@ -17,8 +17,8 @@
刷新
</ButtonGradient>
</div>
<InputSearch style="width: 402px;" :formList="searchFormList"
:formConfigOptions="{ dFormData: { eventState: 0 } }" @handleSearch="handleSearch" />
<InputSearch style="width: 402px;" :formList="searchFormList" :formConfigOptions="{}"
@handleSearch="handleSearch" />
</div>
<!-- 内容 -->
@ -41,8 +41,7 @@
</div>
<!-- 新增修改弹窗 -->
<AddAndEditDialog :visible="isShowDialog" :detail="detail" @close="onCloseAddNew"
@update:phrasesData="onUpdatePhrasesData" @reInitData="initData" />
<AddAndEditDialog :visible="isShowDialog" :detail="detail" @close="onCloseAddNew" @reInitData="initData" />
<!-- 分页 -->
<div class="footer">
@ -137,23 +136,27 @@ export default {
});
},
onSizeChange(pageSize) {
// this.searchData.pageSize = pageSize;
// this.getData();
this.searchData.pageSize = pageSize;
this.initData();
},
onRefresh() {
this.initData();
},
onAdd() {
this.isShowDialog = true
this.detail = {}
this.isShowDialog = true;
},
onCloseAddNew() {
this.isShowDialog = false
this.isShowDialog = false;
},
onUpdatePhrasesData() {
showDisposal(data) {
this.detail = { ...data }
this.isShowDialog = true;
},
handleSearch() {
handleSearch(data) {
console.log(data);
this.searchData = { ...this.searchData, ...data }
this.initData();
},
async handleDelete(data) {
await confirm({ message: "是否要删除该预案?" });

Loading…
Cancel
Save