40 changed files with 4515 additions and 1419 deletions
After Width: | Height: | Size: 1.3 KiB |
@ -1,281 +0,0 @@ |
|||||
<template> |
|
||||
<Card class="DeviceControl" title="设备管控"> |
|
||||
<div class="container"> |
|
||||
<el-row v-for="(item, index) in tableData" :key="index" class="rowBlock"> |
|
||||
<ScopeTable |
|
||||
:tableInfo="item" |
|
||||
:index="index" |
|
||||
@onAdd="onAdd" |
|
||||
@onDel="onDel" |
|
||||
@onConfirm="onConfirm" |
|
||||
@onContentEdit="onContentEdit" |
|
||||
></ScopeTable> |
|
||||
</el-row> |
|
||||
</div> |
|
||||
<div class="foot"> |
|
||||
<ButtonGradient |
|
||||
class="special-button" |
|
||||
style="background: rgb(229, 68, 73)" |
|
||||
@click.native="handleSubmit(1)" |
|
||||
> |
|
||||
一键控制 |
|
||||
</ButtonGradient> |
|
||||
<ButtonGradient |
|
||||
class="special-button" |
|
||||
style="background: rgb(250, 152, 56)" |
|
||||
@click.native="handleSubmit(2)" |
|
||||
> |
|
||||
一键恢复 |
|
||||
</ButtonGradient> |
|
||||
</div> |
|
||||
</Card> |
|
||||
</template> |
|
||||
|
|
||||
<script> |
|
||||
import Card from "@screen/components/Card2/Card.vue"; |
|
||||
import ButtonGradient from "@screen/components/Buttons/ButtonGradient.vue"; |
|
||||
import ScopeTable from "./components/ScopeTable.vue"; |
|
||||
import { provideMixin } from "./../../mixin"; |
|
||||
import { defaultTableInfo } from "./data"; |
|
||||
import { Message } from "element-ui"; |
|
||||
import request from "@/utils/request"; |
|
||||
|
|
||||
export default { |
|
||||
name: "DeviceControl", |
|
||||
mixins: [provideMixin], |
|
||||
components: { |
|
||||
Card, |
|
||||
ScopeTable, |
|
||||
ButtonGradient, |
|
||||
}, |
|
||||
data() { |
|
||||
return { |
|
||||
planId: "", |
|
||||
tableData: [], |
|
||||
}; |
|
||||
}, |
|
||||
watch: {}, |
|
||||
mounted() {}, |
|
||||
methods: { |
|
||||
detailChange(eventId) { |
|
||||
this.initData(this.detailData); |
|
||||
}, |
|
||||
initData(eventInfo) { |
|
||||
request({ |
|
||||
url: `business/plans/list/event/type`, |
|
||||
method: "post", |
|
||||
data: { ...eventInfo }, |
|
||||
}) |
|
||||
.then((result) => { |
|
||||
if (result.code != 200) return Message.error(result?.msg); |
|
||||
let data = result.data; |
|
||||
if (data.length == 0) { |
|
||||
this.tableData = [{ ...defaultTableInfo }]; |
|
||||
return Message.warning("该事件暂无处置预案"); |
|
||||
} |
|
||||
|
|
||||
let dcExecuteAction = data[0].dcExecuteAction || []; |
|
||||
this.planId = data[0].id; |
|
||||
|
|
||||
let dcArr = []; |
|
||||
dcExecuteAction.forEach((it) => { |
|
||||
let action = { ...it }; |
|
||||
if (it.executeConfig) { |
|
||||
let executeConfig = JSON.parse(it.executeConfig); |
|
||||
let execute = this.mapKeys(executeConfig, "zx_"); |
|
||||
action = { ...action, ...execute }; |
|
||||
} |
|
||||
if (it.recoverConfig) { |
|
||||
let recoverConfig = JSON.parse(it.recoverConfig); |
|
||||
let recover = this.mapKeys(recoverConfig, "hf_"); |
|
||||
action = { ...action, ...recover }; |
|
||||
} |
|
||||
if (it.deviceList) { |
|
||||
action.devList = it.deviceList.split(",").map((str) => str); |
|
||||
} |
|
||||
|
|
||||
dcArr.push(action); |
|
||||
}); |
|
||||
this.tableData = |
|
||||
dcArr.length == 0 ? [{ ...defaultTableInfo }] : dcArr; |
|
||||
|
|
||||
}) |
|
||||
.catch((err) => { |
|
||||
console.log(err); |
|
||||
Message.error("查询事件预案列表失败", err); |
|
||||
}); |
|
||||
}, |
|
||||
mapKeys(obj, prefix) { |
|
||||
return Object.keys(obj).reduce((result, key) => { |
|
||||
result[`${prefix}${key}`] = obj[key]; |
|
||||
return result; |
|
||||
}, {}); |
|
||||
}, |
|
||||
onAdd() { |
|
||||
this.tableData.push({ ...defaultTableInfo }); |
|
||||
}, |
|
||||
onDel(index) { |
|
||||
if (this.tableData.length <= 1) { |
|
||||
return Message.warning("最后一项不可删除!"); |
|
||||
} |
|
||||
this.tableData.splice(index, 1); |
|
||||
}, |
|
||||
onConfirm(index){ |
|
||||
const param = { |
|
||||
"dcEvent": { |
|
||||
"eventType": this.detailData.eventType, |
|
||||
"direction": this.detailData.direction, |
|
||||
"id": this.detailData.id, |
|
||||
"stakeMark": this.detailData.stakeMark, |
|
||||
"subclass": this.detailData.subclass |
|
||||
}, |
|
||||
"dcExecuteAction": { |
|
||||
"id": "", |
|
||||
"emergencyPlansId": "", |
|
||||
"deviceType": this.tableData[index].deviceType, |
|
||||
"searchRule": this.tableData[index].searchRule, |
|
||||
"number": this.tableData[index].number, |
|
||||
"deviceList": this.tableData[index].devList.join(','), |
|
||||
"executeConfig": "{\"operationType\":2}", |
|
||||
"recoverConfig": "{\"operationType\":2}" |
|
||||
} |
|
||||
} |
|
||||
request({ |
|
||||
url: `business/plans/list/event/emergencyPlans`, |
|
||||
method: "post", |
|
||||
data: param, |
|
||||
}).then(result=>{ |
|
||||
if (result.code != 200) return Message.error(result?.msg); |
|
||||
console.log(param,result,'===============') |
|
||||
let data = result.data; |
|
||||
this.tableData[index].executeConfig = JSON.parse(data.executeConfig) |
|
||||
this.tableData[index].recoverConfig = JSON.parse(data.recoverConfig) |
|
||||
this.tableData[index].zx_operationType = this.tableData[index].executeConfig?.operationType; |
|
||||
this.tableData[index].hf_operationType = this.tableData[index].recoverConfig?.operationType; |
|
||||
this.tableData = _.cloneDeep(this.tableData) |
|
||||
}) |
|
||||
}, |
|
||||
onContentEdit({field,index,idx,type}){ |
|
||||
if(type==='edit'){ |
|
||||
this.tableData[index][field]['contentList'][idx]['isEditor'] = this.tableData[index][field]['contentList'][idx].content; |
|
||||
} else if(type === 'cancel'){ |
|
||||
this.tableData[index][field]['contentList'][idx]['content'] = this.tableData[index][field]['contentList'][idx].isEditor; |
|
||||
delete this.tableData[index][field]['contentList'][idx].isEditor |
|
||||
} else if(type === 'confirm'){ |
|
||||
delete this.tableData[index][field]['contentList'][idx].isEditor |
|
||||
} |
|
||||
this.tableData = _.cloneDeep(this.tableData) |
|
||||
}, |
|
||||
handleSubmit(value = 1) { |
|
||||
let dcArr = []; |
|
||||
this.tableData.forEach((item) => { |
|
||||
let dcData = { |
|
||||
deviceType: item.deviceType, |
|
||||
searchRule: item.searchRule, |
|
||||
number: item.number, |
|
||||
}; |
|
||||
if (item.devList && item.devList.length > 0) { |
|
||||
dcData.deviceList = item.devList.join(","); |
|
||||
} |
|
||||
let zxData = {}, |
|
||||
hfData = {}; |
|
||||
if(item.executeConfig){ |
|
||||
zxData['executeConfig'] = item.executeConfig |
|
||||
} |
|
||||
if(item.recoverConfig){ |
|
||||
zxData['recoverConfig'] = item.recoverConfig |
|
||||
} |
|
||||
Object.keys(item).forEach((key) => { |
|
||||
if (/^zx_/.test(key)) { |
|
||||
let keyName = key.substring(3); |
|
||||
zxData[keyName] = item[key]; |
|
||||
} |
|
||||
if (/^hf_/.test(key)) { |
|
||||
let keyName = key.substring(3); |
|
||||
hfData[keyName] = item[key]; |
|
||||
} |
|
||||
}); |
|
||||
if (item.deviceType == 12) { |
|
||||
zxData = this.formatData(zxData); |
|
||||
hfData = this.formatData(hfData); |
|
||||
} |
|
||||
dcData.executeConfig = JSON.stringify(zxData); |
|
||||
dcData.recoverConfig = JSON.stringify(hfData); |
|
||||
|
|
||||
dcArr.push(dcData); |
|
||||
}); |
|
||||
|
|
||||
let reqData = { |
|
||||
operationType: value, //1-执行操作 2-恢复操作 |
|
||||
dcEmergencyPlans: { |
|
||||
id: this.planId, |
|
||||
dcExecuteAction: dcArr, |
|
||||
}, |
|
||||
dcEvent: { |
|
||||
id: this.detailData.id, |
|
||||
eventType: this.detailData.eventType, |
|
||||
stakeMark: this.detailData.stakeMark, |
|
||||
subclass: this.detailData.subclass, |
|
||||
direction: this.detailData.direction == "菏泽方向" ? "1" : "3", |
|
||||
}, |
|
||||
}; |
|
||||
console.log("reqData", reqData); |
|
||||
|
|
||||
return; |
|
||||
request({ |
|
||||
url: "/business/plans/event/confirm", |
|
||||
method: "post", |
|
||||
data: reqData, |
|
||||
}) |
|
||||
.then((result) => { |
|
||||
if (result.code != 200) return Message.error(result?.msg); |
|
||||
Message.success("提交成功"); |
|
||||
}) |
|
||||
.catch(() => { |
|
||||
Message.error("提交失败"); |
|
||||
}); |
|
||||
}, |
|
||||
}, |
|
||||
}; |
|
||||
</script> |
|
||||
|
|
||||
<style lang="scss" scoped> |
|
||||
.DeviceControl { |
|
||||
::v-deep { |
|
||||
.content { |
|
||||
display: flex; |
|
||||
flex-direction: column; |
|
||||
} |
|
||||
} |
|
||||
|
|
||||
.container { |
|
||||
flex: 1; |
|
||||
min-height: 300px; |
|
||||
overflow-y: auto; |
|
||||
|
|
||||
.rowBlock { |
|
||||
background-color: #296887; |
|
||||
padding: 5px 10px; |
|
||||
margin-bottom: 10px; |
|
||||
} |
|
||||
} |
|
||||
|
|
||||
.foot { |
|
||||
display: flex; |
|
||||
height: "100px"; |
|
||||
justify-content: space-evenly; |
|
||||
margin-top: 10px; |
|
||||
.special-button { |
|
||||
width: 100px; |
|
||||
cursor: pointer; |
|
||||
.icon { |
|
||||
background-repeat: no-repeat; |
|
||||
background-size: 100% 100%; |
|
||||
width: 20px; |
|
||||
height: 20px; |
|
||||
transition: all 0.3s linear; |
|
||||
} |
|
||||
} |
|
||||
} |
|
||||
} |
|
||||
</style> |
|
@ -1,472 +0,0 @@ |
|||||
<template> |
|
||||
<Dialog v-model="modelVisible" :title="title" width="1330px"> |
|
||||
<div class="EventAddPlanDialog"> |
|
||||
<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-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-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-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-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> |
|
||||
</el-col> |
|
||||
<el-col :span="22"> |
|
||||
<FormTable ref="secondFormTable" :tableData="secondFormData" :type="1"></FormTable> |
|
||||
</el-col> |
|
||||
</el-row> |
|
||||
</div> |
|
||||
<div class="third"> |
|
||||
<el-row> |
|
||||
<el-col :span="2"> |
|
||||
<div class="text"><i style="color: red">*</i>恢复操作:</div> |
|
||||
</el-col> |
|
||||
<el-col :span="22"> |
|
||||
<FormTable ref="thirdFormTable" :tableData="thirdFormData" :type="2"></FormTable> |
|
||||
</el-col> |
|
||||
</el-row> |
|
||||
</div> |
|
||||
</ElForm> |
|
||||
</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> |
|
||||
</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 { Message } from "element-ui"; |
|
||||
import { throttle } from "lodash"; |
|
||||
import { |
|
||||
inducerModeDic, |
|
||||
inducerWorkTypeDic, |
|
||||
gzmsMap, |
|
||||
eventSubClassMap, |
|
||||
trafficKV, |
|
||||
WarningTypeList as perceptionKV, |
|
||||
} from "@screen/utils/enum.js"; |
|
||||
|
|
||||
const typeMap = { |
|
||||
1: trafficKV, |
|
||||
2: perceptionKV, |
|
||||
}; |
|
||||
|
|
||||
export default { |
|
||||
name: "addAndEditDialog", |
|
||||
components: { |
|
||||
Dialog, |
|
||||
Form, |
|
||||
Button, |
|
||||
FormTable, |
|
||||
}, |
|
||||
model: { |
|
||||
prop: "visible", |
|
||||
event: "close", |
|
||||
}, |
|
||||
provide() { |
|
||||
return { |
|
||||
// loadData: throttle(this.loadData, 100) |
|
||||
loadData: this.loadData, |
|
||||
}; |
|
||||
}, |
|
||||
props: { |
|
||||
visible: Boolean, |
|
||||
detail: { |
|
||||
type: Object, |
|
||||
default: () => { }, |
|
||||
}, |
|
||||
}, |
|
||||
data() { |
|
||||
return { |
|
||||
title: "新增预案", |
|
||||
dialogType: 1, |
|
||||
planId: 0, |
|
||||
submitting: false, |
|
||||
formData: { |
|
||||
eventCategory: 1, |
|
||||
eventType: 1, |
|
||||
triggerMechanism: "", |
|
||||
}, |
|
||||
secondFormData: [ |
|
||||
{ |
|
||||
deviceType: 1, |
|
||||
searchRule: 1, |
|
||||
qbb: "", |
|
||||
}, |
|
||||
], |
|
||||
thirdFormData: [ |
|
||||
{ |
|
||||
deviceType: 1, |
|
||||
searchRule: 1, |
|
||||
qbb: "", |
|
||||
}, |
|
||||
], |
|
||||
deviceData: [], |
|
||||
eventOptions: trafficKV, |
|
||||
mechanismOptions: [ |
|
||||
{ |
|
||||
value: "1-1", |
|
||||
label: "追尾", |
|
||||
}, |
|
||||
{ |
|
||||
value: "1-2", |
|
||||
label: "侧翻", |
|
||||
}, |
|
||||
{ |
|
||||
value: "1-3", |
|
||||
label: "撞护栏", |
|
||||
}, |
|
||||
{ |
|
||||
value: "1-4", |
|
||||
label: "自然", |
|
||||
}, |
|
||||
{ |
|
||||
value: "1-5", |
|
||||
label: "其他事故", |
|
||||
}, |
|
||||
], |
|
||||
rules: { |
|
||||
planName: [{ required: true, message: "请输入预案名称" }], |
|
||||
eventType: [ |
|
||||
{ required: true, message: "请选择事件类型", trigger: "change" }, |
|
||||
], |
|
||||
}, |
|
||||
}; |
|
||||
}, |
|
||||
mounted() { }, |
|
||||
computed: { |
|
||||
modelVisible: { |
|
||||
get() { |
|
||||
if (this.visible) { |
|
||||
if (Object.keys(this.detail).length > 0) { |
|
||||
this.title = "修改预案"; |
|
||||
this.dialogType = 2; |
|
||||
this.eventOptions = typeMap[this.detail.eventCategory]; |
|
||||
this.mechanismOptions = |
|
||||
eventSubClassMap[this.detail.eventCategory || 1][ |
|
||||
this.detail.eventType |
|
||||
]; |
|
||||
this.initData(this.detail.id); |
|
||||
} else { |
|
||||
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: "", |
|
||||
}, |
|
||||
]; |
|
||||
} |
|
||||
} |
|
||||
return this.visible; |
|
||||
}, |
|
||||
set(val) { |
|
||||
this.$emit("close", val); |
|
||||
}, |
|
||||
}, |
|
||||
}, |
|
||||
methods: { |
|
||||
initData(id = 1) { |
|
||||
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; |
|
||||
|
|
||||
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 (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); |
|
||||
}); |
|
||||
}, |
|
||||
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"); |
|
||||
} else { |
|
||||
this.deviceData = result.data; |
|
||||
} |
|
||||
return this.deviceData; |
|
||||
}, |
|
||||
changeEventType(value = 1) { |
|
||||
this.mechanismOptions = |
|
||||
eventSubClassMap[this.formData.eventCategory || 1][value]; |
|
||||
}, |
|
||||
changeRadio(value = 1) { |
|
||||
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(","); |
|
||||
} else { |
|
||||
data.deviceList = ""; |
|
||||
} |
|
||||
if (it.content) { |
|
||||
data.otherConfig = JSON.stringify({ content: it.content }); |
|
||||
} |
|
||||
if (it.controlModel) { |
|
||||
let other = { |
|
||||
controlModel: it.controlModel, |
|
||||
controlModelName: inducerModeDic[it.controlModel], |
|
||||
state: it.state, |
|
||||
name: inducerWorkTypeDic[it.state], |
|
||||
}; |
|
||||
if (it.time && it?.time[0]) { |
|
||||
other = { |
|
||||
controlModel: it.controlModel, |
|
||||
controlModelName: inducerModeDic[it.controlModel], |
|
||||
state: it.state, |
|
||||
name: inducerWorkTypeDic[it.state], |
|
||||
startTime: it.time[0], |
|
||||
endTime: it.time[1], |
|
||||
}; |
|
||||
} |
|
||||
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) => { |
|
||||
if (valid) { |
|
||||
// this.submitting = false; |
|
||||
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 }; |
|
||||
// } |
|
||||
// if (flg) return Message.warning('执行操作子项不能为空!'); |
|
||||
// for (let item of thirdFormTable) { |
|
||||
// if (this.areAllValuesEmpty(item)) { flg = true; break }; |
|
||||
// } |
|
||||
// if (flg) return Message.warning('恢复操作子项不能为空!'); |
|
||||
// console.log('12', secondFormTable); |
|
||||
// console.log('34', thirdFormTable); |
|
||||
let dcArr = []; |
|
||||
let id = ""; |
|
||||
if (this.dialogType == 2) id = this.planId; |
|
||||
secondFormTable.forEach((it) => { |
|
||||
dcArr.push(this.formatData(it, 1, id)); |
|
||||
}); |
|
||||
thirdFormTable.forEach((it) => { |
|
||||
dcArr.push(this.formatData(it, 2, id)); |
|
||||
}); |
|
||||
|
|
||||
console.log({ |
|
||||
...this.formData, |
|
||||
dcExecuteAction: dcArr, |
|
||||
}); |
|
||||
// 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); |
|
||||
}); |
|
||||
} |
|
||||
} |
|
||||
}); |
|
||||
}, |
|
||||
areAllValuesEmpty(obj) { |
|
||||
console.log("ass", obj); |
|
||||
return Object.keys(obj).every(function (key) { |
|
||||
const value = obj[key]; |
|
||||
return ( |
|
||||
value == null || |
|
||||
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 0.24s; |
|
||||
} |
|
||||
|
|
||||
.fade-enter, |
|
||||
.fade-leave-to { |
|
||||
opacity: 0; |
|
||||
} |
|
||||
|
|
||||
.EventAddPlanDialog { |
|
||||
gap: 9px; |
|
||||
width: 1280px; |
|
||||
height: 310px; |
|
||||
display: flex; |
|
||||
flex-direction: column; |
|
||||
|
|
||||
.first, |
|
||||
.second, |
|
||||
.third { |
|
||||
padding: 5px 10px 8px; |
|
||||
background-color: #296887; |
|
||||
margin-bottom: 15px; |
|
||||
|
|
||||
.text { |
|
||||
margin-top: 12px; |
|
||||
} |
|
||||
} |
|
||||
|
|
||||
.form { |
|
||||
flex: 1; |
|
||||
overflow-y: auto; |
|
||||
} |
|
||||
|
|
||||
.footer { |
|
||||
display: flex; |
|
||||
justify-content: end; |
|
||||
gap: 15px; |
|
||||
} |
|
||||
} |
|
||||
</style> |
|
File diff suppressed because it is too large
File diff suppressed because it is too large
Loading…
Reference in new issue