| | |
| | | <template> |
| | | <div class="event-list"> |
| | | <div class="title">告警推送配置</div> |
| | | <div class="empty" v-if="eventList.length === 0"> |
| | | <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="showSettingBox = true"> |
| | | <div class="button add" @click="handleAdd"> |
| | | 立即添加 |
| | | </div> |
| | | </div> |
| | | <div class="list scroll"> |
| | | <el-table :data="eventList" style="width: 100%"> |
| | | <el-table-column label="序号" width="180"> </el-table-column> |
| | | <el-table-column label="事件名称" width="180"> </el-table-column> |
| | | <el-table-column label="事件等级" width="180"> </el-table-column> |
| | | <el-table-column label="关联区域" width="180"> </el-table-column> |
| | | <el-table-column label="责任人" width="180"> </el-table-column> |
| | | <el-table-column label="推送方式" width="180"> </el-table-column> |
| | | <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> |
| | |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | | <!-- <div class="devItem" v-for="(item, index) in clusterList" :key="index"> |
| | | <div class="mainInfo"> |
| | | <img src="/images/hashrate/cluster.png" alt="" /> |
| | | |
| | | <div class="right"> |
| | | <div class="name">{{ item.cluster_name }}</div> |
| | | <div class="ip">{{ item.virtual_ip }}</div> |
| | | <div class="number">设备总量:{{ item.nodeNum }}</div> |
| | | </div> |
| | | |
| | | <div class="button set" @click="setting({ clusterId: item.cluster_id }, item.nodeList)"> |
| | | 配置 |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <div class="devItem" v-for="(item, index) in devList" :key="index + 'dev'"> |
| | | <div class="mainInfo"> |
| | | <img src="/images/hashrate/equipment.png" alt="" /> |
| | | |
| | | <div class="right"> |
| | | <div class="name">{{ item.devName }}</div> |
| | | <div class="ip">{{ item.devIp }}</div> |
| | | </div> |
| | | |
| | | <div class="button set" @click="setting({ devId: item.devId })"> |
| | | 配置 |
| | | </div> |
| | | </div> |
| | | </div> --> |
| | | </div> |
| | | |
| | | <SettingBox v-if="showSettingBox" @close="showSettingBox = false" :id="idObj" :nodeList="nodeList"></SettingBox> |
| | | <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 |
| | | }, |
| | | created() { |
| | | this.getClusterDevList() |
| | | }, |
| | | data() { |
| | | return { |
| | | eventList: [], |
| | | clusterList: [], |
| | | devList: [], |
| | | taskList: [], |
| | | showSettingBox: false, |
| | | idObj: {}, |
| | | nodeList: [] |
| | | editNode: {}, |
| | | cameraTree: [], |
| | | menuTree: [] |
| | | } |
| | | }, |
| | | mounted() { |
| | | this.getCameras() |
| | | this.getTaskList() |
| | | }, |
| | | methods: { |
| | | async getClusterDevList() { |
| | | const res = await getClusterDevList() |
| | | if (res && res.success) { |
| | | this.clusterList = res.data.clusterList |
| | | this.devList = res.data.devList |
| | | 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 |
| | | } |
| | | }, |
| | | setting(id, nodeList) { |
| | | this.idObj = id |
| | | this.nodeList = nodeList ? nodeList : [] |
| | | 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 |
| | | }, |
| | | handleEdit(idx, row) {}, |
| | | handleDelete(idx, row) {} |
| | | 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> |
| | |
| | | box-sizing: border-box; |
| | | padding: 20px; |
| | | width: 1280px; |
| | | height: 770px; |
| | | height: 100%; |
| | | background-color: #fff; |
| | | margin: 0 auto; |
| | | |