diff --git a/src/views/staff/staff/data.ts b/src/views/staff/staff/data.ts index 5a0e52d..8d844ab 100644 --- a/src/views/staff/staff/data.ts +++ b/src/views/staff/staff/data.ts @@ -1,7 +1,6 @@ import { BasicColumn, FormSchema } from '/@/components/Table' import { ref } from 'vue' import { getRoleListByPage } from '/@/api/sys/menu'; -import { getOrganizationDepartment } from '/@/api/staff/department' export const tableColumns: BasicColumn[] = [ { title: '用户id', dataIndex: 'userId' }, @@ -42,6 +41,16 @@ export const modalFormSchema: FormSchema[] = [ field: 'realName', component: 'Input', }, + { + label: '所属部门', + required: true, + field: 'orgDepartmentId', + component: 'Select', + componentProps: { + valueField: 'id', + labelField: 'departmentName', + }, + }, { label: '角色', required: true, diff --git a/src/views/staff/staff/modal.vue b/src/views/staff/staff/modal.vue index a784510..be64c69 100644 --- a/src/views/staff/staff/modal.vue +++ b/src/views/staff/staff/modal.vue @@ -11,6 +11,7 @@ import { BasicForm, useForm } from '/@/components/Form' import { BasicModal, useModalInner } from '/@/components/Modal' import { createOrganizationMember, editOrganizationMember } from '/@/api/staff/staff' + import { getOrganizationDepartment } from '/@/api/staff/department' const [registerForm, { resetFields, setFieldsValue, validate, updateSchema }] = useForm({ labelWidth: 100, @@ -31,7 +32,19 @@ title: `${ifUpdate.value ? '编辑' : '添加'}员工`, confirmLoading: false, }) + const result = await getOrganizationDepartment({}) + const list = (result || []).map((item) => { + const { departmentName, id } = item + return { + value: id, + label: departmentName, + } + }) + const departmentList = ref([]) + departmentList.value.push(...list) + await updateSchema({ field: 'phone', componentProps: { disabled: !!ifUpdate.value } }) + await updateSchema({ field: 'orgDepartmentId', componentProps: { options: departmentList } }) if (!!ifUpdate.value) { await setFieldsValue({ ...record }) }