import React, { useEffect, useState, useRef, useMemo } from 'react'; import { connect } from 'react-redux'; import { Table, Button, Pagination, Skeleton, Popconfirm, Tooltip } from '@douyinfe/semi-ui'; import { SkeletonScreen, Setup } from "$components"; import ImportPositionRatingModal from '../components/importPositionRating'; import '../style.less'; const PositionRating = (props) => { const { dispatch, actions, memberList } = props const { getMemberList, getPositionRating, postPositionRating, delPositionRating } = actions.humanAffairs; const form = useRef();//表单 let [archivesList, setArchivesList] = useState([]);//人员列表 const [query, setQuery] = useState({ limit: 10, page: 0 }); //页码信息 const [order, setOrder] = useState({ orderBy: 'hiredate', orderDirection: 'DESC' }); //页码信息 const [importModal, setImportModal] = useState(false); const [limits, setLimits] = useState()//每页实际条数 const page = useRef(query.page);//哪一页 useEffect(() => { getMainList() }, [query]) function getMainList(queryObj) { dispatch(getPositionRating(queryObj || query)).then((res) => { if (res.success) { setArchivesList(res.payload?.data?.rows) setLimits(res.payload?.data?.count) } }) } //获取表格属性设置 const columns = [{ title: '序号', width: 70, dataIndex: "number", key: "number", render: (_, r, index) => {index + 1}, }, { title: (
部门名称
), width: 160, dataIndex: "department", key: "department", render: (_, r, index) => { return (
{ r.department.map((ite, idx) => { let departmentsArr = [] for (let i = 0; i < r.department.length; i++) { departmentsArr.push(r.department[i].depName) } return (
{idx == 0 ? (
{ite.depName}
) : ('') } { r.department.length > 1 && idx == 1 ? (
+{r.department.length - 1}
) : ('') }
) }) }
) }, }, { title: (
姓名
), width: 100, dataIndex: "userName", key: "userName", render: (_, r, index) => { return (r.userName ? r.userName : '-'); }, }, { title: (
岗位
), width: 120, dataIndex: "userPost", key: "userPost", }, { title: '评级时间', width: 120, dataIndex: "ratingTime", key: "ratingTime", }, { title: '理论基础测评成绩', width: 150, dataIndex: "theoryBasicScore", key: "theoryBasicScore", }, { title: '理论基础测评是否通过(≥60)', width: 130, dataIndex: "theoryPassed", key: "theoryPassed", }, { title: '评级总成绩', width: 100, dataIndex: "totalScore", key: "totalScore", }, { title: '评级总成绩是否通过(K≥60)', width: 130, dataIndex: "totalRatingPassed", key: "totalRatingPassed", }, { title: '技术职级等级', width: 150, dataIndex: "technicalGrade", key: "technicalGrade", }, { title: '操作', width: 100, dataIndex: "action", key: "action", render: (text, record) =>
{ handleDel(record.id) }} position={"leftBottom"} > 删除
}]; function handleRow(record, index) {//斑马条纹 // 给偶数行设置斑马纹 if (index % 2 === 0) { return { style: { background: '#FAFCFF', } }; } else { return {}; } } const handleImportModal = () => { if (!memberList.length) { dispatch(getMemberList())//查询人员列表 } setImportModal(true); } const handleImportOk = (dataToSave) => { dispatch(postPositionRating(dataToSave)).then(res => { setImportModal(false); setQuery({ limit: 10, page: 0 }); getMainList({ limit: 10, page: 0 }); }) } const handleDel = (id) => { dispatch(delPositionRating(id)).then(res => { setQuery({ limit: 10, page: 0 }); getMainList({ limit: 10, page: 0 }); }) } const scroll = useMemo(() => ({}), []); return ( <>
档案中心
/
人员档案
/
岗位评级
岗位评级
POSITION RATING
{ handleImportModal(); }} > 导入
表格中带有认证标识" "信息的为系统基础数据,来源于项企PEP、钉钉等系统,其他数据均为导入或自定义数据
{ // if (sorter.key == 'userCode') { // if (sorter.sortOrder == 'descend') { // setOrder({ orderBy: 'code', orderDirection: 'DESC' }) // } else { // setOrder({ orderBy: 'code', orderDirection: 'ASC' }) // } // } else if (sorter.key == 'age') { // if (sorter.sortOrder == 'descend') { // setOrder({ orderBy: 'age', orderDirection: 'DESC' }) // } else { // setOrder({ orderBy: 'age', orderDirection: 'ASC' }) // } // } else { // if (sorter.sortOrder == 'descend') { // setOrder({ orderBy: 'hiredate', orderDirection: 'DESC' }) // } else { // setOrder({ orderBy: 'hiredate', orderDirection: 'ASC' }) // } // } // }} onRow={handleRow} scroll={scroll} />
共{limits}条信息 { setQuery({ limit: pageSize, page: currentPage - 1 }); page.current = currentPage - 1 }} />
{importModal ? { setImportModal(false) }} /> : ''} ) } function mapStateToProps(state) { const { auth, global, MemberSearch, MemberList } = state; return { user: auth.user, actions: global.actions, xqMembers: MemberSearch.data, memberList: MemberList.data && MemberList.data.rows || [] }; } export default connect(mapStateToProps)(PositionRating);