1
1
<template >
2
- <Dialog :title =" modelTitle" v-model =" modelVisible" width = " 800 " >
2
+ <Dialog :title =" modelTitle" v-model =" modelVisible" scroll max-height = " 500px " >
3
3
<el-form
4
4
ref =" formRef"
5
5
:model =" formData"
6
6
:rules =" formRules"
7
- label-width =" 120px "
7
+ label-width =" 160px "
8
8
v-loading =" formLoading"
9
9
>
10
10
<el-form-item label =" 客户端编号" prop =" secret" >
17
17
<el-input v-model =" formData.name" placeholder =" 请输入应用名" />
18
18
</el-form-item >
19
19
<el-form-item label =" 应用图标" >
20
- <imageUpload v-model =" formData.logo" :limit =" 1" />
20
+ <UploadImg v-model =" formData.logo" :limit =" 1" />
21
21
</el-form-item >
22
22
<el-form-item label =" 应用描述" >
23
23
<el-input type =" textarea" v-model =" formData.description" placeholder =" 请输入应用名" />
24
24
</el-form-item >
25
25
<el-form-item label =" 状态" prop =" status" >
26
26
<el-radio-group v-model =" formData.status" >
27
27
<el-radio
28
- v-for =" dict in getDictOptions (DICT_TYPE.COMMON_STATUS)"
28
+ v-for =" dict in getIntDictOptions (DICT_TYPE.COMMON_STATUS)"
29
29
:key =" dict.value"
30
- :label =" parseInt(dict.value)"
31
- >{{ dict.label }}</el-radio
30
+ :label =" dict.value"
32
31
>
32
+ {{ dict.label }}
33
+ </el-radio >
33
34
</el-radio-group >
34
35
</el-form-item >
35
36
<el-form-item label =" 访问令牌的有效期" prop =" accessTokenValiditySeconds" >
47
48
style =" width : 500px "
48
49
>
49
50
<el-option
50
- v-for =" dict in getDictOptions (DICT_TYPE.SYSTEM_OAUTH2_GRANT_TYPE)"
51
+ v-for =" dict in getIntDictOptions (DICT_TYPE.SYSTEM_OAUTH2_GRANT_TYPE)"
51
52
:key =" dict.value"
52
53
:label =" dict.label"
53
54
:value =" dict.value"
137
138
</el-form-item >
138
139
</el-form >
139
140
<template #footer >
140
- <div class =" dialog-footer" >
141
- <el-button @click =" submitForm" type =" primary" :disabled =" formLoading" >确 定</el-button >
142
- <el-button @click =" modelVisible = false" >取 消</el-button >
143
- </div >
141
+ <el-button @click =" submitForm" type =" primary" :disabled =" formLoading" >确 定</el-button >
142
+ <el-button @click =" modelVisible = false" >取 消</el-button >
144
143
</template >
145
144
</Dialog >
146
145
</template >
147
146
<script setup lang="ts">
148
- import { DICT_TYPE , getDictOptions } from ' @/utils/dict'
147
+ import { DICT_TYPE , getIntDictOptions } from ' @/utils/dict'
148
+ import { CommonStatusEnum } from ' @/utils/constants'
149
149
import * as ClientApi from ' @/api/system/oauth2/client'
150
150
const { t } = useI18n () // 国际化
151
151
const message = useMessage () // 消息弹窗
@@ -161,7 +161,7 @@ const formData = ref({
161
161
name: undefined ,
162
162
logo: undefined ,
163
163
description: undefined ,
164
- status: DICT_TYPE . COMMON_STATUS ,
164
+ status: CommonStatusEnum . ENABLE ,
165
165
accessTokenValiditySeconds: 30 * 60 ,
166
166
refreshTokenValiditySeconds: 30 * 24 * 60 ,
167
167
redirectUris: [],
@@ -190,7 +190,7 @@ const formRules = reactive({
190
190
const formRef = ref () // 表单 Ref
191
191
192
192
/** 打开弹窗 */
193
- const openModal = async (type : string , id ? : number ) => {
193
+ const open = async (type : string , id ? : number ) => {
194
194
modelVisible .value = true
195
195
modelTitle .value = t (' action.' + type )
196
196
formType .value = type
@@ -199,13 +199,13 @@ const openModal = async (type: string, id?: number) => {
199
199
if (id ) {
200
200
formLoading .value = true
201
201
try {
202
- formData .value = await ClientApi .getOAuth2ClientApi (id )
202
+ formData .value = await ClientApi .getOAuth2Client (id )
203
203
} finally {
204
204
formLoading .value = false
205
205
}
206
206
}
207
207
}
208
- defineExpose ({ openModal }) // 提供 openModal 方法,用于打开弹窗
208
+ defineExpose ({ open }) // 提供 open 方法,用于打开弹窗
209
209
210
210
/** 提交表单 */
211
211
const emit = defineEmits ([' success' ]) // 定义 success 事件,用于操作成功后的回调
@@ -219,10 +219,10 @@ const submitForm = async () => {
219
219
try {
220
220
const data = formData .value as unknown as ClientApi .OAuth2ClientVO
221
221
if (formType .value === ' create' ) {
222
- await ClientApi .createOAuth2ClientApi (data )
222
+ await ClientApi .createOAuth2Client (data )
223
223
message .success (t (' common.createSuccess' ))
224
224
} else {
225
- await ClientApi .updateOAuth2ClientApi (data )
225
+ await ClientApi .updateOAuth2Client (data )
226
226
message .success (t (' common.updateSuccess' ))
227
227
}
228
228
modelVisible .value = false
@@ -242,7 +242,7 @@ const resetForm = () => {
242
242
name: undefined ,
243
243
logo: undefined ,
244
244
description: undefined ,
245
- status: DICT_TYPE . COMMON_STATUS ,
245
+ status: CommonStatusEnum . ENABLE ,
246
246
accessTokenValiditySeconds: 30 * 60 ,
247
247
refreshTokenValiditySeconds: 30 * 24 * 60 ,
248
248
redirectUris: [],
0 commit comments