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

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

@ -1,5 +1,5 @@
<template> <template>
<Dialog v-model="modelVisible" title="新增预案"> <Dialog v-model="modelVisible" :title="title">
<div class="EventAddPlanDialog"> <div class="EventAddPlanDialog">
<ElForm :model="formData" inline :rules="rules" ref="ruleForm"> <ElForm :model="formData" inline :rules="rules" ref="ruleForm">
<div class="first"> <div class="first">
@ -19,6 +19,7 @@
</el-option> </el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item <el-form-item
v-if="(formData.eventCategory == 1 && formData.eventType !== 8) || formData.eventCategory == 2" v-if="(formData.eventCategory == 1 && formData.eventType !== 8) || formData.eventCategory == 2"
label="触发类型:" prop="triggerMechanism"> label="触发类型:" prop="triggerMechanism">
@ -52,26 +53,27 @@
</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">执行操作:</div> <div class="text">执行操作:</div>
</el-col> </el-col>
<el-col :span="22"> <el-col :span="22">
<FormTable ref="secondFormTable"></FormTable> <FormTable ref="secondFormTable" :tableData="secondFormData"></FormTable>
</el-col> </el-col>
</el-row> </el-row>
</div> </div>
<!-- <div class="third"> <div class="third">
<el-row> <el-row>
<el-col :span="2"> <el-col :span="2">
<div class="text">恢复操作:</div> <div class="text">恢复操作:</div>
</el-col> </el-col>
<el-col :span="22"> <el-col :span="22">
<FormTable></FormTable> <FormTable ref="thirdFormTable" :tableData="thirdFormData"></FormTable>
</el-col> </el-col>
</el-row> </el-row>
</div> --> </div>
</ElForm> </ElForm>
</div> </div>
@ -287,18 +289,25 @@ export default {
}, },
data() { data() {
return { return {
activeName: "TrafficAccident", title: '新增预案',
dialogType: 1,
planId: 0,
submitting: false, submitting: false,
formConfig: {},
formData: { formData: {
eventCategory: 1, eventCategory: 1,
eventType: 1, eventType: 1,
triggeringCondition: 0 triggerMechanism: 1
}, },
index: 1, secondFormData: [{
roads: [], deviceType: 1,
direction: [], searchRule: 1,
lwss: [], qbb: '安全行驶'
}],
thirdFormData: [{
deviceType: 1,
searchRule: 1,
qbb: '安全行驶'
}],
eventOptions: [ eventOptions: [
{ {
value: 1, value: 1,
@ -394,68 +403,70 @@ export default {
} }
} }
}, },
created() { mounted() {
// this.formConfig = tabConfigList[0].formConfig;
this.initData().then(() => {
this.handleChange({ index: 0 })
})
}, },
computed: { computed: {
modelVisible: { modelVisible: {
get() { 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; return this.visible;
}, },
set(val) { set(val) {
this.$emit('close', val) this.$emit('close', val)
} }
}, },
getFormOptions() {
return {
column: 3,
...this.formConfig.formOptions
}
}
}, },
methods: { methods: {
initData() { initData(id = 1) {
return Promise.all([ request({
// url: `/business/plans/list/${id}`,
request({ method: "get",
url: `/business/road/query`, }).then((result) => {
method: "get", if (result.code != 200) return Message.error(result?.msg);
}).then((result) => { let data = result.data;
if (result.code != 200) return Message.error(result?.msg); let dcExecuteAction = result.data.dcExecuteAction;
result.data.forEach(it => {
this.roads.push({ key: it.id, label: it.roadName }) this.planId = data.id;
}) this.formData = {
}).catch((err) => { eventCategory: data.eventCategory,
Message.error("查询失败4", err); planName: data.planName,
}), eventType: data.eventType,
// triggerMechanism: data.triggerMechanism,
request({ }
url: `/system/dict/data/type/iot_event_direction`, this.secondFormData = [];
method: "get", this.thirdFormData = [];
}).then((result) => { dcExecuteAction.forEach(it => {
if (result.code != 200) return Message.error(result?.msg); if (it.deviceList) {
result.data.forEach(it => { it.deviceList = it.deviceList.split(',');
this.direction.push({ key: it.dictValue, label: it.dictLabel }) }
}) if (it.actionType == 1) {
}).catch((err) => { this.secondFormData.push(it);
Message.error("查询失败5", err); } else if (it.actionType == 2) {
}), this.thirdFormData.push(it);
// 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);
}) })
]) }).catch((err) => {
console.log(err)
Message.error("查询事件预案列表失败", err);
})
}, },
changeEventType(value = 1) { changeEventType(value = 1) {
this.mechanismOptions = optionsMap[this.formData.eventCategory || 1][value]; this.mechanismOptions = optionsMap[this.formData.eventCategory || 1][value];
@ -537,33 +548,73 @@ export default {
handleSubmit() { handleSubmit() {
this.$refs['ruleForm'].validate((valid) => { this.$refs['ruleForm'].validate((valid) => {
if (valid) { if (valid) {
this.submitting = true; // this.submitting = false;
console.log('formData', this.formData) let secondFormTable = this.$refs['secondFormTable'].tableData || [];
this.modelVisible = false; let thirdFormTable = this.$refs['thirdFormTable'].tableData || [];
this.submitting = false; let dcArr = [];
// this.$emit('queryData',true) secondFormTable.forEach(it => {
console.log(this.$refs['secondFormTable'].tableData) if (it.deviceList && typeof it.deviceList !== 'string' && it.deviceList.length > 0) {
return; it.deviceList = it.deviceList.join(',');
} else {
request({ it.deviceList = ''
url: `/dc/system/event`, }
method: "post", dcArr.push({ ...it, actionType: 1 });
data: { })
...formData, thirdFormTable.forEach(it => {
eventType: Number(this.index) + 1, if (it.deviceList && typeof it.deviceList !== 'string' && it.deviceList.length > 0) {
eventState: 0, it.deviceList = it.deviceList.join(',');
stakeMark: (stakeMark && stakeMark[0] != null) ? ((stakeMark && stakeMark.length > 0) ? ('K' + stakeMark[0] + '+' + stakeMark[1]) : '') : '', } else {
it.deviceList = ''
} }
}).then((result) => { dcArr.push({ ...it, actionType: 2 });
if (result.code != 200) return Message.error(result?.msg); })
Message.success("提交成功");
this.modelVisible = false; console.log({
}).catch(() => { ...this.formData,
Message.error("提交失败"); dcExecuteAction: dcArr
}).finally(() => {
this.submitting = false;
this.$emit('queryData', true);
}) })
// return;
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);
})
} 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 = [ export const searchFormList = [
{ {
label: "事件状态:", label: "预案名称:",
key: "eventState", key: "planName",
type: "RadioGroup",
options: {
options: [
{
key: "0",
label: "未解决",
},
{
key: "1",
label: "已解决",
},
{
key: "2",
label: "已关闭",
},
],
},
}, },
PresetFormItems.eventSources,
PresetFormItems.eventType,
{ {
label: "方向:", label: "事件分类:",
key: "direction", key: "eventCategory",
type: "RadioGroup", type: "RadioGroup",
options: { options: {
options: [ options: [
{ {
key: "济南方向", key: "1",
label: "济南方向", label: "交通事件",
},
{
key: "菏泽方向",
label: "菏泽方向",
}, },
{ {
key: "双向", key: "2",
label: "双向", label: "感知事件",
}, },
], ],
}, },
}, },
{ // {
label: "时间范围:", // label: "时间范围:",
key: "daterange", // key: "daterange",
required: false, // required: false,
type: "datePicker", // type: "datePicker",
options: { // options: {
type: "daterange", // type: "daterange",
format: "yyyy-MM-dd HH:mm:ss", // format: "yyyy-MM-dd HH:mm:ss",
valueFormat: "yyyy-MM-dd HH:mm:ss", // valueFormat: "yyyy-MM-dd HH:mm:ss",
}, // },
}, // },
{ // {
...PresetFormItems.station, // ...PresetFormItems.station,
label: "开始桩号:", // label: "开始桩号:",
required: false, // required: false,
}, // },
merge(cloneDeep(PresetFormItems.station), { // merge(cloneDeep(PresetFormItems.station), {
options: { // options: {
options: [ // options: [
{ // {
key: "endStakeMark[0]", // key: "endStakeMark[0]",
}, // },
{ // {
key: "endStakeMark[1]", // key: "endStakeMark[1]",
}, // },
], // ],
}, // },
label: "结束桩号:", // label: "结束桩号:",
required: false, // required: false,
}), // }),
]; ];

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

@ -11,26 +11,30 @@
</template> </template>
</ElTableColumn> </ElTableColumn>
<ElTableColumn prop="phrases2" width="260"> <ElTableColumn prop="searchRule" width="260">
<template slot-scope="scope"> <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 v-for="item in zyOptions" :key="item.value" :label="item.label" :value="item.value">
</el-option> </el-option>
</el-select> </el-select>
<div v-if="scope.row.deviceType == 2" class="plhx"> <div v-if="scope.row.deviceType == 2" class="plhx">
<el-select v-model="scope.row.phrases1" placeholder=""> <el-select v-model="scope.row.searchRule" placeholder="">
<el-option label="事发上游最近" :value="1"></el-option> <el-option v-for="item in zyOptions" :key="item.value" :label="item.label"
:value="item.value">
</el-option>
</el-select> </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> style="width: 130px;"></el-input-number>
</div> </div>
<div v-if="scope.row.deviceType == 3 || scope.row.deviceType == 4" class="plhx"> <div v-if="scope.row.deviceType == 3 || scope.row.deviceType == 4" class="plhx">
<el-select v-model="scope.row.phrases1" placeholder=""> <el-select v-model="scope.row.searchRule" placeholder="">
<el-option label="最近公里数" :value="1"></el-option> <el-option v-for="item in zyOptions" :key="item.value" :label="item.label"
:value="item.value">
</el-option>
</el-select> </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> style="width: 130px;"></el-input-number>
<p style="width: 56px;">公里</p> <p style="width: 56px;">公里</p>
</div> </div>
@ -38,42 +42,42 @@
</template> </template>
</ElTableColumn> </ElTableColumn>
<ElTableColumn prop="phrases3" width="370"> <ElTableColumn prop="deviceList" width="370">
<template slot-scope="scope"> <template slot-scope="scope">
<div v-if="scope.row.deviceType == 1" class="mjs"> <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" <el-option v-for="item in options" :key="item.value" :label="item.label"
:value="item.value"> :value="item.value">
</el-option> </el-option>
</el-select> </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> <i slot="suffix" class="el-input__icon el-icon-search"></i>
</el-input> </el-input>
</div> </div>
<div v-if="scope.row.deviceType == 2" class="mjs"> <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-option label="工作模式" :value="1"></el-option>
</el-select> </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-option label="操作时长" :value="1"></el-option>
</el-select> </el-select>
</div> </div>
<div v-if="scope.row.deviceType == 3" class="mjs"> <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-option label="控制模式" :value="1"></el-option>
</el-select> </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-option label="选择时间" :value="1"></el-option>
</el-select> </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-option label="工作状态" :value="1"></el-option>
</el-select> </el-select>
</div> </div>
<div v-if="scope.row.deviceType == 4" class="mjs"> <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> </div>
</template> </template>
@ -112,20 +116,24 @@ export default {
props: { props: {
visible: Boolean, visible: Boolean,
eventType: Number, eventType: Number,
// process: { tableData: {
// type: Array, type: Array,
// default: () => [] default: () => [{
// } deviceType: 1,
searchRule: 1,
qbb: '安全行驶'
}]
}
}, },
data() { data() {
return { return {
tableData: [ // tableData: [
{ // {
deviceType: 1, // deviceType: 1,
phrases2: 1, // searchRule: 1,
phrases4: '安全行驶' // qbb: ''
} // }
], // ],
deviceOptions: [ deviceOptions: [
{ {
value: 1, value: 1,
@ -208,53 +216,14 @@ export default {
} }
}, },
methods: { 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) { changeDeviceType(value) {
this.deviceType = 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) { onAdd(id) {
this.tableData.push({ this.tableData.push({
id: id, deviceType: 1,
phrases: '' // searchRule: 1,
// qbb: ''
}) })
}, },
onDel(index) { onDel(index) {
@ -263,35 +232,6 @@ export default {
} }
this.tableData.splice(index, 1) 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> </script>

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

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

Loading…
Cancel
Save