|
@ -1,26 +1,21 @@ |
|
|
import React, { useEffect, useState, useMemo } from 'react'; |
|
|
import React, { useEffect, useState,useRef } from 'react'; |
|
|
import { connect } from 'react-redux'; |
|
|
import { connect } from 'react-redux'; |
|
|
import { Table, Pagination, Skeleton } from '@douyinfe/semi-ui'; |
|
|
import { Table, Pagination, Skeleton } from '@douyinfe/semi-ui'; |
|
|
import { SkeletonScreen } from "$components"; |
|
|
import { SkeletonScreen } from "$components"; |
|
|
import '../style.less' |
|
|
import '../style.less' |
|
|
import ImportPersonalTrainRecord from './importPersonalTrainRecord' |
|
|
import ImportPersonalTrainRecord from './importPersonalTrainRecord' |
|
|
|
|
|
import moment from 'moment' |
|
|
|
|
|
|
|
|
const PersonalTrainRecord = (props) => { |
|
|
const PersonalTrainRecord = (props) => { |
|
|
const { dispatch, actions } = props |
|
|
const { dispatch, actions ,personalTrainRecordList} = props |
|
|
const [limits, setLimits] = useState()//每页实际条数 |
|
|
const [limits, setLimits] = useState()//每页实际条数 |
|
|
const [query, setQuery] = useState({ limit: 10, page: 0 }); //页码信息 |
|
|
const [query, setQuery] = useState({ limit: 10, page: 0 }); //页码信息 |
|
|
const [importModalV, setImportModalV] = useState(false); //页码信息 |
|
|
const [importModalV, setImportModalV] = useState(false); //页码信息 |
|
|
|
|
|
const page = useRef(query.page); |
|
|
|
|
|
const { getPersonalTrainRecord } = actions.humanAffairs |
|
|
useEffect(() => { |
|
|
useEffect(() => { |
|
|
const { getPersonalTrainRecord } = actions.humanAffairs |
|
|
|
|
|
dispatch(getPersonalTrainRecord(query)) |
|
|
dispatch(getPersonalTrainRecord(query)) |
|
|
}, []); |
|
|
}, []); |
|
|
|
|
|
|
|
|
const [tableData, setTableData] = useState([{ id: 1, personalName: '张三', departmentName: '营销第一军团', trainingType: '内部培训', topic: '新员工入职培训', trainer: '李四', trainDate: '2022-12-30 18:30', trainTime: '1小时', trainMethod: '线下', attendanceScore: '95', appraisalMethod: '笔试', appraisalScore: '86', totalScore: '80' }, { id: 2, personalName: '张三', departmentName: '营销第一军团', trainingType: '内部培训', topic: '新员工入职培训', trainer: '李四', trainDate: '2022-12-30 18:30', trainTime: '1小时', trainMethod: '线下', attendanceScore: '95', appraisalMethod: '笔试', appraisalScore: '86', totalScore: '80' }, { id: 3, personalName: '张三', departmentName: '营销第一军团', trainingType: '内部培训', topic: '新员工入职培训', trainer: '李四', trainDate: '2022-12-30 18:30', trainTime: '1小时', trainMethod: '线下', attendanceScore: '95', appraisalMethod: '笔试', appraisalScore: '86', totalScore: '80' }, { id: 4, personalName: '张三', departmentName: '营销第一军团', trainingType: '内部培训', topic: '新员工入职培训', trainer: '李四', trainDate: '2022-12-30 18:30', trainTime: '1小时', trainMethod: '线下', attendanceScore: '95', appraisalMethod: '笔试', appraisalScore: '86', totalScore: '80' }]); |
|
|
|
|
|
|
|
|
|
|
|
useEffect(() => { |
|
|
|
|
|
|
|
|
|
|
|
}, []) |
|
|
|
|
|
|
|
|
|
|
|
function handleRow(record, index) {// 给偶数行设置斑马纹 |
|
|
function handleRow(record, index) {// 给偶数行设置斑马纹 |
|
|
if (index % 2 === 0) { |
|
|
if (index % 2 === 0) { |
|
|
return { |
|
|
return { |
|
@ -68,7 +63,8 @@ const PersonalTrainRecord = (props) => { |
|
|
title: '培训时间', |
|
|
title: '培训时间', |
|
|
dataIndex: 'trainDate', |
|
|
dataIndex: 'trainDate', |
|
|
key: 'trainDate', |
|
|
key: 'trainDate', |
|
|
width: 200 |
|
|
width: 200, |
|
|
|
|
|
render: (text) => moment(text).format('YYYY-MM-DD HH:mm:ss') |
|
|
}, { |
|
|
}, { |
|
|
title: '培训时长', |
|
|
title: '培训时长', |
|
|
dataIndex: 'trainTime', |
|
|
dataIndex: 'trainTime', |
|
@ -104,9 +100,6 @@ const PersonalTrainRecord = (props) => { |
|
|
dataIndex: 'action', |
|
|
dataIndex: 'action', |
|
|
width: 120 |
|
|
width: 120 |
|
|
}]; |
|
|
}]; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return ( |
|
|
return ( |
|
|
<> |
|
|
<> |
|
|
<div style={{ padding: '0px 12px' }}> |
|
|
<div style={{ padding: '0px 12px' }}> |
|
@ -145,7 +138,7 @@ const PersonalTrainRecord = (props) => { |
|
|
> |
|
|
> |
|
|
<Table |
|
|
<Table |
|
|
columns={columns} |
|
|
columns={columns} |
|
|
dataSource={tableData} |
|
|
dataSource={personalTrainRecordList.rows} |
|
|
bordered={false} |
|
|
bordered={false} |
|
|
empty="暂无数据" |
|
|
empty="暂无数据" |
|
|
pagination={false} |
|
|
pagination={false} |
|
@ -161,15 +154,16 @@ const PersonalTrainRecord = (props) => { |
|
|
<div></div> |
|
|
<div></div> |
|
|
<div style={{ display: 'flex', }}> |
|
|
<div style={{ display: 'flex', }}> |
|
|
<span style={{ lineHeight: "30px", fontSize: 13, color: 'rgba(0,90,189,0.8)' }}> |
|
|
<span style={{ lineHeight: "30px", fontSize: 13, color: 'rgba(0,90,189,0.8)' }}> |
|
|
共{limits}条信息 |
|
|
共{personalTrainRecordList.count}条信息 |
|
|
</span> |
|
|
</span> |
|
|
<Pagination |
|
|
<Pagination |
|
|
total={limits} |
|
|
total={personalTrainRecordList.count} |
|
|
showSizeChanger |
|
|
showSizeChanger |
|
|
currentPage={query.page + 1} |
|
|
currentPage={query.page + 1} |
|
|
pageSizeOpts={[10, 20, 30, 40]} |
|
|
pageSizeOpts={[10, 20, 30, 40]} |
|
|
onChange={(currentPage, pageSize) => { |
|
|
onChange={(currentPage, pageSize) => { |
|
|
setQuery({ limit: pageSize, page: currentPage - 1 }); |
|
|
setQuery({ limit: pageSize, page: currentPage - 1 }); |
|
|
|
|
|
dispatch(getPersonalTrainRecord({ limit: pageSize, page: currentPage - 1 })); |
|
|
page.current = currentPage - 1 |
|
|
page.current = currentPage - 1 |
|
|
}} |
|
|
}} |
|
|
/> |
|
|
/> |
|
@ -179,7 +173,7 @@ const PersonalTrainRecord = (props) => { |
|
|
</div> |
|
|
</div> |
|
|
</div> |
|
|
</div> |
|
|
{ |
|
|
{ |
|
|
importModalV ? <ImportPersonalTrainRecord |
|
|
importModalV ? <ImportPersonalTrainRecord query={query} |
|
|
onCancel={() => { |
|
|
onCancel={() => { |
|
|
setImportModalV(false); |
|
|
setImportModalV(false); |
|
|
}} /> : '' |
|
|
}} /> : '' |
|
@ -190,10 +184,11 @@ const PersonalTrainRecord = (props) => { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
function mapStateToProps(state) { |
|
|
function mapStateToProps(state) { |
|
|
const { auth, global } = state; |
|
|
const { auth, global,personalTrainRecordList } = state; |
|
|
return { |
|
|
return { |
|
|
user: auth.user, |
|
|
user: auth.user, |
|
|
actions: global.actions, |
|
|
actions: global.actions, |
|
|
|
|
|
personalTrainRecordList:personalTrainRecordList.data || {} |
|
|
}; |
|
|
}; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|