Browse Source

no message

master
xpz2018 9 months ago
parent
commit
74d89fd928
2 changed files with 23 additions and 1 deletions
  1. 11
      src/views/staff/staff/data.ts
  2. 13
      src/views/staff/staff/modal.vue

11
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,

13
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<any>([])
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 })
}

Loading…
Cancel
Save