提交 | 用户 | 时间
|
1c14d6
|
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="pointNo"> |
|
12 |
<el-input |
|
13 |
v-model="queryParams.pointNo" |
|
14 |
placeholder="请输入测点编码" |
|
15 |
clearable |
|
16 |
@keyup.enter="handleQuery" |
aba8b4
|
17 |
class="!w-200px" |
1c14d6
|
18 |
/> |
L |
19 |
</el-form-item> |
|
20 |
<el-form-item label="测点名称" prop="pointName"> |
|
21 |
<el-input |
|
22 |
v-model="queryParams.pointName" |
|
23 |
placeholder="请输入测点名称" |
|
24 |
clearable |
|
25 |
@keyup.enter="handleQuery" |
aba8b4
|
26 |
class="!w-200px" |
1c14d6
|
27 |
/> |
L |
28 |
</el-form-item> |
e9d8f9
|
29 |
<el-form-item label="测点Tag" prop="tagNo"> |
潘 |
30 |
<el-input |
|
31 |
v-model="queryParams.tagNo" |
|
32 |
placeholder="请输入测点Tag" |
|
33 |
clearable |
|
34 |
@keyup.enter="handleQuery" |
aba8b4
|
35 |
class="!w-200px" |
e9d8f9
|
36 |
/> |
潘 |
37 |
</el-form-item> |
d97202
|
38 |
<el-form-item label="采集质量" prop="collectQuality"> |
潘 |
39 |
<el-select |
|
40 |
v-model="queryParams.collectQuality" |
|
41 |
placeholder="请选择" |
|
42 |
clearable |
|
43 |
class="!w-240px" |
|
44 |
> |
|
45 |
<el-option |
|
46 |
v-for="dict in getStrDictOptions(DICT_TYPE.DATA_QUALITY)" |
|
47 |
:key="dict.value" |
|
48 |
:label="dict.label" |
|
49 |
:value="dict.value" |
|
50 |
/> |
|
51 |
</el-select> |
|
52 |
</el-form-item> |
1c14d6
|
53 |
<el-form-item> |
L |
54 |
<el-button @click="handleQuery"> |
|
55 |
<Icon icon="ep:search" class="mr-5px" /> |
|
56 |
搜索 |
|
57 |
</el-button> |
|
58 |
<el-button @click="resetQuery"> |
|
59 |
<Icon icon="ep:refresh" class="mr-5px" /> |
|
60 |
重置 |
|
61 |
</el-button> |
|
62 |
<el-button |
|
63 |
type="primary" |
|
64 |
plain |
|
65 |
@click="openForm('create')" |
85c27f
|
66 |
v-hasPermi="['data:point:create']" |
1c14d6
|
67 |
> |
L |
68 |
<Icon icon="ep:plus" class="mr-5px" /> |
|
69 |
新增 |
|
70 |
</el-button> |
031c25
|
71 |
<el-button |
D |
72 |
type="warning" |
|
73 |
plain |
|
74 |
@click="handleImport" |
|
75 |
v-hasPermi="['data:point:import']" |
|
76 |
> |
|
77 |
<Icon icon="ep:upload" /> 导入 |
|
78 |
</el-button> |
|
79 |
<el-button |
|
80 |
type="success" |
|
81 |
plain |
|
82 |
@click="handleExport" |
|
83 |
:loading="exportLoading" |
|
84 |
v-hasPermi="['data:point:export']" |
|
85 |
> |
|
86 |
<Icon icon="ep:download" />导出 |
|
87 |
</el-button> |
5d8c73
|
88 |
<el-button |
J |
89 |
type="success" |
|
90 |
plain |
|
91 |
@click="enable" |
|
92 |
v-hasPermi="['data:point:update']" |
|
93 |
>启用 |
|
94 |
</el-button> |
|
95 |
<el-button |
|
96 |
type="danger" |
|
97 |
plain |
|
98 |
@click="disable" |
|
99 |
v-hasPermi="['data:point:update']" |
|
100 |
>禁用 |
|
101 |
</el-button> |
1c14d6
|
102 |
</el-form-item> |
L |
103 |
</el-form> |
|
104 |
</ContentWrap> |
|
105 |
|
|
106 |
<!-- 列表 --> |
|
107 |
<ContentWrap> |
5d8c73
|
108 |
<el-table border stripe v-loading="loading" :data="list" @selection-change="selectionChangeHandle"> |
de0f62
|
109 |
<el-table-column type="selection" header-align="center" align="center" fixed="left" width="50"/> |
5d8c73
|
110 |
<el-table-column fixed label="测点编码" header-align="center" align="left" min-width="130" prop="pointNo" /> |
de0f62
|
111 |
<el-table-column fixed label="测点名称" header-align="center" align="left" min-width="240" prop="pointName" /> |
e9d8f9
|
112 |
<el-table-column label="测点类型" align="center" prop="pointType" width="100"> |
潘 |
113 |
<template #default="scope"> |
|
114 |
<dict-tag :type="DICT_TYPE.DATA_POINT_TYPE" :value="scope.row.pointType" /> |
|
115 |
</template> |
|
116 |
</el-table-column> |
|
117 |
<el-table-column label="数据类型" align="center" prop="dataType" width="100"> |
|
118 |
<template #default="scope"> |
|
119 |
<dict-tag :type="DICT_TYPE.POINT_DATA_TYPE" :value="scope.row.dataType" /> |
15a226
|
120 |
</template> |
L |
121 |
</el-table-column> |
|
122 |
<el-table-column label="值类型" align="center" prop="valueType" width="120"> |
|
123 |
<template #default="scope"> |
df90c0
|
124 |
<dict-tag :type="DICT_TYPE.MEASURE_VALUE_TYPE" :value="scope.row.valueType" /> |
e9d8f9
|
125 |
</template> |
潘 |
126 |
</el-table-column> |
c4b4d2
|
127 |
<el-table-column label="测量单位" align="center" prop="unit" width="80"/> |
1c14d6
|
128 |
<el-table-column label="单位转换" align="center" prop="unittransfactor" /> |
c4b4d2
|
129 |
<el-table-column label="默认值" align="center" prop="defaultValue" width="100"/> |
e9d8f9
|
130 |
<el-table-column label="采集频率" align="center" prop="minfreqid" width="100"/> |
c4b4d2
|
131 |
<el-table-column label="数据源类型" align="center" prop="sourceType" min-width="100"/> |
潘 |
132 |
<el-table-column label="数据源名称" align="center" prop="sourceName" min-width="100"/> |
e9d8f9
|
133 |
<el-table-column label="测点Tag" header-align="center" align="left" prop="tagNo" min-width="150"/> |
d97202
|
134 |
<el-table-column label="采集质量" header-align="center" align="center" prop="collectQuality" width="100"> |
de0f62
|
135 |
<template #default="scope"> |
潘 |
136 |
<el-tag v-if="scope.row.collectQuality === 'Good'" size="small" type="success">{{scope.row.collectQuality}}</el-tag> |
|
137 |
<el-tag v-if="scope.row.collectQuality === 'Bad'" size="small" type="danger">{{scope.row.collectQuality}}</el-tag> |
|
138 |
</template> |
|
139 |
</el-table-column> |
|
140 |
<el-table-column label="采集时间" header-align="center" align="center" prop="collectTime" min-width="150"/> |
5d8c73
|
141 |
<el-table-column label="是否启用" align="center" prop="isEnable" width="85"> |
85c27f
|
142 |
<template #default="scope"> |
潘 |
143 |
<el-tag v-if="scope.row.isEnable === 1" size="small">是</el-tag> |
|
144 |
<el-tag v-else size="small" type="danger">否</el-tag> |
|
145 |
</template> |
|
146 |
</el-table-column> |
1c14d6
|
147 |
|
5d8c73
|
148 |
<el-table-column label="操作" align="center" min-width="130" fixed="right" width="120"> |
1c14d6
|
149 |
<template #default="scope"> |
L |
150 |
<el-button |
|
151 |
link |
c4b4d2
|
152 |
size="mini" |
1c14d6
|
153 |
type="primary" |
L |
154 |
@click="openForm('update', scope.row.id)" |
85c27f
|
155 |
v-hasPermi="['data:point:update']" |
1c14d6
|
156 |
> |
L |
157 |
编辑 |
|
158 |
</el-button> |
c4b4d2
|
159 |
<el-button link size="mini" type="primary" @click="chartHandle(scope.row)">数据</el-button> |
1c14d6
|
160 |
<el-button |
L |
161 |
link |
c4b4d2
|
162 |
size="mini" |
1c14d6
|
163 |
type="danger" |
L |
164 |
@click="handleDelete(scope.row.id)" |
85c27f
|
165 |
v-hasPermi="['data:point:delete']" |
1c14d6
|
166 |
> |
L |
167 |
删除 |
|
168 |
</el-button> |
|
169 |
</template> |
|
170 |
</el-table-column> |
|
171 |
</el-table> |
|
172 |
<!-- 分页 --> |
|
173 |
<Pagination |
|
174 |
:total="total" |
|
175 |
v-model:page="queryParams.pageNo" |
|
176 |
v-model:limit="queryParams.pageSize" |
|
177 |
@pagination="getList" |
|
178 |
/> |
|
179 |
</ContentWrap> |
|
180 |
|
|
181 |
<!-- 表单弹窗:添加/修改 --> |
|
182 |
<DaPointForm ref="formRef" @success="getList" /> |
|
183 |
|
031c25
|
184 |
<DaPointChart ref="chartView" /> |
D |
185 |
|
|
186 |
<!-- 用户导入对话框 --> |
|
187 |
<PointImportForm ref="importFormRef" @success="getList" /> |
1c14d6
|
188 |
</template> |
L |
189 |
<script lang="ts" setup> |
|
190 |
import * as DaPoint from '@/api/data/da/point' |
5d8c73
|
191 |
import {ref, reactive} from "vue"; |
031c25
|
192 |
import download from "@/utils/download"; |
d97202
|
193 |
import {DICT_TYPE, getDictOptions, getIntDictOptions, getStrDictOptions} from "@/utils/dict"; |
031c25
|
194 |
import DaPointForm from './DaPointForm.vue' |
D |
195 |
import DaPointChart from './DaPointChart.vue' |
|
196 |
import * as UserApi from "@/api/system/user"; |
c52be7
|
197 |
import PointImportForm from './PointImportForm.vue' |
1c14d6
|
198 |
|
85c27f
|
199 |
defineOptions({name: 'DataPoint'}) |
1c14d6
|
200 |
|
L |
201 |
const message = useMessage() // 消息弹窗 |
|
202 |
const {t} = useI18n() // 国际化 |
|
203 |
|
|
204 |
const loading = ref(true) // 列表的加载中 |
|
205 |
const total = ref(0) // 列表的总页数 |
|
206 |
const list = ref([]) // 列表的数据 |
|
207 |
const queryParams = reactive({ |
|
208 |
pageNo: 1, |
|
209 |
pageSize: 10, |
|
210 |
pointNo: undefined, |
|
211 |
pointName: undefined, |
e9d8f9
|
212 |
tagNo: undefined, |
d97202
|
213 |
collectQuality: undefined, |
1c14d6
|
214 |
}) |
L |
215 |
const queryFormRef = ref() // 搜索的表单 |
|
216 |
|
|
217 |
/** 查询列表 */ |
|
218 |
const getList = async () => { |
|
219 |
loading.value = true |
|
220 |
try { |
|
221 |
const page = await DaPoint.getDaPointPage(queryParams) |
|
222 |
list.value = page.list |
|
223 |
total.value = page.total |
|
224 |
} finally { |
|
225 |
loading.value = false |
|
226 |
} |
|
227 |
} |
|
228 |
|
|
229 |
/** 搜索按钮操作 */ |
|
230 |
const handleQuery = () => { |
|
231 |
queryParams.pageNo = 1 |
|
232 |
getList() |
031c25
|
233 |
} |
D |
234 |
|
|
235 |
/** 查看数据操作 */ |
|
236 |
const chartView = ref() |
|
237 |
const chartHandle = (raw: object) => { |
|
238 |
chartView.value.open(raw) |
1c14d6
|
239 |
} |
L |
240 |
|
|
241 |
/** 重置按钮操作 */ |
|
242 |
const resetQuery = () => { |
|
243 |
queryFormRef.value.resetFields() |
|
244 |
handleQuery() |
|
245 |
} |
|
246 |
|
|
247 |
/** 添加/修改操作 */ |
|
248 |
const formRef = ref() |
|
249 |
const openForm = (type: string, id?: number) => { |
|
250 |
formRef.value.open(type, id) |
|
251 |
} |
|
252 |
|
|
253 |
/** 删除按钮操作 */ |
|
254 |
const handleDelete = async (id: number) => { |
|
255 |
try { |
|
256 |
// 删除的二次确认 |
|
257 |
await message.delConfirm() |
|
258 |
// 发起删除 |
|
259 |
await DaPoint.deleteDaPoint(id) |
|
260 |
message.success(t('common.delSuccess')) |
|
261 |
// 刷新列表 |
|
262 |
await getList() |
|
263 |
} catch { |
|
264 |
} |
|
265 |
} |
031c25
|
266 |
/** 测点导入 */ |
D |
267 |
const importFormRef = ref() |
|
268 |
const handleImport = () => { |
|
269 |
importFormRef.value.open() |
|
270 |
} |
1c14d6
|
271 |
|
031c25
|
272 |
/** 导出按钮操作 */ |
D |
273 |
const exportLoading = ref(false) |
|
274 |
const handleExport = async () => { |
|
275 |
try { |
|
276 |
// 导出的二次确认 |
|
277 |
await message.exportConfirm() |
|
278 |
// 发起导出 |
|
279 |
exportLoading.value = true |
|
280 |
const data = await DaPoint.exportDaPoint(queryParams) |
813ce2
|
281 |
download.excel(data, '测点列表.xlsx') |
031c25
|
282 |
} catch { |
D |
283 |
} finally { |
|
284 |
exportLoading.value = false |
|
285 |
} |
|
286 |
} |
5d8c73
|
287 |
|
J |
288 |
let dataListSelections = reactive([]) |
|
289 |
// 多选 |
|
290 |
function selectionChangeHandle (val) { |
|
291 |
dataListSelections = val |
|
292 |
} |
|
293 |
// 启用 |
|
294 |
async function enable() { |
|
295 |
let ids = dataListSelections.map(item => { |
|
296 |
return item.id |
|
297 |
}) |
|
298 |
// 启用的二次确认 |
|
299 |
await message.enableConfirm(ids) |
|
300 |
|
|
301 |
await DaPoint.enable(ids) |
|
302 |
message.success(t('common.enableSuccess')) |
|
303 |
await getList() |
|
304 |
} |
|
305 |
// 禁用 |
|
306 |
async function disable(){ |
|
307 |
let ids = dataListSelections.map(item => { |
|
308 |
return item.id |
|
309 |
}) |
|
310 |
// 启用的二次确认 |
|
311 |
await message.disableConfirm(ids,) |
|
312 |
|
|
313 |
await DaPoint.disable(ids) |
|
314 |
message.success(t('common.disableSuccess')) |
|
315 |
await getList() |
|
316 |
} |
|
317 |
|
1c14d6
|
318 |
/** 初始化 **/ |
L |
319 |
onMounted(async () => { |
|
320 |
await getList() |
|
321 |
}) |
|
322 |
</script> |