style(web): 优化代码缩进
This commit is contained in:
@@ -1,38 +1,38 @@
|
||||
import {horizontalFormOptions, apiPost} from '../constants.js'
|
||||
import {apiPost, horizontalFormOptions} from '../constants.js'
|
||||
import {confirmPasswordFormItem, passwordFormItem} from "./dialog-user-item.js";
|
||||
|
||||
export function userChangePasswordDialog() {
|
||||
return {
|
||||
actionType: 'dialog',
|
||||
dialog: {
|
||||
title: '修改密码',
|
||||
actions: [
|
||||
{
|
||||
type: 'reset',
|
||||
label: '清空',
|
||||
},
|
||||
{
|
||||
type: 'submit',
|
||||
label: '修改',
|
||||
level: 'primary',
|
||||
}
|
||||
],
|
||||
body: {
|
||||
type: 'form',
|
||||
api: apiPost('${base}/user_management/change_password'),
|
||||
...horizontalFormOptions(),
|
||||
body: [
|
||||
{
|
||||
type: 'input-password',
|
||||
name: 'oldPassword',
|
||||
label: '旧密码',
|
||||
placeholder: '请输入旧密码',
|
||||
required: true,
|
||||
},
|
||||
passwordFormItem('newPassword', '新密码'),
|
||||
confirmPasswordFormItem('confirmNewPassword', 'newPassword', '新密码'),
|
||||
]
|
||||
}
|
||||
return {
|
||||
actionType: 'dialog',
|
||||
dialog: {
|
||||
title: '修改密码',
|
||||
actions: [
|
||||
{
|
||||
type: 'reset',
|
||||
label: '清空',
|
||||
},
|
||||
{
|
||||
type: 'submit',
|
||||
label: '修改',
|
||||
level: 'primary',
|
||||
}
|
||||
],
|
||||
body: {
|
||||
type: 'form',
|
||||
api: apiPost('${base}/user_management/change_password'),
|
||||
...horizontalFormOptions(),
|
||||
body: [
|
||||
{
|
||||
type: 'input-password',
|
||||
name: 'oldPassword',
|
||||
label: '旧密码',
|
||||
placeholder: '请输入旧密码',
|
||||
required: true,
|
||||
},
|
||||
passwordFormItem('newPassword', '新密码'),
|
||||
confirmPasswordFormItem('confirmNewPassword', 'newPassword', '新密码'),
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,106 +1,106 @@
|
||||
import {
|
||||
apiGet,
|
||||
formCreatedUserAndModifiedUser,
|
||||
horizontalFormOptions,
|
||||
mappingField,
|
||||
userRoleMapping,
|
||||
userStateMapping
|
||||
apiGet,
|
||||
formCreatedUserAndModifiedUser,
|
||||
horizontalFormOptions,
|
||||
mappingField,
|
||||
userRoleMapping,
|
||||
userStateMapping
|
||||
} from "../constants.js";
|
||||
|
||||
const dialogBody = [
|
||||
{
|
||||
type: 'input-email',
|
||||
name: 'username',
|
||||
label: '邮箱',
|
||||
},
|
||||
{
|
||||
type: 'group',
|
||||
body: [
|
||||
{
|
||||
type: 'control',
|
||||
label: '角色',
|
||||
body: mappingField('role', '角色', userRoleMapping, 120),
|
||||
},
|
||||
{
|
||||
type: 'control',
|
||||
label: '账号状态',
|
||||
body: mappingField('state', '账号状态', userStateMapping),
|
||||
}
|
||||
]
|
||||
},
|
||||
...formCreatedUserAndModifiedUser(),
|
||||
{
|
||||
type: 'group',
|
||||
body: [
|
||||
{
|
||||
type: 'input-text',
|
||||
name: 'checkedUsername',
|
||||
label: '审核人',
|
||||
},
|
||||
{
|
||||
type: 'input-datetime',
|
||||
name: 'checkedTime',
|
||||
label: '审核时间',
|
||||
},
|
||||
]
|
||||
},
|
||||
{
|
||||
type: 'input-email',
|
||||
name: 'username',
|
||||
label: '邮箱',
|
||||
},
|
||||
{
|
||||
type: 'group',
|
||||
body: [
|
||||
{
|
||||
type: 'control',
|
||||
label: '角色',
|
||||
body: mappingField('role', '角色', userRoleMapping, 120),
|
||||
},
|
||||
{
|
||||
type: 'control',
|
||||
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: '上次登陆时间',
|
||||
},
|
||||
],
|
||||
}
|
||||
}
|
||||
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,
|
||||
}
|
||||
}
|
||||
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,
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,49 +1,49 @@
|
||||
export function emailFormItem(name) {
|
||||
return {
|
||||
type: 'input-email',
|
||||
name: name,
|
||||
label: '邮箱',
|
||||
placeholder: '请输入邮箱',
|
||||
required: true,
|
||||
clearable: true,
|
||||
clearValueOnEmpty: true,
|
||||
validateApi: '${base}/user/exists_username/${username}',
|
||||
}
|
||||
return {
|
||||
type: 'input-email',
|
||||
name: name,
|
||||
label: '邮箱',
|
||||
placeholder: '请输入邮箱',
|
||||
required: true,
|
||||
clearable: true,
|
||||
clearValueOnEmpty: true,
|
||||
validateApi: '${base}/user/exists_username/${username}',
|
||||
}
|
||||
}
|
||||
|
||||
export function passwordFormItem(name, label = '密码') {
|
||||
return {
|
||||
type: 'input-password',
|
||||
name: name,
|
||||
label: label,
|
||||
placeholder: `请输入${label}`,
|
||||
required: true,
|
||||
clearable: true,
|
||||
clearValueOnEmpty: true,
|
||||
validations: {
|
||||
matchRegexp:
|
||||
/^(?=.*\d)(?!.*(\d)\1{2})(?!.*(012|123|234|345|456|567|678|789|987|876|765|654|543|432|321|210))(?=.*[a-zA-Z])(?=.*[^\da-zA-Z\s]).{8,16}$/,
|
||||
},
|
||||
validationErrors: {
|
||||
matchRegexp:
|
||||
`${label}至少包含字母、数字、特殊字符,8-16位,并且不能连续出现3个大小连续或相同的数字`,
|
||||
},
|
||||
}
|
||||
return {
|
||||
type: 'input-password',
|
||||
name: name,
|
||||
label: label,
|
||||
placeholder: `请输入${label}`,
|
||||
required: true,
|
||||
clearable: true,
|
||||
clearValueOnEmpty: true,
|
||||
validations: {
|
||||
matchRegexp:
|
||||
/^(?=.*\d)(?!.*(\d)\1{2})(?!.*(012|123|234|345|456|567|678|789|987|876|765|654|543|432|321|210))(?=.*[a-zA-Z])(?=.*[^\da-zA-Z\s]).{8,16}$/,
|
||||
},
|
||||
validationErrors: {
|
||||
matchRegexp:
|
||||
`${label}至少包含字母、数字、特殊字符,8-16位,并且不能连续出现3个大小连续或相同的数字`,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
export function confirmPasswordFormItem(name, target, label = '密码') {
|
||||
return {
|
||||
type: 'input-password',
|
||||
name: name,
|
||||
label: `确认${label}`,
|
||||
placeholder: `请再次输入${label}`,
|
||||
required: true,
|
||||
clearable: true,
|
||||
validations: {
|
||||
equalsField: target,
|
||||
},
|
||||
validationErrors: {
|
||||
equalsField: `两次输入${label}不一致`,
|
||||
},
|
||||
}
|
||||
return {
|
||||
type: 'input-password',
|
||||
name: name,
|
||||
label: `确认${label}`,
|
||||
placeholder: `请再次输入${label}`,
|
||||
required: true,
|
||||
clearable: true,
|
||||
validations: {
|
||||
equalsField: target,
|
||||
},
|
||||
validationErrors: {
|
||||
equalsField: `两次输入${label}不一致`,
|
||||
},
|
||||
}
|
||||
}
|
||||
@@ -32,9 +32,9 @@ export function userRegisterDialog() {
|
||||
required: true,
|
||||
selectFirst: true,
|
||||
options: [
|
||||
{ label: '数据提供方', value: 'PROVIDER' },
|
||||
{ label: '数据使用方', value: 'CUSTOMER' },
|
||||
{ label: '审查监管方', value: 'CHECKER' },
|
||||
{label: '数据提供方', value: 'PROVIDER'},
|
||||
{label: '数据使用方', value: 'CUSTOMER'},
|
||||
{label: '审查监管方', value: 'CHECKER'},
|
||||
],
|
||||
},
|
||||
],
|
||||
@@ -76,9 +76,9 @@ export function userAdministratorRegisterDialog() {
|
||||
inline: false,
|
||||
columnsCount: 2,
|
||||
options: [
|
||||
{ label: '数据提供方', value: 'PROVIDER' },
|
||||
{ label: '数据使用方', value: 'CUSTOMER' },
|
||||
{ label: '审查监管方', value: 'CHECKER' },
|
||||
{label: '数据提供方', value: 'PROVIDER'},
|
||||
{label: '数据使用方', value: 'CUSTOMER'},
|
||||
{label: '审查监管方', value: 'CHECKER'},
|
||||
],
|
||||
},
|
||||
],
|
||||
|
||||
Reference in New Issue
Block a user