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