| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316 |
- <template>
- <div
- class="ele-body"
- :style="
- $route.query.isDrawer
- ? {
- position: 'fixed',
- height: '100vh',
- top: '0',
- bottom: '0',
- left: '0',
- right: '0',
- zIndex: 1000,
- background: '#fff'
- }
- : {}
- "
- >
- <el-card shadow="never" v-loading="loading">
- <message-search @search="reload"> </message-search>
- <!-- 数据表格 -->
- <ele-pro-table
- ref="table"
- :pageSizes="tablePageSizes"
- :columns="columns"
- :datasource="datasource"
- cache-key="systemRoleTable"
- >
- <template v-slot:action="{ row }">
- <el-link
- type="primary"
- :underline="false"
- icon="el-icon-edit"
- @click="openEdit(row)"
- v-if="
- !row.handleStatus && $hasPermission('eam:alarmlogsheet:update')
- "
- >
- 处理
- </el-link>
- </template>
- <template v-slot:triggerCount="{ row }">
- <el-link type="primary" :underline="false" @click="triggerCount(row)">
- {{ row.triggerCount }}
- </el-link>
- </template>
- <template v-slot:deviceName="{ row }">
- <el-link
- type="primary"
- :underline="false"
- @click="openEdit(row, 'view')"
- >
- {{ row.deviceName }}
- </el-link>
- </template>
- </ele-pro-table>
- </el-card>
- <processDialog ref="processDialogRef" @reload="reload"></processDialog>
- <!-- 告警次数详情弹窗 -->
- <el-dialog
- title="告警详情"
- :visible.sync="triggerDialogVisible"
- width="70%"
- append-to-body
- >
- <el-table :data="triggerList" border style="width: 100%">
- <el-table-column type="index" label="序号" width="55" align="center" />
- <el-table-column
- prop="description"
- label="告警描述"
- align="center"
- show-overflow-tooltip
- min-width="180"
- />
- <el-table-column
- prop="triggerTime"
- label="告警时间"
- align="center"
- show-overflow-tooltip
- min-width="160"
- />
- <el-table-column
- label="告警内容"
- align="center"
- show-overflow-tooltip
- min-width="200"
- >
- <template slot-scope="{ row }">
- <div v-if="row._deviceData && row._deviceData.length">
- <div v-for="(item, index) in row._deviceData" :key="index">
- 点位:{{ item.attributeName}} 告警值:{{ item.thresholdValue }} 当前值: {{ item.value }} 差值:{{
- parseFloat((item.value - item.thresholdValue).toFixed(3))
- }}
- </div>
- </div>
- <span v-else>-</span>
- </template>
- </el-table-column>
- </el-table>
- </el-dialog>
- </div>
- </template>
- <script>
- import MessageSearch from './components/message-search.vue';
- import processDialog from './components/processDialog.vue';
- import { alarmlogsheetPage, getDetail } from '@/api/warning/index.js';
- import dictMixins from '@/mixins/dictMixins';
- export default {
- mixins: [dictMixins],
- components: {
- MessageSearch,
- processDialog
- },
- data() {
- return {
- // 表格列配置
- columns: [
- {
- columnKey: 'index',
- label: '序号',
- type: 'index',
- width: 55,
- align: 'center',
- showOverflowTooltip: true,
- fixed: 'left'
- },
- {
- prop: 'alarmLevel',
- label: '告警级别',
- align: 'center',
- showOverflowTooltip: true,
- minWidth: 80,
- formatter: (_row, _column, cellValue) => {
- const map = {
- 1: '轻微',
- 2: '中等',
- 3: '严重',
- 4: '紧急',
- 5: '致命'
- };
- return map[cellValue] || '-';
- }
- },
- {
- prop: 'deviceCode',
- label: '设备编号',
- align: 'center',
- showOverflowTooltip: true,
- minWidth: 110
- },
- {
- prop: 'deviceName',
- label: '设备名称',
- slot: 'deviceName',
- align: 'center',
- showOverflowTooltip: true,
- minWidth: 200
- },
- {
- prop: 'description',
- label: '告警描述',
- align: 'center',
- showOverflowTooltip: true,
- minWidth: 180
- },
- {
- prop: 'generateDocumentType',
- label: '生成单据类型',
- formatter: (_row, _column, cellValue) => {
- let message =
- cellValue == 1
- ? '巡点检'
- : cellValue == 2
- ? '保养'
- : cellValue == 3
- ? '维修'
- : cellValue == 5
- ? '量具送检'
- : '';
- if (_row.orderStatusName) {
- message += ' (' + _row.orderStatusName + ')';
- } else if (message) {
- message += ' (待派单)';
- }
- return message;
- },
- align: 'center',
- showOverflowTooltip: true,
- minWidth: 110
- },
- {
- prop: 'generateDocumentCode',
- label: '生成单据编码',
- align: 'center',
- showOverflowTooltip: true,
- minWidth: 110
- },
- {
- prop: 'triggerCount',
- slot: 'triggerCount',
- label: '告警次数',
- align: 'center',
- showOverflowTooltip: true,
- minWidth: 110
- },
- {
- prop: 'alarmTime',
- label: '首次告警时间',
- align: 'center',
- showOverflowTooltip: true,
- minWidth: 160,
- formatter: (_row, _column, cellValue) => {
- return this.$util.toDateString(cellValue);
- }
- },
- {
- prop: 'lastTriggerTime',
- label: '最近告警时间',
- align: 'center',
- showOverflowTooltip: true,
- minWidth: 160,
- formatter: (_row, _column, cellValue) => {
- return this.$util.toDateString(cellValue);
- }
- },
- {
- prop: 'handleStatus',
- label: '处理状态',
- align: 'center',
- formatter: (_row, _column, cellValue) => {
- return { 0: '未处理', 1: '处理中', 2: '已处理' }[cellValue];
- },
- showOverflowTooltip: true,
- minWidth: 110
- },
- {
- prop: 'handleUserName',
- label: '处理人',
- align: 'center',
- showOverflowTooltip: true,
- minWidth: 110
- },
- {
- prop: 'remark',
- label: '处理意见',
- align: 'center',
- showOverflowTooltip: true,
- minWidth: 110
- },
- {
- columnKey: 'action',
- label: '操作',
- width: 150,
- align: 'center',
- resizable: false,
- slot: 'action',
- showOverflowTooltip: true
- }
- ],
- // 加载状态
- loading: false,
- triggerDialogVisible: false,
- triggerList: []
- };
- },
- computed: {},
- created() {
- this.requestDict('规则状态');
- },
- methods: {
- /* 表格数据源 */
- datasource({ page, limit, where, order }) {
- return alarmlogsheetPage({
- pageNum: page,
- size: limit,
- ...where
- });
- },
- openEdit(row, type) {
- this.$refs.processDialogRef.open(row, type);
- },
- triggerCount(row) {
- getDetail(row.id).then((res) => {
- let list = Array.isArray(res) ? res : [];
- list = list.map((item) => {
- let deviceDataArr = [];
- if (item.deviceData) {
- try {
- const parsed = JSON.parse(item.deviceData);
- deviceDataArr = Array.isArray(parsed) ? parsed : [];
- } catch (e) {
- deviceDataArr = [];
- }
- }
- return {
- ...item,
- _deviceData: deviceDataArr
- };
- });
- this.triggerList = list;
- this.triggerDialogVisible = true;
- });
- },
- /* 刷新表格 */
- reload(where) {
- this.$refs.table.reload({ page: 1, where, ruleType: 2 });
- }
- }
- };
- </script>
- <style lang="scss" scoped></style>
|