提交 | 用户 | 时间
|
b1d33f
|
1 |
<template> |
潘 |
2 |
<!-- 搜索工作栏 --> |
|
3 |
<ContentWrap> |
|
4 |
<el-form |
|
5 |
ref="queryFormRef" |
|
6 |
:inline="true" |
|
7 |
:model="queryParams" |
|
8 |
class="-mb-15px" |
|
9 |
label-width="68px" |
|
10 |
> |
|
11 |
<el-form-item label="名称" prop="name"> |
|
12 |
<el-input |
|
13 |
v-model="queryParams.name" |
|
14 |
class="!w-240px" |
|
15 |
clearable |
|
16 |
placeholder="请输入名称" |
|
17 |
@keyup.enter="handleQuery" |
|
18 |
/> |
|
19 |
</el-form-item> |
|
20 |
<el-form-item> |
|
21 |
<el-button @click="handleQuery"> |
|
22 |
<Icon class="mr-5px" icon="ep:search" /> |
|
23 |
搜索 |
|
24 |
</el-button> |
|
25 |
<el-button @click="resetQuery"> |
|
26 |
<Icon class="mr-5px" icon="ep:refresh" /> |
|
27 |
重置 |
|
28 |
</el-button> |
|
29 |
<el-button |
|
30 |
v-hasPermi="['data:plan-data-set:create']" |
|
31 |
plain |
|
32 |
type="primary" |
|
33 |
@click="openForm('create')" |
|
34 |
> |
|
35 |
<Icon class="mr-5px" icon="ep:plus" /> |
|
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 align="center" label="名称" prop="name" show-overflow-tooltip /> |
|
46 |
<el-table-column align="center" label="备注" prop="remark" /> |
|
47 |
<el-table-column |
|
48 |
:formatter="dateFormatter" |
|
49 |
align="center" |
|
50 |
label="创建时间" |
|
51 |
prop="createTime" |
|
52 |
width="180" |
|
53 |
/> |
|
54 |
<el-table-column align="center" label="操作"> |
|
55 |
<template #default="scope"> |
|
56 |
<el-button |
|
57 |
v-hasPermi="['data:plan-data-set:update']" |
|
58 |
link |
|
59 |
type="primary" |
|
60 |
@click="openForm('update', scope.row.id)" |
|
61 |
> |
|
62 |
修改 |
|
63 |
</el-button> |
|
64 |
<el-button |
|
65 |
v-hasPermi="['data:plan-data-set:delete']" |
|
66 |
link |
|
67 |
type="danger" |
|
68 |
@click="handleDelete(scope.row.id)" |
|
69 |
> |
|
70 |
删除 |
|
71 |
</el-button> |
|
72 |
</template> |
|
73 |
</el-table-column> |
|
74 |
</el-table> |
|
75 |
<!-- 分页 --> |
|
76 |
<Pagination |
|
77 |
v-model:limit="queryParams.pageSize" |
|
78 |
v-model:page="queryParams.pageNo" |
|
79 |
:total="total" |
|
80 |
@pagination="getList" |
|
81 |
/> |
|
82 |
</ContentWrap> |
|
83 |
|
|
84 |
<!-- 表单弹窗:添加/修改 --> |
|
85 |
<DataSetForm ref="formRef" @success="getList" /> |
|
86 |
</template> |
|
87 |
|
|
88 |
<script lang="ts" setup> |
|
89 |
import { DICT_TYPE, getIntDictOptions } from '@/utils/dict' |
|
90 |
import { dateFormatter } from '@/utils/formatTime' |
|
91 |
import * as DataSetApi from '@/api/data/plan/data' |
|
92 |
import DataSetForm from './DataSetForm.vue' |
|
93 |
import download from '@/utils/download' |
|
94 |
|
|
95 |
defineOptions({ name: 'PlanDataSet' }) |
|
96 |
|
|
97 |
const message = useMessage() // 消息弹窗 |
|
98 |
const { t } = useI18n() // 国际化 |
|
99 |
|
|
100 |
const loading = ref(true) // 列表的加载中 |
|
101 |
const total = ref(0) // 列表的总页数 |
|
102 |
const list = ref([]) // 字典表格数据 |
|
103 |
const queryParams = reactive({ |
|
104 |
pageNo: 1, |
|
105 |
pageSize: 10, |
|
106 |
name: '' |
|
107 |
}) |
|
108 |
const queryFormRef = ref() // 搜索的表单 |
|
109 |
const exportLoading = ref(false) // 导出的加载中 |
|
110 |
|
|
111 |
/** 查询字典类型列表 */ |
|
112 |
const getList = async () => { |
|
113 |
loading.value = true |
|
114 |
try { |
|
115 |
const data = await DataSetApi.getDataSetPage(queryParams) |
|
116 |
list.value = data.list |
|
117 |
total.value = data.total |
|
118 |
} finally { |
|
119 |
loading.value = false |
|
120 |
} |
|
121 |
} |
|
122 |
|
|
123 |
/** 搜索按钮操作 */ |
|
124 |
const handleQuery = () => { |
|
125 |
queryParams.pageNo = 1 |
|
126 |
getList() |
|
127 |
} |
|
128 |
|
|
129 |
/** 重置按钮操作 */ |
|
130 |
const resetQuery = () => { |
|
131 |
queryFormRef.value.resetFields() |
|
132 |
handleQuery() |
|
133 |
} |
|
134 |
|
|
135 |
/** 添加/修改操作 */ |
|
136 |
const formRef = ref() |
|
137 |
const openForm = (type: string, id?: number) => { |
|
138 |
formRef.value.open(type, id) |
|
139 |
} |
|
140 |
|
|
141 |
/** 删除按钮操作 */ |
|
142 |
const handleDelete = async (id: number) => { |
|
143 |
try { |
|
144 |
// 删除的二次确认 |
|
145 |
await message.delConfirm() |
|
146 |
// 发起删除 |
|
147 |
await DataSetApi.deleteDataSet(id) |
|
148 |
message.success(t('common.delSuccess')) |
|
149 |
// 刷新列表 |
|
150 |
await getList() |
|
151 |
} catch {} |
|
152 |
} |
|
153 |
|
|
154 |
/** 初始化 **/ |
|
155 |
onMounted(() => { |
|
156 |
getList() |
|
157 |
}) |
|
158 |
</script> |