提交 | 用户 | 时间
|
448126
|
1 |
<template> |
潘 |
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 |
448126
|
11 |
> |
潘 |
12 |
<el-form-item label="名称" prop="packName"> |
|
13 |
<el-input |
|
14 |
v-model="queryParams.packName" |
|
15 |
placeholder="请输入名称" |
|
16 |
clearable |
|
17 |
class="!w-240px" |
|
18 |
/> |
|
19 |
</el-form-item> |
|
20 |
<el-form-item> |
|
21 |
<el-button @click="handleQuery"> |
|
22 |
<Pack pack="ep:search" class="mr-5px"/> |
|
23 |
搜索 |
|
24 |
</el-button> |
|
25 |
<el-button @click="resetQuery"> |
|
26 |
<Pack pack="ep:refresh" class="mr-5px"/> |
|
27 |
重置 |
|
28 |
</el-button> |
|
29 |
<el-button |
|
30 |
type="primary" |
|
31 |
plain |
|
32 |
@click="openForm('create')" |
|
33 |
v-hasPermi="['mpk:pack:create']" |
|
34 |
> |
|
35 |
<Pack pack="ep:plus" class="mr-5px" /> |
|
36 |
新增 |
|
37 |
</el-button> |
|
38 |
|
|
39 |
</el-form-item> |
|
40 |
</el-form> |
|
41 |
</ContentWrap> |
|
42 |
|
|
43 |
<!-- 列表 --> |
|
44 |
<ContentWrap> |
|
45 |
<el-table |
|
46 |
v-loading="loading" |
|
47 |
:data="list" |
|
48 |
row-key="id" |
|
49 |
> |
|
50 |
<el-table-column prop="packName" label="名称"/> |
|
51 |
<el-table-column prop="packDesc" label="描述"/> |
|
52 |
<el-table-column prop="modelPath" label="模型路径"/> |
|
53 |
<el-table-column prop="sort" label="排序"/> |
|
54 |
<el-table-column label="操作" align="center" width="200px"> |
|
55 |
<template #default="scope"> |
|
56 |
<div class="flex items-center justify-center"> |
|
57 |
<el-button |
|
58 |
link |
|
59 |
type="primary" |
|
60 |
@click="openForm('update', scope.row.id)" |
|
61 |
v-hasPermi="['mpk:pack:update']" |
|
62 |
> |
|
63 |
编辑 |
|
64 |
</el-button> |
|
65 |
<el-button link type="danger" @click="handleDelete(scope.row.id)" v-hasPermi="['mpk:pack:delete']"> |
|
66 |
<Pack pack="ep:delete"/>删除 |
|
67 |
</el-button> |
|
68 |
</div> |
|
69 |
</template> |
|
70 |
</el-table-column> |
|
71 |
</el-table> |
|
72 |
<!-- 分页 --> |
|
73 |
<Pagination |
|
74 |
v-model:limit="queryParams.pageSize" |
|
75 |
v-model:page="queryParams.pageNo" |
|
76 |
:total="total" |
|
77 |
@pagination="getList" |
|
78 |
/> |
|
79 |
</ContentWrap> |
|
80 |
|
|
81 |
<!-- 表单弹窗:添加/修改 --> |
|
82 |
<PackForm ref="formRef" @success="getList" /> |
|
83 |
</template> |
|
84 |
<script lang="ts" setup> |
|
85 |
import {dateFormatter} from '@/utils/formatTime' |
|
86 |
import * as MpkPackApi from '@/api/model/mpk/pack' |
|
87 |
import PackForm from './PackForm.vue' |
|
88 |
|
|
89 |
defineOptions({name: 'MpkPack'}) |
|
90 |
|
|
91 |
const message = useMessage() // 消息弹窗 |
|
92 |
const {t} = useI18n() // 国际化 |
|
93 |
|
|
94 |
const loading = ref(true) // 列表的加载中 |
|
95 |
const total = ref(0) // 列表的总页数 |
|
96 |
const list = ref([]) // 字典表格数据 |
|
97 |
const queryParams = reactive({ |
|
98 |
pageNo: 1, |
|
99 |
pageSize: 10, |
|
100 |
packName: '' |
|
101 |
}) |
|
102 |
const queryFormRef = ref() // 搜索的表单 |
|
103 |
|
|
104 |
const getList = async () => { |
|
105 |
loading.value = true |
|
106 |
try { |
|
107 |
const data = await MpkPackApi.getPage(queryParams) |
|
108 |
list.value = data.list |
|
109 |
total.value = data.total |
|
110 |
} finally { |
|
111 |
loading.value = false |
|
112 |
} |
|
113 |
} |
|
114 |
|
|
115 |
/** 搜索按钮操作 */ |
|
116 |
const handleQuery = () => { |
|
117 |
getList() |
|
118 |
} |
|
119 |
|
|
120 |
/** 重置按钮操作 */ |
|
121 |
const resetQuery = () => { |
|
122 |
queryParams.pageNo = 1 |
|
123 |
queryFormRef.value.resetFields() |
|
124 |
handleQuery() |
|
125 |
} |
|
126 |
|
|
127 |
/** 添加/修改操作 */ |
|
128 |
const formRef = ref() |
|
129 |
const openForm = (type: string, id?: string) => { |
|
130 |
formRef.value.open(type, id) |
|
131 |
} |
|
132 |
|
|
133 |
/** 删除按钮操作 */ |
|
134 |
const handleDelete = async (id: string) => { |
|
135 |
try { |
|
136 |
// 删除的二次确认 |
|
137 |
await message.delConfirm() |
|
138 |
// 发起删除 |
|
139 |
await MpkPackApi.deletePack(id) |
|
140 |
message.success(t('common.delSuccess')) |
|
141 |
// 刷新列表 |
|
142 |
await getList() |
|
143 |
} catch { |
|
144 |
} |
|
145 |
} |
|
146 |
|
|
147 |
/** 初始化 **/ |
|
148 |
onMounted(async () => { |
|
149 |
await getList() |
|
150 |
}) |
|
151 |
</script> |
|
152 |
<style scoped> |
|
153 |
.mpk-pack-list { |
|
154 |
height: 30px; |
|
155 |
margin: 0; |
|
156 |
} |
|
157 |
|
|
158 |
</style> |