feat(system): 用户模块新增组织编码功能
- 在用户组件中新增 orgCodeOptions 数据选项 - 调用 fetchGetDictDataByCode 获取 'rdms_object_direction' 字典数据 - 将组织编码选项传递给用户组织操作对话框组件 - 在用户操作对话框中新增所属公司选择字段 - 修改组织操作对话框支持组织编码下拉选择功能 - 仅当组织类型为 'direction'(方向) 时显示编码下拉选项 - 更新国际化配置中组织类型 'direction' 的显示文本从 '条线' 改为 '方向'
This commit is contained in:
@@ -464,7 +464,7 @@ const local: App.I18n.Schema = {
|
||||
orgType: {
|
||||
company: '公司',
|
||||
dept: '部门',
|
||||
direction: '条线',
|
||||
direction: '方向',
|
||||
team: '团队'
|
||||
},
|
||||
gender: {
|
||||
|
||||
@@ -138,6 +138,7 @@ const editingUserId = ref<number | null>(null);
|
||||
const postOptions = ref<Api.SystemManage.PostSimple[]>([]);
|
||||
const roleOptions = ref<Api.SystemManage.RoleSimple[]>([]);
|
||||
const companyOptions = ref<any>([]);
|
||||
const orgCodeOptions = ref<any>([]);
|
||||
const resetPasswordVisible = ref(false);
|
||||
const resetPasswordUserId = ref<number | null>(null);
|
||||
const resetPasswordUsername = ref<string | null>(null);
|
||||
@@ -360,10 +361,11 @@ async function loadDeptTree() {
|
||||
}
|
||||
|
||||
async function loadFormOptions() {
|
||||
const [postResult, roleResult, companyResult] = await Promise.all([
|
||||
const [postResult, roleResult, companyResult, orgCodeResult] = await Promise.all([
|
||||
fetchGetPostSimpleList(),
|
||||
fetchGetRoleSimpleList(),
|
||||
fetchGetDictDataByCode('system_user_company')
|
||||
fetchGetDictDataByCode('system_user_company'),
|
||||
fetchGetDictDataByCode('rdms_object_direction')
|
||||
]);
|
||||
|
||||
if (!postResult.error) {
|
||||
@@ -377,6 +379,10 @@ async function loadFormOptions() {
|
||||
if (!companyResult.error) {
|
||||
companyOptions.value = companyResult.data;
|
||||
}
|
||||
|
||||
if (!orgCodeResult.error) {
|
||||
orgCodeOptions.value = orgCodeResult.data;
|
||||
}
|
||||
}
|
||||
|
||||
async function reloadUserTable(page = searchParams.pageNo) {
|
||||
@@ -753,6 +759,7 @@ onMounted(async () => {
|
||||
:row-data="editingDeptData"
|
||||
:parent-id="orgParentId"
|
||||
:dept-tree="deptTree"
|
||||
:org-code-options="orgCodeOptions"
|
||||
@submitted="handleDeptSubmitted"
|
||||
/>
|
||||
|
||||
|
||||
@@ -332,6 +332,13 @@ watch(visible, async value => {
|
||||
</ElSelect>
|
||||
</ElFormItem>
|
||||
</ElCol>
|
||||
<ElCol :span="12">
|
||||
<ElFormItem label="所属公司" prop="company">
|
||||
<ElSelect v-model="model.company" clearable filterable placeholder="请选择所属公司">
|
||||
<ElOption v-for="item in companyOptions" :key="item.value" :label="item.label" :value="item.value" />
|
||||
</ElSelect>
|
||||
</ElFormItem>
|
||||
</ElCol>
|
||||
<ElCol :span="12">
|
||||
<ElFormItem :label="$t('page.system.user.userRole')" prop="roleIds">
|
||||
<ElSelect
|
||||
|
||||
@@ -13,6 +13,7 @@ interface Props {
|
||||
rowData?: Api.SystemManage.Dept | null;
|
||||
parentId?: number | null;
|
||||
deptTree: Api.SystemManage.Dept[];
|
||||
orgCodeOptions: Api.Dict.DictData[];
|
||||
}
|
||||
|
||||
const props = defineProps<Props>();
|
||||
@@ -76,6 +77,11 @@ const parentTree = computed(() => {
|
||||
|
||||
const expandParentTree = computed(() => !isEdit.value && (props.parentId ?? 0) === 0);
|
||||
|
||||
// 只有组(direction)类型的组织才可以选择编码
|
||||
const isCodeSelectable = computed(() => {
|
||||
return model.value.orgType === 'direction';
|
||||
});
|
||||
|
||||
const rules = {
|
||||
name: createRequiredRule($t('page.system.user.form.orgName')),
|
||||
parentId: createRequiredRule($t('page.system.user.form.parentOrg')),
|
||||
@@ -222,7 +228,15 @@ watch(visible, async value => {
|
||||
</ElCol>
|
||||
<ElCol :span="12">
|
||||
<ElFormItem :label="$t('page.system.user.orgCode')" prop="code">
|
||||
<ElInput v-model="model.code" :placeholder="$t('page.system.user.form.orgCode')" />
|
||||
<ElSelect v-if="isCodeSelectable" v-model="model.code" clearable filterable placeholder="请选择组织编码">
|
||||
<ElOption
|
||||
v-for="item in props.orgCodeOptions"
|
||||
:key="item.value"
|
||||
:label="item.value"
|
||||
:value="item.value"
|
||||
/>
|
||||
</ElSelect>
|
||||
<ElInput v-else v-model="model.code" :placeholder="$t('page.system.user.form.orgCode')"/>
|
||||
</ElFormItem>
|
||||
</ElCol>
|
||||
<ElCol :span="12">
|
||||
|
||||
Reference in New Issue
Block a user