Commit 2143410b authored by 刘斌's avatar 刘斌

feat: 增加人员变动分析及问题修复

parent 21d2c6b4
......@@ -21,7 +21,7 @@ export const ContentTypeEnum = {
export function commonExport(url: string, data: Record<string, any>) {
return requestClient.post<Blob>(url, data, {
data,
// headers: { 'Content-Type': ContentTypeEnum.FORM_URLENCODED },
headers: { 'Content-Type': ContentTypeEnum.FORM_URLENCODED },
// transformResponse: false,
responseReturn: 'body',
responseType: 'blob',
......
import type { BaseModel, PageQuery } from '#/api/baseModel';
import { commonExport } from '#/api/helper';
import { requestClient } from '#/api/request';
export namespace ChangeAnalysisApi {
export interface ChangeAnalysis extends BaseModel {
/**
* 板块
*/
plate?: string;
/**
* 板块ID
*/
plateId?: number;
/**
* 期初人数
*/
beginningCount?: number;
/**
* 入职人数
*/
entryCount?: number;
/**
* 转正人数
*/
regularCount?: number;
/**
* 转入
*/
transferIn?: number;
/**
* 转出
*/
transferOut?: number;
/**
* 试用期内
*/
probationPeriod?: number;
/**
* 入职3年内
*/
within3Years?: number;
/**
* 入职3年以上
*/
over3Years?: number;
/**
* 被动离职
*/
passiveResignation?: number;
/**
* 总离职
*/
totalResignation?: number;
/**
* 期末人数
*/
endingCount?: number;
/**
* 试用期内离职率
*/
probationResignationRate?: number;
/**
* 入职3年内离职率
*/
within3YearsResignationRate?: number;
/**
* 入职3年以上离职率
*/
over3YearsResignationRate?: number;
/**
* 被动离职率
*/
passiveResignationRate?: number;
/**
* 总离职率
*/
totalResignationRate?: number;
}
}
/**
* 查询人员变化分析列表
* @param params
* @returns {*} page
*/
export function apiPage(params: PageQuery) {
return requestClient.get('/employee/changeAnalysis/page', { params });
}
// /**
// * 查询人员变化分析详细
// * @param id
// */
// export function apiDetail(id: number) {
// return requestClient.get(`/hr/changeAnalysis/${id}`);
// }
// /**
// * 新增人员变化分析
// * @param data
// */
// export function apiAdd(data: ChangeAnalysisApi.ChangeAnalysis) {
// return requestClient.post('/hr/changeAnalysis', data);
// }
// /**
// * 修改人员变化分析
// * @param data
// */
// export function apiUpdate(data: ChangeAnalysisApi.ChangeAnalysis) {
// return requestClient.put('/hr/changeAnalysis', data);
// }
// /**
// * 删除人员变化分析
// * @param id
// */
// export function apiDelete(id: Array<number> | number) {
// return requestClient.delete(`/hr/changeAnalysis/${id}`);
// }
/**
* 导出人员变化分析
* @param params
*/
export function apiExport(params: PageQuery) {
return commonExport('/employee/changeAnalysis/export', params);
}
import type { BaseModel, PageQuery } from '#/api/baseModel';
import { commonExport } from '#/api/helper';
import { requestClient } from '#/api/request';
export namespace ChangeLogApi {
export interface ChangeLog extends BaseModel {
/**
* 异动类型
*/
type?: string;
typeName?: string;
/**
* 流程申请编号
*/
applyCode?: string;
/**
* 板块ID
*/
plateId?: number;
/**
* 板块
*/
plate?: string;
/**
* 部门ID
*/
deptId?: number;
/**
* 员工ID
*/
employeeId?: number;
/**
* 异动时间
*/
changeDate?: string;
/**
* 离职类型
*/
resignType?: string;
resignTypeName?: string;
/**
* 离职工龄类型
*/
resignYearsOfServiceType?: string;
resignYearsOfServiceTypeName?: string;
}
}
/**
* 查询员工异动记录列表
* @param params
* @returns {*} page
*/
export function apiPage(params: PageQuery) {
return requestClient.get('/employee/changeLog/page', { params });
}
/**
* 查询员工异动记录详细
* @param id
*/
export function apiDetail(id: number) {
return requestClient.get(`/employee/changeLog/${id}`);
}
/**
* 新增员工异动记录
* @param data
*/
export function apiAdd(data: ChangeLogApi.ChangeLog) {
return requestClient.post('/employee/changeLog', data);
}
// /**
// * 修改员工异动记录
// * @param data
// */
// export function apiUpdate(data: ChangeLogApi.ChangeLog) {
// return requestClient.put('/employee/changeLog', data);
// }
// /**
// * 删除员工异动记录
// * @param id
// */
// export function apiDelete(id: Array<number> | number) {
// return requestClient.delete(`/employee/changeLog/${id}`);
// }
/**
* 导出员工异动记录
* @param params
*/
export function apiExport(params: PageQuery) {
return commonExport('/employee/changeLog/export', params);
}
......@@ -68,28 +68,36 @@ export function apiExport(id: number) {
* @param data
*/
export function applyEntry(data: EmployeeInfoApi.EmployeeApplyBo) {
return requestClient.post('/employee/info/applyEntry', data);
return requestClient.post('/employee/info/applyEntry', data, {
successMessageMode: 'message',
});
}
/**
* 申请员工离职
* @param data
*/
export function applyResign(data: EmployeeInfoApi.EmployeeResignApplyBo) {
return requestClient.post('/employee/info/applyResign', data);
return requestClient.post('/employee/info/applyResign', data, {
successMessageMode: 'message',
});
}
/**
* 申请员工调职
* @param id
*/
export function applyTransfer(data: EmployeeInfoApi.EmployeeTransferApplyBo) {
return requestClient.post('/employee/info/applyTransfer', data);
return requestClient.post('/employee/info/applyTransfer', data, {
successMessageMode: 'message',
});
}
/**
* 申请员工入职
* @param data
*/
export function applyRegular(data: EmployeeInfoApi.EmployeeRegularApplyBo) {
return requestClient.post('/employee/info/applyRegular', data);
return requestClient.post('/employee/info/applyRegular', data, {
successMessageMode: 'message',
});
}
/**
* 申请员工入职
......@@ -98,7 +106,9 @@ export function applyRegular(data: EmployeeInfoApi.EmployeeRegularApplyBo) {
export function applyRenewalContract(
data: EmployeeInfoApi.EmployeeRenewalContractApplyBo,
) {
return requestClient.post('/employee/info/applyRenewalContract', data);
return requestClient.post('/employee/info/applyRenewalContract', data, {
successMessageMode: 'message',
});
}
/**
......
......@@ -43,11 +43,11 @@ export function ossList(params?: PageQuery) {
/**
* 查询文件信息 返回为数组
* @param ossIds id数组
* @param ossIds id数组`
* @returns 信息数组
*/
export function ossInfo(ossIds: ID | IDS) {
return requestClient.get(`/system/oss/${ossIds}`);
return requestClient.get(`/system/oss/listByIds/${ossIds}`);
}
/**
......
......@@ -73,6 +73,42 @@ const routes: RouteRecordRaw[] = [
componentPath: '#/views/hr/contractExpirationReminder/list.vue',
},
},
{
path: '/hr/changeLog/list',
name: 'EmployeeChangeLogList',
component: () => import('#/views/hr/changeLog/list.vue'),
meta: {
title: '员工变动记录',
icon: 'solar:monitor-smartphone-outline',
keepAlive: true,
permission: ['dashboard'],
componentPath: '#/views/hr/changeLog/list.vue',
},
},
{
path: '/hr/report',
name: 'HrReport',
meta: {
title: '报表',
keepAlive: true,
icon: 'material-symbols:logo-dev-outline',
permission: ['dashboard'],
},
children: [
{
path: '/hr/report/changeAnalysis',
name: 'EmployeeChangeAnalysisList',
component: () => import('#/views/hr/changeAnalysis/list.vue'),
meta: {
title: '人员变化分析',
icon: 'arcticons:one-hand-operation',
keepAlive: true,
permission: ['dashboard'],
componentPath: '#/views/hr/changeAnalysis/list.vue',
},
},
],
},
{
name: 'EmployeeFlowList',
path: '/hr/employee/flow',
......
......@@ -103,6 +103,7 @@ const formSchema: VbenFormSchema[] = [
}),
fieldName: 'deptId',
label: '部门',
rules: 'selectRequired',
},
{
component: 'Input',
......
import type { VbenFormSchema } from '#/adapter/form';
import type { VxeTableGridOptions } from '#/adapter/vxe-table';
import type { ChangeAnalysisApi } from '#/api/hr/changeAnalysis';
import dayjs from 'dayjs';
export const querySchema: VbenFormSchema[] = [
// {
// component: 'Input',
// fieldName: 'plate',
// label: '板块',
// },
// {
// component: 'Input',
// fieldName: 'plateId',
// label: '板块ID',
// },
{
component: 'RangePicker',
fieldName: 'entryDate',
defaultValue: [dayjs().subtract(1, 'months'), dayjs()],
label: '统计时间',
},
// {
// component: 'Input',
// fieldName: 'beginningCount',
// label: '期初人数',
// },
// {
// component: 'Input',
// fieldName: 'entryCount',
// label: '入职人数',
// },
// {
// component: 'Input',
// fieldName: 'regularCount',
// label: '转正人数',
// },
// {
// component: 'Input',
// fieldName: 'transferIn',
// label: '转入',
// },
// {
// component: 'Input',
// fieldName: 'transferOut',
// label: '转出',
// },
// {
// component: 'Input',
// fieldName: 'probationPeriod',
// label: '试用期内',
// },
// {
// component: 'Input',
// fieldName: 'within3Years',
// label: '入职3年内',
// },
// {
// component: 'Input',
// fieldName: 'over3Years',
// label: '入职3年以上',
// },
// {
// component: 'Input',
// fieldName: 'passiveResignation',
// label: '被动离职',
// },
// {
// component: 'Input',
// fieldName: 'totalResignation',
// label: '总离职',
// },
// {
// component: 'Input',
// fieldName: 'endingCount',
// label: '期末人数',
// },
// {
// component: 'Input',
// fieldName: 'probationResignationRate',
// label: '试用期内离职率',
// },
// {
// component: 'Input',
// fieldName: 'within3YearsResignationRate',
// label: '入职3年内离职率',
// },
// {
// component: 'Input',
// fieldName: 'over3YearsResignationRate',
// label: '入职3年以上离职率',
// },
// {
// component: 'Input',
// fieldName: 'passiveResignationRate',
// label: '被动离职率',
// },
// {
// component: 'Input',
// fieldName: 'totalResignationRate',
// label: '总离职率',
// },
];
export function useColumns(): VxeTableGridOptions<ChangeAnalysisApi.ChangeAnalysis>['columns'] {
return [
{
title: '公司',
field: 'plate',
},
// {
// title: '板块ID',
// field: 'plateId',
// },
{
title: '期初人数',
field: 'beginningCount',
},
{
title: '入职人数',
field: 'entryCount',
},
{
title: '转正人数',
field: 'regularCount',
},
{
title: '异动人数',
headerAlign: 'center',
children: [
{
title: '调入',
field: 'transferIn',
},
{
title: '调出',
field: 'transferOut',
},
],
},
{
title: '月离职人数',
headerAlign: 'center',
children: [
{
title: '主动离职',
headerAlign: 'center',
children: [
{
title: '试用期内(6个月)',
field: 'probationPeriod',
},
{
title: '入职3年内',
field: 'within3Years',
},
{
title: '入职3年以上',
field: 'over3Years',
},
],
},
{
title: '被动离职',
field: 'passiveResignation',
},
{
title: '总离职',
field: 'totalResignation',
},
],
},
{
title: '期末人数',
field: 'endingCount',
},
{
title: '月离职率',
headerAlign: 'center',
children: [
{
title: '主动离职率',
headerAlign: 'center',
children: [
{
title: '试用期内离职率',
field: 'probationResignationRate',
},
{
title: '入职3年内离职率',
field: 'within3YearsResignationRate',
},
{
title: '入职3年以上离职率',
field: 'over3YearsResignationRate',
},
],
},
{
title: '被动离职率',
field: 'passiveResignationRate',
},
{
title: '总离职率',
field: 'totalResignationRate',
},
],
},
// {
// align: 'right',
// slots: { default: 'action' },
// cellRender: {
// attrs: {
// nameField: 'name',
// nameTitle: '人员变化分析',
// onClick: onActionClick,
// },
// name: 'CellOperation',
// options: [
// {
// code: 'edit',
// accessCode: ['hr:changeAnalysis:edit'],
// }, // 默认的编辑按钮
// {
// code: 'delete',
// accessCode: ['hr:changeAnalysis:remove'],
// }, // 默认的删除按钮
// ],
// },
// field: 'action',
// fixed: 'right',
// headerAlign: 'center',
// resizable: false,
// showOverflow: false,
// title: '操作',
// width: 'auto',
// },
];
}
<script lang="ts" setup>
import type { VbenFormProps } from '@vben/common-ui';
import type { VxeTableGridOptions } from '#/adapter/vxe-table';
import { Page } from '@vben/common-ui';
import { ExportOutlined } from '@ant-design/icons-vue';
import { Button, Space } from 'ant-design-vue';
import { useVbenVxeGrid } from '#/adapter/vxe-table';
import { apiExport, apiPage } from '#/api/hr/changeAnalysis';
import { commonDownloadExcel } from '#/utils/file/download';
import { querySchema, useColumns } from './data';
// import Form from './form.vue';
const formOptions: VbenFormProps = {
commonConfig: {
labelWidth: 80,
componentProps: {
allowClear: true,
},
},
schema: querySchema,
wrapperClass: 'grid-cols-2',
// wrapperClass: 'grid-cols-1 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4',
// 日期选择格式化
fieldMappingTime: [
[
'entryDate',
['beginTime', 'endTime'],
['YYYY-MM-DD 00:00:00', 'YYYY-MM-DD 23:59:59'],
],
],
};
// const [FormDrawer, formDrawerApi] = useVbenDrawer({
// connectedComponent: Form,
// });
const [Grid, gridApi] = useVbenVxeGrid({
formOptions,
gridOptions: {
columns: useColumns(),
height: 'auto',
keepSource: true,
pagerConfig: {
enabled: false,
},
proxyConfig: {
ajax: {
query: async ({ page }, formValues = {}) => {
// console.log('[formValues]', formValues);
return await apiPage({
pageNo: page.currentPage,
pageSize: page.pageSize,
...formValues,
});
},
},
},
border: true,
columnConfig: {
resizable: false,
},
showCustomHeader: true,
mergeHeaderCells: [
{ row: 0, col: 0, rowspan: 3, colspan: 1 },
{ row: 0, col: 1, rowspan: 3, colspan: 1 },
{ row: 0, col: 2, rowspan: 3, colspan: 1 },
{ row: 0, col: 3, rowspan: 3, colspan: 1 },
{ row: 0, col: 4, rowspan: 2, colspan: 2 },
{ row: 2, col: 4, rowspan: 1, colspan: 1 },
{ row: 2, col: 5, rowspan: 1, colspan: 1 },
{ row: 0, col: 6, rowspan: 1, colspan: 5 },
{ row: 1, col: 6, rowspan: 1, colspan: 3 },
{ row: 2, col: 6, rowspan: 1, colspan: 1 },
{ row: 2, col: 7, rowspan: 1, colspan: 1 },
{ row: 2, col: 8, rowspan: 1, colspan: 1 },
{ row: 1, col: 9, rowspan: 2, colspan: 1 },
{ row: 1, col: 10, rowspan: 2, colspan: 1 },
{ row: 0, col: 11, rowspan: 3, colspan: 1 },
{ row: 0, col: 12, rowspan: 1, colspan: 5 },
{ row: 1, col: 12, rowspan: 1, colspan: 3 },
{ row: 1, col: 15, rowspan: 2, colspan: 1 },
{ row: 1, col: 16, rowspan: 2, colspan: 1 },
],
rowConfig: {
keyField: 'id',
// 高亮当前行
isCurrent: true,
},
} as VxeTableGridOptions,
});
// function onActionClick({ code, row }: OnActionClickParams<ChangeAnalysisApi.ChangeAnalysis>) {
// switch (code) {
// case 'delete': {
// onDelete(row);
// break;
// }
// case 'edit': {
// onEdit(row);
// break;
// }
// default: {
// break;
// }
// }
// }
// function onRefresh() {
// gridApi.query();
// }
// function onEdit(row: ChangeAnalysisApi.ChangeAnalysis) {
// formDrawerApi.setData(row).open();
// }
// function onCreate() {
// formDrawerApi.setData({}).open();
// }
// function onDelete(row: ChangeAnalysisApi.ChangeAnalysis) {
// const hideLoading = message.loading({
// content: `正在删除${row.name}...`,
// duration: 0,
// key: 'action_process_msg',
// });
// apiDelete(row.id || 0)
// .then(() => {
// message.success({
// content: `${row.name}删除成功`,
// key: 'action_process_msg',
// });
// onRefresh();
// })
// .catch(() => {
// hideLoading();
// });
// }
async function handleDownloadExcel() {
const values = await gridApi.formApi.getValues();
commonDownloadExcel(apiExport, '人员变化分析', values);
}
</script>
<template>
<Page auto-content-height>
<!-- <FormDrawer @success="onRefresh" /> -->
<Grid table-title="人员变化分析列表">
<template #toolbar-tools>
<Space>
<Button
v-access:code="['employee:changeAnalysis:export']"
@click="handleDownloadExcel"
>
<template #icon>
<ExportOutlined />
</template>
导出
</Button>
<!-- <Button
v-access:code="['hr:changeAnalysis:add']"
type="primary"
@click="onCreate"
>
<Plus class="size-5" />
新增
</Button> -->
</Space>
</template>
</Grid>
</Page>
</template>
import type { VbenFormSchema } from '#/adapter/form';
import type { VxeTableGridOptions } from '#/adapter/vxe-table';
import type { ChangeLogApi } from '#/api/hr/changeLog';
import { getDictOptions, getTagDicts } from '#/utils/dict';
import { HrDictEnum } from '../dict-enum';
export const querySchema: VbenFormSchema[] = [
{
component: 'Select',
componentProps: {
options: getDictOptions(HrDictEnum.HR_CHANGE_LOG_TYPE),
},
fieldName: 'type',
label: '变动类型',
},
{
component: 'Input',
fieldName: 'applyCode',
label: '流程申请编号',
},
// {
// component: 'Input',
// fieldName: 'plateId',
// label: '板块ID',
// },
{
component: 'Input',
fieldName: 'plate',
label: '板块',
},
// {
// component: 'Input',
// fieldName: 'deptId',
// label: '部门ID',
// },
// {
// component: 'Input',
// fieldName: 'employeeId',
// label: '员工ID',
// },
{
component: 'DatePicker',
fieldName: 'changeDate',
label: '变动时间',
},
{
component: 'Select',
componentProps: {
options: getDictOptions(HrDictEnum.HR_RESIGNATION_TYPE),
},
fieldName: 'resignType',
label: '离职类型',
},
{
component: 'Select',
componentProps: {
options: getDictOptions(HrDictEnum.HR_RESIGN_YEARS_OF_SERVICE_TYPE),
},
fieldName: 'resignYearsOfServiceType',
label: '离职工龄类型',
},
];
export function useColumns(): VxeTableGridOptions<ChangeLogApi.ChangeLog>['columns'] {
return [
{
title: '变动类型',
field: 'type',
cellRender: {
name: 'CellTag',
options: [getTagDicts(HrDictEnum.HR_CHANGE_LOG_TYPE)],
},
},
{
title: '流程申请编号',
field: 'applyCode',
},
// {
// title: '板块ID',
// field: 'plateId',
// },
{
title: '板块',
field: 'plate',
},
{
title: '部门ID',
field: 'deptId',
},
{
title: '员工ID',
field: 'employeeId',
},
{
title: '变动时间',
field: 'changeDate',
formatter: 'formatDateTime',
},
{
title: '离职类型',
field: 'resignType',
cellRender: {
name: 'CellTag',
options: [getTagDicts(HrDictEnum.HR_RESIGNATION_TYPE)],
},
},
{
title: '离职工龄类型',
field: 'resignYearsOfServiceType',
cellRender: {
name: 'CellTag',
options: [getTagDicts(HrDictEnum.HR_RESIGN_YEARS_OF_SERVICE_TYPE)],
},
},
{
align: 'right',
slots: { default: 'action' },
// cellRender: {
// attrs: {
// nameField: 'name',
// nameTitle: '员工变动记录',
// onClick: onActionClick,
// },
// name: 'CellOperation',
// options: [
// {
// code: 'edit',
// accessCode: ['employee:changeLog:edit'],
// }, // 默认的编辑按钮
// {
// code: 'delete',
// accessCode: ['employee:changeLog:remove'],
// }, // 默认的删除按钮
// ],
// },
field: 'action',
fixed: 'right',
headerAlign: 'center',
resizable: false,
showOverflow: false,
title: '操作',
width: 'auto',
},
];
}
<script lang="ts" setup>
import type { ChangeLogApi } from '#/api/hr/changeLog';
import { shallowRef } from 'vue';
import { useVbenDrawer } from '@vben/common-ui';
import { Descriptions, DescriptionsItem } from 'ant-design-vue';
// import { useVbenForm, z } from '#/adapter/form';
// const emit = defineEmits<{
// success: [];
// }>();
// const isUpdate = ref(false);
const currentLog = shallowRef<ChangeLogApi.ChangeLog | null>(null);
// const formSchema: VbenFormSchema[] = [
// {
// component: 'Input',
// dependencies: {
// show: () => false,
// triggerFields: [''],
// },
// fieldName: 'id',
// label: 'id',
// },
// {
// component: 'Select',
// componentProps: {
// getVxePopupContainer,
// options: getDictOptions(DictEnum.HR_CHANGE_LOG_TYPE),
// },
// fieldName: 'type',
// label: '变动类型',
// rules: 'selectRequired',
// },
// {
// component: 'Input',
// fieldName: 'applyCode',
// label: '流程申请编号',
// rules: 'required',
// },
// {
// component: 'Input',
// fieldName: 'plateId',
// label: '板块ID',
// rules: 'required',
// },
// {
// component: 'Input',
// fieldName: 'plate',
// label: '板块',
// rules: 'required',
// },
// {
// component: 'Input',
// fieldName: 'deptId',
// label: '部门ID',
// rules: 'required',
// },
// {
// component: 'Input',
// fieldName: 'employeeId',
// label: '员工ID',
// rules: 'required',
// },
// {
// component: 'DatePicker',
// fieldName: 'changeDate',
// label: '变动时间',
// rules: 'required',
// },
// {
// component: 'Select',
// componentProps: {
// getVxePopupContainer,
// options: getDictOptions(DictEnum.HR_RESIGNATION_TYPE),
// },
// fieldName: 'resignType',
// label: '离职类型',
// rules: 'selectRequired',
// },
// {
// component: 'Select',
// componentProps: {
// getVxePopupContainer,
// options: getDictOptions(DictEnum.HR_RESIGN_YEARS_OF_SERVICE_TYPE),
// },
// fieldName: 'resignYearsOfServiceType',
// label: '离职工龄类型',
// rules: 'selectRequired',
// },
// ];
// const [BasicForm, formApi] = useVbenForm({
// commonConfig: {
// componentProps: {
// class: 'w-full',
// },
// formItemClass: 'col-span-2',
// labelWidth: 90,
// },
// schema: formSchema,
// showDefaultActions: false,
// wrapperClass: 'grid-cols-2',
// });
// const { onBeforeClose, markInitialized, resetInitialized } = useBeforeCloseDiff(
// {
// initializedGetter: defaultFormValueGetter(formApi),
// currentGetter: defaultFormValueGetter(formApi),
// },
// );
const [Drawer, drawerApi] = useVbenDrawer({
// onBeforeClose,
// onClosed: handleClosed,
// onConfirm: onSubmit,
onClosed() {
currentLog.value = null;
},
async onOpenChange(isOpen) {
if (!isOpen) {
return null;
}
const data = drawerApi.getData() as ChangeLogApi.ChangeLog;
currentLog.value = data;
},
});
// async function onSubmit() {
// const { valid } = await formApi.validate();
// if (valid) {
// drawerApi.lock();
// const data = await formApi.getValues<ChangeLogApi.ChangeLog>();
// try {
// await (isUpdate.value ? apiUpdate(data) : apiAdd(data));
// resetInitialized();
// emit('success');
// drawerApi.close();
// } finally {
// drawerApi.unlock();
// }
// }
// }
// async function handleClosed() {
// await formApi.resetForm();
// resetInitialized();
// }
// const getDrawerTitle = computed(() =>
// isUpdate.value ? '修改员工变动记录' : '新增员工变动记录',
// );
</script>
<template>
<Drawer :footer="false" class="w-[600px]" title="查看变动日志">
<Descriptions v-if="currentLog" size="small" bordered :column="1">
<DescriptionsItem label="变动类型">
{{ currentLog.typeName }}
</DescriptionsItem>
<DescriptionsItem label="流程申请编号">
{{ currentLog.applyCode }}
</DescriptionsItem>
<DescriptionsItem label="板块">
{{ currentLog.plate }}
</DescriptionsItem>
<DescriptionsItem label="变动时间">
{{ currentLog.changeDate }}
</DescriptionsItem>
<DescriptionsItem label="离职类型">
{{ currentLog.resignType }}
</DescriptionsItem>
<DescriptionsItem label="离职工龄类型">
{{ currentLog.resignYearsOfServiceType }}
</DescriptionsItem>
</Descriptions>
</Drawer>
</template>
<script lang="ts" setup>
import type { VbenFormProps } from '@vben/common-ui';
import type { VxeTableGridOptions } from '#/adapter/vxe-table';
import type { ChangeLogApi } from '#/api/hr/changeLog';
import { Page, useVbenDrawer } from '@vben/common-ui';
import { Button, Space } from 'ant-design-vue';
import { useVbenVxeGrid } from '#/adapter/vxe-table';
import { apiExport, apiPage } from '#/api/hr/changeLog';
import { GhostButton } from '#/components/global/button';
import { commonDownloadExcel } from '#/utils/file/download';
import { querySchema, useColumns } from './data';
import Form from './form.vue';
const formOptions: VbenFormProps = {
commonConfig: {
labelWidth: 80,
componentProps: {
allowClear: true,
},
},
schema: querySchema,
wrapperClass: 'grid-cols-1 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4',
};
const [FormDrawer, formDrawerApi] = useVbenDrawer({
connectedComponent: Form,
});
const [Grid, gridApi] = useVbenVxeGrid({
formOptions,
gridOptions: {
columns: useColumns(),
height: 'auto',
keepSource: true,
pagerConfig: {
enabled: true,
},
proxyConfig: {
ajax: {
query: async ({ page }, formValues = {}) => {
return await apiPage({
pageNo: page.currentPage,
pageSize: page.pageSize,
...formValues,
});
},
},
},
rowConfig: {
keyField: 'id',
// 高亮当前行
isCurrent: true,
},
} as VxeTableGridOptions,
});
// function onActionClick({ code, row }: OnActionClickParams<ChangeLogApi.ChangeLog>) {
// switch (code) {
// case 'delete': {
// onDelete(row);
// break;
// }
// case 'edit': {
// onEdit(row);
// break;
// }
// default: {
// break;
// }
// }
// }
function onRefresh() {
gridApi.query();
}
function onEdit(row: ChangeLogApi.ChangeLog) {
formDrawerApi.setData(row).open();
}
// function onCreate() {
// formDrawerApi.setData({}).open();
// }
// function onDelete(row: ChangeLogApi.ChangeLog) {
// const hideLoading = message.loading({
// content: `正在删除${row.name}...`,
// duration: 0,
// key: 'action_process_msg',
// });
// apiDelete(row.id || 0)
// .then(() => {
// message.success({
// content: `${row.name}删除成功`,
// key: 'action_process_msg',
// });
// onRefresh();
// })
// .catch(() => {
// hideLoading();
// });
// }
function handleDownloadExcel() {
commonDownloadExcel(apiExport, '员工变动记录', gridApi.formApi.form.values);
}
</script>
<template>
<Page auto-content-height>
<FormDrawer @success="onRefresh" />
<Grid table-title="员工变动记录列表">
<template #toolbar-tools>
<Space>
<Button
v-access:code="['employee:changeLog:export']"
@click="handleDownloadExcel"
>
导出
</Button>
<!-- <Button
v-access:code="['employee:changeLog:add']"
type="primary"
@click="onCreate"
>
<Plus class="size-5" />
新增
</Button> -->
</Space>
</template>
<template #action="{ row }">
<!-- 租户管理员不可修改admin角色 防止误操作 -->
<!-- 超级管理员可通过租户切换来操作租户管理员角色 -->
<!-- -->
<!-- <template
v-if="!row.superAdmin && (row.roleKey !== 'admin' || isSuperAdmin)"
> -->
<Space>
<GhostButton
v-access:code="['employee:changeLog:query']"
@click.stop="onEdit(row)"
>
查看
</GhostButton>
<!-- <GhostButton
danger
v-access:code="['employee:info:regular']"
@click.stop="onApplyRegular(row)"
>
申请转正
</GhostButton> -->
</Space>
<!-- </template> -->
</template>
</Grid>
</Page>
</template>
......@@ -8,6 +8,7 @@ import { ref } from 'vue';
import { Page, useVbenDrawer, useVbenModal } from '@vben/common-ui';
import { ExportOutlined } from '@ant-design/icons-vue';
import { Button, Space } from 'ant-design-vue';
import { useVbenVxeGrid } from '#/adapter/vxe-table';
......@@ -179,6 +180,9 @@ function handleDownloadExcel() {
v-access:code="['employee:contractExpiration:export']"
@click="handleDownloadExcel"
>
<template #icon>
<ExportOutlined />
</template>
导出
</Button>
<!-- <Button
......
......@@ -7,12 +7,14 @@ export const HrDictEnum = {
HR_EDUCATION: 'hr_education', // 通知状态
HR_EMPLOYEE_TYPE: 'hr_employee_type', // 通知类型
HR_EMPLOYMENT_FORM: 'hr_employment_form', // 操作类型
HR_JOB_LEVEL: "hr_job_level", // 员工职级
HR_POSITION_TYPE: "hr_position_type", // 员工岗位类型
HR_SEQUENCE: "hr_sequence", // 员工序列
HR_EDUCATION_CATEGORY: "hr_education_category", // 员工学历类别
HR_CONTRACT_FORM: "hr_contract_form", // 员工合同形式
HR_RESIGNATION_TYPE: "hr_resignation_type", // 员工离职类型
HR_JOB_LEVEL: 'hr_job_level', // 员工职级
HR_POSITION_TYPE: 'hr_position_type', // 员工岗位类型
HR_SEQUENCE: 'hr_sequence', // 员工序列
HR_EDUCATION_CATEGORY: 'hr_education_category', // 员工学历类别
HR_CONTRACT_FORM: 'hr_contract_form', // 员工合同形式
HR_RESIGNATION_TYPE: 'hr_resignation_type', // 员工离职类型
HR_RESIGN_YEARS_OF_SERVICE_TYPE: 'hr_resign_years_of_service_type', // 员工离职类型
HR_CHANGE_LOG_TYPE: 'hr_change_log_type', // 员工离职类型
// SYS_JOB_TYPE: 'sys_job_type', // 定时任务类型
// SYS_JOB_STATUS: 'sys_job_status', // 定时任务状态
// SYS_OSS_ACCESS_POLICY: 'oss_access_policy', // oss权限桶类型
......
......@@ -7,6 +7,7 @@ import { ref } from 'vue';
import { Page } from '@vben/common-ui';
import { ExportOutlined } from '@ant-design/icons-vue';
import { Button, Space } from 'ant-design-vue';
import { useVbenVxeGrid } from '#/adapter/vxe-table';
......@@ -142,6 +143,9 @@ function handleDownloadExcel() {
v-access:code="['employee:phoneBook:export']"
@click="handleDownloadExcel"
>
<template #icon>
<ExportOutlined />
</template>
导出
</Button>
<!-- <Button
......
......@@ -8,6 +8,7 @@ import { ref } from 'vue';
import { Page, useVbenDrawer, useVbenModal } from '@vben/common-ui';
import { ExportOutlined } from '@ant-design/icons-vue';
import { Button, Space } from 'ant-design-vue';
import { useVbenVxeGrid } from '#/adapter/vxe-table';
......@@ -175,6 +176,9 @@ function handleDownloadExcel() {
v-access:code="['employee:regularReminder:export']"
@click="handleDownloadExcel"
>
<template #icon>
<ExportOutlined />
</template>
导出
</Button>
<!-- <Button
......
......@@ -113,10 +113,9 @@ const [Drawer, drawerApi] = useVbenDrawer({
}
const data = drawerApi.getData<DictDataApi.DictData>();
isUpdate.value = !!data?.id;
await formApi.setFieldValue('dictType', data.dictType);
if (isUpdate.value) {
await formApi.setValues(data);
} else {
formApi.resetForm();
}
await markInitialized();
},
......
......@@ -76,7 +76,7 @@ const [Grid, gridApi] = useVbenVxeGrid({
function onActionClick({
code,
row,
}: OnActionClickParams<DictDataApi.DictItem>) {
}: OnActionClickParams<DictDataApi.DictData>) {
switch (code) {
case 'delete': {
onDelete(row);
......
......@@ -10,6 +10,9 @@ export const flowTypeOptions = [
{ label: '入职', value: '1' },
{ label: '离职', value: '2' },
{ label: '调配', value: '3' },
{ label: '转正', value: '4' },
{ label: '续签', value: '5' },
{ label: '部门调整', value: '6' },
];
export const querySchema: VbenFormSchema[] = [
......@@ -54,16 +57,16 @@ export function useColumns(): VxeTableGridOptions<EmployeeFlowApi.EmployeeFlow>[
// title: '员工信息ID',
// field: 'employeeId',
// },
{
title: '开始时间',
field: 'startDate',
formatter: 'formatDateTime',
},
{
title: '结束时间',
field: 'endDate',
formatter: 'formatDateTime',
},
// {
// title: '开始时间',
// field: 'startDate',
// formatter: 'formatDateTime',
// },
// {
// title: '结束时间',
// field: 'endDate',
// formatter: 'formatDateTime',
// },
{
title: '状态',
field: 'status',
......
......@@ -13,9 +13,18 @@ import { defaultFormValueGetter, useBeforeCloseDiff } from '#/utils/popup';
const emit = defineEmits<{
success: [];
}>();
const formData = ref<EmployeeFlowApi.EmployeeFlow>();
const isUpdate = ref(false);
const formSchema: VbenFormSchema[] = [
{
component: 'Input',
dependencies: {
show: () => false,
triggerFields: [''],
},
fieldName: 'id',
label: 'id',
},
{
component: 'Input',
fieldName: 'applyCode',
......@@ -35,33 +44,33 @@ const formSchema: VbenFormSchema[] = [
label: '员工信息ID',
rules: 'required',
},
{
component: 'DatePicker',
fieldName: 'startDate',
label: '开始时间',
rules: 'required',
},
{
component: 'DatePicker',
fieldName: 'endDate',
label: '结束时间',
rules: 'required',
},
{
component: 'RadioGroup',
componentProps: {
buttonStyle: 'solid',
optionType: 'button',
},
fieldName: 'status',
label: '状态',
rules: 'required',
},
// {
// component: 'DatePicker',
// fieldName: 'startDate',
// label: '开始时间',
// // rules: 'required',
// },
// {
// component: 'DatePicker',
// fieldName: 'endDate',
// label: '结束时间',
// // rules: 'required',
// },
// {
// component: 'RadioGroup',
// componentProps: {
// buttonStyle: 'solid',
// optionType: 'button',
// },
// fieldName: 'status',
// label: '状态',
// rules: 'required',
// },
{
component: 'Textarea',
fieldName: 'remark',
label: '备注',
rules: 'required',
// rules: 'required',
},
];
......@@ -94,8 +103,8 @@ const [Drawer, drawerApi] = useVbenDrawer({
return null;
}
const data = drawerApi.getData<EmployeeFlowApi.EmployeeFlow>();
if (data) {
formData.value = data;
isUpdate.value = !!data?.id;
if (isUpdate.value) {
await formApi.setValues(formData.value);
} else {
formApi.resetForm();
......@@ -110,9 +119,7 @@ async function onSubmit() {
drawerApi.lock();
const data = await formApi.getValues<EmployeeFlowApi.EmployeeFlow>();
try {
await (formData.value?.id
? apiUpdate({ id: formData.value.id, ...data })
: apiAdd(data));
await (isUpdate.value ? apiUpdate(data) : apiAdd(data));
resetInitialized();
emit('success');
drawerApi.close();
......@@ -128,7 +135,7 @@ async function handleClosed() {
}
const getDrawerTitle = computed(() =>
formData.value?.id ? '修改人事审批对象' : '新增人事审批对象',
isUpdate.value ? '修改人事审批对象' : '新增人事审批对象',
);
</script>
<template>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment