1
0
Files
gringotts/gringotts-frontend/components/user/dialog-user-check.js

112 lines
2.9 KiB
JavaScript

import {
apiGet,
formCreatedUserAndModifiedUser,
horizontalFormOptions,
mappingField,
userRoleMapping,
userStateMapping
} from "../constants.js";
const dialogBody = [
{
type: 'input-email',
name: 'username',
label: '邮箱',
},
{
type: 'group',
body: [
{
type: 'control',
name: 'role',
label: '角色',
body: [
mappingField('role', userRoleMapping),
]
},
{
type: 'control',
name: 'state',
label: '账号状态',
body: [
mappingField('state', userStateMapping)
]
},
]
},
...formCreatedUserAndModifiedUser(),
{
type: 'group',
body: [
{
type: 'input-text',
name: 'checkedUsername',
label: '审核人',
},
{
type: 'input-datetime',
name: 'checkedTime',
label: '审核时间',
},
]
},
]
export function userDetailDialog() {
return {
actionType: 'dialog',
dialog: {
title: '账号详情',
actions: [],
size: 'md',
body: {
type: 'form',
initApi: apiGet('${base}/user_management/detail/${username}'),
...horizontalFormOptions(),
horizontal: {
left: 2,
},
static: true,
body: [
...dialogBody,
{
type: 'input-datetime',
name: 'lastLoginTime',
label: '上次登陆时间',
},
],
}
}
}
}
export function userCheckDialog() {
return {
actionType: 'dialog',
dialog: {
title: '账号审核',
actions: [
{
type: 'action',
label: '同意',
level: 'primary',
actionType: 'submit',
confirmTitle: '审核通过',
confirmText: '确认通过账号为${username}通过审核吗?审核通过后将无法撤销。',
},
],
size: 'md',
body: {
type: 'form',
api: apiGet('${base}/user_management/check/${username}'),
initApi: apiGet('${base}/user_management/detail/${username}'),
...horizontalFormOptions(),
horizontal: {
left: 2,
},
static: true,
body: dialogBody,
}
}
}
}