提交 | 用户 | 时间
|
ebc552
|
1 |
<template> |
L |
2 |
<!-- 搜索 --> |
|
3 |
<ContentWrap> |
|
4 |
<el-form |
|
5 |
class="-mb-15px" |
|
6 |
:model="queryParams" |
|
7 |
ref="queryFormRef" |
|
8 |
:inline="true" |
|
9 |
label-width="68px" |
|
10 |
> |
|
11 |
<el-form-item label="名称" prop="title"> |
|
12 |
<el-input |
|
13 |
v-model="queryParams.title" |
|
14 |
placeholder="请输入名称" |
|
15 |
clearable |
|
16 |
@keyup.enter="handleQuery" |
|
17 |
class="!w-240px" |
|
18 |
/> |
|
19 |
</el-form-item> |
|
20 |
<el-form-item> |
|
21 |
<el-button @click="handleQuery"> |
|
22 |
<Icon icon="ep:search" class="mr-5px" /> |
|
23 |
搜索 |
|
24 |
</el-button> |
|
25 |
<el-button @click="resetQuery"> |
|
26 |
<Icon icon="ep:refresh" class="mr-5px" /> |
|
27 |
重置 |
|
28 |
</el-button> |
|
29 |
<el-button |
|
30 |
type="primary" |
|
31 |
plain |
|
32 |
@click="openForm('create')" |
|
33 |
v-hasPermi="['pre:alarm-config:create']" |
|
34 |
> |
|
35 |
<Icon icon="ep:plus" class="mr-5px" /> |
|
36 |
新增 |
|
37 |
</el-button> |
|
38 |
</el-form-item> |
|
39 |
</el-form> |
|
40 |
</ContentWrap> |
|
41 |
|
|
42 |
<!-- 列表 --> |
|
43 |
<ContentWrap> |
|
44 |
<el-table v-loading="loading" :data="list"> |
|
45 |
<el-table-column label="消息标题" header-align="center" align="center" min-width="150" prop="title" fixed/> |
|
46 |
<el-table-column label="监控对象" header-align="center" align="center" min-width="150" prop="alarmObj" /> |
|
47 |
<el-table-column label="预测项" header-align="center" align="center" min-width="150" prop="itemName" /> |
|
48 |
<el-table-column label="输出" header-align="center" align="center" min-width="150" prop="outName" /> |
|
49 |
<el-table-column label="比较长度" header-align="center" align="center" min-width="100" prop="compLength" /> |
|
50 |
<el-table-column label="上限" header-align="center" align="center" min-width="50" prop="upperLimit" /> |
|
51 |
<el-table-column label="下限" header-align="center" align="center" min-width="50" prop="lowerLimit" /> |
|
52 |
<el-table-column label="单位" header-align="center" align="center" min-width="50" prop="unit" /> |
|
53 |
<el-table-column label="转换系数" header-align="center" align="center" min-width="100" prop="coefficient" /> |
|
54 |
<el-table-column label="是否启用" header-align="center" align="center" min-width="100" prop="isEnable" > |
|
55 |
<template #default="scope"> |
|
56 |
<dict-tag :type="DICT_TYPE.COM_IS_INT" :value="scope.row.isEnable" /> |
|
57 |
</template> |
|
58 |
</el-table-column> |
|
59 |
<el-table-column label="操作" align="center" min-width="180" fixed="right"> |
|
60 |
<template #default="scope"> |
|
61 |
<el-button |
|
62 |
link |
|
63 |
type="primary" |
|
64 |
@click="openForm('update', scope.row.id)" |
|
65 |
v-hasPermi="['pre:alarm-config:update']" |
|
66 |
> |
|
67 |
编辑 |
|
68 |
</el-button> |
|
69 |
<el-button |
|
70 |
link |
|
71 |
type="danger" |
|
72 |
@click="handleDelete(scope.row.id)" |
|
73 |
v-hasPermi="['pre:alarm-config:delete']" |
|
74 |
> |
|
75 |
删除 |
|
76 |
</el-button> |
|
77 |
<el-button |
|
78 |
link |
|
79 |
type="primary" |
|
80 |
@click="handleView(scope.row.id)" |
|
81 |
> |
|
82 |
查看历史 |
|
83 |
</el-button> |
|
84 |
</template> |
|
85 |
</el-table-column> |
|
86 |
</el-table> |
|
87 |
<!-- 分页 --> |
|
88 |
<Pagination |
|
89 |
:total="total" |
|
90 |
v-model:page="queryParams.pageNo" |
|
91 |
v-model:limit="queryParams.pageSize" |
|
92 |
@pagination="getList" |
|
93 |
/> |
|
94 |
</ContentWrap> |
|
95 |
|
|
96 |
<!-- 表单弹窗:添加/修改 --> |
|
97 |
<MmPredictAlarmConfigForm ref="formRef" @success="getList" /> |
|
98 |
<MmPredictAlarmMessage ref="MessageRef" /> |
|
99 |
|
|
100 |
</template> |
|
101 |
<script lang="ts" setup> |
|
102 |
import MmPredictAlarmConfigForm from './MmPredictAlarmConfigForm.vue' |
|
103 |
import MmPredictAlarmMessage from './MmPredictAlarmMessageForm.vue' |
|
104 |
import * as MmPredictAlarmConfig from '@/api/model/pre/alarm/config' |
|
105 |
import {DICT_TYPE} from "@/utils/dict"; |
|
106 |
|
|
107 |
defineOptions({name: 'DataMmPredictAlarmConfig'}) |
|
108 |
|
|
109 |
const message = useMessage() // 消息弹窗 |
|
110 |
const {t} = useI18n() // 国际化 |
|
111 |
|
|
112 |
const loading = ref(true) // 列表的加载中 |
|
113 |
const total = ref(0) // 列表的总页数 |
|
114 |
const list = ref([]) // 列表的数据 |
|
115 |
const queryParams = reactive({ |
|
116 |
pageNo: 1, |
|
117 |
pageSize: 10, |
|
118 |
title: undefined, |
|
119 |
}) |
|
120 |
const queryFormRef = ref() // 搜索的表单 |
|
121 |
|
|
122 |
/** 查询列表 */ |
|
123 |
const getList = async () => { |
|
124 |
loading.value = true |
|
125 |
try { |
|
126 |
const page = await MmPredictAlarmConfig.getMmPredictAlarmConfigPage(queryParams) |
|
127 |
list.value = page.list |
|
128 |
total.value = page.total |
|
129 |
} finally { |
|
130 |
loading.value = false |
|
131 |
} |
|
132 |
} |
|
133 |
|
|
134 |
/** 搜索按钮操作 */ |
|
135 |
const handleQuery = () => { |
|
136 |
queryParams.pageNo = 1 |
|
137 |
getList() |
|
138 |
} |
|
139 |
|
|
140 |
/** 重置按钮操作 */ |
|
141 |
const resetQuery = () => { |
|
142 |
queryFormRef.value.resetFields() |
|
143 |
handleQuery() |
|
144 |
} |
|
145 |
|
|
146 |
/** 添加/修改操作 */ |
|
147 |
const formRef = ref() |
|
148 |
const openForm = (type: string, id?: number) => { |
|
149 |
formRef.value.open(type, id) |
|
150 |
} |
|
151 |
|
|
152 |
/** 删除按钮操作 */ |
|
153 |
const handleDelete = async (id: number) => { |
|
154 |
try { |
|
155 |
// 删除的二次确认 |
|
156 |
await message.delConfirm() |
|
157 |
// 发起删除 |
|
158 |
await MmPredictAlarmConfig.deleteMmPredictAlarmConfig(id) |
|
159 |
message.success(t('common.delSuccess')) |
|
160 |
// 刷新列表 |
|
161 |
await getList() |
|
162 |
} catch { |
|
163 |
} |
|
164 |
} |
|
165 |
|
|
166 |
/** 查看历史按钮操作 */ |
|
167 |
const MessageRef = ref() |
|
168 |
const handleView = (id?: string) => { |
|
169 |
MessageRef.value.open(id) |
|
170 |
} |
|
171 |
|
|
172 |
/** 初始化 **/ |
|
173 |
onMounted(async () => { |
|
174 |
await getList() |
|
175 |
}) |
|
176 |
</script> |