7 changed files with 211 additions and 77 deletions
Unified View
Diff Options
-
15src/api/staff/department/index.ts
-
37src/api/staff/department/model.ts
-
2src/locales/lang/zh-CN/routes/staff.ts
-
2src/settings/projectSetting.ts
-
29src/views/staff/staff/data.ts
-
144src/views/staff/staff/index.vue
-
59src/views/staff/staff/modal1.vue
@ -1,20 +1,21 @@ |
|||||
import { defHttp } from '/@/utils/http/axios' |
import { defHttp } from '/@/utils/http/axios' |
||||
import { DepartmentModel, DepartmentPostModel } from '/@/api/staff/department/model' |
|
||||
|
|
||||
enum Api { |
enum Api { |
||||
GetOrganizationDepartment = '/uec/user/get/organization-department', |
|
||||
SaveOrganizationDepartment = '/uec/user/save/organization-department', |
|
||||
|
GetOrganizationDepartment = '/dating-agency-uec/user/list/organization-department', |
||||
|
SaveOrganizationDepartment = '/dating-agency-uec/user/create/organization-department', |
||||
} |
} |
||||
|
|
||||
/** |
/** |
||||
* 获取组织部门架构 |
* 获取组织部门架构 |
||||
*/ |
*/ |
||||
export const getOrganizationDepartment = () => |
|
||||
defHttp.get<DepartmentModel>({ url: Api.GetOrganizationDepartment }) |
|
||||
|
export const getOrganizationDepartment = (params: any) => defHttp.get<any>({ url: Api.GetOrganizationDepartment, params }) |
||||
|
|
||||
/** |
/** |
||||
* 用户修改组织部门信息 |
* 用户修改组织部门信息 |
||||
* @param params |
* @param params |
||||
*/ |
*/ |
||||
export const saveOrganizationDepartment = (params: DepartmentPostModel) => |
|
||||
defHttp.get<DepartmentModel>({ url: Api.SaveOrganizationDepartment, params }) |
|
||||
|
export const saveOrganizationDepartment = (params: any) => defHttp.post<any>({ url: Api.SaveOrganizationDepartment, params }) |
||||
|
|
||||
|
export const editOrganizationDepartment = (params: any) => defHttp.post<any>({ url: '/dating-agency-uec/user/edit/organization-department', params }) |
||||
|
|
||||
|
export const deleteOrganizationDepartment = (id: string) => defHttp.post<any>({ url: '/dating-agency-uec/user/delete/organization-department', params: {id} }) |
||||
@ -1,37 +0,0 @@ |
|||||
/** |
|
||||
* 组织部门接口模型 |
|
||||
*/ |
|
||||
export interface DepartmentModel { |
|
||||
childrenList: DepartmentModel[] |
|
||||
departmentName: string |
|
||||
departmentUserId: string |
|
||||
departmentUserName: string |
|
||||
id: string |
|
||||
level: number |
|
||||
organizationId: string |
|
||||
parentId: string |
|
||||
parentIds: string |
|
||||
organizationMemberList: OrganizationMemberModel[] |
|
||||
undistributedOrganizationMemberList: OrganizationMemberModel[] |
|
||||
} |
|
||||
|
|
||||
/** |
|
||||
* 组织成员接口模型 |
|
||||
*/ |
|
||||
export interface OrganizationMemberModel { |
|
||||
id: string |
|
||||
joinedTime: string |
|
||||
nickName: string |
|
||||
orgId: string |
|
||||
phone: string |
|
||||
realName: string |
|
||||
status: number |
|
||||
userId: string |
|
||||
} |
|
||||
|
|
||||
export interface DepartmentPostModel { |
|
||||
departmentName: string |
|
||||
departmentUserId: string |
|
||||
id: string |
|
||||
parentId: string |
|
||||
} |
|
||||
@ -1,7 +1,7 @@ |
|||||
export default { |
export default { |
||||
staff: '员工管理', |
staff: '员工管理', |
||||
auth: '权限管理', |
auth: '权限管理', |
||||
staffList: '员工列表', |
|
||||
|
staffList: '员工管理', |
||||
staffAudit: '员工审核', |
staffAudit: '员工审核', |
||||
department: '部门管理', |
department: '部门管理', |
||||
} |
} |
||||
@ -0,0 +1,59 @@ |
|||||
|
<template> |
||||
|
<BasicModal v-bind="$attrs" @ok="handleOk" @register="registerModal"> |
||||
|
<BasicForm @register="registerForm" /> |
||||
|
</BasicModal> |
||||
|
</template> |
||||
|
|
||||
|
<script setup lang="ts"> |
||||
|
import { ref, unref } from 'vue' |
||||
|
import { modalFormSchema1 } from './data' |
||||
|
import { useMessage } from '/@/hooks/web/useMessage' |
||||
|
import { BasicForm, useForm } from '/@/components/Form' |
||||
|
import { BasicModal, useModalInner } from '/@/components/Modal' |
||||
|
import { saveOrganizationDepartment, editOrganizationDepartment } from '/@/api/staff/department' |
||||
|
|
||||
|
const [registerForm, { setFieldsValue, updateSchema, resetFields, validate }] = useForm({ |
||||
|
labelWidth: 100, |
||||
|
schemas: modalFormSchema1, |
||||
|
baseColProps: { span: 22 }, |
||||
|
showActionButtonGroup: false, |
||||
|
}) |
||||
|
|
||||
|
const postModel = ref<any>({}) |
||||
|
const ifUpdate = ref<boolean>(false) |
||||
|
const [registerModal, { setModalProps }] = useModalInner(async (data) => { |
||||
|
await resetFields() |
||||
|
ifUpdate.value = !!data.ifUpdate |
||||
|
setModalProps({ |
||||
|
confirmLoading: false, |
||||
|
title: ifUpdate.value ? '编辑部门' : '添加部门', |
||||
|
}) |
||||
|
if (unref(ifUpdate)) { |
||||
|
await setFieldsValue({ ...data.item }) |
||||
|
} |
||||
|
const { id, parentId } = data.item || {} |
||||
|
postModel.value = { |
||||
|
id: ifUpdate.value ? id : null, |
||||
|
parentId: ifUpdate.value ? parentId : null, |
||||
|
} |
||||
|
// 编辑操作,不可修改所属部门名称 |
||||
|
await updateSchema({ field: 'departmentName', componentProps: { disabled: ifUpdate.value } }) |
||||
|
}) |
||||
|
|
||||
|
const { createMessage } = useMessage() |
||||
|
const emits = defineEmits(['success']) |
||||
|
async function handleOk() { |
||||
|
try { |
||||
|
const values = await validate() |
||||
|
const model = { ...values, ...postModel.value } |
||||
|
console.log('model.............', model) |
||||
|
setModalProps({ confirmLoading: true }) |
||||
|
const fun = unref(ifUpdate) ? editOrganizationDepartment : saveOrganizationDepartment |
||||
|
await fun(model) |
||||
|
createMessage.success(`${unref(ifUpdate) ? '编辑' : '新增'}成功!`) |
||||
|
emits('success') |
||||
|
} finally { |
||||
|
setModalProps({ confirmLoading: false }) |
||||
|
} |
||||
|
} |
||||
|
</script> |
||||
Write
Preview
Loading…
Cancel
Save