From 8ae1c17d32d6867042fe1343ff0fc082deb11a8f Mon Sep 17 00:00:00 2001 From: wuqun Date: Mon, 17 Oct 2022 17:09:39 +0800 Subject: [PATCH 1/2] =?UTF-8?q?(*)=E5=AF=BC=E5=85=A5=E4=BA=BA=E5=91=98?= =?UTF-8?q?=E4=BF=A1=E6=81=AF,=20=E4=BA=BA=E5=91=98=E7=BC=96=E5=8F=B7?= =?UTF-8?q?=E5=88=A4=E6=96=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../humanAffairs/containers/import-members-modal.js | 6 +++--- .../src/sections/humanAffairs/containers/personnelFiles.jsx | 3 ++- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/web/client/src/sections/humanAffairs/containers/import-members-modal.js b/web/client/src/sections/humanAffairs/containers/import-members-modal.js index 677e213..cf9a00c 100644 --- a/web/client/src/sections/humanAffairs/containers/import-members-modal.js +++ b/web/client/src/sections/humanAffairs/containers/import-members-modal.js @@ -238,9 +238,9 @@ const ImportMembersModal = props => { error(`第${i + 2}行人员编号为空,请填写`) return } - let xqExist = xqMembers.find(m => m.peopleCode == number); + let xqExist = xqMembers.find(m => m.userCode == number); if (!xqExist) { - error(`第${i + 2}行,项企中不存在该人员编号`) + error(`第${i + 2}行的人员编号无对应的员工信息`) return } if (postData.some(p => p.number == number)) {//人员编号 唯一 @@ -327,7 +327,7 @@ const ImportMembersModal = props => { return } postData.push({//人员编号 待办todotodo - pepUserId: xqExist.id, name, idNumber, gender, birthday, nativePlace, marital, + pepUserId: xqExist.pepUserId, name, idNumber, gender, birthday, nativePlace, marital, politicsStatus, phoneNumber, workPlace, graduatedFrom, educationBackground, specialty, graduationDate, hiredate, turnProbationPeriod, regularDate, dimissionDate, experienceYear, occupationalHistory, del: false, number diff --git a/web/client/src/sections/humanAffairs/containers/personnelFiles.jsx b/web/client/src/sections/humanAffairs/containers/personnelFiles.jsx index 7017c5f..7b3754f 100644 --- a/web/client/src/sections/humanAffairs/containers/personnelFiles.jsx +++ b/web/client/src/sections/humanAffairs/containers/personnelFiles.jsx @@ -31,6 +31,7 @@ const Rest = (props) => { }, []) function getMemberSearchList () {//搜索项企用户 + dispatch(humanAffairs.getMemberSearch()) dispatch(humanAffairs.getMemberList()).then((res) => {//搜索项企用户 if (res.success) { console.log('res.success', res.payload.data); @@ -145,7 +146,7 @@ const Rest = (props) => {
{ - archivesList.map((item, index) => { + archivesList?.rows?.map((item, index) => { return (
From da206bad02ae8376c43935e464566788b5651662 Mon Sep 17 00:00:00 2001 From: deartibers <947466799@qq.com> Date: Mon, 17 Oct 2022 18:04:45 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E4=BA=BA=E5=91=98=E6=A1=A3=E6=A1=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../humanAffairs/actions/personnelFiles.js | 42 +++++ .../components/personnelModal.jsx | 154 ++++++++-------- .../containers/personnelFiles.jsx | 108 +++++------ .../containers/personnelFilesDetail.jsx | 172 +++++++++--------- web/client/src/utils/webapi.js | 3 + 5 files changed, 268 insertions(+), 211 deletions(-) diff --git a/web/client/src/sections/humanAffairs/actions/personnelFiles.js b/web/client/src/sections/humanAffairs/actions/personnelFiles.js index fea5a7d..f85d093 100644 --- a/web/client/src/sections/humanAffairs/actions/personnelFiles.js +++ b/web/client/src/sections/humanAffairs/actions/personnelFiles.js @@ -80,3 +80,45 @@ export function getMemberOvertime(query) {//查询单个人员加班统计数据 reducer: { name: "MemberOvertime", params: { noClear: true } }, }); } + +export function getMemberVacate(query) {//查询单个人员请假统计数据 + return (dispatch) => basicAction({ + type: "get", + dispatch: dispatch, + actionType: "GET_MemberVACATE", + query: query, + url: `${ApiTable.getMemberVacate}`, + msg: { option: "查询人员请假统计数据" }, + reducer: { name: "MemberVacate", params: { noClear: true } }, + }); +} + +export function getMemberExport(query) {//导出员工信息 + return (dispatch) => basicAction({ + type: "get", + dispatch: dispatch, + actionType: "GET_MemberEXPORT", + query: query, + url: `${ApiTable.getMemberExport}`, + msg: { option: "导出员工信息" }, + reducer: { name: "MemberExport", params: { noClear: true } }, + }); +} + + +export function putMember (data) {//更新成员状态 + let msg = '' + if (data) { + msg = data.msg + } + return (dispatch) => + basicAction({ + type: "put", + dispatch: dispatch, + data, + actionType: "PUT_MEMBER", + url: `${ApiTable.putMember}`, + msg: { option: msg }, //更新成员状态 + reducer: {}, + }); +} \ No newline at end of file diff --git a/web/client/src/sections/humanAffairs/components/personnelModal.jsx b/web/client/src/sections/humanAffairs/components/personnelModal.jsx index fd39986..b8760bc 100644 --- a/web/client/src/sections/humanAffairs/components/personnelModal.jsx +++ b/web/client/src/sections/humanAffairs/components/personnelModal.jsx @@ -1,6 +1,6 @@ import React, { useState, useRef, useEffect } from "react"; import { connect } from "react-redux"; -import { Modal, Form, Button, Upload } from "@douyinfe/semi-ui"; +import { Modal, Form, Button, Upload, Notification } from "@douyinfe/semi-ui"; import { IconAlertCircle } from '@douyinfe/semi-icons'; import cityData from './city.json'; import PerfectScrollbar from "perfect-scrollbar"; @@ -48,18 +48,6 @@ function pushModal (props) { } } setUsecityData(mycityData) - // if (editObj.id) { - // let departmentList = [] - // for (let i = 0; i < pepList.length; i++) { - // if (pepList[i].id == editObj.departments[0].id) { - // departmentList = pepList[i].users - // } - // } - // setPeopleList(departmentList) - // setDepartmentId(editObj.departments[0].id) - // setPeopleId(editObj.pepUserId) - // setDisablePeople(false) - // } }, []); useEffect(() => { @@ -74,7 +62,7 @@ function pushModal (props) { } }); function memberSeach (id) {//搜索项企用户 - dispatch(humanAffairs.getMemberSearch({ keyword: id })).then((res) => {//搜索项企用户 + dispatch(humanAffairs.getMemberSearch({ code: id })).then((res) => {//搜索项企用户 if (res.success) { setPeoplePro(res.payload.data[0]) } @@ -105,31 +93,51 @@ function pushModal (props) { form.current .validate() .then((values) => { - let obj = values - if (values.nativePlace) { - if (values.nativePlace.length > 1) { - obj.nativePlace = values.nativePlace.join('-') - } - else { - obj.nativePlace = values.nativePlace[0] - } - } - if (values.workPlace) { - if (values.workPlace.length > 1) { - obj.workPlace = values.workPlace.join('-') + if (peoplePro.userCode) { + if (values.userCode == peoplePro.userCode) { + let obj = values + if (values.nativePlace) { + if (values.nativePlace.length > 1) { + obj.nativePlace = values.nativePlace.join('-') + } + else { + obj.nativePlace = values.nativePlace[0] + } + } + if (values.workPlace) { + if (values.workPlace.length > 1) { + obj.workPlace = values.workPlace.join('-') + } + else { + obj.workPlace = values.workPlace[0] + } + } + if (adminEdit) { + dispatch(humanAffairs.putMember({ pepUserId: peoplePro.pepUserId, idPhoto: idPhoto, vitae: vitae, msg: '编辑档案', ...obj })).then((res) => {//获取项企(PEP)全部部门及其下用户 + if (res.success) { + close(); + } + }) + } + else { + dispatch(humanAffairs.postMember({ pepUserId: peoplePro.pepUserId, idPhoto: idPhoto, vitae: vitae, msg: '新增档案', ...obj })).then((res) => {//获取项企(PEP)全部部门及其下用户 + if (res.success) { + close(); + } + }) + } } else { - obj.workPlace = values.workPlace[0] + Notification.error({ + content: '你填写的员工编号无对应的人员信息', + duration: 2, + }) } - } - if (adminEdit) { - } else { - dispatch(humanAffairs.postMember({ idPhoto: idPhoto, vitae: vitae, msg: '新增档案', ...obj })).then((res) => {//获取项企(PEP)全部部门及其下用户 - if (res.success) { - close(); - } + Notification.error({ + content: '你填写的员工编号无对应的人员信息', + duration: 2, }) } }) @@ -141,7 +149,7 @@ function pushModal (props) { return ( <> { console.log('values', values); - // for (var key in field) { - // if (key == 'department') { - // if (values.department >= 0) { - // let departmentList = [] - // for (let i = 0; i < pepList.length; i++) { - // if (pepList[i].id == values.department) { - // departmentList = pepList[i].users - // } - // } - // setPeopleList(departmentList) - // setDisablePeople(false) - // form.current.setValue('pepUserId', undefined); - // } - // else { - // setPeopleList([]) - // setDisablePeople(true) - // form.current.setValue('pepUserId', undefined); - // } - // } - // } }} getFormApi={(formApi) => (form.current = formApi)} > @@ -190,16 +178,16 @@ function pushModal (props) {
{ let formList = form.current.getValues() - memberSeach(formList.pepUserId) + memberSeach(formList.userCode) }}> 搜索
@@ -227,7 +215,7 @@ function pushModal (props) { 员工编号:
- {peoplePro.pepUserId} + {peoplePro.userCode}
@@ -278,10 +266,11 @@ function pushModal (props) { field="idNumber" label='证件号:' style={{ width: 364 }} - initValue={'' || ""} + maxLength="18" + initValue={editObj?.idNumber || ""} placeholder="请输入证件号" showClear - // rules={[{ required: true, message: "请输入证件号" }]} + rules={[{ pattern: "^([1-9][0-9]{14})([0-9]{2}[0-9xX])$", message: "请输入正确的证件号" },]} />
{/* idPhoto */} @@ -311,7 +300,7 @@ function pushModal (props) { field="gender" placeholder="请选择性别" style={{ width: 122 }} - initValue={departmentId || ""} + initValue={editObj?.gender || ""} showClear > @@ -328,7 +317,7 @@ function pushModal (props) { label='出生年月:' placeholder="请选择出生年月" style={{ width: 184 }} - // initValue={new Date()} + initValue={editObj?.birthday || ""} />
@@ -339,6 +328,7 @@ function pushModal (props) { label='籍贯:' showClear style={{ width: 184 }} + initValue={editObj?.nativePlace.split('-') || ""} >
@@ -350,7 +340,7 @@ function pushModal (props) { field="politicsStatus" placeholder="请选择政治面貌" style={{ width: 122 }} - initValue={'' || ""} + initValue={editObj?.politicsStatus || ""} showClear > @@ -366,10 +356,12 @@ function pushModal (props) { field="phoneNumber" label='联系方式:' style={{ width: 184 }} - initValue={'' || ""} + maxLength="11" + initValue={editObj?.phoneNumber || ""} placeholder="请输入联系方式" showClear - // rules={[{ required: true, message: "请输入证件号" }]} + rules={[{ pattern: "^1[3-9]{1}[0-9]{9}$", message: "请输入正确的联系方式" },]} + />
@@ -379,6 +371,7 @@ function pushModal (props) { field='workPlace' label='工作地点:' showClear + initValue={editObj?.workPlace.split('-') || ""} style={{ width: 184 }} > @@ -391,7 +384,7 @@ function pushModal (props) { field="marital" placeholder="请选择婚育状态" style={{ width: 122 }} - initValue={'' || ""} + initValue={editObj?.marital || ""} showClear > @@ -421,10 +414,10 @@ function pushModal (props) { field="graduatedFrom" label='毕业院校:' style={{ width: 288 }} - initValue={'' || ""} + maxLength="20" + initValue={editObj?.graduatedFrom || ""} placeholder="请输入毕业院校" showClear - // rules={[{ required: true, message: "请输入证件号" }]} />
@@ -433,7 +426,7 @@ function pushModal (props) { field="educationBackground" placeholder="小学/初中/高中/大专/本科/研究生/博士" style={{ width: 300 }} - initValue={'' || ""} + initValue={editObj?.educationBackground || ""} showClear > @@ -466,10 +459,10 @@ function pushModal (props) { field="specialty" label='专业:' style={{ width: 288 }} - initValue={'' || ""} + maxLength="20" + initValue={editObj?.specialty || ""} placeholder="请输入专业" showClear - // rules={[{ required: true, message: "请输入证件号" }]} />
@@ -478,7 +471,7 @@ function pushModal (props) { label='毕业时间:' placeholder="请选择毕业时间" style={{ width: 300 }} - // initValue={new Date()} + initValue={editObj?.graduationDate || ""} />
@@ -498,7 +491,7 @@ function pushModal (props) { label='入职时间:' placeholder="请选择入职时间" style={{ width: 288 }} - // initValue={new Date()} . + initValue={editObj?.hiredate || ""} />
@@ -508,7 +501,7 @@ function pushModal (props) { placeholder="请选择转试用期时间" labelWidth="110px" style={{ width: 288 }} - // initValue={new Date()} + initValue={editObj?.turnProbationPeriod || ""} />
@@ -523,7 +516,7 @@ function pushModal (props) { label='转正时间:' placeholder="请选择转正时间" style={{ width: 288 }} - // initValue={new Date()} + initValue={editObj?.regularDate || ""} />
@@ -533,7 +526,7 @@ function pushModal (props) { placeholder="请选择离职时间" style={{ width: 288 }} labelWidth="110px" - // initValue={new Date()} + initValue={editObj?.dimissionDate || ""} />
@@ -552,11 +545,12 @@ function pushModal (props) { {/* vitae */} @@ -590,6 +584,8 @@ function pushModal (props) { diff --git a/web/client/src/sections/humanAffairs/containers/personnelFiles.jsx b/web/client/src/sections/humanAffairs/containers/personnelFiles.jsx index 7017c5f..b7f2ca0 100644 --- a/web/client/src/sections/humanAffairs/containers/personnelFiles.jsx +++ b/web/client/src/sections/humanAffairs/containers/personnelFiles.jsx @@ -1,60 +1,49 @@ import React, { useEffect, useState } from 'react'; import { connect } from 'react-redux'; -import { Select, Input, Button, CheckboxGroup, Tooltip } from '@douyinfe/semi-ui'; +import { Select, Input, Button, RadioGroup, Radio, Tooltip } from '@douyinfe/semi-ui'; import { IconSearch } from '@douyinfe/semi-icons'; import PersonnelModal from '../components/personnelModal'; import ImportMembersModal from './import-members-modal' import '../style.less' import moment from 'moment' +import { set } from 'nprogress'; const Rest = (props) => { const { dispatch, actions, history, user, loading, socket, xqMembers } = props const { humanAffairs } = actions; - let [departmentValue, setDepartmentValue] = useState(''); let [archivesList, setArchivesList] = useState([]); const [personnelModal, setPersonnelModal] = useState(false);//档案弹框 const [exportModalVs, setExportModalVs] = useState(false); - const options = [ - { label: '离职', value: 'abc' }, - { label: '请假', value: 'hotsoon' }, - { label: '放假', value: 'pipixia' }, - { label: '在岗', value: 'toutiao' }, - { label: '加班', value: 'jiaban' } - ] - - let [seachValue, setSeachValue] = useState(''); - let [typeChoose, setTypeChoose] = useState([]); + const [keyword, setKeyword] = useState('');//搜索内容 + const [keywordTarget, setKeywordTarget] = useState('');//搜索类型 + const [downloadUrl, setDownloadUrl] = useState('') + const optionsList = { + dimission: '离职', + onJob: '在职', + vacate: '请假', + inOffice: '在岗', + dayoff: '放假', + } + let [typeChoose, setTypeChoose] = useState(''); useEffect(() => { getMemberSearchList() - }, []) + }, [typeChoose]) function getMemberSearchList () {//搜索项企用户 - dispatch(humanAffairs.getMemberList()).then((res) => {//搜索项企用户 + dispatch(humanAffairs.getMemberList({ keywordTarget, keyword, state: typeChoose })).then((res) => {//搜索项企用户 if (res.success) { - console.log('res.success', res.payload.data); - setArchivesList(res.payload.data) - // let mytableData = JSON.parse(JSON.stringify(res.payload.data.rows)); - // let mytableKey = [] - // for (let index = 0; index < mytableData.length; index++) { - // mytableData[index].key = mytableData[index].id - // mytableKey.push(mytableData[index].id) - // } - // setTableKey(mytableKey) - // setTableData(mytableData) - // setLimits(res.payload.data.count) - // mylimits.current = res.payload.data.rows.length + setArchivesList(res.payload?.data?.rows) } }) } function typeOnChange (e) {//角色选择 - console.log('e.target.value', e.target.value); setTypeChoose(e.target.value); } - function seachValueChange () { - + function seachValueChange (value) { + setKeyword(value) } return ( <> @@ -96,22 +85,30 @@ const Rest = (props) => {
- + 职位 + 部门 + 编号 + 姓名
} showClear placeholder='请输入或选择关键词' - value={seachValue} + value={keyword} style={{ width: 346 }} onChange={seachValueChange}>
- +
@@ -120,7 +117,7 @@ const Rest = (props) => { 当前显示
- 11条 + {archivesList.length || 0}条
结果 @@ -131,15 +128,25 @@ const Rest = (props) => { 人员状态:
- + + 全部 + 离职 + 在职 +
-
+
{ + setDownloadUrl(`members/export?token=${user.token}×tamp=${moment().valueOf()}`) + + }}>
-
+
导出
+ { + downloadUrl ?