fix: 给名称加上长度限制

This commit is contained in:
RubyLiu 2024-02-01 17:34:39 +08:00 committed by Craftsman
parent 74f6c94f57
commit bdb421d1c6
12 changed files with 83 additions and 26 deletions

View File

@ -107,6 +107,9 @@
callback(t('system.userGroup.userGroupNameIsExist', { name: value })); callback(t('system.userGroup.userGroupNameIsExist', { name: value }));
} }
} }
if (value.length === 255) {
callback(t('common.nameIsTooLang'));
}
callback(); callback();
} }
}; };

View File

@ -293,7 +293,7 @@
} from '@/api/modules/setting/usergroup'; } from '@/api/modules/setting/usergroup';
import { useI18n } from '@/hooks/useI18n'; import { useI18n } from '@/hooks/useI18n';
import useModal from '@/hooks/useModal'; import useModal from '@/hooks/useModal';
import { useAppStore, useUserStore } from '@/store'; import { useAppStore } from '@/store';
import { characterLimit } from '@/utils'; import { characterLimit } from '@/utils';
import { hasAnyPermission } from '@/utils/permission'; import { hasAnyPermission } from '@/utils/permission';
@ -307,7 +307,6 @@
(e: 'addUserSuccess', id: string): void; (e: 'addUserSuccess', id: string): void;
}>(); }>();
const appStore = useAppStore(); const appStore = useAppStore();
const userStore = useUserStore();
const { openModal } = useModal(); const { openModal } = useModal();
const systemType = inject<AuthScopeEnum>('systemType'); const systemType = inject<AuthScopeEnum>('systemType');

View File

@ -12,7 +12,14 @@
<div v-else> <div v-else>
<div class="flex flex-row items-center"> <div class="flex flex-row items-center">
<MsUserSelector v-bind="$attrs" v-model="memberList" class="w-[262px]" /> <MsUserSelector v-bind="$attrs" v-model="memberList" class="w-[262px]" />
<a-button type="outline" :loading="props.okLoading" class="ml-[12px]" size="mini" @click="handleConfirm"> <a-button
type="outline"
:disabled="!memberList.length"
:loading="props.okLoading"
class="ml-[12px]"
size="mini"
@click="handleConfirm"
>
{{ t('common.confirm') }} {{ t('common.confirm') }}
</a-button> </a-button>
<div <div

View File

@ -109,4 +109,6 @@ export default {
'common.batchMove': 'Batch move', 'common.batchMove': 'Batch move',
'common.batchMoveSuccess': 'Batch move successful', 'common.batchMoveSuccess': 'Batch move successful',
'common.importSuccess': 'Import successful', 'common.importSuccess': 'Import successful',
'common.nameIsTooLang': 'The name exceeds 255 characters',
'common.validateSuccess': 'Validate success',
}; };

View File

@ -112,4 +112,6 @@ export default {
'common.batchMove': '批量移动', 'common.batchMove': '批量移动',
'common.batchMoveSuccess': '批量移动成功', 'common.batchMoveSuccess': '批量移动成功',
'common.importSuccess': '导入成功', 'common.importSuccess': '导入成功',
'common.nameIsTooLang': '名称超过255个字符',
'common.validateSuccess': '验证成功',
}; };

View File

@ -43,7 +43,10 @@
<span class="text-[var(--color-text-1)]">{{ t('project.menu.incrementalSync') }}</span> <span class="text-[var(--color-text-1)]">{{ t('project.menu.incrementalSync') }}</span>
<a-tooltip :content="t('project.menu.incrementalSyncTip')" position="top"> <a-tooltip :content="t('project.menu.incrementalSyncTip')" position="top">
<div> <div>
<MsIcon class="ml-[4px] text-[var(--color-text-4)]" type="icon-icon-maybe_outlined" /> <MsIcon
class="ml-[4px] text-[var(--color-text-4)] hover:text-[rgb(var(--primary-5))]"
type="icon-icon-maybe_outlined"
/>
</div> </div>
</a-tooltip> </a-tooltip>
</div> </div>
@ -53,7 +56,10 @@
<span class="text-[var(--color-text-1)]">{{ t('project.menu.fullSync') }}</span> <span class="text-[var(--color-text-1)]">{{ t('project.menu.fullSync') }}</span>
<a-tooltip :content="t('project.menu.fullSyncTip')" position="bl"> <a-tooltip :content="t('project.menu.fullSyncTip')" position="bl">
<div> <div>
<MsIcon class="ml-[4px] text-[var(--color-text-4)]" type="icon-icon-maybe_outlined" /> <MsIcon
class="ml-[4px] text-[var(--color-text-4)] hover:text-[rgb(var(--primary-5))]"
type="icon-icon-maybe_outlined"
/>
</div> </div>
</a-tooltip> </a-tooltip>
</div> </div>
@ -102,7 +108,10 @@
</div> </div>
</template> </template>
<div> <div>
<MsIcon class="ml-[4px] text-[var(--color-text-4)]" type="icon-icon-maybe_outlined" /> <MsIcon
class="ml-[4px] text-[var(--color-text-4)] hover:text-[rgb(var(--primary-5))]"
type="icon-icon-maybe_outlined"
/>
</div> </div>
</a-tooltip> </a-tooltip>
</div> </div>

View File

@ -59,7 +59,10 @@
</div> </div>
</template> </template>
<div> <div>
<MsIcon class="ml-[4px] text-[var(--color-text-4)]" type="icon-icon-maybe_outlined" /> <MsIcon
class="ml-[4px] text-[var(--color-text-4)] hover:text-[rgb(var(--primary-5))]"
type="icon-icon-maybe_outlined"
/>
</div> </div>
</a-tooltip> </a-tooltip>
</div> </div>

View File

@ -3,7 +3,10 @@
<div class="text-[var(--color-text-1)]"> {{ t('project.menu.management') }}</div> <div class="text-[var(--color-text-1)]"> {{ t('project.menu.management') }}</div>
<a-tooltip :content="t('project.menu.manageTip')" position="bl"> <a-tooltip :content="t('project.menu.manageTip')" position="bl">
<div> <div>
<MsIcon class="ml-[4px] text-[rgb(var(--primary-5))]" type="icon-icon-maybe_outlined" /> <MsIcon
class="ml-[4px] text-[var(--color-text-4)] hover:text-[rgb(var(--primary-5))]"
type="icon-icon-maybe_outlined"
/>
</div> </div>
</a-tooltip> </a-tooltip>
</div> </div>
@ -113,7 +116,10 @@
position="right" position="right"
> >
<div> <div>
<MsIcon class="ml-[4px] text-[rgb(var(--primary-5))]" type="icon-icon-maybe_outlined" /> <MsIcon
class="ml-[4px] text-[var(--color-text-4)] hover:text-[rgb(var(--primary-5))]"
type="icon-icon-maybe_outlined"
/>
</div> </div>
</a-tooltip> </a-tooltip>
</div> </div>
@ -129,7 +135,10 @@
/> />
<a-tooltip :content="t('project.menu.API_SCRIPT_REVIEWER_TIP')" position="right"> <a-tooltip :content="t('project.menu.API_SCRIPT_REVIEWER_TIP')" position="right">
<div> <div>
<MsIcon class="ml-[4px] text-[rgb(var(--primary-5))]" type="icon-icon-maybe_outlined" /> <MsIcon
class="ml-[4px] text-[var(--color-text-4)] hover:text-[rgb(var(--primary-5))]"
type="icon-icon-maybe_outlined"
/>
</div> </div>
</a-tooltip> </a-tooltip>
</div> </div>
@ -155,7 +164,10 @@
> >
<a-tooltip :content="t('project.menu.API_ERROR_REPORT_RULE_TIP')" position="right"> <a-tooltip :content="t('project.menu.API_ERROR_REPORT_RULE_TIP')" position="right">
<div> <div>
<MsIcon class="ml-[4px] text-[rgb(var(--primary-5))]" type="icon-icon-maybe_outlined" /> <MsIcon
class="ml-[4px] text-[var(--color-text-4)] hover:text-[rgb(var(--primary-5))]"
type="icon-icon-maybe_outlined"
/>
</div> </div>
</a-tooltip> </a-tooltip>
</div> </div>
@ -195,7 +207,10 @@
position="right" position="right"
> >
<div> <div>
<MsIcon class="ml-[4px] text-[rgb(var(--primary-5))]" type="icon-icon-maybe_outlined" /> <MsIcon
class="ml-[4px] text-[var(--color-text-4)] hover:text-[rgb(var(--primary-5))]"
type="icon-icon-maybe_outlined"
/>
</div> </div>
</a-tooltip> </a-tooltip>
</div> </div>
@ -227,7 +242,10 @@
/> />
<a-tooltip :content="t('project.menu.PERFORMANCE_TEST_SCRIPT_REVIEWER_TIP')" position="right"> <a-tooltip :content="t('project.menu.PERFORMANCE_TEST_SCRIPT_REVIEWER_TIP')" position="right">
<div> <div>
<MsIcon class="ml-[4px] text-[rgb(var(--primary-5))]" type="icon-icon-maybe_outlined" /> <MsIcon
class="ml-[4px] text-[var(--color-text-4)] hover:text-[rgb(var(--primary-5))]"
type="icon-icon-maybe_outlined"
/>
</div> </div>
</a-tooltip> </a-tooltip>
</div> </div>

View File

@ -94,7 +94,10 @@
<a-form-item <a-form-item
field="name" field="name"
:label="t('project.userGroup.name')" :label="t('project.userGroup.name')"
:rules="[{ required: true, message: t('project.userGroup.addRequired') }]" :rules="[
{ required: true, message: t('project.userGroup.addRequired') },
{ maxLength: 255, message: t('common.nameIsTooLang') },
]"
asterisk-position="end" asterisk-position="end"
> >
<a-input v-model="form.name" /> <a-input v-model="form.name" />

View File

@ -22,7 +22,10 @@
required required
:label="t('system.project.name')" :label="t('system.project.name')"
asterisk-position="end" asterisk-position="end"
:rules="[{ required: true, message: t('system.project.projectNameRequired') }]" :rules="[
{ required: true, message: t('system.project.projectNameRequired') },
{ maxLength: 255, message: t('common.nameIsTooLang') },
]"
> >
<a-input v-model="form.name" allow-clear :placeholder="t('system.project.projectNamePlaceholder')" /> <a-input v-model="form.name" allow-clear :placeholder="t('system.project.projectNamePlaceholder')" />
</a-form-item> </a-form-item>
@ -80,7 +83,10 @@
<a-switch v-model="form.enable" size="small" type="line" /> <a-switch v-model="form.enable" size="small" type="line" />
<span>{{ t('system.organization.status') }}</span> <span>{{ t('system.organization.status') }}</span>
<a-tooltip :content="t('system.project.createTip')" position="top"> <a-tooltip :content="t('system.project.createTip')" position="top">
<MsIcon type="icon-icon-maybe_outlined" class="text-[var(--color-text-4)]" /> <MsIcon
type="icon-icon-maybe_outlined"
class="text-[var(--color-text-4)] hover:text-[rgb(var(--primary-5))]"
/>
</a-tooltip> </a-tooltip>
</div> </div>
<div class="flex flex-row gap-[14px]"> <div class="flex flex-row gap-[14px]">

View File

@ -23,15 +23,14 @@
required required
asterisk-position="end" asterisk-position="end"
:label="t('system.organization.organizationName')" :label="t('system.organization.organizationName')"
:rules="[{ required: true, message: t('system.organization.organizationNameRequired') }]" :rules="[
{ required: true, message: t('system.organization.organizationNameRequired') },
{ maxLength: 255, message: t('common.nameIsTooLang') },
]"
> >
<a-input <a-input v-model="form.name" :placeholder="t('system.organization.organizationNamePlaceholder')" />
v-model="form.name"
:max-length="255"
:placeholder="t('system.organization.organizationNamePlaceholder')"
/>
</a-form-item> </a-form-item>
<a-form-item field="name" :label="t('system.organization.organizationAdmin')"> <a-form-item field="userIds" :label="t('system.organization.organizationAdmin')">
<MsUserSelector <MsUserSelector
v-model="form.userIds" v-model="form.userIds"
placeholder="system.organization.organizationAdminPlaceholder" placeholder="system.organization.organizationAdminPlaceholder"

View File

@ -23,9 +23,12 @@
required required
asterisk-position="end" asterisk-position="end"
:label="t('system.project.name')" :label="t('system.project.name')"
:rules="[{ required: true, message: t('system.project.projectNameRequired') }]" :rules="[
{ required: true, message: t('system.project.projectNameRequired') },
{ maxLength: 255, message: t('common.nameIsTooLang') },
]"
> >
<a-input v-model="form.name" :max-length="255" :placeholder="t('system.project.projectNamePlaceholder')" /> <a-input v-model="form.name" :placeholder="t('system.project.projectNamePlaceholder')" />
</a-form-item> </a-form-item>
<a-form-item <a-form-item
required required
@ -83,7 +86,10 @@
<a-switch v-model="form.enable" size="small" type="line" /> <a-switch v-model="form.enable" size="small" type="line" />
<span>{{ t('system.organization.status') }}</span> <span>{{ t('system.organization.status') }}</span>
<a-tooltip :content="t('system.project.createTip')" position="top"> <a-tooltip :content="t('system.project.createTip')" position="top">
<MsIcon type="icon-icon-maybe_outlined" class="text-[var(--color-text-4)]" /> <MsIcon
type="icon-icon-maybe_outlined"
class="text-[var(--color-text-4)] hover:text-[rgb(var(--primary-5))]"
/>
</a-tooltip> </a-tooltip>
</div> </div>
<div class="flex flex-row gap-[14px]"> <div class="flex flex-row gap-[14px]">