master
Joe 2 years ago
parent ac8aee97f4
commit 427f96094a

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 114 KiB

@ -4,6 +4,9 @@ export interface TableListItem {
educationList?: any[],
ptqList?: any[],
skillLevelList?: any[],
sexList?: any[],
departmentList?: any[],
ageList?: any[],
}
export interface TableListPagination {

@ -2,7 +2,7 @@ import React, { useState, useEffect } from "react";
import { Card, Button, Row, Col, Form, Select, Checkbox, Spin } from "antd";
import { TableListItem } from "./data";
import { queryRule } from "./service";
import { getAllInfoSettingValueBySettingName } from "../Employee/service";
import { getAllInfoSettingValueBySettingName, getPostListByDept } from "../Employee/service";
const { Option } = Select;
@ -25,13 +25,14 @@ const UserList: React.FC<{}> = () => {
}
const [postList, setPostList] = useState<any[]>([]);
const [departmentList, setDepartmentList] = useState<any[]>([]);
const [form] = Form.useForm();
useEffect(() => {
async function fetchData() {
handleLoadChange(true)
const res = await handleTableChange({isEdu: 1, isPtq: 1, isSkill: 1})
const res = await handleTableChange({isEdu: 1, isPtq: 1, isSkill: 1, isSex: 1, isDepartment: 1, isAge: 1})
handleLoadChange(false)
handleDataChange(res.data)
}
@ -40,6 +41,11 @@ const UserList: React.FC<{}> = () => {
setPostList(res.data);
}
});
getAllInfoSettingValueBySettingName({ settingName: '部门' }).then((res) => {
if (res.retcode && res.data) {
setDepartmentList(res.data);
}
});
fetchData()
}, []);
return (
@ -49,8 +55,26 @@ const UserList: React.FC<{}> = () => {
<Row style={{marginBottom: 20}} justify="space-between">
<Col span={20}>
<Form form={form} layout="inline">
<Form.Item name="postName" label="岗位">
<Select style={{ width: 200 }} placeholder="请选择岗位" allowClear>
<Form.Item name="departments" label="部门">
<Select style={{ width: 200 }} placeholder="请选择部门" mode="multiple" onChange={(e) => {
getPostListByDept({departments: e}).then(res => {
const arr = res.data.map((item: any) => {
return {
settingValue: item
}
})
setPostList(arr)
})
}} allowClear>
{departmentList.map((item) => (
<Option value={item.settingValue} key={item.settingValue}>
{item.settingValue}
</Option>
))}
</Select>
</Form.Item>
<Form.Item name="postNames" label="岗位">
<Select style={{ width: 200 }} placeholder="请选择岗位" mode="multiple" allowClear>
{postList.map((item) => (
<Option value={item.settingValue} key={item.settingValue}>
{item.settingValue}
@ -58,8 +82,17 @@ const UserList: React.FC<{}> = () => {
))}
</Select>
</Form.Item>
<Form.Item name="isSex" label="" initialValue={true} valuePropName="checked">
<Checkbox></Checkbox>
</Form.Item>
<Form.Item name="isAge" label="" initialValue={true} valuePropName="checked">
<Checkbox></Checkbox>
</Form.Item>
<Form.Item name="isDepartment" label="" initialValue={true} valuePropName="checked">
<Checkbox></Checkbox>
</Form.Item>
<Form.Item name="isEdu" label="" initialValue={true} valuePropName="checked">
<Checkbox></Checkbox>
<Checkbox></Checkbox>
</Form.Item>
<Form.Item name="isSkill" label="" initialValue={true} valuePropName="checked">
<Checkbox></Checkbox>
@ -75,6 +108,9 @@ const UserList: React.FC<{}> = () => {
const param = {
...values,
isEdu: values.isEdu ? 1 : 0,
isDepartment: values.isDepartment ? 1 : 0,
isSex: values.isSex ? 1 : 0,
isAge: values.isAge ? 1 : 0,
isSkill: values.isSkill ? 1 : 0,
isPtq: values.isPtq ? 1 : 0
}
@ -86,6 +122,24 @@ const UserList: React.FC<{}> = () => {
<Spin spinning={loading}>
{data.map(e =>
<Card key={e.postName} title={e.postName}>
{e.sexList && e.sexList?.length > 0 ? <>
<div style={{marginBottom: 10, fontSize: 14, fontWeight: 'bold'}}></div>
<Row style={{marginBottom: 20}} gutter={10}>
{e.sexList?.map(item => <Col key={item.analysisName} span={6}>{item.analysisName == 1 ? '男' : item.analysisName == 2 ? '女' : ''}: {item.analysisCount} {(item.analysisCount/item.postCount * 100).toFixed(2)}%</Col>)}
</Row>
</>:null}
{e.ageList && e.ageList?.length > 0 ? <>
<div style={{marginBottom: 10, fontSize: 14, fontWeight: 'bold'}}></div>
<Row style={{marginBottom: 20}} gutter={10}>
{e.ageList?.map(item => <Col key={item.analysisName} span={6}>{item.analysisName}: {item.analysisCount} {(item.analysisCount/item.postCount * 100).toFixed(2)}%</Col>)}
</Row>
</>:null}
{e.departmentList && e.departmentList?.length > 0 ? <>
<div style={{marginBottom: 10, fontSize: 14, fontWeight: 'bold'}}></div>
<Row style={{marginBottom: 20}} gutter={10}>
{e.departmentList?.map(item => <Col key={item.analysisName} span={6}>: {item.postCount} {(item.analysisCount/item.postCount * 100).toFixed(2)}%</Col>)}
</Row>
</>:null}
{e.educationList && e.educationList?.length > 0 ? <>
<div style={{marginBottom: 10, fontSize: 14, fontWeight: 'bold'}}></div>
<Row style={{marginBottom: 20}} gutter={10}>

@ -6,6 +6,9 @@ export interface FormValueType extends Partial<TableListItem> {
education?: string;
school?: string;
speciality?: string;
highestEducation?: string;
undergraduateSchools?: string;
undergraduateMajor?: string;
intake?: string;
graduationTime?: string;
}
@ -25,6 +28,9 @@ const UpdateEducationResumeForm: React.FC<UpdateFormProps> = (props) => {
education: props.values.education,
school: props.values.school,
speciality: props.values.speciality,
highestEducation: props.values.highestEducation,
undergraduateSchools: props.values.undergraduateSchools,
undergraduateMajor: props.values.undergraduateMajor,
intake: props.values.intake,
graduationTime: props.values.graduationTime,
});
@ -86,29 +92,46 @@ const UpdateEducationResumeForm: React.FC<UpdateFormProps> = (props) => {
</Row>
<Row gutter={16}>
<Col span={12}>
<Form.Item name="education" label="学历">
<Input placeholder="请输入学历" />
<Form.Item name="education" label="就业学历">
<Input placeholder="请输入就业学历" />
</Form.Item>
</Col>
<Col span={12}>
<Form.Item name="school" label="学校">
<Input placeholder="请输入学校" />
<Form.Item name="highestEducation" label="最高学历">
<Input placeholder="请输入最高学历" />
</Form.Item>
</Col>
</Row>
<Row gutter={16}>
<Col span={12}>
<Form.Item name="undergraduateSchools" label="本科学历学校">
<Input placeholder="请输入本科学历学校" />
</Form.Item>
</Col>
<Col span={12}>
<Form.Item name="undergraduateMajor" label="本科学历专业">
<Input placeholder="请输入本科学历专业" />
</Form.Item>
</Col>
</Row>
<Row gutter={16}>
<Col span={12}>
<Form.Item name="school" label="最高学历学校">
<Input placeholder="请输入最高学历学校" />
</Form.Item>
</Col>
<Col span={12}>
<Form.Item name="speciality" label="专业">
<Input placeholder="请输入专业" />
</Form.Item>
</Col>
</Row>
<Row gutter={16}>
<Col span={12}>
<Form.Item name="intake" label="入学日期">
<Input placeholder="请输入入学日期" />
</Form.Item>
</Col>
</Row>
<Row gutter={16}>
<Col span={12}>
<Form.Item name="graduationTime" label="毕业日期">
<Input placeholder="请输入毕业日期" />

@ -11,6 +11,8 @@ import {
Modal,
Popconfirm,
message,
Image,
InputNumber,
} from 'antd';
import { TableListItem } from '../data';
import {
@ -18,6 +20,7 @@ import {
delFamilyMembers,
delHonor,
delWorkExperience,
exportEmployeeDetail,
getAllEducationResume,
getAllFamilyMembers,
getAllHonor,
@ -36,6 +39,7 @@ import UpdateHonorForm from './UpdateHonorForm';
import { useReactToPrint } from 'react-to-print';
//@ts-ignore
import Html2Pdf from 'js-html2pdf';
import EmptyImage from '@/assets/empty.png'
const { Option } = Select;
export interface FormValueType extends Partial<TableListItem> {}
@ -47,6 +51,23 @@ export interface UpdateFormProps {
values: Partial<TableListItem>;
}
/**
*
* @param selectedRows
*/
const handleExportEmployeeDetail = async ({ ...params }: any) => {
const hide = message.loading('正在导出');
try {
await exportEmployeeDetail(params);
hide();
return true;
} catch (error) {
hide();
message.error('处理失败,请重试');
return false;
}
};
/**
*
* @param fields
@ -175,6 +196,10 @@ const UpdateForm: React.FC<UpdateFormProps> = (props) => {
employeeName: props.values.employeeName,
employeeNo: props.values.employeeNo,
unitId: props.values.unitId,
age: props.values.age,
departmentId: props.values.departmentId,
sex: props.values.sex,
photo: props.values.photo,
postId: props.values.postId,
groupsId: props.values.groupsId,
ptqId: props.values.ptqId,
@ -192,6 +217,7 @@ const UpdateForm: React.FC<UpdateFormProps> = (props) => {
const [ptqList, setPtqList] = useState<any[]>([]);
const [skillLevelList, setSkillLevelList] = useState<any[]>([]);
const [highestEducationList, setHighestEducationList] = useState<any[]>([]);
const [departmentList, setDepartmentList] = useState<any[]>([]);
const [educationResumeList, setEducationResumeList] = useState<any[]>([]);
const [familyMembersList, setFamilyMembersList] = useState<any[]>([]);
@ -207,17 +233,29 @@ const UpdateForm: React.FC<UpdateFormProps> = (props) => {
const educationResumeColumns: ColumnsType<any> = [
{
title: '学历',
dataIndex: 'education',
title: '最高学历',
dataIndex: 'highestEducation',
},
{
title: '学校',
title: '最高学历学校',
dataIndex: 'school',
},
{
title: '专业',
dataIndex: 'speciality',
},
{
title: '就业学历',
dataIndex: 'education',
},
{
title: '本科学历学校',
dataIndex: 'undergraduateSchools',
},
{
title: '本科学历专业',
dataIndex: 'undergraduateMajor',
},
{
title: '时间',
dataIndex: 'intake',
@ -228,17 +266,29 @@ const UpdateForm: React.FC<UpdateFormProps> = (props) => {
];
const educationResumeColumns1: ColumnsType<any> = [
{
title: '学历',
dataIndex: 'education',
title: '最高学历',
dataIndex: 'highestEducation',
},
{
title: '学校',
title: '最高学历学校',
dataIndex: 'school',
},
{
title: '专业',
dataIndex: 'speciality',
},
{
title: '就业学历',
dataIndex: 'education',
},
{
title: '本科学历学校',
dataIndex: 'undergraduateSchools',
},
{
title: '本科学历专业',
dataIndex: 'undergraduateMajor',
},
{
title: '入学时间',
dataIndex: 'intake',
@ -457,10 +507,14 @@ const UpdateForm: React.FC<UpdateFormProps> = (props) => {
let ptq;
let skillLevel;
let highestEducation;
let department;
if (fieldsValue.unitId) {
unit = unitList.find((e) => e.id === fieldsValue.unitId).settingValue;
}
if (fieldsValue.departmentId) {
department = departmentList.find((e) => e.id === fieldsValue.departmentId).settingValue;
}
if (fieldsValue.postId) {
post = postList.find((e) => e.id === fieldsValue.postId).settingValue;
}
@ -490,6 +544,7 @@ const UpdateForm: React.FC<UpdateFormProps> = (props) => {
ptq,
skillLevel,
highestEducation,
department
});
};
@ -524,6 +579,11 @@ const UpdateForm: React.FC<UpdateFormProps> = (props) => {
setUnitList(res.data);
}
});
getAllInfoSettingValueBySettingName({ settingName: '部门' }).then((res) => {
if (res.retcode && res.data) {
setDepartmentList(res.data);
}
});
}, []);
const getData = (employeeNo: string, type: number) => {
@ -652,6 +712,11 @@ const UpdateForm: React.FC<UpdateFormProps> = (props) => {
PDF
</Button>
) : null}
{values.id ? (
<Button style={{ marginRight: 8 }} onClick={() => handleExportEmployeeDetail({employeeNo: values.employeeNo})} type="primary">
Excel
</Button>
) : null}
<Button onClick={handleSubmit} type="primary">
</Button>
@ -660,6 +725,13 @@ const UpdateForm: React.FC<UpdateFormProps> = (props) => {
>
<div id="print" style={{padding: 20}} ref={componentRef}>
<div style={{ fontSize: 16, marginBottom: 10, fontWeight: 'bold' }}></div>
<div style={{marginBottom: 10 }}>
<Image
width={200}
src="12"
fallback={EmptyImage}
/>
</div>
<Form form={form} labelAlign="left" labelCol={{ span: 7 }} initialValues={formVals}>
<Row gutter={16}>
<Col span={12}>
@ -697,9 +769,24 @@ const UpdateForm: React.FC<UpdateFormProps> = (props) => {
</Row>
<Row gutter={16}>
<Col span={12}>
<Form.Item name="unitId" label="单位">
<Select bordered={!isPrint} showArrow={!isPrint} placeholder="请选择单位" allowClear>
{unitList.map((item) => (
<Form.Item name="sex" label="性别">
<Select bordered={!isPrint} showArrow={!isPrint} placeholder="请选择性别" allowClear>
<Option value={1} key={1}></Option>
<Option value={2} key={2}></Option>
</Select>
</Form.Item>
</Col>
<Col span={12}>
<Form.Item name="age" label="年龄">
<InputNumber bordered={!isPrint} placeholder="请输入年龄" />
</Form.Item>
</Col>
</Row>
<Row gutter={16}>
<Col span={12}>
<Form.Item name="departmentId" label="部门">
<Select bordered={!isPrint} showArrow={!isPrint} placeholder="请选择部门" allowClear>
{departmentList.map((item) => (
<Option value={item.id} key={item.id}>
{item.settingValue}
</Option>
@ -721,9 +808,9 @@ const UpdateForm: React.FC<UpdateFormProps> = (props) => {
</Row>
<Row gutter={16}>
<Col span={12}>
<Form.Item name="groupsId" label="班组">
<Select bordered={!isPrint} showArrow={!isPrint} placeholder="请选择班组" allowClear>
{groupsList.map((item) => (
<Form.Item name="unitId" label="单位">
<Select bordered={!isPrint} showArrow={!isPrint} placeholder="请选择单位" allowClear>
{unitList.map((item) => (
<Option value={item.id} key={item.id}>
{item.settingValue}
</Option>
@ -745,9 +832,9 @@ const UpdateForm: React.FC<UpdateFormProps> = (props) => {
</Row>
<Row gutter={16}>
<Col span={12}>
<Form.Item name="ptqId" label="专业技术资格">
<Select bordered={!isPrint} showArrow={!isPrint} placeholder="请选择专业技术资格" allowClear>
{ptqList.map((item) => (
<Form.Item name="groupsId" label="班组">
<Select bordered={!isPrint} showArrow={!isPrint} placeholder="请选择班组" allowClear>
{groupsList.map((item) => (
<Option value={item.id} key={item.id}>
{item.settingValue}
</Option>
@ -767,6 +854,19 @@ const UpdateForm: React.FC<UpdateFormProps> = (props) => {
</Form.Item>
</Col>
</Row>
<Row gutter={16}>
<Col span={12}>
<Form.Item name="ptqId" label="专业技术资格">
<Select bordered={!isPrint} showArrow={!isPrint} placeholder="请选择专业技术资格" allowClear>
{ptqList.map((item) => (
<Option value={item.id} key={item.id}>
{item.settingValue}
</Option>
))}
</Select>
</Form.Item>
</Col>
</Row>
</Form>
{values.id ? (
<>
@ -787,6 +887,9 @@ const UpdateForm: React.FC<UpdateFormProps> = (props) => {
<Table
bordered
size="middle"
scroll={{
x: 'max-content'
}}
columns={educationResumeColumns}
rowKey="id"
dataSource={educationResumeList}

@ -2,12 +2,17 @@ export interface TableListItem {
id?: number,
employeeName?: string,
employeeNo?: string,
department?: string,
age?: number,
photo?: string,
sex?: number,
unit?: string,
post?: string,
groups?: string,
ptq?: string,
skillLevel?: string,
unitId?: number,
departmentId?: number,
postId?: number,
groupsId?: number,
ptqId?: number,

@ -1,5 +1,5 @@
import React, { useState, useRef } from "react";
import { message, Button, Popconfirm, FormInstance } from "antd";
import { message, Button, Popconfirm, FormInstance, InputNumber, Input } from "antd";
import { TableListItem, TableListPagination } from "./data";
import { queryRule, updateRule, removeRule, addRule, getAllInfoSettingValueBySettingName, exportEmployee } from "./service";
import UpdateForm, { FormValueType } from './components/UpdateForm';
@ -120,10 +120,114 @@ const UserList: React.FC<{}> = () => {
title: '手机号',
dataIndex: 'mobile',
},
{
title: '性别',
dataIndex: 'sex',
valueType: 'select',
fieldProps: {
mode: "multiple"
},
formItemProps: {
name: 'sexes'
},
valueEnum: {
1: '男',
2: '女'
}
},
{
title: '年龄',
dataIndex: 'age',
fieldProps: {
mode: "multiple"
},
formItemProps: {
name: 'ages'
},
renderFormItem: (_, { type }, form) => {
if (type === 'form') {
return null;
}
let value1 = form.getFieldValue('ages') ? form.getFieldValue('ages')[0] : '';
let value2 = form.getFieldValue('ages') ? form.getFieldValue('ages')[1] : '';
return (
<Input.Group compact>
<InputNumber
{...{
value: value1,
min: 0,
onChange: (e) => {
value1 = e;
const newValues: any = {};
newValues.ages = [value1, value2];
form.setFieldsValue(newValues);
},
}}
style={{ width: 100, textAlign: 'center' }}
/>
<Input
style={{
width: 30,
borderLeft: 0,
borderRight: 0,
pointerEvents: 'none',
}}
placeholder="~"
disabled
/>
<InputNumber
{...{
value: value2,
min: 0,
onChange: (e) => {
value2 = e;
const newValues: any = {};
newValues.ages = [value1, value2];
form.setFieldsValue(newValues);
},
}}
style={{
width: 100,
textAlign: 'center',
}}
/>
</Input.Group>
);
},
},
{
title: '部门',
dataIndex: 'departmentId',
valueType: 'select',
fieldProps: {
mode: "multiple"
},
formItemProps: {
name: 'departmentIds'
},
request: async () => {
const msg = await getAllInfoSettingValueBySettingName({settingName: '部门'})
if (msg.retcode && msg.data) {
return msg.data.map((e: any) => {
return {
label: e.settingValue,
value: e.id
}
})
}
return []
}
},
{
title: '单位',
dataIndex: 'unitId',
valueType: 'select',
fieldProps: {
mode: "multiple"
},
formItemProps: {
name: 'unitIds'
},
request: async () => {
const msg = await getAllInfoSettingValueBySettingName({settingName: '单位'})
if (msg.retcode && msg.data) {
@ -141,6 +245,12 @@ const UserList: React.FC<{}> = () => {
title: '现岗位',
dataIndex: 'postId',
valueType: 'select',
fieldProps: {
mode: "multiple"
},
formItemProps: {
name: 'postIds'
},
request: async () => {
const msg = await getAllInfoSettingValueBySettingName({settingName: '岗位'})
if (msg.retcode && msg.data) {
@ -158,6 +268,12 @@ const UserList: React.FC<{}> = () => {
title: '班组',
dataIndex: 'groupsId',
valueType: 'select',
fieldProps: {
mode: "multiple"
},
formItemProps: {
name: 'groupsIds'
},
request: async () => {
const msg = await getAllInfoSettingValueBySettingName({settingName: '班组'})
if (msg.retcode && msg.data) {
@ -175,6 +291,12 @@ const UserList: React.FC<{}> = () => {
title: '最高学历',
dataIndex: 'highestEducationId',
valueType: 'select',
fieldProps: {
mode: "multiple"
},
formItemProps: {
name: 'highestEducationIds'
},
request: async () => {
const msg = await getAllInfoSettingValueBySettingName({settingName: '学历'})
if (msg.retcode && msg.data) {
@ -215,6 +337,12 @@ const UserList: React.FC<{}> = () => {
title: '技能等级',
dataIndex: 'skillLevelId',
valueType: 'select',
fieldProps: {
mode: "multiple"
},
formItemProps: {
name: 'skillLevelIds'
},
request: async () => {
const msg = await getAllInfoSettingValueBySettingName({settingName: '技能等级'})
if (msg.retcode && msg.data) {
@ -232,6 +360,12 @@ const UserList: React.FC<{}> = () => {
title: '奖惩等级',
dataIndex: 'honorLevel',
valueType: 'select',
fieldProps: {
mode: "multiple"
},
formItemProps: {
name: 'honorLevels'
},
hideInTable: true,
request: async () => {
const msg = await getAllInfoSettingValueBySettingName({settingName: '奖惩等级'})
@ -279,6 +413,9 @@ const UserList: React.FC<{}> = () => {
rowKey="id"
options={false}
formRef={ref}
search={{
labelWidth: 'auto'
}}
toolBarRender={() => [
<Button
type="primary"

@ -25,6 +25,16 @@ export async function exportEmployee(params: object) {
});
}
export async function exportEmployeeDetail(params: object) {
return request(`/api/employee/exportEmployeeDetail`, {
params: {employeeVal: JSON.stringify(params)},
responseType: 'blob',
getResponse: true,
parseResponse: false,
data: { fileName: '员工明细导出' },
});
}
export async function updateRule(params: TableListItem) {
return request('/api/employee/saveEmployee', {
method: 'POST',
@ -39,6 +49,13 @@ export async function removeRule(params: TableListItem) {
});
}
export async function getPostListByDept(params: any) {
return request('/api/employee/getPostListByDept', {
method: 'POST',
data: params,
});
}
export async function getAllInfoSettingValueBySettingName(params: any) {
return request('/api/infoSettingValue/getAllInfoSettingValueBySettingName', {
method: 'POST',

Loading…
Cancel
Save