Browse Source

请假统计,加班统计

master
deartibers 2 years ago
parent
commit
ee318bffcf
  1. BIN
      web/client/assets/images/hrImg/newsetup.png
  2. BIN
      web/client/assets/images/hrImg/setUp.png
  3. 33
      web/client/src/sections/humanAffairs/actions/employeeInformation.js
  4. 19
      web/client/src/sections/humanAffairs/containers/employeeInformation.jsx
  5. 3
      web/client/src/sections/humanAffairs/containers/index.js
  6. 429
      web/client/src/sections/humanAffairs/containers/leaveStatistics.jsx
  7. 500
      web/client/src/sections/humanAffairs/containers/overtimeStatistics.jsx
  8. 2
      web/client/src/sections/humanAffairs/nav-item.jsx
  9. 7
      web/client/src/sections/humanAffairs/routes.js
  10. 3
      web/client/src/utils/webapi.js

BIN
web/client/assets/images/hrImg/newsetup.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.2 KiB

BIN
web/client/assets/images/hrImg/setUp.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.0 KiB

33
web/client/src/sections/humanAffairs/actions/employeeInformation.js

@ -24,3 +24,36 @@ export function getMemberWorkPlace(query) {//查询工作地列表
reducer: { name: "MemberWorkPlace", params: { noClear: true } },
});
}
export function getAttendanceVacate(query) {//请假统计
return (dispatch) => basicAction({
type: "get",
dispatch: dispatch,
actionType: "GET_ATTENDANCEVACATE",
query: query,
url: `${ApiTable.getAttendanceVacate}`,
msg: { option: "请假统计" },
reducer: { name: "AttendanceVacate", params: { noClear: true } },
});
}
export function getAttendanceVacateType(query) {//请假类型
return (dispatch) => basicAction({
type: "get",
dispatch: dispatch,
actionType: "GET_ATTENDANCEVACATETYPE",
query: query,
url: `${ApiTable.getAttendanceVacateType}`,
msg: { option: "请假类型" },
reducer: { name: "AttendanceVacateType", params: { noClear: true } },
});
}
export function getAttendanceOvertime(query) {//加班统计
return (dispatch) => basicAction({
type: "get",
dispatch: dispatch,
actionType: "GET_ATTENDANCEOVERTIME",
query: query,
url: `${ApiTable.getAttendanceOvertime}`,
msg: { option: "加班统计" },
reducer: { name: "AttendanceOvertime", params: { noClear: true } },
});
}

19
web/client/src/sections/humanAffairs/containers/employeeInformation.jsx

@ -72,7 +72,6 @@ const employeeInformation = (props) => {
useEffect(() => {
getMemberNativePlaceList()//
getMemberWorkPlaceList()//
attribute();
localStorage.getItem(EMPLOYEEINFORMATION) == null
? localStorage.setItem(
EMPLOYEEINFORMATION,
@ -82,6 +81,7 @@ const employeeInformation = (props) => {
'occupationalHistory', 'vitae'])
)
: "";
attribute();
}, [])
useEffect(() => {
getMemberSearchList()//
@ -438,7 +438,7 @@ const employeeInformation = (props) => {
labelAlign="right"
labelWidth="80px"
onValueChange={(values, field) => {
console.log('values', values);
// console.log('values', values);
}}
getFormApi={(formApi) => (form.current = formApi)}
>
@ -449,7 +449,7 @@ const employeeInformation = (props) => {
field="keywordTarget"
placeholder="请选择搜索类型"
style={{ width: 200 }}
showClear
initValue={"role"}
>
<Form.Select.Option value='role'>职位</Form.Select.Option>
<Form.Select.Option value='dep'>部门</Form.Select.Option>
@ -529,20 +529,27 @@ const employeeInformation = (props) => {
<div style={{ width: 20, height: 20, cursor: "pointer", marginRight: 15 }}
onClick={() => {
let obj = form.current.getValues()
setDownloadUrl(`members/export?token=${user.token}&keywordTarget=${obj.keywordTarget ? obj.keywordTarget : ''}&keyword=${obj.keyword ? obj.keyword : ''}&marital=${obj.marital ? obj.marital : ''}&native=${obj.native ? obj.native : ''}&workPlace=${obj.workPlace ? obj.workPlace : ''}`)
if (form.current.getValues().entryTime?.length > 1) {
obj.hiredateStart = moment(form.current.getValues().entryTime[0]).format('YYYY-MM-DD')
obj.hiredateEnd = moment(form.current.getValues().entryTime[1]).format('YYYY-MM-DD')
}
else {
obj.hiredateStart = ''
obj.hiredateEnd = ''
}
setDownloadUrl(`members/export?token=${user.token}&keywordTarget=${obj.keywordTarget ? obj.keywordTarget : ''}&keyword=${obj.keyword ? obj.keyword : ''}&marital=${obj.marital ? obj.marital : ''}&native=${obj.native ? obj.native : ''}&workPlace=${obj.workPlace ? obj.workPlace : ''}&hiredateStart=${obj.hiredateStart}&hiredateEnd=${obj.hiredateEnd}&limit=${query.limit}&page=${query.page}`)
}}>
<img src="/assets/images/hrImg/export.png" alt="" style={{ width: '100%', height: '100%' }} />
{
downloadUrl ? <iframe src={`/_api/${downloadUrl}`} style={{ display: 'none' }} /> : ''
}
</div>
<img src="/assets/images/hrImg/setup.png" alt="" style={{ width: 20, height: 20, cursor: "pointer", marginRight: 15 }}
<img src="/assets/images/hrImg/newsetup.png" alt="" style={{ width: 20, height: 20, cursor: "pointer", marginRight: 15 }}
onClick={() => setSetup(true)}
/>
<Button theme='solid' type='primary' style={{ width: 80, borderRadius: 2, height: 32, background: '#DBECFF', color: '#005ABD' }}
onClick={() => {
setQuery({ limit: 10, page: 0 })
getMemberSearchList()
}}>查询</Button>
</div>
</div>

3
web/client/src/sections/humanAffairs/containers/index.js

@ -4,6 +4,7 @@ import PersonnelFiles from './personnelFiles';
import PersonnelFilesDetail from './personnelFilesDetail';
import EmployeeInformation from './employeeInformation';
import LeaveStatistics from './leaveStatistics';
import OvertimeStatistics from './overtimeStatistics';
export { PersonnelFiles, PersonnelFilesDetail, EmployeeInformation, LeaveStatistics };
export { PersonnelFiles, PersonnelFilesDetail, EmployeeInformation, LeaveStatistics,OvertimeStatistics };

429
web/client/src/sections/humanAffairs/containers/leaveStatistics.jsx

@ -15,117 +15,79 @@ const leaveStatistics = (props) => {
const form = useRef();//
let [archivesList, setArchivesList] = useState([]);//
let [workPlaceList, setWorkPlaceList] = useState([]);//
let [nativeList, setNativeList] = useState([]);//
let [mytypeList, setTypeList] = useState([]);//
const [setup, setSetup] = useState(false);//
const [setupp, setSetupp] = useState([]);//
const [query, setQuery] = useState({ limit: 10, page: 0 }); //
const [order, setOrder] = useState({ orderBy: 'hiredate', orderDirection: 'DESC' }); //
const [limits, setLimits] = useState()//
const [downloadUrl, setDownloadUrl] = useState('')//pdf
const EMPLOYEEINFORMATION = "employeeInformation";
const LEAVESTATISTICS = "leaveStatistics";
const page = useRef(query.page);//
const tableList = [//
{
title: '基础信息',
const [tableList, setTableList] = useState([{
title: '展示信息',
list: [
{ name: "姓名", value: "userName" },
{ name: "所属部门", value: "departmrnt" },
{ name: "职位", value: "roleName" },
{ name: "证件号", value: "idNumber" },
{ name: "性别", value: "gender" },
{ name: "籍贯", value: "nativePlace" },
{ name: "出生日期", value: "birthday" },
{ name: "婚育状态", value: "marital" },
{ name: "政治面貌", value: "politicsStatus" },
{ name: "联系方式", value: "phoneNumber" },
{ name: "工作地点", value: "workPlace" },
]
}, {
title: '学历信息',
list: [
{ name: "毕业院校", value: "graduatedFrom" },
{ name: "学历", value: "educationBackground" },
{ name: "专业", value: "specialty" },
{ name: "毕业时间", value: "graduationDate" },
{ name: "合计请假时长", value: "vacateDayStatisticDuration" },
{ name: "合计请假次数", value: "vacateCount" },
]
}, {
title: '学历信息',
list: [
{ name: "入职时间", value: "hiredate" },
{ name: "转正时间", value: "regularDate" },
{ name: "转试用期时间", value: "turnProbationPeriod" },
{ name: "离职日期", value: "dimissionDate" },
{ name: "入职年限", value: "employmentLife" },
{ name: "试用期时间", value: "probationPeriodDate" },
{ name: "工作经验", value: "experienceYear" },
]
}, {
title: '履历信息',
list: [
{ name: "历史工作经历与职务", value: "occupationalHistory" },
{ name: "简历", value: "vitae" },
]
}
];
}]);//
useEffect(() => {
getMemberNativePlaceList()//
getMemberWorkPlaceList()//
attribute();
localStorage.getItem(EMPLOYEEINFORMATION) == null
localStorage.getItem(LEAVESTATISTICS) == null
? localStorage.setItem(
EMPLOYEEINFORMATION,
JSON.stringify(['userName', 'departmrnt', 'roleName', 'idNumber', 'gender', 'nativePlace', 'birthday', 'marital', 'politicsStatus', 'phoneNumber', 'workPlace',
'graduatedFrom', 'educationBackground', 'specialty', 'graduationDate',
'hiredate', 'regularDate', 'turnProbationPeriod', 'dimissionDate', 'employmentLife', 'probationPeriodDate', 'experienceYear',
'occupationalHistory', 'vitae'])
LEAVESTATISTICS,
JSON.stringify(['userName', 'departmrnt', 'roleName', 'vacateCount', 'vacateDayStatisticDuration'])
)
: "";
getAttendanceVacateTypeList()
}, [])
useEffect(() => {
getMemberSearchList()//
}, [query])
getAttendanceVacateList()//
}, [query, order])
function getMemberSearchList () {//
function getAttendanceVacateList () {//
let obj = form.current.getValues()
if (form.current.getValues().entryTime?.length > 1) {
obj.hiredateStart = moment(form.current.getValues().entryTime[0]).format('YYYY-MM-DD')
obj.hiredateEnd = moment(form.current.getValues().entryTime[1]).format('YYYY-MM-DD')
obj.startDate = moment(form.current.getValues().entryTime[0]).format('YYYY-MM-DD')
obj.endDate = moment(form.current.getValues().entryTime[1]).format('YYYY-MM-DD')
}
else {
obj.hiredateStart = ''
obj.hiredateEnd = ''
obj.startDate = ''
obj.endDate = ''
}
dispatch(humanAffairs.getMemberList({ ...obj, ...query })).then((res) => {//
dispatch(humanAffairs.getAttendanceVacate({ ...obj, ...query, ...order })).then((res) => {//
if (res.success) {
setArchivesList(res.payload?.data?.rows)
setLimits(res.payload?.data?.count)
}
})
}
function getMemberNativePlaceList () {
dispatch(humanAffairs.getMemberNativePlace()).then((res) => {//
function getAttendanceVacateTypeList () {
dispatch(humanAffairs.getAttendanceVacateType()).then((res) => {//
if (res.success) {
setNativeList(res.payload?.data)
let myTableList = tableList
for (let i = 0; i < res.payload?.data?.length; i++) {
myTableList[0].list.push({ name: res.payload?.data[i].type, value: res.payload?.data[i].type },)
}
})
}
function getMemberWorkPlaceList () {
dispatch(humanAffairs.getMemberWorkPlace()).then((res) => {//
if (res.success) {
setWorkPlaceList(res.payload?.data)
setTypeList(res.payload?.data)
setTableList(myTableList)
attribute(res.payload?.data);
}
})
}
const columns = [
{
title: (
<div>
<span>
<img src="/assets/images/hrImg/V.png" alt="" style={{ width: 14, height: 14 }} /> 员工编号
</div>
</span>
),
width: 120,
width: 200,
dataIndex: "userCode",
key: "userCode",
render: (_, r, index) => {
@ -134,12 +96,12 @@ const leaveStatistics = (props) => {
},
];
//
function attribute () {
const arr = localStorage.getItem(EMPLOYEEINFORMATION)
? JSON.parse(localStorage.getItem(EMPLOYEEINFORMATION))
function attribute (typeList) {
const arr = localStorage.getItem(LEAVESTATISTICS)
? JSON.parse(localStorage.getItem(LEAVESTATISTICS))
: [];
const column = [
let column = [
{
title: (
<div>
@ -163,7 +125,7 @@ const leaveStatistics = (props) => {
key: "departmrnt",
render: (_, r, index) => {
return (
<div>
<div style={{ display: 'flex' }}>
{
r.departmrnt.map((ite, idx) => {
let departmentsArr = []
@ -206,187 +168,44 @@ const leaveStatistics = (props) => {
render: (_, r, index) => {
return (r.roleName ? r.roleName : '-');
},
}, {
title: '证件号',
width: 180,
dataIndex: "idNumber",
key: "idNumber",
render: (_, r, index) => {
return (r.idNumber ? r.idNumber : '-');
},
}, {
title: '性别',
width: 60,
dataIndex: "gender",
key: "gender",
render: (_, r, index) => {
return (r.gender ? r.gender : '-');
},
}, {
title: '籍贯',
width: 150,
dataIndex: "nativePlace",
key: "nativePlace",
render: (_, r, index) => {
return (r.nativePlace ? r.nativePlace : '-');
},
}, {
title: '出生日期',
width: 120,
dataIndex: "birthday",
key: "birthday",
render: (_, r, index) => {
return (r.birthday ? r.birthday : '-');
},
}, {
title: '婚育状态',
width: 100,
dataIndex: "marital",
key: "marital",
render: (_, r, index) => {
return (r.marital ? r.marital : '-');
},
}, {
title: '政治面貌',
width: 100,
dataIndex: "politicsStatus",
key: "politicsStatus",
render: (_, r, index) => {
return (r.politicsStatus ? r.politicsStatus : '-');
},
}, {
title: '联系方式',
width: 120,
dataIndex: "phoneNumber",
key: "phoneNumber",
render: (_, r, index) => {
return (r.phoneNumber ? r.phoneNumber : '-');
},
}, {
title: '工作地点',
width: 150,
dataIndex: "workPlace",
key: "workPlace",
render: (_, r, index) => {
return (r.workPlace ? r.workPlace : '-');
},
}, {
title: '毕业院校',
width: 200,
dataIndex: "graduatedFrom",
key: "graduatedFrom",
render: (_, r, index) => {
return (r.graduatedFrom ? r.graduatedFrom : '-');
},
}, {
title: '学历',
width: 60,
dataIndex: "educationBackground",
key: "educationBackground",
render: (_, r, index) => {
return (r.educationBackground ? r.educationBackground : '-');
},
}, {
title: '专业',
width: 200,
dataIndex: "specialty",
key: "specialty",
render: (_, r, index) => {
return (r.specialty ? r.specialty : '-');
},
}, {
title: '毕业时间',
width: 120,
dataIndex: "graduationDate",
key: "graduationDate",
render: (_, r, index) => {
return (r.graduationDate ? r.graduationDate : '-');
},
}, {
title: '入职时间',
width: 120,
dataIndex: "hiredate",
key: "hiredate",
render: (_, r, index) => {
return (r.hiredate ? r.hiredate : '-');
},
}, {
title: '转正时间',
width: 120,
dataIndex: "regularDate",
key: "regularDate",
render: (_, r, index) => {
return (r.regularDate ? r.regularDate : '-');
},
}, {
title: '转试用期时间',
width: 120,
dataIndex: "turnProbationPeriod",
key: "turnProbationPeriod",
render: (_, r, index) => {
return (r.turnProbationPeriod ? r.turnProbationPeriod : '-');
},
}, {
title: '离职日期',
width: 120,
dataIndex: "dimissionDate",
key: "dimissionDate",
render: (_, r, index) => {
return (r.dimissionDate ? r.dimissionDate : '-');
},
}, {
title: '入职年限',
width: 120,
dataIndex: "employmentLife",
key: "employmentLife",
render: (_, r, index) => {
return (r.hiredate ? <span style={{ color: '#1890FF' }}>{moment(new Date()).diff(r.hiredate, 'years') + '年'}</span> : '-')
},
}, {
title: '试用期时间',
width: 120,
dataIndex: "probationPeriodDate",
key: "probationPeriodDate",
render: (_, r, index) => {
return (r.regularDate ? moment(r.regularDate).diff(r.hiredate, 'months', true).toFixed(1) + '个月' : '-')
},
}, {
title: '工作经验',
width: 120,
dataIndex: "experienceYear",
key: "experienceYear",
render: (_, r, index) => {
return (r.experienceYear ? r.experienceYear + '年' : '-')
},
}, {
title: '历史工作经历与职务',
width: 200,
dataIndex: "occupationalHistory",
key: "occupationalHistory",
];
for (let j = 0; j < typeList.length; j++) {
column.push({
title: (typeList[j].type + '/h'),
width: 160,
dataIndex: typeList[j].type,
key: typeList[j].type,
render: (_, r, index) => {
return (r.occupationalHistory ?
(
<Tooltip content={r.occupationalHistory} style={{ lineHeight: 2 }}>
<div style={{
textOverflow: 'ellipsis',
overflow: 'hidden',
whiteSpace: 'nowrap',
width: 200
}}>{r.occupationalHistory}</div>
</Tooltip>
return (r.vacateStatistic.findIndex(((ev) => {
return ev.type == typeList[j].type
})) !== -1 ? r.vacateStatistic[r.vacateStatistic.findIndex(((ev) => {
return ev.type == typeList[j].type
}))].duration / 3600 : '0')
) : '-')
},
}, {
title: '简历',
width: 200,
dataIndex: "vitae",
key: "vitae",
})
}
column.push({
title: '合计请假时长/h',
width: 160,
dataIndex: "vacateDayStatisticDuration",
key: "vacateDayStatisticDuration",
sorter: (a, b) => { },
render: (_, r, index) => {
return (r.vitae ? <a href={`/_file-server/${r.vitae}`} style={{ color: '#005ABD' }}>下载</a> : '-')
return (r.vacateDayStatisticDuration ? r.vacateDayStatisticDuration / 3600 : '0')
},
})
column.push({
title: '合计请假次数/次',
width: 160,
dataIndex: "vacateCount",
key: "vacateCount",
sorter: (a, b) => { },
render: (_, r, index) => {
return (r.vacateCount ? r.vacateCount : '0')
},
];
})
for (let i = 0; i < arr.length; i++) {
let colum = column.filter((item) => {
return item.key === arr[i];
@ -432,18 +251,19 @@ const leaveStatistics = (props) => {
labelAlign="right"
labelWidth="80px"
onValueChange={(values, field) => {
console.log('values', values);
// console.log('values', values);
}}
getFormApi={(formApi) => (form.current = formApi)}
>
<div>
<div style={{ display: 'flex', alignItems: 'center', justifyContent: 'space-between' }}>
<div style={{ display: 'flex', alignItems: 'center' }}>
<Form.Select
pure
field="keywordTarget"
placeholder="请选择搜索类型"
style={{ width: 200 }}
showClear
initValue={"role"}
>
<Form.Select.Option value='role'>职位</Form.Select.Option>
<Form.Select.Option value='dep'>部门</Form.Select.Option>
@ -460,79 +280,35 @@ const leaveStatistics = (props) => {
/>
<Form.DatePicker
label='入职时间:'
label='时间范围:'
field='entryTime' type="dateRange" density="compact" showClear style={{ width: 370, color: "#F9F9F9" }} />
</div>
<div style={{ display: 'flex', alignItems: 'center', justifyContent: 'space-between' }}>
<div style={{ display: 'flex', alignItems: 'center' }}>
<Form.Select
label="婚育状态:"
field="marital"
labelPosition="left"
placeholder="全部"
style={{ width: 246, marginRight: 20, color: "#F9F9F9", }}
showClear
>
<Form.Select.Option value=''>
全部
</Form.Select.Option>
<Form.Select.Option value='已婚已育'>
已婚已育
</Form.Select.Option>
<Form.Select.Option value='已婚'>
已婚
</Form.Select.Option>
<Form.Select.Option value='未婚'>
未婚
</Form.Select.Option>
</Form.Select>
<Form.Select
label='户籍地:'
labelPosition="left"
field='native'
style={{ width: 246, marginRight: 20, color: "#F9F9F9", }}
placeholder="全部"
showClear
>
{nativeList.map((item) => {
return (
<Form.Select.Option key={item.nativePlace} value={item.nativePlace}>
{item.nativePlace}
</Form.Select.Option>
);
})}
</Form.Select>
<Form.Select
label='工作地点:'
labelPosition="left"
field='workPlace'
style={{ width: 246, marginRight: 20, color: "#F9F9F9", }}
placeholder="全部"
showClear
>
{workPlaceList.map((item) => {
return (
<Form.Select.Option key={item.workPlace} value={item.workPlace}>
{item.workPlace}
</Form.Select.Option>
);
})}
</Form.Select>
</div>
<div style={{ display: 'flex', alignItems: 'center' }}>
<img src="/assets/images/hrImg/export.png" alt="" style={{ width: 20, height: 20, cursor: "pointer", marginRight: 15 }}
onClick={() => { setDownloadUrl(`members/export?token=${user.token}&timestamp=${moment().valueOf()}`) }}
/>
<div style={{ width: 20, height: 20, cursor: "pointer", marginRight: 15 }}
onClick={() => {
let obj = form.current.getValues()
if (form.current.getValues().entryTime?.length > 1) {
obj.startDate = moment(form.current.getValues().entryTime[0]).format('YYYY-MM-DD')
obj.endDate = moment(form.current.getValues().entryTime[1]).format('YYYY-MM-DD')
}
else {
obj.startDate = ''
obj.endDate = ''
}
setDownloadUrl(`attendance/vacate/export?token=${user.token}&keywordTarget=${obj.keywordTarget ? obj.keywordTarget : ''}&keyword=${obj.keyword ? obj.keyword : ''}&startDate=${obj.startDate}&endDate=${obj.endDate}&limit=${query.limit}&page=${query.page}}`)
}}>
<img src="/assets/images/hrImg/export.png" alt="" style={{ width: '100%', height: '100%' }} />
{
downloadUrl ? <iframe src={`/_api/${downloadUrl}`} style={{ display: 'none' }} /> : ''
}
<img src="/assets/images/hrImg/setup.png" alt="" style={{ width: 20, height: 20, cursor: "pointer", marginRight: 15 }}
</div>
<img src="/assets/images/hrImg/newsetup.png" alt="" style={{ width: 20, height: 20, cursor: "pointer", marginRight: 15 }}
onClick={() => setSetup(true)}
/>
<Button theme='solid' type='primary' style={{ width: 80, borderRadius: 2, height: 32, background: '#DBECFF', color: '#005ABD' }}
onClick={() => {
setQuery({ limit: 10, page: 0 })
getMemberSearchList()
}}>查询</Button>
</div>
</div>
@ -557,6 +333,27 @@ const leaveStatistics = (props) => {
bordered={false}
empty="暂无数据"
pagination={false}
onChange={({ sorter }) => {
if (sorter.key == 'userCode') {
if (sorter.sortOrder == 'descend') {
setOrder({ orderBy: 'code', orderDirection: 'DESC' })
} else {
setOrder({ orderBy: 'code', orderDirection: 'ASC' })
}
} else if (sorter.key == 'vacateCount') {
if (sorter.sortOrder == 'descend') {
setOrder({ orderBy: 'vacateCount', orderDirection: 'DESC' })
} else {
setOrder({ orderBy: 'vacateCount', orderDirection: 'ASC' })
}
} else {
if (sorter.sortOrder == 'descend') {
setOrder({ orderBy: 'vacateSum', orderDirection: 'DESC' })
} else {
setOrder({ orderBy: 'vacateSum', orderDirection: 'ASC' })
}
}
}}
onRow={handleRow}
scroll={scroll}
/>
@ -593,12 +390,12 @@ const leaveStatistics = (props) => {
</div>
{setup ? (
<Setup
tableType={EMPLOYEEINFORMATION}
tableType={LEAVESTATISTICS}
tableList={tableList}
length={25}
length={15}
close={() => {
setSetup(false);
attribute();
attribute(mytypeList);
}}
/>
) : (

500
web/client/src/sections/humanAffairs/containers/overtimeStatistics.jsx

@ -0,0 +1,500 @@
import React, { useEffect, useState, useRef, useMemo } from 'react';
import { connect } from 'react-redux';
import { Table, Button, Pagination, Skeleton, Form, Tooltip } from '@douyinfe/semi-ui';
import { IconSearch } from '@douyinfe/semi-icons';
import { SkeletonScreen } from "$components";
import '../style.less'
import { Setup } from "$components";
import moment from 'moment'
import { set } from 'nprogress';
const overtimeStatistics = (props) => {
const { dispatch, actions, history, user, loading, socket, xqMembers } = props
const { humanAffairs } = actions;
const form = useRef();//
let [archivesList, setArchivesList] = useState([]);//
// let [typeList, setTypeList] = useState([]);//
const [setup, setSetup] = useState(false);//
const [setupp, setSetupp] = useState([]);//
const [query, setQuery] = useState({ limit: 10, page: 0 }); //
const [order, setOrder] = useState({ orderBy: 'hiredate', orderDirection: 'DESC' }); //
const [limits, setLimits] = useState()//
const [downloadUrl, setDownloadUrl] = useState('')//pdf
const OVERTIMESTATISTICS = "overtimeStatistics";
const page = useRef(query.page);//
const [tableList, setTableList] = useState([{
title: '展示信息',
list: [
{ name: "姓名", value: "userName" },
{ name: "所属部门", value: "departmrnt" },
{ name: "职位", value: "roleName" },
{ name: "工作日-调休", value: "workdayChange" },
{ name: "普假-调休", value: "dayoffChange" },
{ name: "法定假-调休", value: "festivalsChange" },
{ name: "工作日-折算", value: "workdayConversion" },
{ name: "普假-折算", value: "dayoffConversion" },
{ name: "法定假-折算", value: "festivalsConversion" },
{ name: "合计调休加班时长", value: "overtimeTakeRestSum" },
{ name: "合计折算加班时长", value: "overtimePaySum" },
{ name: "合计加班次数", value: "overtimeCount" },
{ name: "合计加班时长", value: "overtimeSum" },
]
}]);//
useEffect(() => {
localStorage.getItem(OVERTIMESTATISTICS) == null
? localStorage.setItem(
OVERTIMESTATISTICS,
JSON.stringify(['userName', 'departmrnt', 'roleName', 'overtimeCount', 'overtimeSum'])
)
: "";
attribute();
}, [])
useEffect(() => {
getAttendanceOvertimeList()//
}, [query, order])
function getAttendanceOvertimeList () {//
let obj = form.current.getValues()
if (form.current.getValues().entryTime?.length > 1) {
obj.startDate = moment(form.current.getValues().entryTime[0]).format('YYYY-MM-DD')
obj.endDate = moment(form.current.getValues().entryTime[1]).format('YYYY-MM-DD')
}
else {
obj.startDate = ''
obj.endDate = ''
}
dispatch(humanAffairs.getAttendanceOvertime({ ...obj, ...query, ...order })).then((res) => {//
if (res.success) {
setArchivesList(res.payload?.data?.rows)
setLimits(res.payload?.data?.count)
}
})
}
const columns = [
{
title: (
<span>
<img src="/assets/images/hrImg/V.png" alt="" style={{ width: 14, height: 14 }} /> 员工编号
</span>
),
width: 200,
dataIndex: "userCode",
key: "userCode",
render: (_, r, index) => {
return (r.userCode ? r.userCode : '-');
},
},
];
//
function attribute () {
const arr = localStorage.getItem(OVERTIMESTATISTICS)
? JSON.parse(localStorage.getItem(OVERTIMESTATISTICS))
: [];
let column = [
{
title: (
<div>
<img src="/assets/images/hrImg/V.png" alt="" style={{ width: 14, height: 14 }} /> 姓名
</div>
),
width: 100,
dataIndex: "userName",
key: "userName",
render: (_, r, index) => {
return (r.userName ? r.userName : '-');
},
}, {
title: (
<div>
<img src="/assets/images/hrImg/V.png" alt="" style={{ width: 14, height: 14 }} /> 所属部门
</div>
),
width: 200,
dataIndex: "departmrnt",
key: "departmrnt",
render: (_, r, index) => {
return (
<div style={{ display: 'flex' }}>
{
r.departmrnt.map((ite, idx) => {
let departmentsArr = []
for (let i = 0; i < r.departmrnt.length; i++) {
departmentsArr.push(r.departmrnt[i].name)
}
return (
<div key={idx} style={{ display: 'flex' }}>
{idx == 0 ?
(<div style={{ padding: '0px 4px 1px 4px ', color: '#FFFFFF', fontSize: 12, background: 'rgba(0,90,189,0.8)', borderRadius: 2, marginRight: 4 }}>
{ite.name}
</div>) : ('')
}
{
r.departmrnt.length > 1 && idx == 1 ? (
<Tooltip content={departmentsArr.join(',')} trigger="click" style={{ lineHeight: 2 }}>
<div style={{ padding: '0px 4px 1px 4px ', color: '#FFFFFF', fontSize: 12, background: 'rgba(0,90,189,0.8)', borderRadius: 2, marginRight: 4, cursor: "pointer", }}>
...
</div>
</Tooltip>
) : ('')
}
</div>
)
})
}
</div>
)
},
}, {
title: (
<div>
<img src="/assets/images/hrImg/V.png" alt="" style={{ width: 14, height: 14 }} /> 职位
</div>
),
width: 150,
dataIndex: "roleName",
key: "roleName",
render: (_, r, index) => {
return (r.roleName ? r.roleName : '-');
},
}, {
title: '工作日-调休/h',
width: 140,
dataIndex: "workdayChange",
key: "workdayChange",
render: (_, r, index) => {
let num = 0
for (let i = 0; i < r.overtimeStatistic.length; i++) {
if (r.overtimeStatistic[i].dayType == 'workday' && r.overtimeStatistic[i].compensate == '调休') {
num = r.overtimeStatistic[i].duration / 3600
}
}
return (num);
},
}, {
title: '普假-调休/h',
width: 140,
dataIndex: "dayoffChange",
key: "dayoffChange",
render: (_, r, index) => {
let num = 0
for (let i = 0; i < r.overtimeStatistic.length; i++) {
if (r.overtimeStatistic[i].dayType == 'dayoff' && r.overtimeStatistic[i].compensate == '调休') {
num = r.overtimeStatistic[i].duration / 3600
}
}
return (num);
},
}, {
title: '法定假-调休/h',
width: 140,
dataIndex: "festivalsChange",
key: "festivalsChange",
render: (_, r, index) => {
let num = 0
for (let i = 0; i < r.overtimeStatistic.length; i++) {
if (r.overtimeStatistic[i].dayType == 'festivals' && r.overtimeStatistic[i].compensate == '调休') {
num = r.overtimeStatistic[i].duration / 3600
}
}
return (num);
},
}, {
title: '工作日-折算/h',
width: 140,
dataIndex: "workdayConversion",
key: "workdayConversion",
render: (_, r, index) => {
let num = 0
for (let i = 0; i < r.overtimeStatistic.length; i++) {
if (r.overtimeStatistic[i].dayType == 'workday' && r.overtimeStatistic[i].compensate !== '调休') {
num = r.overtimeStatistic[i].duration / 3600
}
}
return (num);
},
}, {
title: '普假-折算/h',
width: 140,
dataIndex: "dayoffConversion",
key: "dayoffConversion",
render: (_, r, index) => {
let num = 0
for (let i = 0; i < r.overtimeStatistic.length; i++) {
if (r.overtimeStatistic[i].dayType == 'dayoff' && r.overtimeStatistic[i].compensate !== '调休') {
num = r.overtimeStatistic[i].duration / 3600
}
}
return (num);
},
}, {
title: '法定假-折算/h',
width: 140,
dataIndex: "festivalsConversion",
key: "festivalsConversion",
render: (_, r, index) => {
let num = 0
for (let i = 0; i < r.overtimeStatistic.length; i++) {
if (r.overtimeStatistic[i].dayType == 'festivals' && r.overtimeStatistic[i].compensate !== '调休') {
num = r.overtimeStatistic[i].duration / 3600
}
}
return (num);
},
}, {
title: '合计调休加班时长/h',
width: 180,
dataIndex: "overtimeTakeRestSum",
key: "overtimeTakeRestSum",
sorter: (a, b) => { },
render: (_, r, index) => {
let num = 0
for (let i = 0; i < r.overtimeStatistic.length; i++) {
if (r.overtimeStatistic[i].compensate == '调休') {
num = num + r.overtimeStatistic[i].duration / 3600
}
}
return num;
},
}, {
title: '合计折算加班时长/h',
width: 180,
dataIndex: "overtimePaySum",
key: "overtimePaySum",
sorter: (a, b) => { },
render: (_, r, index) => {
let num = 0
for (let i = 0; i < r.overtimeStatistic.length; i++) {
if (r.overtimeStatistic[i].compensate !== '调休') {
num = num + r.overtimeStatistic[i].duration / 3600
}
}
return num;
},
}, {
title: '合计加班时长/h',
width: 160,
dataIndex: "overtimeSum",
key: "overtimeSum",
sorter: (a, b) => { },
render: (_, r, index) => {
let num = 0
for (let i = 0; i < r.overtimeStatistic.length; i++) {
num = num + r.overtimeStatistic[i].duration / 3600
}
return num;
},
}, {
title: '合计加班次数',
width: 140,
dataIndex: "overtimeCount",
key: "overtimeCount",
sorter: (a, b) => { },
render: (_, r, index) => {
return (r.overtimeCount ? r.overtimeCount : '0');
},
},
];
for (let i = 0; i < arr.length; i++) {
let colum = column.filter((item) => {
return item.key === arr[i];
});
columns.splice(i + 2, 0, colum[0]);
}
setSetupp(columns);
}
function handleRow (record, index) {//
//
if (index % 2 === 0) {
return {
style: {
background: '#FAFCFF',
}
};
} else {
return {};
}
}
const scroll = useMemo(() => ({}), []);
return (
<>
<div style={{ padding: '0px 12px' }}>
<div style={{ display: 'flex' }}>
<div style={{ color: 'rgba(0,0,0,0.45)', fontSize: 14 }}>人事管理</div>
<div style={{ color: 'rgba(0,0,0,0.45)', fontSize: 14, margin: '0px 8px' }}>/</div>
<div style={{ color: 'rgba(0,0,0,0.45)', fontSize: 14 }}>档案中心</div>
<div style={{ color: '#033C9A', fontSize: 14, margin: '0px 8px' }}>/</div>
<div style={{ color: '#033C9A', fontSize: 14 }}>人员档案</div>
</div>
<div style={{ background: '#FFFFFF', boxShadow: '0px 0px 12px 2px rgba(220,222,224,0.2)', borderRadius: 2, padding: '20px 0px 20px 19px ', marginTop: 12 }}>
<div style={{ display: 'flex', alignItems: 'center', justifyContent: 'space-between' }}>
<div style={{ display: 'flex', alignItems: 'baseline' }}>
<div style={{ width: 0, height: 20, borderLeft: '3px solid #0F7EFB', borderTop: '3px solid transparent', borderBottom: '3px solid transparent' }}></div>
<div style={{ fontFamily: "YouSheBiaoTiHei", fontSize: 24, color: '#033C9A', marginLeft: 8 }}>员工信息</div>
<div style={{ marginLeft: 6, fontSize: 12, color: '#969799', fontFamily: "DINExp", }}>EMPLOYEE INFORMATION</div>
</div>
</div>
<div style={{ marginRight: 20, marginTop: 18 }}>
<Form
labelPosition="left"
labelAlign="right"
labelWidth="80px"
onValueChange={(values, field) => {
console.log('values', values);
}}
getFormApi={(formApi) => (form.current = formApi)}
>
<div>
<div style={{ display: 'flex', alignItems: 'center', justifyContent: 'space-between' }}>
<div style={{ display: 'flex', alignItems: 'center' }}>
<Form.Select
pure
field="keywordTarget"
placeholder="请选择搜索类型"
style={{ width: 200 }}
initValue={"role"}
>
<Form.Select.Option value='role'>职位</Form.Select.Option>
<Form.Select.Option value='dep'>部门</Form.Select.Option>
<Form.Select.Option value='number'>编号</Form.Select.Option>
<Form.Select.Option value='name'>姓名</Form.Select.Option>
</Form.Select>
<Form.Input
suffix={<IconSearch />}
field="keyword"
pure
showClear
style={{ width: 346, marginLeft: 12, marginRight: 12 }}
placeholder="请输入或选择关键词"
/>
<Form.DatePicker
label='时间范围:'
field='entryTime' type="dateRange" density="compact" showClear style={{ width: 370, color: "#F9F9F9" }} />
</div>
<div style={{ display: 'flex', alignItems: 'center' }}>
<div style={{ width: 20, height: 20, cursor: "pointer", marginRight: 15 }}
onClick={() => {
let obj = form.current.getValues()
if (form.current.getValues().entryTime?.length > 1) {
obj.startDate = moment(form.current.getValues().entryTime[0]).format('YYYY-MM-DD')
obj.endDate = moment(form.current.getValues().entryTime[1]).format('YYYY-MM-DD')
}
else {
obj.startDate = ''
obj.endDate = ''
}
setDownloadUrl(`attendance/overtime/export?token=${user.token}&keywordTarget=${obj.keywordTarget ? obj.keywordTarget : ''}&keyword=${obj.keyword ? obj.keyword : ''}&startDate=${obj.startDate}&endDate=${obj.endDate}&limit=${query.limit}&page=${query.page}}`)
}}>
<img src="/assets/images/hrImg/export.png" alt="" style={{ width: '100%', height: '100%' }} />
{
downloadUrl ? <iframe src={`/_api/${downloadUrl}`} style={{ display: 'none' }} /> : ''
}
</div>
<img src="/assets/images/hrImg/newsetup.png" alt="" style={{ width: 20, height: 20, cursor: "pointer", marginRight: 15 }}
onClick={() => setSetup(true)}
/>
<Button theme='solid' type='primary' style={{ width: 80, borderRadius: 2, height: 32, background: '#DBECFF', color: '#005ABD' }}
onClick={() => {
setQuery({ limit: 10, page: 0 })
}}>查询</Button>
</div>
</div>
</div>
</Form>
<div style={{ border: '1px solid #C7E1FF', background: '#F4F8FF', borderRadius: 2, height: 32, width: 669, padding: '8px 0px 7px 12px', display: 'flex', alignItems: 'center', color: '#0F7EFB', fontSize: 12 }}>
<img src="/assets/images/hrImg/!.png" alt="" style={{ width: 14, height: 14, marginRight: 8 }} />
表格中带有认证标识"
<img src="/assets/images/hrImg/V.png" alt="" style={{ width: 14, height: 14 }} />
"信息的为系统基础数据来源于项企PEP钉钉等系统其他数据均为导入或自定义数据
</div>
<div style={{ marginTop: 20 }}>
<Skeleton
// loading={loading}
loading={false}
active={true}
placeholder={SkeletonScreen()}
>
<Table
columns={setupp.filter((s) => s)}
dataSource={archivesList}
bordered={false}
empty="暂无数据"
pagination={false}
onChange={({ sorter }) => {
if (sorter.sortOrder == 'descend') {
setOrder({ orderBy: sorter.key, orderDirection: 'DESC' })
} else {
setOrder({ orderBy: sorter.key, orderDirection: 'ASC' })
}
}}
onRow={handleRow}
scroll={scroll}
/>
</Skeleton>
<div
style={{
display: "flex",
justifyContent: "space-between",
padding: "20px 20px",
}}
>
<div>
</div>
<div style={{ display: 'flex', }}>
<span style={{ lineHeight: "30px", fontSize: 13, color: 'rgba(0,90,189,0.8)' }}>
{limits}条信息
</span>
<Pagination
className="22"
total={limits}
showSizeChanger
currentPage={query.page + 1}
pageSizeOpts={[10, 20, 30, 40]}
onChange={(currentPage, pageSize) => {
setQuery({ limit: pageSize, page: currentPage - 1 });
page.current = currentPage - 1
}}
/>
</div>
</div>
</div>
</div>
</div>
</div>
{setup ? (
<Setup
tableType={OVERTIMESTATISTICS}
tableList={tableList}
length={13}
close={() => {
setSetup(false);
attribute();
}}
/>
) : (
""
)}
</>
)
}
function mapStateToProps (state) {
const { auth, global, MemberSearch, webSocket } = state;
return {
// loading: members.isRequesting,
user: auth.user,
actions: global.actions,
xqMembers: MemberSearch.data,
// socket: webSocket.socket
};
}
export default connect(mapStateToProps)(overtimeStatistics);

2
web/client/src/sections/humanAffairs/nav-item.jsx

@ -32,6 +32,8 @@ export function getNavItem (user, dispatch) {
to: '/humanAffairs/leaveManagement/leaveStatistics',
items: [{
itemKey: 'leaveStatistics', to: '/humanAffairs/leaveManagement/leaveStatistics', text: '请假统计'
},{
itemKey: 'overtimeStatistics', to: '/humanAffairs/leaveManagement/overtimeStatistics', text: '加班统计'
}]
},
]

7
web/client/src/sections/humanAffairs/routes.js

@ -1,4 +1,4 @@
import { PersonnelFiles, PersonnelFilesDetail, EmployeeInformation,LeaveStatistics } from './containers';
import { PersonnelFiles, PersonnelFilesDetail, EmployeeInformation, LeaveStatistics, OvertimeStatistics } from './containers';
export default [{
type: 'inner',
@ -36,6 +36,11 @@ export default [{
key: 'leaveStatistics',
component: LeaveStatistics,
breadcrumb: '请假统计',
}, {
path: '/overtimeStatistics',
key: 'overtimeStatistics',
component: OvertimeStatistics,
breadcrumb: '加班统计',
}]
}]
}

3
web/client/src/utils/webapi.js

@ -28,6 +28,9 @@ export const ApiTable = {
getMemberExport: 'member/export',//导出员工信息
getMemberNativePlace: 'member/native_place',//查询籍贯列表
getMemberWorkPlace: 'member/work_place',//查询工作地列表
getAttendanceVacate: 'attendance/vacate',//请假统计
getAttendanceVacateType: 'attendance/vacate/type',//请假类型
getAttendanceOvertime: 'attendance/overtime',//加班统计
};
export const RouteTable = {
apiRoot: "/api/root",

Loading…
Cancel
Save