| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192 |
- <template>
- <div class="ele-body">
- <el-card shadow="never" v-loading="loading">
- <setting-search @search="reload"> </setting-search>
- <!-- 数据表格 -->
- <ele-pro-table
- ref="table"
- :pageSizes="tablePageSizes"
- :columns="columns"
- :datasource="datasource"
- cache-key="systemRoleTable"
- height="calc(100vh - 350px)"
- >
- <!-- 表头工具栏 -->
- <template v-slot:toolbar>
- <el-button
- size="small"
- type="primary"
- icon="el-icon-plus"
- class="ele-btn-icon"
- @click="openEdit('add')"
- >
- 新建
- </el-button>
- </template>
- <template v-slot:enable="{ row }">
- <el-switch
- v-model="row.enable"
- active-color="#13ce66"
- inactive-color="#ff4949"
- :active-value="1"
- :inactive-value="0"
- disabled
- >
- </el-switch>
- </template>
- <template v-slot:code="{ row }">
- <el-link
- type="primary"
- :underline="false"
- @click="openEdit('view', row)"
- >
- {{ row.code }}
- </el-link>
- </template>
- <!-- 操作列 -->
- <template v-slot:action="{ row }">
- <el-link
- type="primary"
- :underline="false"
- icon="el-icon-edit"
- @click="openEdit('edit', row)"
- >
- 修改
- </el-link>
- <el-popconfirm
- class="ele-action"
- title="确定要删除此告警设置吗?"
- @confirm="remove(row)"
- >
- <template v-slot:reference>
- <el-link type="danger" :underline="false" icon="el-icon-delete">
- 删除
- </el-link>
- </template>
- </el-popconfirm>
- </template>
- </ele-pro-table>
- </el-card>
- <AddWarningDialog ref="addWarningDialogRef" @refreshList="reload" />
- </div>
- </template>
- <script>
- import SettingSearch from './components/setting-search.vue';
- import AddWarningDialog from './components/addWarningDialog.vue';
- import dictMixins from '@/mixins/dictMixins';
- import { getList, remove } from '@/api/warning/index.js';
- export default {
- mixins: [dictMixins],
- components: {
- SettingSearch,
- AddWarningDialog
- },
- data() {
- return {
- // 表格列配置
- columns: [
- {
- columnKey: 'index',
- label: '序号',
- type: 'index',
- width: 55,
- align: 'center',
- showOverflowTooltip: true,
- fixed: 'left'
- },
- {
- prop: 'code',
- label: '告警编码',
- align: 'center',
- slot: 'code',
- showOverflowTooltip: true,
- minWidth: 110
- },
- {
- prop: 'name',
- label: '告警名称',
- align: 'center',
- showOverflowTooltip: true,
- minWidth: 110
- },
- {
- prop: 'level',
- label: '告警级别',
- align: 'center',
- showOverflowTooltip: true,
- minWidth: 110,
- formatter: (_row, _column, cellValue) => {
- return { 1: '轻微', 2: '中等', 3: '严重', 4: '紧急', 5: '致命' }[
- cellValue
- ];
- }
- },
- {
- prop: 'deviceName',
- label: '告警设备名称',
- align: 'center',
- showOverflowTooltip: true,
- minWidth: 110
- },
- {
- prop: 'description',
- label: '告警描述',
- align: 'center',
- showOverflowTooltip: true,
- minWidth: 110
- },
- {
- columnKey: 'action',
- label: '操作',
- width: 150,
- align: 'center',
- resizable: false,
- slot: 'action',
- showOverflowTooltip: true
- }
- ],
- // 加载状态
- loading: false,
- pageType: 'add',
- dialogTitle: '',
- isBindPlan: false
- };
- },
- computed: {},
- created() {
- this.requestDict('告警级别');
- },
- methods: {
- /* 表格数据源 */
- datasource({ page, limit, where, order }) {
- return getList({
- pageNum: page,
- size: limit,
- ...where
- });
- },
- /* 刷新表格 */
- reload(where) {
- this.$refs.table.reload({ page: 1, where });
- },
- openEdit(type, row) {
- this.$refs.addWarningDialogRef.open(type, row);
- },
- remove(row) {
- remove([row.id]).then((res) => {
- this.$message.success('删除成功!');
- this.reload();
- });
- }
- }
- };
- </script>
- <style lang="scss" scoped></style>
|