<template>
|
<div class="event-list">
|
<div class="title">
|
<span>告警推送配置</span>
|
<i
|
class="el-icon-circle-plus-outline"
|
style="cursor: pointer;margin-left:15px"
|
v-show="taskList.length > 0"
|
@click="handleAdd"
|
></i>
|
</div>
|
<div class="empty" v-show="taskList.length == 0">
|
<img src="/images/search/1.png" alt="" />
|
<div class="des">您还未添加添加告警事件推送任务</div>
|
<div class="button add" @click="handleAdd">
|
立即添加
|
</div>
|
</div>
|
<div class="list scroll">
|
<el-table :data="taskList" style="width: 100%">
|
<el-table-column label="序号" type="index" width="50"> </el-table-column>
|
<el-table-column label="事件名称" width="180" prop="taskName"> </el-table-column>
|
<el-table-column label="事件等级" width="120" prop="level"> </el-table-column>
|
<el-table-column label="关联区域" prop="org"> </el-table-column>
|
<el-table-column label="责任人" width="180" prop="person"> </el-table-column>
|
<el-table-column label="手机号" width="180" prop="tel"> </el-table-column>
|
<el-table-column label="状态" width="100" prop="enable">
|
<template slot-scope="scope">
|
<el-switch v-model="scope.row.enable" active-color="#13ce66" inactive-color="#bbbbbb"> </el-switch>
|
</template>
|
</el-table-column>
|
<el-table-column label="操作">
|
<template slot-scope="scope">
|
<el-button size="mini" @click="handleEdit(scope.$index, scope.row)">编辑</el-button>
|
<el-button size="mini" type="danger" @click="handleDelete(scope.$index, scope.row)">删除</el-button>
|
</template>
|
</el-table-column>
|
</el-table>
|
</div>
|
|
<SettingBox
|
v-if="showSettingBox"
|
@close="handleClose"
|
:id="idObj"
|
:node-list="editNode"
|
:camera="cameraTree"
|
:menu="menuTree"
|
></SettingBox>
|
</div>
|
</template>
|
|
<script>
|
import SettingBox from "@/views/report/components/SettingBox"
|
import { getClusterDevList } from "@/api/clusterManage"
|
import { findAllTask, deleteTask } from "@/api/report"
|
import { getLocalCameraTree } from "@/api/area"
|
|
export default {
|
components: {
|
SettingBox
|
},
|
data() {
|
return {
|
taskList: [],
|
showSettingBox: false,
|
idObj: {},
|
editNode: {},
|
cameraTree: [],
|
menuTree: []
|
}
|
},
|
mounted() {
|
this.getCameras()
|
this.getTaskList()
|
},
|
methods: {
|
async getCameras() {
|
let clusterId = ""
|
let clusterReq = await getClusterDevList()
|
if (clusterReq && clusterReq.success) {
|
if (clusterReq.data.clusterList.length > 0) {
|
clusterId = clusterReq.data.clusterList[0].cluster_id
|
}
|
}
|
let camereReq = await getLocalCameraTree({ clusterId: clusterId })
|
if (camereReq && camereReq.success) {
|
this.cameraTree = camereReq.data.treeMenu
|
let tmpTree = JSON.parse(JSON.stringify(camereReq.data.treeMenu))
|
for (let i = 0; i < tmpTree.length; i++) this.clearNode(tmpTree[i])
|
this.menuTree = tmpTree
|
}
|
},
|
clearNode(tree) {
|
if (tree.children) {
|
tree.children = tree.children.filter((item) => {
|
return item.type == "MENU"
|
})
|
}
|
if (tree.children && tree.children.length > 0) {
|
for (let i = 0; i < tree.children.length; i++) this.clearNode(tree.children[i])
|
} else {
|
delete tree.children
|
}
|
},
|
getTaskList() {
|
findAllTask().then((rsp) => {
|
if (rsp && rsp.success) {
|
this.taskList = rsp.data
|
}
|
})
|
},
|
handleAdd() {
|
this.idObj = ""
|
this.editNode = {}
|
this.showSettingBox = true
|
},
|
handleClose() {
|
this.showSettingBox = false
|
this.getTaskList()
|
},
|
handleEdit(idx, row) {
|
console.log("edit", row)
|
this.idObj = row.id
|
this.editNode = row
|
this.showSettingBox = true
|
},
|
handleDelete(idx, row) {
|
deleteTask({ id: row.id }).then((rsp) => {
|
if (rsp && rsp.success) {
|
this.getTaskList()
|
}
|
})
|
}
|
}
|
}
|
</script>
|
|
<style lang="scss" scoped>
|
.event-list {
|
position: relative;
|
box-sizing: border-box;
|
padding: 20px;
|
width: 1280px;
|
height: 100%;
|
background-color: #fff;
|
margin: 0 auto;
|
|
.title {
|
margin-bottom: 20px;
|
height: 20px;
|
padding-left: 20px;
|
font-weight: 700;
|
font-size: 16px;
|
border-left: 4px solid #0065ff;
|
}
|
|
.empty {
|
text-align: center;
|
|
img {
|
width: 260px;
|
}
|
|
.des {
|
margin-bottom: 30px;
|
font-size: 14px;
|
}
|
|
.add {
|
margin: 0 auto;
|
width: 112px;
|
height: 40px;
|
text-align: center;
|
line-height: 40px;
|
color: #fff;
|
background-color: #0065ff;
|
}
|
}
|
|
.list {
|
display: flex;
|
flex-wrap: wrap;
|
overflow-y: auto;
|
height: 710px;
|
|
.devItem {
|
position: relative;
|
margin: 0 15px 20px 0;
|
width: 295px;
|
height: 150px;
|
border: 1px solid #c0c5cc;
|
border-radius: 5px;
|
|
.mainInfo {
|
display: flex;
|
padding: 20px;
|
|
img {
|
margin-right: 20px;
|
width: 88px;
|
}
|
}
|
|
.right {
|
.name {
|
margin-bottom: 6px;
|
font-size: 16px;
|
font-weight: 700;
|
}
|
|
.ip,
|
.number {
|
margin-bottom: 2px;
|
font-size: 12px;
|
color: #666;
|
}
|
}
|
|
.set {
|
position: absolute;
|
left: 0;
|
right: 0;
|
bottom: 0;
|
height: 40px;
|
line-height: 40px;
|
text-align: center;
|
border: 1px solid #c0c5cc;
|
font-size: 16px;
|
color: #0065ff;
|
}
|
|
&:nth-child(4n) {
|
margin-right: 0;
|
}
|
|
&:hover {
|
box-shadow: 0px 2px 16px 0px rgba(0, 43, 106, 0.25);
|
|
.set {
|
color: #fff;
|
background-color: #0065ff;
|
border-color: #0065ff;
|
}
|
}
|
}
|
}
|
}
|
</style>
|