From ca1756344c5254ada0e67364c96dd9a638bbbcea Mon Sep 17 00:00:00 2001 From: dk <1260500659@qq.com> Date: Tue, 21 Apr 2026 11:49:42 +0800 Subject: [PATCH] =?UTF-8?q?feat(system):=20=E7=94=A8=E6=88=B7=E6=A8=A1?= =?UTF-8?q?=E5=9D=97=E6=96=B0=E5=A2=9E=E7=BB=84=E7=BB=87=E7=BC=96=E7=A0=81?= =?UTF-8?q?=E5=8A=9F=E8=83=BD=20-=20=E5=9C=A8=E7=94=A8=E6=88=B7=E7=BB=84?= =?UTF-8?q?=E4=BB=B6=E4=B8=AD=E6=96=B0=E5=A2=9E=20orgCodeOptions=20?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E9=80=89=E9=A1=B9=20-=20=E8=B0=83=E7=94=A8?= =?UTF-8?q?=20fetchGetDictDataByCode=20=E8=8E=B7=E5=8F=96=20'rdms=5Fobject?= =?UTF-8?q?=5Fdirection'=20=E5=AD=97=E5=85=B8=E6=95=B0=E6=8D=AE=20-=20?= =?UTF-8?q?=E5=B0=86=E7=BB=84=E7=BB=87=E7=BC=96=E7=A0=81=E9=80=89=E9=A1=B9?= =?UTF-8?q?=E4=BC=A0=E9=80=92=E7=BB=99=E7=94=A8=E6=88=B7=E7=BB=84=E7=BB=87?= =?UTF-8?q?=E6=93=8D=E4=BD=9C=E5=AF=B9=E8=AF=9D=E6=A1=86=E7=BB=84=E4=BB=B6?= =?UTF-8?q?=20-=20=E5=9C=A8=E7=94=A8=E6=88=B7=E6=93=8D=E4=BD=9C=E5=AF=B9?= =?UTF-8?q?=E8=AF=9D=E6=A1=86=E4=B8=AD=E6=96=B0=E5=A2=9E=E6=89=80=E5=B1=9E?= =?UTF-8?q?=E5=85=AC=E5=8F=B8=E9=80=89=E6=8B=A9=E5=AD=97=E6=AE=B5=20-=20?= =?UTF-8?q?=E4=BF=AE=E6=94=B9=E7=BB=84=E7=BB=87=E6=93=8D=E4=BD=9C=E5=AF=B9?= =?UTF-8?q?=E8=AF=9D=E6=A1=86=E6=94=AF=E6=8C=81=E7=BB=84=E7=BB=87=E7=BC=96?= =?UTF-8?q?=E7=A0=81=E4=B8=8B=E6=8B=89=E9=80=89=E6=8B=A9=E5=8A=9F=E8=83=BD?= =?UTF-8?q?=20-=20=E4=BB=85=E5=BD=93=E7=BB=84=E7=BB=87=E7=B1=BB=E5=9E=8B?= =?UTF-8?q?=E4=B8=BA=20'direction'(=E6=96=B9=E5=90=91)=20=E6=97=B6?= =?UTF-8?q?=E6=98=BE=E7=A4=BA=E7=BC=96=E7=A0=81=E4=B8=8B=E6=8B=89=E9=80=89?= =?UTF-8?q?=E9=A1=B9=20-=20=E6=9B=B4=E6=96=B0=E5=9B=BD=E9=99=85=E5=8C=96?= =?UTF-8?q?=E9=85=8D=E7=BD=AE=E4=B8=AD=E7=BB=84=E7=BB=87=E7=B1=BB=E5=9E=8B?= =?UTF-8?q?=20'direction'=20=E7=9A=84=E6=98=BE=E7=A4=BA=E6=96=87=E6=9C=AC?= =?UTF-8?q?=E4=BB=8E=20'=E6=9D=A1=E7=BA=BF'=20=E6=94=B9=E4=B8=BA=20'?= =?UTF-8?q?=E6=96=B9=E5=90=91'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/locales/langs/zh-cn.ts | 2 +- src/views/system/user/index.vue | 11 ++++- .../user/modules/user-operate-dialog.vue | 7 +++ .../user/modules/user-org-operate-dialog.vue | 48 ++++++++++++------- 4 files changed, 48 insertions(+), 20 deletions(-) diff --git a/src/locales/langs/zh-cn.ts b/src/locales/langs/zh-cn.ts index a68e30b..067fcf2 100644 --- a/src/locales/langs/zh-cn.ts +++ b/src/locales/langs/zh-cn.ts @@ -464,7 +464,7 @@ const local: App.I18n.Schema = { orgType: { company: '公司', dept: '部门', - direction: '条线', + direction: '方向', team: '团队' }, gender: { diff --git a/src/views/system/user/index.vue b/src/views/system/user/index.vue index 3a94aa1..f94ba38 100644 --- a/src/views/system/user/index.vue +++ b/src/views/system/user/index.vue @@ -138,6 +138,7 @@ const editingUserId = ref(null); const postOptions = ref([]); const roleOptions = ref([]); const companyOptions = ref([]); +const orgCodeOptions = ref([]); const resetPasswordVisible = ref(false); const resetPasswordUserId = ref(null); const resetPasswordUsername = ref(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" /> diff --git a/src/views/system/user/modules/user-operate-dialog.vue b/src/views/system/user/modules/user-operate-dialog.vue index 5ee623c..5ea4c5f 100644 --- a/src/views/system/user/modules/user-operate-dialog.vue +++ b/src/views/system/user/modules/user-operate-dialog.vue @@ -332,6 +332,13 @@ watch(visible, async value => { + + + + + + + -import { computed, nextTick, ref, watch } from 'vue'; -import { commonStatusOptions } from '@/constants/business'; -import { fetchCreateDept, fetchUpdateDept } from '@/service/api'; -import { useForm, useFormRules } from '@/hooks/common/form'; +import {computed, nextTick, ref, watch} from 'vue'; +import {commonStatusOptions} from '@/constants/business'; +import {fetchCreateDept, fetchUpdateDept} from '@/service/api'; +import {useForm, useFormRules} from '@/hooks/common/form'; import BusinessFormDialog from '@/components/custom/business-form-dialog.vue'; -import { $t } from '@/locales'; +import {$t} from '@/locales'; -defineOptions({ name: 'UserOrgOperateDialog' }); +defineOptions({name: 'UserOrgOperateDialog'}); interface Props { operateType: UI.TableOperateType; rowData?: Api.SystemManage.Dept | null; parentId?: number | null; deptTree: Api.SystemManage.Dept[]; + orgCodeOptions: Api.Dict.DictData[]; } const props = defineProps(); @@ -27,8 +28,8 @@ const visible = defineModel('visible', { default: false }); -const { formRef, validate } = useForm(); -const { createRequiredRule } = useFormRules(); +const {formRef, validate} = useForm(); +const {createRequiredRule} = useFormRules(); const submitting = ref(false); @@ -43,10 +44,10 @@ const title = computed(() => { }); const orgTypeOptions: CommonType.Option[] = [ - { value: 'company', label: 'page.system.user.orgType.company' }, - { value: 'dept', label: 'page.system.user.orgType.dept' }, - { value: 'direction', label: 'page.system.user.orgType.direction' }, - { value: 'team', label: 'page.system.user.orgType.team' } + {value: 'company', label: 'page.system.user.orgType.company'}, + {value: 'dept', label: 'page.system.user.orgType.dept'}, + {value: 'direction', label: 'page.system.user.orgType.direction'}, + {value: 'team', label: 'page.system.user.orgType.team'} ]; type Model = Api.SystemManage.SaveDeptParams; @@ -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')), @@ -143,7 +149,7 @@ async function handleSubmit() { } as Api.SystemManage.SaveDeptParams; if (isEdit.value && props.rowData) { - const { error } = await fetchUpdateDept({ + const {error} = await fetchUpdateDept({ id: props.rowData.id, ...payload }); @@ -160,7 +166,7 @@ async function handleSubmit() { return; } - const { error, data } = await fetchCreateDept(payload); + const {error, data} = await fetchCreateDept(payload); submitting.value = false; @@ -197,7 +203,7 @@ watch(visible, async value => { - + @@ -216,13 +222,21 @@ watch(visible, async value => { - + - + + + +