| | |
| | | <template> |
| | | <div>预警研判</div> |
| | | <div> |
| | | <MyHeader @getList="getAlarmList" @exportTable="exportAlarm"></MyHeader> |
| | | <!-- 数据展示 --> |
| | | <div style="width: 100%; overflow-x: scroll"> |
| | | <el-table |
| | | border |
| | | stripe |
| | | ref="multipleTable" |
| | | :header-cell-style="{ |
| | | background: '#F5F5F5', |
| | | 'font-weight': '650', |
| | | 'line-height': '45px', |
| | | }" |
| | | :data="tableData" |
| | | :row-class-name="tableRowClassName" |
| | | > |
| | | <el-table-column label="序号" type="index" width="60px"> |
| | | </el-table-column> |
| | | <el-table-column prop="Addr" label="点位名称" min-width="2"> |
| | | </el-table-column> |
| | | <el-table-column prop="MsgTypeStr" label="事件类型" min-width="3"> |
| | | </el-table-column> |
| | | <el-table-column prop="Content" label="消息内容" min-width="8"> |
| | | </el-table-column> |
| | | <el-table-column prop="AcquitAtStr" label="时间" min-width="2"> |
| | | </el-table-column> |
| | | |
| | | <el-table-column prop="operation" label="操作" min-width="3"> |
| | | <template slot-scope="scope"> |
| | | <div class="operation"> |
| | | <span @click="handleLearn(scope.row)">处理</span> |
| | | </div> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | | </div> |
| | | <div class="tools"> |
| | | <div class="pagination"> |
| | | <el-pagination |
| | | background |
| | | @prev-click="handlePrev" |
| | | @next-click="handleNext" |
| | | :current-page="currentPage" |
| | | layout="prev, pager, next" |
| | | :total="totalNum" |
| | | :page-size="pageSize" |
| | | @current-change="changeCurrentPage" |
| | | > |
| | | </el-pagination> |
| | | </div> |
| | | </div> |
| | | <el-dialog |
| | | :visible.sync="dialogAdd" |
| | | width="90%" |
| | | title="预警研判" |
| | | v-if="dialogAdd" |
| | | :before-close="handleClose" |
| | | > |
| | | <JudgeIndex :info="videoInspection" ></JudgeIndex> |
| | | </el-dialog> |
| | | </div> |
| | | </template> |
| | | |
| | | <script> |
| | | import MyHeader from "./header"; |
| | | import realTimeApi from "@/api/smoke/alarm"; |
| | | import JudgeIndex from "./components/index.vue"; |
| | | export default { |
| | | data() { |
| | | return { |
| | | dialogAdd:false, |
| | | tableData: [], |
| | | totalNum: 0, |
| | | pageSize: 10, |
| | | currentPage: 1, |
| | | params: {}, |
| | | videoInspection:{} |
| | | }; |
| | | }, |
| | | components: { MyHeader ,JudgeIndex}, |
| | | created() { |
| | | this.getAlarmList(); |
| | | }, |
| | | methods: { |
| | | getAlarmList(seachData) { |
| | | if (seachData) { |
| | | this.params = this.getParam(seachData); |
| | | } else { |
| | | this.params = { |
| | | pageNum: this.currentPage, |
| | | pageSize: this.pageSize, |
| | | }; |
| | | } |
| | | |
| | | } |
| | | realTimeApi |
| | | .findAlarmList(this.params) |
| | | .then(({ list, total }) => { |
| | | list.forEach((e) => { |
| | | e.AcquitAtStr = this.dateFormat( |
| | | "YYYY-mm-dd HH:MM", |
| | | new Date(e.AcquitAt*1000) |
| | | ); |
| | | e.MsgTypeStr = this.MsgTypeStr(e.MsgType); |
| | | }); |
| | | this.tableData = list; |
| | | this.totalNum = total; |
| | | }) |
| | | .catch((err) => this.$message.error(err)); |
| | | }, |
| | | exportAlarm(seachData) { |
| | | let params; |
| | | if (seachData) { |
| | | params = this.getParam(seachData); |
| | | } |
| | | realTimeApi |
| | | .exportAlarm(params) |
| | | .then((res) => { |
| | | let time = new Date(); |
| | | let deathdate = time.toLocaleDateString(); |
| | | const blob = new Blob([res.data], { |
| | | type: "application/vnd.ms-excel;charset=utf-8", |
| | | }); |
| | | if (window.navigator.msSaveBlob) { |
| | | window.navigator.msSaveBlob(blob, deathdate + "报警信息" + ".xls"); |
| | | } else { |
| | | const url = window.URL.createObjectURL(blob); |
| | | const link = document.createElement("a"); |
| | | link.style.display = "none"; |
| | | link.href = url; |
| | | link.download = deathdate + "报警信息" + ".xls"; |
| | | document.body.appendChild(link); |
| | | link.click(); |
| | | document.body.removeChild(link); |
| | | } |
| | | this.$message.success("操作成功"); |
| | | }) |
| | | .catch((err) => this.$message.error(err)); |
| | | }, |
| | | getParam(seachData) { |
| | | let params; |
| | | if (seachData) { |
| | | const seachParams = seachData.seachData || seachData; |
| | | params = { |
| | | msgType: |
| | | seachParams.msgType == undefined ? null : seachParams.msgType, |
| | | startTime: |
| | | seachParams.alarmTime == undefined |
| | | ? null |
| | | : this.dateFormat( |
| | | "YYYY-mm-dd HH:MM:SS", |
| | | seachParams.alarmTime[0] |
| | | ), |
| | | endTime: |
| | | seachParams.alarmTime == undefined |
| | | ? null |
| | | : this.dateFormat( |
| | | "YYYY-mm-dd HH:MM:SS", |
| | | seachParams.alarmTime[1] |
| | | ), |
| | | }; |
| | | params.pageNum = this.currentPage; |
| | | params.pageSize = this.pageSize; |
| | | } |
| | | return params; |
| | | }, |
| | | |
| | | MsgTypeStr(Status) { |
| | | switch (Status) { |
| | | case "ExceedStandard": |
| | | return "超标"; |
| | | case "AbnormalOffline": |
| | | return "异常离线"; |
| | | default: |
| | | return "异常离线"; |
| | | } |
| | | }, |
| | | // 设置表格斑马纹 |
| | | tableRowClassName({ row, rowIndex }) { |
| | | if ((rowIndex + 1) % 2 === 0) { |
| | | return "warning-row"; |
| | | } else { |
| | | return "success-row"; |
| | | } |
| | | }, |
| | | // 当前页改变触发事件 |
| | | changeCurrentPage(page) { |
| | | this.currentPage = page; |
| | | this.getAlarmList(this.params); |
| | | }, |
| | | // 上一页点击事件 |
| | | handlePrev(page) { |
| | | this.currentPage = page; |
| | | this.getAlarmList(this.params); |
| | | }, |
| | | // 下一页点击事件 |
| | | handleNext(page) { |
| | | this.currentPage = page; |
| | | this.getAlarmList(this.params); |
| | | }, |
| | | dateFormat(fmt, date) { |
| | | let ret; |
| | | const opt = { |
| | | "Y+": date.getFullYear().toString(), // 年 |
| | | "m+": (date.getMonth() + 1).toString(), // 月 |
| | | "d+": date.getDate().toString(), // 日 |
| | | "H+": date.getHours().toString(), // 时 |
| | | "M+": date.getMinutes().toString(), // 分 |
| | | "S+": date.getSeconds().toString(), // 秒 |
| | | // 有其他格式化字符需求可以继续添加,必须转化成字符串 |
| | | }; |
| | | for (let k in opt) { |
| | | ret = new RegExp("(" + k + ")").exec(fmt); |
| | | if (ret) { |
| | | fmt = fmt.replace( |
| | | ret[1], |
| | | ret[1].length == 1 ? opt[k] : opt[k].padStart(ret[1].length, "0") |
| | | ); |
| | | } |
| | | } |
| | | return fmt; |
| | | }, |
| | | handleLearn(row) { |
| | | this.dialogAdd = true; |
| | | this.videoInspection = row; |
| | | |
| | | }, |
| | | handleClose(done) { |
| | | this.changeCurrentPage(1); |
| | | done(); |
| | | }, |
| | | }, |
| | | }; |
| | | </script> |
| | | |
| | | <style> |
| | | <style lang="scss" scoped> |
| | | .el-table { |
| | | .operation { |
| | | display: flex; |
| | | color: var(--operation-color); |
| | | .line { |
| | | padding: 0 5px; |
| | | } |
| | | |
| | | span:hover { |
| | | cursor: pointer; |
| | | } |
| | | } |
| | | } |
| | | </style> |