feat(系统设置): 系统创建组织管理员必填

This commit is contained in:
RubyLiu 2024-02-07 16:20:38 +08:00 committed by wxg0103
parent ed9b95eba1
commit d2778c0eb2
3 changed files with 12 additions and 7 deletions

View File

@ -34,7 +34,12 @@
> >
<a-input v-model="form.name" :placeholder="t('system.organization.organizationNamePlaceholder')" /> <a-input v-model="form.name" :placeholder="t('system.organization.organizationNamePlaceholder')" />
</a-form-item> </a-form-item>
<a-form-item field="userIds" :label="t('system.organization.organizationAdmin')"> <a-form-item
field="userIds"
asterisk-position="end"
:rules="[{ required: true, message: t('system.organization.organizationAdminRequired') }]"
:label="t('system.organization.organizationAdmin')"
>
<MsUserSelector <MsUserSelector
v-model="form.userIds" v-model="form.userIds"
placeholder="system.organization.organizationAdminPlaceholder" placeholder="system.organization.organizationAdminPlaceholder"
@ -73,6 +78,7 @@
import { createOrUpdateOrg } from '@/api/modules/setting/organizationAndProject'; import { createOrUpdateOrg } from '@/api/modules/setting/organizationAndProject';
import { useI18n } from '@/hooks/useI18n'; import { useI18n } from '@/hooks/useI18n';
import { useUserStore } from '@/store';
import { characterLimit } from '@/utils'; import { characterLimit } from '@/utils';
import { CreateOrUpdateSystemOrgParams } from '@/models/setting/system/orgAndProject'; import { CreateOrUpdateSystemOrgParams } from '@/models/setting/system/orgAndProject';
@ -81,13 +87,13 @@
const { t } = useI18n(); const { t } = useI18n();
const props = defineProps<{ const props = defineProps<{
visible: boolean;
currentOrganization?: CreateOrUpdateSystemOrgParams; currentOrganization?: CreateOrUpdateSystemOrgParams;
}>(); }>();
const formRef = ref<FormInstance>(); const formRef = ref<FormInstance>();
const loading = ref(false); const loading = ref(false);
const userStore = useUserStore();
const emit = defineEmits<{ const emit = defineEmits<{
(e: 'cancel', shouldSearch: boolean): void; (e: 'cancel', shouldSearch: boolean): void;
@ -95,15 +101,12 @@
const form = reactive<{ name: string; userIds: string[]; description: string }>({ const form = reactive<{ name: string; userIds: string[]; description: string }>({
name: '', name: '',
userIds: [], userIds: userStore.id ? [userStore.id] : [],
description: '', description: '',
}); });
const currentVisible = ref(props.visible); const currentVisible = defineModel<boolean>('visible', { default: false });
watchEffect(() => {
currentVisible.value = props.visible;
});
const handleCancel = (shouldSearch = false) => { const handleCancel = (shouldSearch = false) => {
emit('cancel', shouldSearch); emit('cancel', shouldSearch);
formRef.value?.resetFields(); formRef.value?.resetFields();

View File

@ -57,6 +57,7 @@ export default {
'system.organization.subordinateOrg': 'Subordinate organization', 'system.organization.subordinateOrg': 'Subordinate organization',
'system.organization.searchUserPlaceholder': 'Search by name/email/phone number', 'system.organization.searchUserPlaceholder': 'Search by name/email/phone number',
'system.organization.searchIndexPlaceholder': 'Search by name/id', 'system.organization.searchIndexPlaceholder': 'Search by name/id',
'system.organization.organizationAdminRequired': 'Organization administrator cannot be empty',
'system.project.enableTitle': 'Start project', 'system.project.enableTitle': 'Start project',
'system.project.endTitle': 'Close project', 'system.project.endTitle': 'Close project',
'system.project.enableContent': 'The project after opening is displayed in the organization switching list', 'system.project.enableContent': 'The project after opening is displayed in the organization switching list',

View File

@ -53,6 +53,7 @@ export default {
'system.organization.subordinateOrg': '所属组织', 'system.organization.subordinateOrg': '所属组织',
'system.organization.searchIndexPlaceholder': '通过ID或名称搜索', 'system.organization.searchIndexPlaceholder': '通过ID或名称搜索',
'system.organization.searchUserPlaceholder': '通过名称/邮箱/手机搜索', 'system.organization.searchUserPlaceholder': '通过名称/邮箱/手机搜索',
'system.organization.organizationAdminRequired': '组织管理员不能为空',
'system.project.enableTitle': '开启项目', 'system.project.enableTitle': '开启项目',
'system.project.endTitle': '结束项目', 'system.project.endTitle': '结束项目',
'system.project.enableContent': '开启后的项目展示在项目切换列表', 'system.project.enableContent': '开启后的项目展示在项目切换列表',