|
|
@ -1,15 +1,28 @@ |
|
|
|
<template> |
|
|
|
<Card class='DeviceControl' title="设备管控"> |
|
|
|
<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"></ScopeTable> |
|
|
|
<ScopeTable |
|
|
|
:tableInfo="item" |
|
|
|
:index="index" |
|
|
|
@onAdd="onAdd" |
|
|
|
@onDel="onDel" |
|
|
|
></ScopeTable> |
|
|
|
</el-row> |
|
|
|
</div> |
|
|
|
<div class="foot"> |
|
|
|
<ButtonGradient class="special-button" style="background: rgb(229, 68, 73);" @click.native="handleSubmit(1)"> |
|
|
|
<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 |
|
|
|
class="special-button" |
|
|
|
style="background: rgb(250, 152, 56)" |
|
|
|
@click.native="handleSubmit(2)" |
|
|
|
> |
|
|
|
一键恢复 |
|
|
|
</ButtonGradient> |
|
|
|
</div> |
|
|
@ -17,50 +30,48 @@ |
|
|
|
</template> |
|
|
|
|
|
|
|
<script> |
|
|
|
import Card from "@screen/components/Card2/Card.vue";; |
|
|
|
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 { provideMixin } from "./../../mixin"; |
|
|
|
import { defaultTableInfo } from "./data"; |
|
|
|
import { Message } from 'element-ui' |
|
|
|
import { Message } from "element-ui"; |
|
|
|
import request from "@/utils/request"; |
|
|
|
|
|
|
|
export default { |
|
|
|
name: 'DeviceControl', |
|
|
|
name: "DeviceControl", |
|
|
|
mixins: [provideMixin], |
|
|
|
components: { |
|
|
|
Card, |
|
|
|
ScopeTable, |
|
|
|
ButtonGradient |
|
|
|
ButtonGradient, |
|
|
|
}, |
|
|
|
data() { |
|
|
|
return { |
|
|
|
planId: '', |
|
|
|
tableData: [] |
|
|
|
} |
|
|
|
}, |
|
|
|
watch: { |
|
|
|
}, |
|
|
|
mounted() { |
|
|
|
planId: "", |
|
|
|
tableData: [], |
|
|
|
}; |
|
|
|
}, |
|
|
|
watch: {}, |
|
|
|
mounted() {}, |
|
|
|
methods: { |
|
|
|
detailChange(eventId) { |
|
|
|
this.initData(this.detailData); |
|
|
|
}, |
|
|
|
initData(eventInfo) { |
|
|
|
console.log('eventInfo', eventInfo) |
|
|
|
console.log("eventInfo", eventInfo); |
|
|
|
request({ |
|
|
|
url: `business/plans/list/event/type`, |
|
|
|
method: "post", |
|
|
|
data: { ...eventInfo } |
|
|
|
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('该事件暂无处置预案') |
|
|
|
}; |
|
|
|
return Message.warning("该事件暂无处置预案"); |
|
|
|
} |
|
|
|
|
|
|
|
let dcExecuteAction = data[0].dcExecuteAction || []; |
|
|
|
this.planId = data[0].id; |
|
|
@ -70,23 +81,22 @@ export default { |
|
|
|
let action = { ...it }; |
|
|
|
if (it.executeConfig) { |
|
|
|
let executeConfig = JSON.parse(it.executeConfig); |
|
|
|
let execute = this.mapKeys(executeConfig, 'zx_'); |
|
|
|
let execute = this.mapKeys(executeConfig, "zx_"); |
|
|
|
action = { ...action, ...execute }; |
|
|
|
} |
|
|
|
if (it.recoverConfig) { |
|
|
|
let recoverConfig = JSON.parse(it.recoverConfig); |
|
|
|
let recover = this.mapKeys(recoverConfig, 'hf_'); |
|
|
|
let recover = this.mapKeys(recoverConfig, "hf_"); |
|
|
|
action = { ...action, ...recover }; |
|
|
|
} |
|
|
|
if (it.deviceList) { |
|
|
|
action.devList = it.deviceList |
|
|
|
.split(",") |
|
|
|
.map((str) => str); |
|
|
|
action.devList = it.deviceList.split(",").map((str) => str); |
|
|
|
} |
|
|
|
|
|
|
|
dcArr.push(action); |
|
|
|
}); |
|
|
|
this.tableData = dcArr.length == 0 ? [{ ...defaultTableInfo }] : dcArr; |
|
|
|
this.tableData = |
|
|
|
dcArr.length == 0 ? [{ ...defaultTableInfo }] : dcArr; |
|
|
|
|
|
|
|
console.log("tableData", this.tableData); |
|
|
|
}) |
|
|
@ -102,27 +112,28 @@ export default { |
|
|
|
}, {}); |
|
|
|
}, |
|
|
|
onAdd() { |
|
|
|
this.tableData.push({ ...defaultTableInfo }) |
|
|
|
this.tableData.push({ ...defaultTableInfo }); |
|
|
|
}, |
|
|
|
onDel(index) { |
|
|
|
if (this.tableData.length <= 1) { |
|
|
|
return Message.warning('最后一项不可删除!'); |
|
|
|
return Message.warning("最后一项不可删除!"); |
|
|
|
} |
|
|
|
this.tableData.splice(index, 1) |
|
|
|
this.tableData.splice(index, 1); |
|
|
|
}, |
|
|
|
handleSubmit(value = 1) { |
|
|
|
let dcArr = []; |
|
|
|
this.tableData.forEach(item => { |
|
|
|
this.tableData.forEach((item) => { |
|
|
|
let dcData = { |
|
|
|
deviceType: item.deviceType, |
|
|
|
searchRule: item.searchRule, |
|
|
|
number: item.number |
|
|
|
} |
|
|
|
number: item.number, |
|
|
|
}; |
|
|
|
if (item.devList && item.devList.length > 0) { |
|
|
|
dcData.deviceList = item.devList.join(","); |
|
|
|
} |
|
|
|
let zxData = {}, hfData = {}; |
|
|
|
Object.keys(item).forEach(key => { |
|
|
|
let zxData = {}, |
|
|
|
hfData = {}; |
|
|
|
Object.keys(item).forEach((key) => { |
|
|
|
if (/^zx_/.test(key)) { |
|
|
|
let keyName = key.substring(3); |
|
|
|
zxData[keyName] = item[key]; |
|
|
@ -131,7 +142,7 @@ export default { |
|
|
|
let keyName = key.substring(3); |
|
|
|
hfData[keyName] = item[key]; |
|
|
|
} |
|
|
|
}) |
|
|
|
}); |
|
|
|
if (item.deviceType == 12) { |
|
|
|
zxData = this.formatData(zxData); |
|
|
|
hfData = this.formatData(hfData); |
|
|
@ -140,19 +151,19 @@ export default { |
|
|
|
dcData.recoverConfig = JSON.stringify(hfData); |
|
|
|
|
|
|
|
dcArr.push(dcData); |
|
|
|
}) |
|
|
|
}); |
|
|
|
|
|
|
|
let reqData = { |
|
|
|
operationType: value, //1-执行操作 2-恢复操作 |
|
|
|
dcEmergencyPlans: { |
|
|
|
id: this.planId, |
|
|
|
dcExecuteAction: dcArr |
|
|
|
dcExecuteAction: dcArr, |
|
|
|
}, |
|
|
|
dcEvent: { |
|
|
|
id: this.detailData.id, |
|
|
|
eventType: this.detailData.eventType, |
|
|
|
stakeMark: this.detailData.stakeMark, |
|
|
|
direction: this.detailData.direction == "菏泽方向" ? '1': '3', |
|
|
|
direction: this.detailData.direction == "菏泽方向" ? "1" : "3", |
|
|
|
}, |
|
|
|
}; |
|
|
|
console.log("reqData", reqData); |
|
|
@ -169,14 +180,13 @@ export default { |
|
|
|
}) |
|
|
|
.catch(() => { |
|
|
|
Message.error("提交失败"); |
|
|
|
}) |
|
|
|
}); |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
} |
|
|
|
}; |
|
|
|
</script> |
|
|
|
|
|
|
|
<style lang='scss' scoped> |
|
|
|
<style lang="scss" scoped> |
|
|
|
.DeviceControl { |
|
|
|
::v-deep { |
|
|
|
.content { |
|
|
@ -186,7 +196,7 @@ export default { |
|
|
|
} |
|
|
|
|
|
|
|
.container { |
|
|
|
flex:1; |
|
|
|
flex: 1; |
|
|
|
min-height: 300px; |
|
|
|
overflow-y: auto; |
|
|
|
|
|
|
@ -195,12 +205,11 @@ export default { |
|
|
|
padding: 5px 10px; |
|
|
|
margin-bottom: 10px; |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
.foot { |
|
|
|
display: flex; |
|
|
|
height:'100px'; |
|
|
|
height: "100px"; |
|
|
|
justify-content: space-evenly; |
|
|
|
margin-top: 10px; |
|
|
|
.special-button { |
|
|
@ -214,6 +223,5 @@ export default { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
</style> |
|
|
|
</style> |
|
|
|