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 }));
}
}
if (value.length === 255) {
callback(t('common.nameIsTooLang'));
}
callback();
}
};

View File

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

View File

@ -12,7 +12,14 @@
<div v-else>
<div class="flex flex-row items-center">
<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') }}
</a-button>
<div

View File

@ -109,4 +109,6 @@ export default {
'common.batchMove': 'Batch move',
'common.batchMoveSuccess': 'Batch move 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.batchMoveSuccess': '批量移动成功',
'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>
<a-tooltip :content="t('project.menu.incrementalSyncTip')" position="top">
<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>
</a-tooltip>
</div>
@ -53,7 +56,10 @@
<span class="text-[var(--color-text-1)]">{{ t('project.menu.fullSync') }}</span>
<a-tooltip :content="t('project.menu.fullSyncTip')" position="bl">
<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>
</a-tooltip>
</div>
@ -102,7 +108,10 @@
</div>
</template>
<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>
</a-tooltip>
</div>

View File

@ -59,7 +59,10 @@
</div>
</template>
<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>
</a-tooltip>
</div>

View File

@ -3,7 +3,10 @@
<div class="text-[var(--color-text-1)]"> {{ t('project.menu.management') }}</div>
<a-tooltip :content="t('project.menu.manageTip')" position="bl">
<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>
</a-tooltip>
</div>
@ -113,7 +116,10 @@
position="right"
>
<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>
</a-tooltip>
</div>
@ -129,7 +135,10 @@
/>
<a-tooltip :content="t('project.menu.API_SCRIPT_REVIEWER_TIP')" position="right">
<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>
</a-tooltip>
</div>
@ -155,7 +164,10 @@
>
<a-tooltip :content="t('project.menu.API_ERROR_REPORT_RULE_TIP')" position="right">
<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>
</a-tooltip>
</div>
@ -195,7 +207,10 @@
position="right"
>
<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>
</a-tooltip>
</div>
@ -227,7 +242,10 @@
/>
<a-tooltip :content="t('project.menu.PERFORMANCE_TEST_SCRIPT_REVIEWER_TIP')" position="right">
<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>
</a-tooltip>
</div>

View File

@ -94,7 +94,10 @@
<a-form-item
field="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"
>
<a-input v-model="form.name" />

View File

@ -22,7 +22,10 @@
required
:label="t('system.project.name')"
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-form-item>
@ -80,7 +83,10 @@
<a-switch v-model="form.enable" size="small" type="line" />
<span>{{ t('system.organization.status') }}</span>
<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>
</div>
<div class="flex flex-row gap-[14px]">

View File

@ -23,15 +23,14 @@
required
asterisk-position="end"
: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
v-model="form.name"
:max-length="255"
:placeholder="t('system.organization.organizationNamePlaceholder')"
/>
<a-input v-model="form.name" :placeholder="t('system.organization.organizationNamePlaceholder')" />
</a-form-item>
<a-form-item field="name" :label="t('system.organization.organizationAdmin')">
<a-form-item field="userIds" :label="t('system.organization.organizationAdmin')">
<MsUserSelector
v-model="form.userIds"
placeholder="system.organization.organizationAdminPlaceholder"

View File

@ -23,9 +23,12 @@
required
asterisk-position="end"
: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
required
@ -83,7 +86,10 @@
<a-switch v-model="form.enable" size="small" type="line" />
<span>{{ t('system.organization.status') }}</span>
<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>
</div>
<div class="flex flex-row gap-[14px]">