2022-07-18 19:06:37 +08:00
|
|
|
import { reactive } from 'vue'
|
|
|
|
import { useI18n } from '@/hooks/web/useI18n'
|
|
|
|
import { required } from '@/utils/formRules'
|
|
|
|
import { DICT_TYPE } from '@/utils/dict'
|
2022-11-13 14:40:51 +08:00
|
|
|
import { VxeCrudSchema, useVxeCrudSchemas } from '@/hooks/web/useVxeCrudSchemas'
|
|
|
|
const { t } = useI18n() // 国际化
|
2022-07-18 19:06:37 +08:00
|
|
|
|
|
|
|
// 表单校验
|
|
|
|
export const rules = reactive({
|
|
|
|
clientId: [required],
|
|
|
|
secret: [required],
|
|
|
|
name: [required],
|
|
|
|
logo: [required],
|
|
|
|
status: [required],
|
|
|
|
accessTokenValiditySeconds: [required],
|
|
|
|
refreshTokenValiditySeconds: [required],
|
|
|
|
redirectUris: [required],
|
|
|
|
authorizedGrantTypes: [required]
|
|
|
|
})
|
|
|
|
|
|
|
|
// CrudSchema
|
2022-11-13 14:40:51 +08:00
|
|
|
const crudSchemas = reactive<VxeCrudSchema>({
|
|
|
|
primaryKey: 'clientId',
|
|
|
|
primaryType: 'seq',
|
|
|
|
action: true,
|
|
|
|
columns: [
|
|
|
|
{
|
|
|
|
title: '客户端密钥',
|
|
|
|
field: 'secret'
|
2022-07-18 19:06:37 +08:00
|
|
|
},
|
2022-11-13 14:40:51 +08:00
|
|
|
{
|
|
|
|
title: '应用名',
|
|
|
|
field: 'name',
|
|
|
|
isSearch: true
|
|
|
|
},
|
|
|
|
{
|
|
|
|
title: '应用图标',
|
2022-11-15 13:59:22 +08:00
|
|
|
field: 'logo',
|
|
|
|
table: {
|
|
|
|
type: 'html',
|
|
|
|
formatter: 'formatImg'
|
|
|
|
}
|
2022-11-13 14:40:51 +08:00
|
|
|
},
|
|
|
|
{
|
|
|
|
title: t('common.status'),
|
|
|
|
field: 'status',
|
2022-11-15 13:59:22 +08:00
|
|
|
dictType: DICT_TYPE.COMMON_STATUS,
|
2022-11-16 23:15:14 +08:00
|
|
|
dictData: 'number',
|
2022-11-13 14:40:51 +08:00
|
|
|
isSearch: true
|
|
|
|
},
|
|
|
|
{
|
|
|
|
title: '访问令牌的有效期',
|
2022-11-16 11:32:47 +08:00
|
|
|
field: 'accessTokenValiditySeconds',
|
2022-11-14 13:19:33 +08:00
|
|
|
form: {
|
2022-11-17 13:27:26 +08:00
|
|
|
component: 'InputNumber'
|
2022-11-16 11:32:47 +08:00
|
|
|
},
|
|
|
|
table: {
|
|
|
|
slots: {
|
|
|
|
default: 'accessTokenValiditySeconds_default'
|
|
|
|
}
|
2022-11-14 13:19:33 +08:00
|
|
|
}
|
2022-07-18 19:06:37 +08:00
|
|
|
},
|
2022-11-13 14:40:51 +08:00
|
|
|
{
|
|
|
|
title: '刷新令牌的有效期',
|
2022-11-16 11:32:47 +08:00
|
|
|
field: 'refreshTokenValiditySeconds',
|
2022-11-14 13:19:33 +08:00
|
|
|
form: {
|
2022-11-17 13:27:26 +08:00
|
|
|
component: 'InputNumber'
|
2022-11-16 11:32:47 +08:00
|
|
|
},
|
|
|
|
table: {
|
|
|
|
slots: {
|
|
|
|
default: 'refreshTokenValiditySeconds_default'
|
|
|
|
}
|
2022-11-14 13:19:33 +08:00
|
|
|
}
|
2022-11-13 14:40:51 +08:00
|
|
|
},
|
|
|
|
{
|
|
|
|
title: '授权类型',
|
2022-11-16 11:32:47 +08:00
|
|
|
field: 'authorizedGrantTypes',
|
2022-11-15 13:59:22 +08:00
|
|
|
table: {
|
|
|
|
width: 300,
|
|
|
|
slots: {
|
|
|
|
default: 'authorizedGrantTypes_default'
|
|
|
|
}
|
2022-07-18 19:06:37 +08:00
|
|
|
}
|
|
|
|
},
|
2022-11-13 14:40:51 +08:00
|
|
|
{
|
|
|
|
title: '授权范围',
|
2022-11-13 19:08:32 +08:00
|
|
|
field: 'scopes', // TODO @星语:带输入的 SELECT
|
2022-11-16 11:32:47 +08:00
|
|
|
isTable: false
|
2022-11-13 14:40:51 +08:00
|
|
|
},
|
|
|
|
{
|
|
|
|
title: '自动授权范围',
|
2022-11-13 19:08:32 +08:00
|
|
|
field: 'autoApproveScopes', // TODO @星语:带输入的 SELECT
|
2022-11-16 11:32:47 +08:00
|
|
|
isTable: false
|
2022-11-13 14:40:51 +08:00
|
|
|
},
|
|
|
|
{
|
|
|
|
title: '可重定向的 URI 地址',
|
2022-11-13 19:08:32 +08:00
|
|
|
field: 'redirectUris', // TODO @星语:带输入的 SELECT
|
2022-11-16 11:32:47 +08:00
|
|
|
isTable: false
|
2022-11-13 14:40:51 +08:00
|
|
|
},
|
|
|
|
{
|
|
|
|
title: '权限',
|
|
|
|
field: 'authorities',
|
|
|
|
isTable: false
|
|
|
|
},
|
|
|
|
{
|
|
|
|
title: '资源',
|
|
|
|
field: 'resourceIds',
|
|
|
|
isTable: false
|
|
|
|
},
|
|
|
|
{
|
|
|
|
title: '附加信息',
|
|
|
|
field: 'additionalInformation',
|
|
|
|
isTable: false,
|
|
|
|
form: {
|
|
|
|
component: 'Input',
|
|
|
|
componentProps: {
|
|
|
|
type: 'textarea',
|
|
|
|
rows: 4
|
|
|
|
},
|
|
|
|
colProps: {
|
|
|
|
span: 24
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
title: t('common.createTime'),
|
|
|
|
field: 'createTime',
|
2022-11-14 13:19:33 +08:00
|
|
|
formatter: 'formatDate',
|
2022-11-13 14:40:51 +08:00
|
|
|
isForm: false
|
2022-07-18 19:06:37 +08:00
|
|
|
}
|
2022-11-13 14:40:51 +08:00
|
|
|
]
|
|
|
|
})
|
|
|
|
export const { allSchemas } = useVxeCrudSchemas(crudSchemas)
|