名称不填写

This commit is contained in:
wangwenchen 2023-08-03 11:59:04 +08:00
parent d3b10014fd
commit 5ad96a7128
2 changed files with 20 additions and 14 deletions

View File

@ -16,10 +16,7 @@ export default function render(
{
searchValue: string;
list: EntityDict['userEntityGrant']['Schema'][];
showBack: boolean;
variant?: 'inline' | 'alone' | 'dialog';
qrCodeUrl: string;
qrCodeExpiresAt: number;
nameLabel: string;
},
{
cancel: () => void;
@ -32,6 +29,7 @@ export default function render(
oakFullpath,
list = [],
oakLoading,
nameLabel,
} = props.data;
@ -56,9 +54,9 @@ export default function render(
},
{
dataIndex: ['user', 'nickname'],
title: '姓名',
title: nameLabel || '名称',
render: (value, record, index) => {
return value || '--';
return value !== 'shadow_user' && value || '--';
},
},
{

View File

@ -20,6 +20,7 @@ export default OakComponent({
| undefined,
multiple: false,
nameLabel: '',
nameRequired: true
},
lifetimes: {
ready() { },
@ -117,19 +118,26 @@ export default OakComponent({
});
},
confirm() {
const { entityId, entity, redirectTo, relation, multiple } =
const { entityId, entity, redirectTo, relation, multiple, nameRequired } =
this.props;
const { period, userId, searchValue } = this.state;
let nickname = searchValue;
const time = period * 24 * 60 * 60 * 1000;
if (!userId && !searchValue) {
this.setMessage({
type: 'error',
content: '请输入名称',
});
return;
if (nameRequired) {
if (!userId && !searchValue) {
this.setMessage({
type: 'error',
content: '请输入名称',
});
return;
}
} else {
nickname = 'shadow_user'
}
if (!period) {
this.setMessage({
type: 'error',
@ -152,7 +160,7 @@ export default OakComponent({
action: 'create',
data: {
id: generateNewId(),
nickname: searchValue,
nickname: nickname,
[`${userRelationRelativePath}`]: [
{