提交 | 用户 | 时间
|
7462da
|
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" |
ec54c9
|
10 |
@submit.prevent |
7462da
|
11 |
> |
L |
12 |
<el-form-item label="名称" prop="modulename"> |
|
13 |
<el-input |
|
14 |
v-model="queryParams.modulename" |
|
15 |
placeholder="请输入名称" |
|
16 |
clearable |
|
17 |
@keyup.enter="handleQuery" |
|
18 |
class="!w-240px" |
|
19 |
/> |
|
20 |
</el-form-item> |
|
21 |
<el-form-item> |
|
22 |
<el-button @click="handleQuery"> |
6e7f22
|
23 |
<Icon icon="ep:search" class="mr-5px"/> |
7462da
|
24 |
搜索 |
L |
25 |
</el-button> |
|
26 |
<el-button @click="resetQuery"> |
6e7f22
|
27 |
<Icon icon="ep:refresh" class="mr-5px"/> |
7462da
|
28 |
重置 |
L |
29 |
</el-button> |
|
30 |
<el-button |
|
31 |
type="primary" |
|
32 |
plain |
|
33 |
@click="openForm('create')" |
cd9f11
|
34 |
v-hasPermi="['model:pre-module:create']" |
7462da
|
35 |
> |
6e7f22
|
36 |
<Icon icon="ep:plus" class="mr-5px"/> |
7462da
|
37 |
新增 |
L |
38 |
</el-button> |
|
39 |
</el-form-item> |
|
40 |
</el-form> |
|
41 |
</ContentWrap> |
|
42 |
|
|
43 |
<!-- 列表 --> |
|
44 |
<ContentWrap> |
|
45 |
<el-table v-loading="loading" :data="list"> |
6e7f22
|
46 |
<el-table-column label="名称" header-align="center" align="left" min-width="100" prop="modulename"/> |
潘 |
47 |
<el-table-column label="类型" header-align="center" align="left" min-width="100" prop="moduletype"/> |
|
48 |
<el-table-column label="周期" align="center" prop="cycle"/> |
|
49 |
<el-table-column label="模块配置" align="center" prop="modulenavconfig"/> |
|
50 |
<el-table-column label="预测时间" align="center" prop="predicttime"/> |
|
51 |
<el-table-column label="采集时间" align="center" prop="collecttime"/> |
7462da
|
52 |
<el-table-column label="操作" align="center" min-width="110" fixed="right"> |
L |
53 |
<template #default="scope"> |
|
54 |
<el-button |
|
55 |
link |
|
56 |
type="primary" |
|
57 |
@click="openForm('update', scope.row.id)" |
cd9f11
|
58 |
v-hasPermi="['model:pre-module:update']" |
7462da
|
59 |
> |
L |
60 |
编辑 |
|
61 |
</el-button> |
|
62 |
<el-button |
|
63 |
link |
|
64 |
type="danger" |
|
65 |
@click="handleDelete(scope.row.id)" |
cd9f11
|
66 |
v-hasPermi="['model:pre-module:delete']" |
7462da
|
67 |
> |
L |
68 |
删除 |
|
69 |
</el-button> |
|
70 |
</template> |
|
71 |
</el-table-column> |
|
72 |
</el-table> |
|
73 |
<!-- 分页 --> |
|
74 |
<Pagination |
|
75 |
:total="total" |
|
76 |
v-model:page="queryParams.pageNo" |
|
77 |
v-model:limit="queryParams.pageSize" |
|
78 |
@pagination="getList" |
|
79 |
/> |
|
80 |
</ContentWrap> |
|
81 |
|
|
82 |
<!-- 表单弹窗:添加/修改 --> |
6e7f22
|
83 |
<DmModuleForm ref="formRef" @success="getList"/> |
7462da
|
84 |
|
L |
85 |
</template> |
|
86 |
<script lang="ts" setup> |
|
87 |
import DmModuleForm from './DmModuleForm.vue' |
|
88 |
import * as DmModule from '@/api/model/pre/dm' |
|
89 |
|
|
90 |
defineOptions({name: 'DataDmModule'}) |
|
91 |
|
6e7f22
|
92 |
const message = useMessage() // 消息弹窗 |
潘 |
93 |
const {t} = useI18n() // 国际化 |
7462da
|
94 |
|
6e7f22
|
95 |
const loading = ref(true) // 列表的加载中 |
潘 |
96 |
const total = ref(0) // 列表的总页数 |
|
97 |
const list = ref([]) // 列表的数据 |
|
98 |
const queryParams = reactive({ |
|
99 |
pageNo: 1, |
|
100 |
pageSize: 10, |
|
101 |
modulename: undefined, |
|
102 |
}) |
|
103 |
const queryFormRef = ref() // 搜索的表单 |
|
104 |
const exportLoading = ref(false) // 导出的加载中 |
7462da
|
105 |
|
6e7f22
|
106 |
/** 查询列表 */ |
潘 |
107 |
const getList = async () => { |
|
108 |
loading.value = true |
|
109 |
try { |
|
110 |
const page = await DmModule.getDmModulePage(queryParams) |
|
111 |
list.value = page.list |
|
112 |
total.value = page.total |
|
113 |
} finally { |
|
114 |
loading.value = false |
7462da
|
115 |
} |
6e7f22
|
116 |
} |
7462da
|
117 |
|
6e7f22
|
118 |
/** 搜索按钮操作 */ |
潘 |
119 |
const handleQuery = () => { |
|
120 |
queryParams.pageNo = 1 |
|
121 |
getList() |
|
122 |
} |
7462da
|
123 |
|
6e7f22
|
124 |
/** 重置按钮操作 */ |
潘 |
125 |
const resetQuery = () => { |
|
126 |
queryFormRef.value.resetFields() |
|
127 |
handleQuery() |
|
128 |
} |
7462da
|
129 |
|
6e7f22
|
130 |
/** 添加/修改操作 */ |
潘 |
131 |
const formRef = ref() |
|
132 |
const openForm = (type: string, id?: number) => { |
|
133 |
formRef.value.open(type, id) |
|
134 |
} |
7462da
|
135 |
|
6e7f22
|
136 |
/** 删除按钮操作 */ |
潘 |
137 |
const handleDelete = async (id: number) => { |
|
138 |
try { |
|
139 |
// 删除的二次确认 |
|
140 |
await message.delConfirm() |
|
141 |
// 发起删除 |
|
142 |
await DmModule.deleteDmModule(id) |
|
143 |
message.success(t('common.delSuccess')) |
|
144 |
// 刷新列表 |
7462da
|
145 |
await getList() |
6e7f22
|
146 |
} catch { |
潘 |
147 |
} |
|
148 |
} |
|
149 |
|
|
150 |
/** 初始化 **/ |
|
151 |
onMounted(async () => { |
|
152 |
await getList() |
|
153 |
}) |
7462da
|
154 |
</script> |