Commit 6575db45 authored by 刘斌's avatar 刘斌

feat: 增加在职人员分析

parent 521d27c9
import type { BaseModel, PageQuery } from '#/api/baseModel';
import { commonExport } from '#/api/helper';
import { requestClient } from '#/api/request';
export namespace EmployeeStatusAnalysisApi {
export interface EmployeeStatusAnalysis extends BaseModel {
/**
* 总人数
*/
totalCount?: number;
/**
* 男性人数
*/
maleCount?: number;
/**
* 女性人数
*/
femaleCount?: number;
/**
* 24岁以下人数
*/
under24Count?: number;
/**
* 25-34岁人数
*/
age25To34Count?: number;
/**
* 35-44岁人数
*/
age35To44Count?: number;
/**
* 45岁以上人数
*/
over45Count?: number;
/**
* 专科以下人数
*/
belowCollegeCount?: number;
/**
* 专科人数
*/
collegeCount?: number;
/**
* 本科人数
*/
bachelorCount?: number;
/**
* 硕士人数
*/
masterCount?: number;
/**
* 小于2年人数
*/
lessThan2YearsCount?: number;
/**
* 2年到5年人数
*/
years2To5Count?: number;
/**
* 5年到10年人数
*/
years5To10Count?: number;
/**
* 10年以上人数
*/
over10YearsCount?: number;
/**
* 男性占比
*/
maleRatio?: number;
/**
* 女性占比
*/
femaleRatio?: number;
/**
* 24岁以下占比
*/
under24Ratio?: number;
/**
* 25-34岁占比
*/
age25To34Ratio?: number;
/**
* 35-44岁占比
*/
age35To44Ratio?: number;
/**
* 45岁以上占比
*/
over45Ratio?: number;
/**
* 专科以下占比
*/
belowCollegeRatio?: number;
/**
* 专科占比
*/
collegeRatio?: number;
/**
* 本科占比
*/
bachelorRatio?: number;
/**
* 硕士占比
*/
masterRatio?: number;
/**
* 小于2年占比
*/
lessThan2YearsRatio?: number;
/**
* 2年到5年占比
*/
years2To5Ratio?: number;
/**
* 5年到10年占比
*/
years5To10Ratio?: number;
/**
* 10年以上占比
*/
over10YearsRatio?: number;
}
}
/**
* 查询在职人员情况分析列表
* @param params
* @returns {*} page
*/
export function apiPage(params: PageQuery) {
return requestClient.get('/employee/statusAnalysis/page', { params });
}
// /**
// * 查询在职人员情况分析详细
// * @param id
// */
// export function apiDetail(id: number) {
// return requestClient.get(`/employee/employeeStatusAnalysis/${id}`);
// }
// /**
// * 新增在职人员情况分析
// * @param data
// */
// export function apiAdd(data: EmployeeStatusAnalysisApi.EmployeeStatusAnalysis) {
// return requestClient.post('/employee/employeeStatusAnalysis', data);
// }
// /**
// * 修改在职人员情况分析
// * @param data
// */
// export function apiUpdate(data: EmployeeStatusAnalysisApi.EmployeeStatusAnalysis) {
// return requestClient.put('/employee/employeeStatusAnalysis', data);
// }
// /**
// * 删除在职人员情况分析
// * @param id
// */
// export function apiDelete(id: Array<number> | number) {
// return requestClient.delete(`/employee/employeeStatusAnalysis/${id}`);
// }
/**
* 导出在职人员情况分析
* @param params
*/
export function apiExport(params: PageQuery) {
return commonExport('/employee/statusAnalysis/export', params);
}
......@@ -19,6 +19,9 @@ export const overridesPreferences = defineOverridesPreferences({
name: import.meta.env.VITE_APP_TITLE,
},
logo: {
source: 'https://cdn.test.antaikeji.top/logo/antai_logo.png',
},
footer: {
/**
* 不显示footer
......
......@@ -18,7 +18,7 @@ const routes: RouteRecordRaw[] = [
component: () => import('#/views/hr/employeeInfo/list.vue'),
meta: {
title: '员工信息列表',
icon: 'clarity:employee-line',
icon: 'fluent:people-28-regular',
keepAlive: true,
permission: ['dashboard'],
componentPath: '#/views/hr/employeeInfo/list.vue',
......@@ -30,7 +30,7 @@ const routes: RouteRecordRaw[] = [
component: () => import('#/views/hr/employeeInfo/list.vue'),
meta: {
title: '离职员工列表',
icon: 'clarity:employee-line',
icon: 'fluent:people-swap-28-regular',
keepAlive: true,
permission: ['dashboard'],
componentPath: '#/views/hr/resignEmployee/list.vue',
......@@ -42,7 +42,7 @@ const routes: RouteRecordRaw[] = [
component: () => import('#/views/hr/phoneBook/list.vue'),
meta: {
title: '电话本管理',
icon: 'solar:monitor-smartphone-outline',
icon: 'streamline-plump:contact-phonebook',
keepAlive: true,
permission: ['dashboard'],
componentPath: '#/views/hr/phoneBook/list.vue',
......@@ -67,7 +67,7 @@ const routes: RouteRecordRaw[] = [
import('#/views/hr/contractExpirationReminder/list.vue'),
meta: {
title: '合同续约提醒',
icon: 'solar:monitor-smartphone-outline',
icon: 'material-symbols-light:contract-outline-rounded',
keepAlive: true,
permission: ['dashboard'],
componentPath: '#/views/hr/contractExpirationReminder/list.vue',
......@@ -79,7 +79,7 @@ const routes: RouteRecordRaw[] = [
component: () => import('#/views/hr/changeLog/list.vue'),
meta: {
title: '员工变动记录',
icon: 'solar:monitor-smartphone-outline',
icon: 'clarity:employee-group-line',
keepAlive: true,
permission: ['dashboard'],
componentPath: '#/views/hr/changeLog/list.vue',
......@@ -91,7 +91,7 @@ const routes: RouteRecordRaw[] = [
meta: {
title: '报表',
keepAlive: true,
icon: 'material-symbols:logo-dev-outline',
icon: 'oui:app-reporting',
permission: ['dashboard'],
},
children: [
......@@ -107,6 +107,19 @@ const routes: RouteRecordRaw[] = [
componentPath: '#/views/hr/changeAnalysis/list.vue',
},
},
{
path: '/hr/report/statusAnalysis',
name: 'EmployeeStatusAnalysisList',
component: () =>
import('#/views/hr/employeeStatusAnalysis/list.vue'),
meta: {
title: '在职情况分析',
icon: 'arcticons:one-hand-operation',
keepAlive: true,
permission: ['dashboard'],
componentPath: '#/views/hr/employeeStatusAnalysis/list.vue',
},
},
],
},
{
......
......@@ -53,7 +53,7 @@ const routes: RouteRecordRaw[] = [
component: () => import('#/views/auth/dept/list.vue'),
name: 'SysDeptList',
meta: {
title: '部门列表',
title: '组织架构',
icon: 'mingcute:department-line',
keepAlive: true,
permission: ['dashboard'],
......
......@@ -141,7 +141,11 @@ const [Drawer, drawerApi] = useVbenDrawer({
}
const data = drawerApi.getData<SysDeptApi.Dept>();
isUpdate.value = !!data.id;
await (isUpdate.value ? formApi.setValues(data) : formApi.resetForm());
if (isUpdate.value) {
await formApi.setValues(data);
} else if (data.parentId) {
await formApi.setFieldValue('parentId', data.parentId);
}
await markInitialized();
},
});
......@@ -168,7 +172,7 @@ async function handleClosed() {
}
const getDrawerTitle = computed(() =>
isUpdate.value ? '修改部门' : '新增部门',
isUpdate.value ? '修改组织架构' : '新增组织架构',
);
</script>
<template>
......
......@@ -116,13 +116,13 @@ function onDelete(row: SysDeptApi.Dept) {
});
}
function handleDownloadExcel() {
commonDownloadExcel(exportDetail, '部门列表', gridApi.formApi.form.values);
commonDownloadExcel(exportDetail, '组织架构', gridApi.formApi.form.values);
}
</script>
<template>
<Page auto-content-height>
<FormDrawer @success="onRefresh" />
<Grid table-title="部门列表">
<Grid table-title="组织架构">
<template #toolbar-tools>
<Space>
<Button
......
......@@ -237,8 +237,8 @@ const [Drawer, drawerApi] = useVbenDrawer({
isUpdate.value = !!data.id;
if (isUpdate.value) {
await formApi.setValues(data);
} else {
formApi.resetForm();
} else if (data.parentId) {
await formApi.setFieldValue('parentId', data.parentId);
}
await markInitialized();
drawerApi.drawerLoading(false);
......
......@@ -50,13 +50,9 @@ const [Grid, gridApi] = useVbenVxeGrid({
},
proxyConfig: {
ajax: {
query: async ({ page }, formValues = {}) => {
// console.log('[formValues]', formValues);
return await apiPage({
pageNo: page.currentPage,
pageSize: page.pageSize,
...formValues,
});
query: async (_, formValues = {}) => {
const data = await apiPage({ ...formValues });
return { data };
},
},
},
......@@ -87,9 +83,9 @@ const [Grid, gridApi] = useVbenVxeGrid({
{ row: 1, col: 16, rowspan: 2, colspan: 1 },
],
rowConfig: {
keyField: 'id',
keyField: 'plate',
// 高亮当前行
isCurrent: true,
isCurrent: false,
},
} as VxeTableGridOptions,
});
......
import type { VbenFormSchema } from '#/adapter/form';
import type { VxeTableGridOptions } from '#/adapter/vxe-table';
import type { EmployeeStatusAnalysisApi } from '#/api/hr/employeeStatusAnalysis';
// import { DictEnum } from '@vben/constants';
// import { getDictOptions, getTagDicts } from '#/utils/dict';
export const querySchema: VbenFormSchema[] = [
{
component: 'Input',
fieldName: 'plate',
label: '公司',
},
// {
// component: 'Input',
// fieldName: 'maleCount',
// label: '男性人数',
// },
// {
// component: 'Input',
// fieldName: 'femaleCount',
// label: '女性人数',
// },
// {
// component: 'Input',
// fieldName: 'under24Count',
// label: '24岁以下人数',
// },
// {
// component: 'Input',
// fieldName: 'age25To34Count',
// label: '25-34岁人数',
// },
// {
// component: 'Input',
// fieldName: 'age35To44Count',
// label: '35-44岁人数',
// },
// {
// component: 'Input',
// fieldName: 'over45Count',
// label: '45岁以上人数',
// },
// {
// component: 'Input',
// fieldName: 'belowCollegeCount',
// label: '专科以下人数',
// },
// {
// component: 'Input',
// fieldName: 'collegeCount',
// label: '专科人数',
// },
// {
// component: 'Input',
// fieldName: 'bachelorCount',
// label: '本科人数',
// },
// {
// component: 'Input',
// fieldName: 'masterCount',
// label: '硕士人数',
// },
// {
// component: 'Input',
// fieldName: 'lessThan2YearsCount',
// label: '小于2年人数',
// },
// {
// component: 'Input',
// fieldName: 'years2To5Count',
// label: '2年到5年人数',
// },
// {
// component: 'Input',
// fieldName: 'years5To10Count',
// label: '5年到10年人数',
// },
// {
// component: 'Input',
// fieldName: 'over10YearsCount',
// label: '10年以上人数',
// },
// {
// component: 'Input',
// fieldName: 'maleRatio',
// label: '男性占比',
// },
// {
// component: 'Input',
// fieldName: 'femaleRatio',
// label: '女性占比',
// },
// {
// component: 'Input',
// fieldName: 'under24Ratio',
// label: '24岁以下占比',
// },
// {
// component: 'Input',
// fieldName: 'age25To34Ratio',
// label: '25-34岁占比',
// },
// {
// component: 'Input',
// fieldName: 'age35To44Ratio',
// label: '35-44岁占比',
// },
// {
// component: 'Input',
// fieldName: 'over45Ratio',
// label: '45岁以上占比',
// },
// {
// component: 'Input',
// fieldName: 'belowCollegeRatio',
// label: '专科以下占比',
// },
// {
// component: 'Input',
// fieldName: 'collegeRatio',
// label: '专科占比',
// },
// {
// component: 'Input',
// fieldName: 'bachelorRatio',
// label: '本科占比',
// },
// {
// component: 'Input',
// fieldName: 'masterRatio',
// label: '硕士占比',
// },
// {
// component: 'Input',
// fieldName: 'lessThan2YearsRatio',
// label: '小于2年占比',
// },
// {
// component: 'Input',
// fieldName: 'years2To5Ratio',
// label: '2年到5年占比',
// },
// {
// component: 'Input',
// fieldName: 'years5To10Ratio',
// label: '5年到10年占比',
// },
// {
// component: 'Input',
// fieldName: 'over10YearsRatio',
// label: '10年以上占比',
// },
];
export function useColumns(): VxeTableGridOptions<EmployeeStatusAnalysisApi.EmployeeStatusAnalysis>['columns'] {
return [
{
title: '公司',
field: 'plate',
},
{
title: '总人数',
field: 'totalCount',
},
{
title: '性别分析',
headerAlign: 'center',
children: [
{
title: '男',
field: 'maleCount',
},
{
title: '女',
field: 'femaleCount',
},
],
},
{
title: '年龄结构分析',
headerAlign: 'center',
children: [
{
title: '24岁以下',
field: 'under24Count',
},
{
title: '25-34岁',
field: 'age25To34Count',
},
{
title: '35-44岁',
field: 'age35To44Count',
},
{
title: '45岁以上',
field: 'over45Count',
},
],
},
{
title: '教育结构分析',
headerAlign: 'center',
children: [
{
title: '专科以下',
field: 'belowCollegeCount',
},
{
title: '专科',
field: 'juniorCollegeCount',
},
{
title: '本科',
field: 'bachelorCount',
},
{
title: '硕士',
field: 'postgraduateCount',
},
],
},
{
title: '工龄结构分析',
headerAlign: 'center',
children: [
{
title: '<2年',
field: 'lessThan2YearsCount',
},
{
title: '≥2年<5年',
field: 'years2To5Count',
},
{
title: '≥5年<10年',
field: 'years5To10Count',
},
{
title: '≥10年以上',
field: 'over10YearsCount',
},
],
},
{
title: '性别分析占比',
headerAlign: 'center',
children: [
{
title: '男',
field: 'maleRatio',
},
{
title: '女',
field: 'femaleRatio',
},
],
},
{
title: '年龄结构分析占比',
headerAlign: 'center',
children: [
{
title: '24岁以下',
field: 'under24Ratio',
},
{
title: '25-34岁',
field: 'age25To34Ratio',
},
{
title: '35-44岁',
field: 'age35To44Ratio',
},
{
title: '45岁以上',
field: 'over45Ratio',
},
],
},
{
title: '教育结构分析占比',
headerAlign: 'center',
children: [
{
title: '专科以下',
field: 'belowCollegeRatio',
},
{
title: '专科',
field: 'juniorCollegeRatio',
},
{
title: '本科',
field: 'bachelorRatio',
},
{
title: '硕士',
field: 'postgraduateRatio',
},
],
},
{
title: '工龄结构分析占比',
headerAlign: 'center',
children: [
{
title: '<2年',
field: 'lessThan2YearsRatio',
},
{
title: '≥2年<5年',
field: 'years2To5Ratio',
},
{
title: '≥5年<10年',
field: 'years5To10Ratio',
},
{
title: '≥10年以上',
field: 'over10YearsRatio',
},
],
},
// {
// align: 'right',
// cellRender: {
// attrs: {
// nameField: 'name',
// nameTitle: '在职人员情况分析',
// onClick: onActionClick,
// },
// name: 'CellOperation',
// options: [
// {
// code: 'edit',
// accessCode: ['employee:employeeStatusAnalysis:edit'],
// }, // 默认的编辑按钮
// {
// code: 'delete',
// accessCode: ['employee:employeeStatusAnalysis:remove'],
// }, // 默认的删除按钮
// ],
// },
// field: 'action',
// fixed: 'right',
// headerAlign: 'center',
// resizable: false,
// showOverflow: false,
// title: '操作',
// width: 'auto',
// },
];
}
<script lang="ts" setup>
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/employeeStatusAnalysis';
import { commonDownloadExcel } from '#/utils/file/download';
import { 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: false,
},
proxyConfig: {
ajax: {
query: async (_, formValues = {}) => {
const data = await apiPage({ ...formValues });
return { data };
},
},
},
border: true,
columnConfig: {
resizable: false,
},
showCustomHeader: true,
mergeHeaderCells: [
{ row: 0, col: 0, rowspan: 2, colspan: 1 },
{ row: 0, col: 1, rowspan: 2, colspan: 1 },
{ row: 0, col: 2, rowspan: 1, colspan: 2 },
{ row: 0, col: 4, rowspan: 1, colspan: 4 },
{ row: 0, col: 8, rowspan: 1, colspan: 4 },
{ row: 0, col: 12, rowspan: 1, colspan: 4 },
{ row: 0, col: 16, rowspan: 1, colspan: 2 },
{ row: 0, col: 18, rowspan: 1, colspan: 4 },
{ row: 0, col: 22, rowspan: 1, colspan: 4 },
{ row: 0, col: 26, rowspan: 1, colspan: 4 },
{ row: 0, col: 30, rowspan: 1, colspan: 4 },
],
rowConfig: {
keyField: 'plate',
// 高亮当前行
isCurrent: false,
},
} as VxeTableGridOptions,
});
// function onActionClick({ code, row }: OnActionClickParams<EmployeeStatusAnalysisApi.EmployeeStatusAnalysis>) {
// switch (code) {
// case 'delete': {
// onDelete(row);
// break;
// }
// case 'edit': {
// onEdit(row);
// break;
// }
// default: {
// break;
// }
// }
// }
// function onRefresh() {
// gridApi.query();
// }
// function onEdit(row: EmployeeStatusAnalysisApi.EmployeeStatusAnalysis) {
// formDrawerApi.setData(row).open();
// }
// function onCreate() {
// formDrawerApi.setData({}).open();
// }
// function onDelete(row: EmployeeStatusAnalysisApi.EmployeeStatusAnalysis) {
// 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:statusAnalysis:export']"
@click="handleDownloadExcel"
>
<template #icon>
<ExportOutlined />
</template>
导出
</Button>
<!-- <Button
v-access:code="['employee:employeeStatusAnalysis:add']"
type="primary"
@click="onCreate"
>
<Plus class="size-5" />
新增
</Button> -->
</Space>
</template>
</Grid>
</Page>
</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