diff --git a/web/client/src/sections/humanAffairs/containers/index.js b/web/client/src/sections/humanAffairs/containers/index.js index 654d302..f93e670 100644 --- a/web/client/src/sections/humanAffairs/containers/index.js +++ b/web/client/src/sections/humanAffairs/containers/index.js @@ -4,8 +4,14 @@ import PersonnelFiles from './personnelFiles'; import PersonnelFilesDetail from './personnelFilesDetail'; import EmployeeInformation from './employeeInformation'; import WeeklyManagement from './weeklyManagement'; +import SaleLog from './saleLog'; +import PMLog from './pmLog'; import LeaveStatistics from './leaveStatistics'; import OvertimeStatistics from './overtimeStatistics'; -export { PersonnelFiles, PersonnelFilesDetail, EmployeeInformation, WeeklyManagement, LeaveStatistics, OvertimeStatistics }; \ No newline at end of file +export { + PersonnelFiles, PersonnelFilesDetail, EmployeeInformation, + WeeklyManagement, SaleLog, PMLog, + LeaveStatistics, OvertimeStatistics +}; \ No newline at end of file diff --git a/web/client/src/sections/humanAffairs/containers/pmLog.jsx b/web/client/src/sections/humanAffairs/containers/pmLog.jsx new file mode 100644 index 0000000..26b28dc --- /dev/null +++ b/web/client/src/sections/humanAffairs/containers/pmLog.jsx @@ -0,0 +1,382 @@ +import React, { useEffect, useState, useRef, useMemo } from 'react'; +import { connect } from 'react-redux'; +import { Table, Button, Pagination, Skeleton, Form, Tooltip, Banner } 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 { getServiceUrl } from '../actions/service'; + +const PMLog = (props) => { + const { dispatch, actions, history, user, loading, socket } = props; + + const form = useRef();//表单 + + const [setup, setSetup] = useState(false);//表格设置是否显现 + const [setupp, setSetupp] = useState([]);//实际显示的表格列表 + const [lookup, setLookup] = useState({});//搜索 + const [query, setQuery] = useState({ limit: 10, page: 0 }); //页码信息 + const [order, setOrder] = useState({ orderBy: 'hiredate', orderDirection: 'DESC' }); //页码信息 + const [limits, setLimits] = useState(0)//每页实际条数 + const [downloadUrl, setDownloadUrl] = useState('')//下载pdf; + const [warningBanner, setWarningBanner] = useState(null); + const PMLOG = "pmLog"; + const page = useRef(query.page);//哪一页 + + let btnDisable = false; + const tableList = [//表格属性 + { + title: '基础信息', + list: [ + { name: "姓名", value: "userName" }, + { name: "所属部门", value: "departmrnt" }, + { name: "职位", value: "roleName" }, + { name: "月度需提交次数", value: "idNumber" }, + { name: "实际提交次数", value: "number" }, + { name: "异常次数", value: "ycNumber" }, + { name: "操作", value: "action" } + ] + } + ]; + useEffect(() => { + localStorage.getItem(PMLOG) == null + ? localStorage.setItem( + PMLOG, + JSON.stringify(['userName', 'departmrnt', 'roleName', 'idNumber', 'number', 'ycNumber', 'action']) + ) + : ""; + attribute(); + }, []) + + useEffect(() => { + if (form && form.current && form.current.setValue) { + form.current.setValue("weeklyRange", [moment().startOf('isoWeek').format('YYYY-MM-DD'), moment().endOf('isoWeek').format('YYYY-MM-DD')]) + } + }, []) + + const columns = [ + { + title: ( + + 员工编号 + + ), + width: 200, + dataIndex: "userCode", + key: "userCode", + sorter: (a, b) => { }, + // sorter: (a, b) => a.name.length - b.name.length > 0 ? 1 : -1, + render: (_, r, index) => { + return (r.userCode ? r.userCode : '-'); + }, + }, + ]; + //获取表格属性设置 + function attribute() { + const arr = localStorage.getItem(PMLOG) + ? JSON.parse(localStorage.getItem(PMLOG)) + : []; + + const column = [ + { + title: ( +
+ 姓名 +
+ ), + dataIndex: "userName", + key: "userName", + render: (_, r, index) => { + return (r.userName ? r.userName : '-'); + }, + }, { + title: ( +
+ 所属部门 +
+ ), + dataIndex: "departmrnt", + key: "departmrnt", + render: (_, r, index) => { + return ( +
+ { + r.departmrnt.map((ite, idx) => { + let departmentsArr = [] + for (let i = 0; i < r.departmrnt.length; i++) { + departmentsArr.push(r.departmrnt[i].name) + } + return ( +
+ {idx == 0 ? + (
+ {ite.name} +
) : ('') + + } + { + r.departmrnt.length > 1 && idx == 1 ? ( + +
+ +{r.departmrnt.length - 1} +
+
+ ) : ('') + } +
+ ) + }) + } +
+ ) + }, + }, { + title: ( +
+ 职位 +
+ ), + dataIndex: "roleName", + key: "roleName", + render: (_, r, index) => { + return ( +
+ { + r.role.map((ite, idx) => { + let roleArr = [] + for (let i = 0; i < r.role.length; i++) { + roleArr.push(r.role[i].name) + } + return ( +
+ {idx == 0 ? + (ite.name) : ('') + } + { + r.role.length > 1 && idx == 1 ? ( + +
+ +{r.role.length - 1} +
+
+ ) : ('') + } +
+ ) + }) + } +
); + }, + }, { + title: '月度需提交次数', + dataIndex: "idNumber", + key: "idNumber", + render: (_, r, index) => { + return (r.idNumber ? r.idNumber : '-'); + }, + }, { + title: '实际提交次数', + dataIndex: "number", + key: "number", + render: (_, r, index) => { + return (r.number ? r.number : '-'); + }, + }, { + title: '异常次数', + dataIndex: "ycNumber", + key: "ycNumber", + render: (_, r, index) => { + return (r.ycNumber ? r.ycNumber : '-'); + }, + }, { + title: '操作', + dataIndex: "action", + key: "action", + render: (_, r, index) => { + return (r.vitae ? 下载 : '-') + }, + }, + ]; + 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 ( + <> +
+
+
人事管理
+
/
+
基本动作
+
/
+
工程日志
+
+
+
+
+
+
工程日志
+
PM LOG
+
+
+
+
(form.current = formApi)} + > +
+
+
+ +
+
+
+ + {/* */} + { + downloadUrl ?