提交 | 用户 | 时间
|
db5c54
|
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" |
|
10 |
> |
|
11 |
<el-form-item label="应用编号" prop="appCode"> |
|
12 |
<el-input |
|
13 |
v-model="queryParams.appCode" |
|
14 |
placeholder="请输入应用编号" |
|
15 |
clearable |
|
16 |
@keyup.enter="handleQuery" |
|
17 |
class="!w-240px" |
|
18 |
/> |
|
19 |
</el-form-item> |
|
20 |
<el-form-item label="应用名称" prop="appName"> |
|
21 |
<el-input |
|
22 |
v-model="queryParams.appName" |
|
23 |
placeholder="请输入应用名称" |
|
24 |
clearable |
|
25 |
@keyup.enter="handleQuery" |
|
26 |
class="!w-240px" |
|
27 |
/> |
|
28 |
</el-form-item> |
|
29 |
<el-form-item label="应用状态" prop="status"> |
|
30 |
<el-select |
|
31 |
v-model="queryParams.status" |
|
32 |
placeholder="请选择应用状态" |
|
33 |
clearable |
|
34 |
class="!w-240px" |
|
35 |
> |
|
36 |
<el-option |
|
37 |
v-for="dict in getIntDictOptions(DICT_TYPE.COMMON_STATUS)" |
|
38 |
:key="dict.value" |
|
39 |
:label="dict.label" |
|
40 |
:value="dict.value" |
|
41 |
/> |
|
42 |
</el-select> |
|
43 |
</el-form-item> |
|
44 |
<el-form-item> |
|
45 |
<el-button @click="handleQuery"> |
|
46 |
<Icon icon="ep:search" class="mr-5px" /> |
|
47 |
搜索 |
|
48 |
</el-button> |
|
49 |
<el-button @click="resetQuery"> |
|
50 |
<Icon icon="ep:refresh" class="mr-5px" /> |
|
51 |
重置 |
|
52 |
</el-button> |
|
53 |
<el-button |
|
54 |
type="primary" |
|
55 |
plain |
|
56 |
@click="openForm('create')" |
|
57 |
v-hasPermi="['system:tenant:create']" |
|
58 |
> |
|
59 |
<Icon icon="ep:plus" class="mr-5px" /> |
|
60 |
新增 |
|
61 |
</el-button> |
|
62 |
<el-button |
|
63 |
type="success" |
|
64 |
plain |
|
65 |
@click="handleExport" |
|
66 |
:loading="exportLoading" |
|
67 |
v-hasPermi="['system:tenant:export']" |
|
68 |
> |
|
69 |
<Icon icon="ep:download" class="mr-5px" /> |
|
70 |
导出 |
|
71 |
</el-button> |
|
72 |
</el-form-item> |
|
73 |
</el-form> |
|
74 |
</ContentWrap> |
|
75 |
|
|
76 |
<!-- 列表 --> |
|
77 |
<ContentWrap> |
|
78 |
<el-table v-loading="loading" :data="list"> |
b1e092
|
79 |
<el-table-column label="应用类型" align="center" prop="type"> |
H |
80 |
<template #default="scope"> |
|
81 |
<dict-tag :type="DICT_TYPE.SYSTEM_APP_TYPE" :value="scope.row.type" /> |
|
82 |
</template> |
|
83 |
</el-table-column> |
|
84 |
<el-table-column label="应用分组" align="center" prop="groupId"> |
|
85 |
<template #default="scope"> |
|
86 |
<template v-for="item in groupList"> |
|
87 |
<el-tag type="warning" :key="item.id" v-if="item.id === scope.row.groupId"> |
|
88 |
{{ item.name }} |
|
89 |
</el-tag> |
|
90 |
</template> |
|
91 |
</template> |
|
92 |
</el-table-column> |
db5c54
|
93 |
<el-table-column label="应用编号" align="center" prop="appCode" /> |
潘 |
94 |
<el-table-column label="应用名称" align="center" prop="appName" /> |
|
95 |
<el-table-column label="应用域名" align="center" prop="appDomain" /> |
9259c2
|
96 |
<!-- <el-table-column label="接口域名" align="center" prop="apiDomain" />--> |
H |
97 |
<!-- <el-table-column label="应用账号" align="center" prop="appKey" />--> |
b1e092
|
98 |
<el-table-column label="应用图标" align="center" prop="logo"> |
H |
99 |
<template #default="scope"> |
|
100 |
<img width="40px" height="40px" :src="scope.row.icon" /> |
|
101 |
</template> |
|
102 |
</el-table-column> |
db5c54
|
103 |
<el-table-column label="备注" align="center" prop="remark" width="200" /> |
潘 |
104 |
<el-table-column |
|
105 |
label="创建时间" |
|
106 |
align="center" |
|
107 |
prop="createTime" |
|
108 |
width="180" |
|
109 |
:formatter="dateFormatter" |
|
110 |
/> |
|
111 |
<el-table-column label="操作" align="center" min-width="110" fixed="right"> |
|
112 |
<template #default="scope"> |
|
113 |
<el-button |
|
114 |
link |
|
115 |
type="primary" |
|
116 |
@click="openForm('update', scope.row.id)" |
b1e092
|
117 |
v-hasPermi="['system:app:update']" |
db5c54
|
118 |
> |
潘 |
119 |
编辑 |
|
120 |
</el-button> |
|
121 |
<el-button |
|
122 |
link |
|
123 |
type="danger" |
|
124 |
@click="handleDelete(scope.row.id)" |
b1e092
|
125 |
v-hasPermi="['system:app:delete']" |
db5c54
|
126 |
> |
潘 |
127 |
删除 |
|
128 |
</el-button> |
|
129 |
</template> |
|
130 |
</el-table-column> |
|
131 |
</el-table> |
|
132 |
<!-- 分页 --> |
|
133 |
<Pagination |
|
134 |
:total="total" |
|
135 |
v-model:page="queryParams.pageNo" |
|
136 |
v-model:limit="queryParams.pageSize" |
|
137 |
@pagination="getList" |
|
138 |
/> |
|
139 |
</ContentWrap> |
|
140 |
|
|
141 |
<!-- 表单弹窗:添加/修改 --> |
|
142 |
<AppForm ref="formRef" @success="getList" /> |
|
143 |
|
|
144 |
</template> |
|
145 |
<script lang="ts" setup> |
|
146 |
import {DICT_TYPE, getIntDictOptions} from '@/utils/dict' |
|
147 |
import {dateFormatter} from '@/utils/formatTime' |
|
148 |
import download from '@/utils/download' |
|
149 |
import * as AppApi from '@/api/system/app' |
|
150 |
import AppForm from './AppForm.vue' |
b1e092
|
151 |
import * as TenantApi from "@/api/system/tenant"; |
H |
152 |
import * as AppGroupApi from "@/api/system/appgroup"; |
db5c54
|
153 |
|
潘 |
154 |
defineOptions({name: 'SystemApp'}) |
|
155 |
|
|
156 |
const message = useMessage() // 消息弹窗 |
|
157 |
const {t} = useI18n() // 国际化 |
|
158 |
|
|
159 |
const loading = ref(true) // 列表的加载中 |
|
160 |
const total = ref(0) // 列表的总页数 |
|
161 |
const list = ref([]) // 列表的数据 |
|
162 |
const queryParams = reactive({ |
|
163 |
pageNo: 1, |
|
164 |
pageSize: 10, |
|
165 |
appCode: undefined, |
|
166 |
appName: undefined, |
|
167 |
status: undefined, |
|
168 |
createTime: [] |
|
169 |
}) |
|
170 |
const queryFormRef = ref() // 搜索的表单 |
|
171 |
const exportLoading = ref(false) // 导出的加载中 |
b1e092
|
172 |
|
H |
173 |
const tenantList = ref([] as TenantApi.TenantVO[]) // 租户列表 |
|
174 |
const groupList = ref([] as AppGroupApi.AppGroupVO[]) // 分组列表 |
db5c54
|
175 |
|
潘 |
176 |
/** 查询列表 */ |
|
177 |
const getList = async () => { |
|
178 |
loading.value = true |
|
179 |
try { |
|
180 |
const data = await AppApi.getAppPage(queryParams) |
|
181 |
list.value = data.list |
|
182 |
total.value = data.total |
|
183 |
} finally { |
|
184 |
loading.value = false |
|
185 |
} |
|
186 |
} |
|
187 |
|
|
188 |
/** 搜索按钮操作 */ |
|
189 |
const handleQuery = () => { |
|
190 |
queryParams.pageNo = 1 |
|
191 |
getList() |
|
192 |
} |
|
193 |
|
|
194 |
/** 重置按钮操作 */ |
|
195 |
const resetQuery = () => { |
|
196 |
queryFormRef.value.resetFields() |
|
197 |
handleQuery() |
|
198 |
} |
|
199 |
|
|
200 |
/** 添加/修改操作 */ |
|
201 |
const formRef = ref() |
|
202 |
const openForm = (type: string, id?: number) => { |
|
203 |
formRef.value.open(type, id) |
|
204 |
} |
|
205 |
|
|
206 |
/** 删除按钮操作 */ |
|
207 |
const handleDelete = async (id: number) => { |
|
208 |
try { |
|
209 |
// 删除的二次确认 |
|
210 |
await message.delConfirm() |
|
211 |
// 发起删除 |
|
212 |
await AppApi.deleteApp(id) |
|
213 |
message.success(t('common.delSuccess')) |
|
214 |
// 刷新列表 |
|
215 |
await getList() |
|
216 |
} catch { |
|
217 |
} |
|
218 |
} |
|
219 |
|
|
220 |
/** 导出按钮操作 */ |
|
221 |
const handleExport = async () => { |
|
222 |
try { |
|
223 |
// 导出的二次确认 |
|
224 |
await message.exportConfirm() |
|
225 |
// 发起导出 |
|
226 |
exportLoading.value = true |
|
227 |
const data = await AppApi.exportApp(queryParams) |
|
228 |
download.excel(data, '租户列表.xls') |
|
229 |
} catch { |
|
230 |
} finally { |
|
231 |
exportLoading.value = false |
|
232 |
} |
|
233 |
} |
|
234 |
|
|
235 |
/** 初始化 **/ |
|
236 |
onMounted(async () => { |
|
237 |
await getList() |
b1e092
|
238 |
tenantList.value = await TenantApi.getSimpleTenant() |
H |
239 |
groupList.value = await AppGroupApi.getAppGroupList() |
db5c54
|
240 |
}) |
潘 |
241 |
</script> |