提交 | 用户 | 时间
|
aff5c9
|
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 |
aff5c9
|
11 |
> |
潘 |
12 |
<el-form-item label="模型名称" prop="iconName"> |
|
13 |
<el-input |
|
14 |
v-model="queryParams.iconName" |
|
15 |
placeholder="请输入名称" |
|
16 |
clearable |
|
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="['mpk:icon:create']" |
|
34 |
> |
|
35 |
<Icon icon="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="iconName" label="名称"/> |
|
51 |
<el-table-column prop="iconDesc" label="描述"/> |
15ff71
|
52 |
<el-table-column align="center" label="图标" prop="icon" width="100"> |
潘 |
53 |
<template #default="scope"> |
963828
|
54 |
<img :src="staticDir + 'SimtreeUnitImage/' + scope.row.iconName" class="mpk-icon-list" :alt=" scope.row.iconDesc" /> |
15ff71
|
55 |
</template> |
潘 |
56 |
</el-table-column> |
aff5c9
|
57 |
<el-table-column prop="sort" label="排序"/> |
潘 |
58 |
<el-table-column label="操作" align="center" width="200px"> |
|
59 |
<template #default="scope"> |
|
60 |
<div class="flex items-center justify-center"> |
|
61 |
<el-button |
|
62 |
link |
|
63 |
type="primary" |
|
64 |
@click="openForm('update', scope.row.id)" |
|
65 |
v-hasPermi="['mpk:icon:update']" |
|
66 |
> |
|
67 |
编辑 |
|
68 |
</el-button> |
|
69 |
<el-button link type="danger" @click="handleDelete(scope.row.id)" v-hasPermi="['mpk:icon:delete']"> |
|
70 |
<Icon icon="ep:delete"/>删除 |
|
71 |
</el-button> |
|
72 |
</div> |
|
73 |
</template> |
|
74 |
</el-table-column> |
|
75 |
</el-table> |
|
76 |
<!-- 分页 --> |
|
77 |
<Pagination |
|
78 |
v-model:limit="queryParams.pageSize" |
b45bad
|
79 |
v-model:page="queryParams.pageNo" |
aff5c9
|
80 |
:total="total" |
潘 |
81 |
@pagination="getList" |
|
82 |
/> |
|
83 |
</ContentWrap> |
|
84 |
|
|
85 |
<!-- 表单弹窗:添加/修改 --> |
|
86 |
<IconForm ref="formRef" @success="getList" /> |
|
87 |
</template> |
|
88 |
<script lang="ts" setup> |
|
89 |
import {dateFormatter} from '@/utils/formatTime' |
|
90 |
import * as MpkIconApi from '@/api/model/mpk/icon' |
|
91 |
import IconForm from './IconForm.vue' |
|
92 |
|
|
93 |
defineOptions({name: 'MpkIcon'}) |
|
94 |
|
963828
|
95 |
const staticDir = ref(import.meta.env.VITE_STATIC_DIR) |
潘 |
96 |
|
aff5c9
|
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({ |
b45bad
|
104 |
pageNo: 1, |
aff5c9
|
105 |
pageSize: 10, |
潘 |
106 |
iconName: '' |
|
107 |
}) |
|
108 |
const queryFormRef = ref() // 搜索的表单 |
|
109 |
|
|
110 |
const getList = async () => { |
|
111 |
loading.value = true |
|
112 |
try { |
|
113 |
const data = await MpkIconApi.getPage(queryParams) |
|
114 |
list.value = data.list |
|
115 |
total.value = data.total |
|
116 |
} finally { |
|
117 |
loading.value = false |
|
118 |
} |
|
119 |
} |
|
120 |
|
|
121 |
/** 搜索按钮操作 */ |
|
122 |
const handleQuery = () => { |
|
123 |
getList() |
|
124 |
} |
|
125 |
|
|
126 |
/** 重置按钮操作 */ |
|
127 |
const resetQuery = () => { |
b45bad
|
128 |
queryParams.pageNo = 1 |
aff5c9
|
129 |
queryFormRef.value.resetFields() |
潘 |
130 |
handleQuery() |
|
131 |
} |
|
132 |
|
|
133 |
/** 添加/修改操作 */ |
|
134 |
const formRef = ref() |
|
135 |
const openForm = (type: string, id?: string) => { |
|
136 |
formRef.value.open(type, id) |
|
137 |
} |
|
138 |
|
|
139 |
/** 删除按钮操作 */ |
|
140 |
const handleDelete = async (id: string) => { |
|
141 |
try { |
|
142 |
// 删除的二次确认 |
|
143 |
await message.delConfirm() |
|
144 |
// 发起删除 |
|
145 |
await MpkIconApi.deleteIcon(id) |
|
146 |
message.success(t('common.delSuccess')) |
|
147 |
// 刷新列表 |
|
148 |
await getList() |
|
149 |
} catch { |
|
150 |
} |
|
151 |
} |
|
152 |
|
|
153 |
/** 初始化 **/ |
|
154 |
onMounted(async () => { |
|
155 |
await getList() |
|
156 |
}) |
|
157 |
</script> |
15ff71
|
158 |
<style scoped> |
潘 |
159 |
.mpk-icon-list { |
|
160 |
height: 30px; |
|
161 |
margin: 0; |
|
162 |
} |
|
163 |
|
|
164 |
</style> |