|
|
@@ -39,6 +39,10 @@
|
|
|
</span>
|
|
|
</template>
|
|
|
</template>
|
|
|
+ <template v-slot:ruleObjCode="{ row }">
|
|
|
+ {{ rulesObj[row.ruleObjCode] }}
|
|
|
+ </template>
|
|
|
+
|
|
|
<!-- 操作列 -->
|
|
|
<template v-slot:action="{ row }">
|
|
|
<el-link
|
|
|
@@ -47,7 +51,6 @@
|
|
|
icon="el-icon-finished"
|
|
|
@click="openEdit('clone', row)"
|
|
|
v-if="$hasPermission('main:warnrule:update')"
|
|
|
-
|
|
|
>
|
|
|
克隆
|
|
|
</el-link>
|
|
|
@@ -57,7 +60,6 @@
|
|
|
icon="el-icon-edit"
|
|
|
@click="openEdit('edit', row)"
|
|
|
v-if="$hasPermission('main:warnrule:update')"
|
|
|
-
|
|
|
>
|
|
|
修改
|
|
|
</el-link>
|
|
|
@@ -66,7 +68,6 @@
|
|
|
title="确定要删除此角色吗?"
|
|
|
@confirm="remove(row)"
|
|
|
v-if="$hasPermission('main:warnrule:delete')"
|
|
|
-
|
|
|
>
|
|
|
<template v-slot:reference>
|
|
|
<el-link type="danger" :underline="false" icon="el-icon-delete">
|
|
|
@@ -89,161 +90,166 @@
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
-import tabMixins from '@/mixins/tableColumnsMixin';
|
|
|
-import MatterSearch from './components/matter-search.vue';
|
|
|
-import MatterAdd from './components/matter-add.vue';
|
|
|
-import {
|
|
|
- getList,
|
|
|
- getDetail,
|
|
|
- removeRule,
|
|
|
- listAllDateUnit
|
|
|
-} from '@/api/ruleManagement/earlyWarning';
|
|
|
-import dictMixins from '@/mixins/dictMixins';
|
|
|
-export default {
|
|
|
- mixins: [dictMixins, tabMixins],
|
|
|
- components: {
|
|
|
- MatterSearch,
|
|
|
- MatterAdd
|
|
|
- },
|
|
|
- data() {
|
|
|
- return {
|
|
|
- // 表格列配置
|
|
|
- columns: [
|
|
|
- {
|
|
|
- columnKey: 'index',
|
|
|
- label: '序号',
|
|
|
- type: 'index',
|
|
|
- width: 55,
|
|
|
- align: 'center',
|
|
|
- showOverflowTooltip: true,
|
|
|
- fixed: 'left'
|
|
|
- },
|
|
|
- {
|
|
|
- prop: 'ruleCode',
|
|
|
- label: '规则编码',
|
|
|
- align: 'center',
|
|
|
- showOverflowTooltip: true,
|
|
|
- minWidth: 110,
|
|
|
- slot: 'ruleCode'
|
|
|
- },
|
|
|
- {
|
|
|
- prop: 'ruleName',
|
|
|
- label: '规则名称',
|
|
|
- align: 'center',
|
|
|
- showOverflowTooltip: true,
|
|
|
- minWidth: 110
|
|
|
- },
|
|
|
- {//修改此prop名称时,请同步修改columnKey属性和下方selectType方法
|
|
|
- prop: 'enabled',
|
|
|
- label: '状态',
|
|
|
- align: 'center',
|
|
|
- showOverflowTooltip: true,
|
|
|
- minWidth: 110,
|
|
|
- formatter: (_row, _column, cellValue) => {
|
|
|
- return this.getDictValue('规则状态', _row.enabled);
|
|
|
+ import tabMixins from '@/mixins/tableColumnsMixin';
|
|
|
+ import MatterSearch from './components/matter-search.vue';
|
|
|
+ import MatterAdd from './components/matter-add.vue';
|
|
|
+ import {
|
|
|
+ getList,
|
|
|
+ getDetail,
|
|
|
+ removeRule,
|
|
|
+ listAllRulesObj,
|
|
|
+ listAllDateUnit
|
|
|
+ } from '@/api/ruleManagement/earlyWarning';
|
|
|
+ import dictMixins from '@/mixins/dictMixins';
|
|
|
+
|
|
|
+ export default {
|
|
|
+ mixins: [dictMixins, tabMixins],
|
|
|
+ components: {
|
|
|
+ MatterSearch,
|
|
|
+ MatterAdd
|
|
|
+ },
|
|
|
+ data() {
|
|
|
+ return {
|
|
|
+ rulesObj: [],
|
|
|
+ // 表格列配置
|
|
|
+ columns: [
|
|
|
+ {
|
|
|
+ columnKey: 'index',
|
|
|
+ label: '序号',
|
|
|
+ type: 'index',
|
|
|
+ width: 55,
|
|
|
+ align: 'center',
|
|
|
+ showOverflowTooltip: true,
|
|
|
+ fixed: 'left'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ prop: 'ruleCode',
|
|
|
+ label: '规则编码',
|
|
|
+ align: 'center',
|
|
|
+ showOverflowTooltip: true,
|
|
|
+ minWidth: 110,
|
|
|
+ slot: 'ruleCode'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ prop: 'ruleName',
|
|
|
+ label: '规则名称',
|
|
|
+ align: 'center',
|
|
|
+ showOverflowTooltip: true,
|
|
|
+ minWidth: 110
|
|
|
},
|
|
|
- filters: [
|
|
|
+ {
|
|
|
+ //修改此prop名称时,请同步修改columnKey属性和下方selectType方法
|
|
|
+ prop: 'enabled',
|
|
|
+ label: '状态',
|
|
|
+ align: 'center',
|
|
|
+ showOverflowTooltip: true,
|
|
|
+ minWidth: 110,
|
|
|
+ formatter: (_row, _column, cellValue) => {
|
|
|
+ return this.getDictValue('规则状态', _row.enabled);
|
|
|
+ },
|
|
|
+ filters: [
|
|
|
{ value: 1, text: '生效' },
|
|
|
- { value: 0, text: '失效' },
|
|
|
+ { value: 0, text: '失效' }
|
|
|
],
|
|
|
- filterMultiple: false,
|
|
|
- columnKey: 'enabled'
|
|
|
- },
|
|
|
- {
|
|
|
- prop: 'alertCycleValue',
|
|
|
- label: '周期',
|
|
|
- align: 'center',
|
|
|
- showOverflowTooltip: true,
|
|
|
- minWidth: 110,
|
|
|
- slot: 'alertCycleValue'
|
|
|
- },
|
|
|
- {
|
|
|
- prop: 'createUserName',
|
|
|
- label: '创建人',
|
|
|
- align: 'center',
|
|
|
- showOverflowTooltip: true,
|
|
|
- minWidth: 110
|
|
|
- },
|
|
|
- {
|
|
|
- prop: 'createTime',
|
|
|
- label: '创建时间',
|
|
|
- align: 'center',
|
|
|
- showOverflowTooltip: true,
|
|
|
- minWidth: 110,
|
|
|
- formatter: (_row, _column, cellValue) => {
|
|
|
- return this.$util.toDateString(cellValue);
|
|
|
+ filterMultiple: false,
|
|
|
+ columnKey: 'enabled'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ prop: 'ruleObjCode',
|
|
|
+ label: '预警对象',
|
|
|
+ align: 'center',
|
|
|
+ showOverflowTooltip: true,
|
|
|
+ minWidth: 110,
|
|
|
+ slot: 'ruleObjCode'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ prop: 'createUserName',
|
|
|
+ label: '创建人',
|
|
|
+ align: 'center',
|
|
|
+ showOverflowTooltip: true,
|
|
|
+ minWidth: 110
|
|
|
+ },
|
|
|
+ {
|
|
|
+ prop: 'createTime',
|
|
|
+ label: '创建时间',
|
|
|
+ align: 'center',
|
|
|
+ showOverflowTooltip: true,
|
|
|
+ minWidth: 110,
|
|
|
+ formatter: (_row, _column, cellValue) => {
|
|
|
+ return this.$util.toDateString(cellValue);
|
|
|
+ }
|
|
|
+ },
|
|
|
+ {
|
|
|
+ columnKey: 'action',
|
|
|
+ label: '操作',
|
|
|
+ width: 230,
|
|
|
+ align: 'center',
|
|
|
+ resizable: false,
|
|
|
+ slot: 'action',
|
|
|
+ showOverflowTooltip: true
|
|
|
}
|
|
|
- },
|
|
|
- {
|
|
|
- columnKey: 'action',
|
|
|
- label: '操作',
|
|
|
- width: 230,
|
|
|
- align: 'center',
|
|
|
- resizable: false,
|
|
|
- slot: 'action',
|
|
|
- showOverflowTooltip: true
|
|
|
- }
|
|
|
- ],
|
|
|
- // 加载状态
|
|
|
- loading: false,
|
|
|
- pageType: 'add',
|
|
|
- dialogTitle: '',
|
|
|
+ ],
|
|
|
+ // 加载状态
|
|
|
+ loading: false,
|
|
|
+ pageType: 'add',
|
|
|
+ dialogTitle: '',
|
|
|
|
|
|
- cycleUnitOpt: {},
|
|
|
- pageSize: this.$store.state.tablePageSize,
|
|
|
- cacheKeyUrl: 'dfb89646-rulesManagement-earlyWarningRules'
|
|
|
- };
|
|
|
- },
|
|
|
- computed: {},
|
|
|
- created() {
|
|
|
- // this.requestDict('规则周期');
|
|
|
- this.requestDict('预警类型');
|
|
|
- this.requestDict('规则状态');
|
|
|
- this.getData();
|
|
|
- },
|
|
|
- methods: {
|
|
|
- selectType(value) {
|
|
|
- let where = {}
|
|
|
- if (value.enabled.length > 0) {
|
|
|
- where['enabled'] = value.enabled[0]
|
|
|
- }
|
|
|
- this.reload(where)
|
|
|
- },
|
|
|
- /* 表格数据源 */
|
|
|
- datasource({ page, limit, where, order }) {
|
|
|
- return getList({ pageNum: page, size: limit, ...where });
|
|
|
+ cycleUnitOpt: {},
|
|
|
+ pageSize: this.$store.state.tablePageSize,
|
|
|
+ cacheKeyUrl: 'dfb89646-rulesManagement-earlyWarningRules'
|
|
|
+ };
|
|
|
},
|
|
|
- /* 刷新表格 */
|
|
|
- reload(where) {
|
|
|
- this.$refs.table.reload({ page: 1, where });
|
|
|
- },
|
|
|
- async getData() {
|
|
|
- const res2 = await listAllDateUnit();
|
|
|
- this.cycleUnitOpt = res2;
|
|
|
+ computed: {},
|
|
|
+ async created() {
|
|
|
+ // this.requestDict('规则周期');
|
|
|
+ this.requestDict('预警类型');
|
|
|
+ this.requestDict('规则状态');
|
|
|
+ this.getData();
|
|
|
+ this.rulesObj = await listAllRulesObj();
|
|
|
},
|
|
|
+ methods: {
|
|
|
+ selectType(value) {
|
|
|
+ let where = {};
|
|
|
+ if (value.enabled.length > 0) {
|
|
|
+ where['enabled'] = value.enabled[0];
|
|
|
+ }
|
|
|
+ this.reload(where);
|
|
|
+ },
|
|
|
+ /* 表格数据源 */
|
|
|
+ datasource({ page, limit, where, order }) {
|
|
|
+ return getList({ pageNum: page, size: limit, ...where });
|
|
|
+ },
|
|
|
+ /* 刷新表格 */
|
|
|
+ reload(where) {
|
|
|
+ this.$refs.table.reload({ page: 1, where });
|
|
|
+ },
|
|
|
+ async getData() {
|
|
|
+ const res2 = await listAllDateUnit();
|
|
|
+ this.cycleUnitOpt = res2;
|
|
|
+ },
|
|
|
|
|
|
- remove(row) {
|
|
|
- removeRule([row.id]).then((res) => {
|
|
|
- this.$message.success('删除成功!');
|
|
|
- this.reload();
|
|
|
- });
|
|
|
- },
|
|
|
+ remove(row) {
|
|
|
+ removeRule([row.id]).then((res) => {
|
|
|
+ this.$message.success('删除成功!');
|
|
|
+ this.reload();
|
|
|
+ });
|
|
|
+ },
|
|
|
|
|
|
- openEdit(type, row) {
|
|
|
- this.pageType = type;
|
|
|
- this.dialogTitle =
|
|
|
- type == 'add' ? '新建规则' : type == 'edit' ? '编辑规则' : '克隆规则';
|
|
|
- this.$refs.addMatterRulesRef.openDialog(row, type);
|
|
|
- },
|
|
|
+ openEdit(type, row) {
|
|
|
+ this.pageType = type;
|
|
|
+ this.dialogTitle =
|
|
|
+ type == 'add' ? '新建规则' : type == 'edit' ? '编辑规则' : '克隆规则';
|
|
|
+ this.$refs.addMatterRulesRef.openDialog(row, type);
|
|
|
+ },
|
|
|
|
|
|
- goDetail({ id }) {
|
|
|
- this.$router.push({
|
|
|
- path: '/rulesManagement/earlyWarningRules/details',
|
|
|
- query: { id }
|
|
|
- });
|
|
|
+ goDetail({ id }) {
|
|
|
+ this.$router.push({
|
|
|
+ path: '/rulesManagement/earlyWarningRules/details',
|
|
|
+ query: { id }
|
|
|
+ });
|
|
|
+ }
|
|
|
}
|
|
|
- }
|
|
|
-};
|
|
|
+ };
|
|
|
</script>
|
|
|
|
|
|
<style lang="scss" scoped></style>
|