Browse Source

合并代码解决冲突

master
deartibers 3 years ago
parent
commit
3129a6bf1e
  1. 65
      api/app/lib/controllers/member/index.js
  2. 1
      api/app/lib/index.js
  3. 418
      api/app/lib/models/member.js
  4. 4
      api/app/lib/utils/member.js
  5. 6
      api/config.js
  6. 131
      web/client/src/sections/humanAffairs/containers/import-members-modal.js
  7. 14
      web/client/src/sections/humanAffairs/containers/personnelFiles.jsx
  8. 2
      web/client/src/sections/humanAffairs/containers/table-input-rule.js

65
api/app/lib/controllers/member/index.js

@ -221,7 +221,7 @@ async function list (ctx) {
) )
.replace(/_/g, '') .replace(/_/g, '')
} }
obj[nextKey] = u[k] obj[nextKey] = u[k] == '1970-01-01 00:00:00.000000' ? null : u[k]
} }
returnD.push({ returnD.push({
...obj, ...obj,
@ -234,7 +234,7 @@ async function list (ctx) {
name: u.roleName name: u.roleName
}] : [], }] : [],
del: undefined, del: undefined,
pepuserid: undefined pepuserid: undefined,
}) })
} }
}) })
@ -382,6 +382,7 @@ async function vacateStatistics (ctx) {
async function exportData (ctx) { async function exportData (ctx) {
try { try {
const { models } = ctx.fs.dc; const { models } = ctx.fs.dc;
const { clickHouse, opts: { qiniu } } = ctx.app.fs
const { simpleExcelDown, memberList } = ctx.app.fs.utils const { simpleExcelDown, memberList } = ctx.app.fs.utils
const { keywordTarget, keyword, limit, page, state, keys = '' } = ctx.query const { keywordTarget, keyword, limit, page, state, keys = '' } = ctx.query
@ -391,6 +392,7 @@ async function exportData (ctx) {
const optionKeys = keys.split(',') const optionKeys = keys.split(',')
let exportD = [] let exportD = []
let pepUserIds = []
userRes.forEach(u => { userRes.forEach(u => {
let existUser = exportD.find(r => r.pepUserId == u.pepUserId) let existUser = exportD.find(r => r.pepUserId == u.pepUserId)
if (existUser) { if (existUser) {
@ -419,8 +421,9 @@ async function exportData (ctx) {
) )
.replace(/_/g, '') .replace(/_/g, '')
} }
obj[nextKey] = u[k] obj[nextKey] = u[k] == '1970-01-01 00:00:00.000000' ? null : u[k]
} }
pepUserIds.push(u.pepUserId)
exportD.push({ exportD.push({
...obj, ...obj,
departmrnt: u.depId ? [{ departmrnt: u.depId ? [{
@ -444,7 +447,7 @@ async function exportData (ctx) {
let header = [].concat(preHeader) let header = [].concat(preHeader)
for (let k in tableAttributes) { for (let k in tableAttributes) {
const comment = tableAttributes[k].comment const comment = tableAttributes[k].comment
if (k != 'id' && comment) { if (k != 'id' && k != 'pepUserId' && comment) {
if ([].includes(k)) { if ([].includes(k)) {
// 截住不想导出的字段 // 截住不想导出的字段
continue continue
@ -456,6 +459,56 @@ async function exportData (ctx) {
}) })
} }
} }
header = header.concat([{
title: '累计加班次数',
key: 'overTimeCount',
}, {
title: '累计加班总时长 / h',
key: 'overTimeDuration',
}, {
title: '累计请假次数',
key: 'vacateCount',
}, {
title: '累计请假总时长 / h',
key: 'vacateDuration',
},])
// 查询累计加班次数及总时长
const statisticOvertimeRes = await clickHouse.hr.query(`
SELECT
pep_user_id AS pepUserId,
count(id) AS count,
sum(duration) AS duration
FROM
overtime
WHERE pep_user_id IN (${pepUserIds.join(',')})
GROUP BY pep_user_id
`).toPromise()
const statisticVacateRes = await clickHouse.hr.query(`
SELECT
pep_user_id AS pepUserId,
count(id) AS count,
sum(duration) AS duration
FROM
vacate
WHERE pep_user_id IN (${pepUserIds.join(',')})
GROUP BY pep_user_id
`).toPromise()
exportD.forEach(d => {
d.departmrnt = d.departmrnt.map(dep => dep.name).join('、')
d.role = d.role.map(r => r.name).join('、')
d.idPhoto ? d.idPhoto = qiniu.domain + '/' + d.idPhoto : ''
d.vitae ? d.vitae = qiniu.domain + '/' + d.vitae : ''
const corOverTime = statisticOvertimeRes.find(so => so.pepUserId == d.pepUserId)
d.overTimeCount = corOverTime ? corOverTime.count : 0
d.overTimeDuration = corOverTime ? (corOverTime.duration / 3600).toFixed(1) : 0
const corVacate = statisticVacateRes.find(so => so.pepUserId == d.pepUserId)
d.vacateCount = corVacate ? corVacate.count : 0
d.vacateDuration = corVacate ? (corVacate.duration / 3600).toFixed(1) : 0
})
const fileName = `人员信息_${moment().format('YYYYMMDDHHmmss')}` + '.csv' const fileName = `人员信息_${moment().format('YYYYMMDDHHmmss')}` + '.csv'
const filePath = await simpleExcelDown({ data: exportD, header, fileName: fileName }) const filePath = await simpleExcelDown({ data: exportD, header, fileName: fileName })
@ -475,7 +528,7 @@ async function exportData (ctx) {
} }
async function addMembersBulk (ctx) { async function addMembersBulk (ctx) {
let errorMsg = { message: '批量添加员工信息失败' }; let errorMsg = { message: '导入员工信息失败' };
const transaction = await ctx.fs.dc.orm.transaction(); const transaction = await ctx.fs.dc.orm.transaction();
try { try {
const models = ctx.fs.dc.models; const models = ctx.fs.dc.models;
@ -486,7 +539,7 @@ async function addMembersBulk (ctx) {
attributes: ['pepUserId'] attributes: ['pepUserId']
}); });
data.map(d => { data.map(d => {
let exist = memberList.find(d => d.pepUserId == d.number);//项企的人员编号字段还没有 let exist = memberList.find(m => m.pepUserId == d.pepUserId);//项企的人员编号字段还没有
if (exist) { if (exist) {
editMembers.push(d); editMembers.push(d);
} else { } else {

1
api/app/lib/index.js

@ -16,6 +16,7 @@ module.exports.entry = function (app, router, opts) {
app.fs.logger.log('info', '[FS-AUTH]', 'Inject auth and api mv into router.'); app.fs.logger.log('info', '[FS-AUTH]', 'Inject auth and api mv into router.');
app.fs.api = app.fs.api || {}; app.fs.api = app.fs.api || {};
app.fs.opts = opts || {};
app.fs.utils = app.fs.utils || {}; app.fs.utils = app.fs.utils || {};
app.fs.api.authAttr = app.fs.api.authAttr || {}; app.fs.api.authAttr = app.fs.api.authAttr || {};
app.fs.api.logAttr = app.fs.api.logAttr || {}; app.fs.api.logAttr = app.fs.api.logAttr || {};

418
api/app/lib/models/member.js

@ -2,213 +2,213 @@
'use strict'; 'use strict';
module.exports = dc => { module.exports = dc => {
const DataTypes = dc.ORM; const DataTypes = dc.ORM;
const sequelize = dc.orm; const sequelize = dc.orm;
const Member = sequelize.define("member", { const Member = sequelize.define("member", {
pepUserId: { pepUserId: {
type: DataTypes.INTEGER, type: DataTypes.INTEGER,
allowNull: false, allowNull: false,
defaultValue: null, defaultValue: null,
comment: "项企用户id", comment: "项企用户id",
primaryKey: true, primaryKey: true,
field: "pep_user_id", field: "pep_user_id",
autoIncrement: false, autoIncrement: false,
unique: "member_pep_user_id_uindex" unique: "member_pep_user_id_uindex"
}, },
idNumber: { idNumber: {
type: DataTypes.STRING, type: DataTypes.STRING,
allowNull: true, allowNull: true,
defaultValue: null, defaultValue: null,
comment: "证件号", comment: "证件号",
primaryKey: false, primaryKey: false,
field: "id_number", field: "id_number",
autoIncrement: false autoIncrement: false
}, },
idPhoto: { idPhoto: {
type: DataTypes.STRING, type: DataTypes.STRING,
allowNull: true, allowNull: true,
defaultValue: null, defaultValue: null,
comment: "证件照", comment: "证件照",
primaryKey: false, primaryKey: false,
field: "id_photo", field: "id_photo",
autoIncrement: false autoIncrement: false
}, },
gender: { gender: {
type: DataTypes.STRING, type: DataTypes.STRING,
allowNull: true, allowNull: true,
defaultValue: null, defaultValue: null,
comment: "性别", comment: "性别",
primaryKey: false, primaryKey: false,
field: "gender", field: "gender",
autoIncrement: false autoIncrement: false
}, },
birthday: { birthday: {
type: DataTypes.DATEONLY, type: DataTypes.DATEONLY,
allowNull: true, allowNull: true,
defaultValue: null, defaultValue: null,
comment: "出生年月", comment: "出生年月",
primaryKey: false, primaryKey: false,
field: "birthday", field: "birthday",
autoIncrement: false autoIncrement: false
}, },
nativePlace: { nativePlace: {
type: DataTypes.STRING, type: DataTypes.STRING,
allowNull: true, allowNull: true,
defaultValue: null, defaultValue: null,
comment: "籍贯", comment: "籍贯",
primaryKey: false, primaryKey: false,
field: "native_place", field: "native_place",
autoIncrement: false autoIncrement: false
}, },
marital: { marital: {
type: DataTypes.STRING, type: DataTypes.STRING,
allowNull: true, allowNull: true,
defaultValue: null, defaultValue: null,
comment: "婚育状态", comment: "婚育状态",
primaryKey: false, primaryKey: false,
field: "marital", field: "marital",
autoIncrement: false autoIncrement: false
}, },
politicsStatus: { politicsStatus: {
type: DataTypes.STRING, type: DataTypes.STRING,
allowNull: true, allowNull: true,
defaultValue: null, defaultValue: null,
comment: "整治面貌", comment: "整治面貌",
primaryKey: false, primaryKey: false,
field: "politics_status", field: "politics_status",
autoIncrement: false autoIncrement: false
}, },
phoneNumber: { phoneNumber: {
type: DataTypes.STRING, type: DataTypes.STRING,
allowNull: true, allowNull: true,
defaultValue: null, defaultValue: null,
comment: null, comment: '手机号码',
primaryKey: false, primaryKey: false,
field: "phone_number", field: "phone_number",
autoIncrement: false autoIncrement: false
}, },
workPlace: { workPlace: {
type: DataTypes.STRING, type: DataTypes.STRING,
allowNull: true, allowNull: true,
defaultValue: null, defaultValue: null,
comment: "工作地点", comment: "工作地点",
primaryKey: false, primaryKey: false,
field: "work_place", field: "work_place",
autoIncrement: false autoIncrement: false
}, },
graduatedFrom: { graduatedFrom: {
type: DataTypes.STRING, type: DataTypes.STRING,
allowNull: true, allowNull: true,
defaultValue: null, defaultValue: null,
comment: "毕业院校", comment: "毕业院校",
primaryKey: false, primaryKey: false,
field: "graduated_from", field: "graduated_from",
autoIncrement: false autoIncrement: false
}, },
educationBackground: { educationBackground: {
type: DataTypes.STRING, type: DataTypes.STRING,
allowNull: true, allowNull: true,
defaultValue: null, defaultValue: null,
comment: "学历", comment: "学历",
primaryKey: false, primaryKey: false,
field: "education_background", field: "education_background",
autoIncrement: false autoIncrement: false
}, },
specialty: { specialty: {
type: DataTypes.STRING, type: DataTypes.STRING,
allowNull: true, allowNull: true,
defaultValue: null, defaultValue: null,
comment: "专业", comment: "专业",
primaryKey: false, primaryKey: false,
field: "specialty", field: "specialty",
autoIncrement: false autoIncrement: false
}, },
graduationDate: { graduationDate: {
type: DataTypes.DATEONLY, type: DataTypes.DATEONLY,
allowNull: true, allowNull: true,
defaultValue: null, defaultValue: null,
comment: "毕业时间", comment: "毕业时间",
primaryKey: false, primaryKey: false,
field: "graduation_date", field: "graduation_date",
autoIncrement: false autoIncrement: false
}, },
hiredate: { hiredate: {
type: DataTypes.DATEONLY, type: DataTypes.DATEONLY,
allowNull: true, allowNull: true,
defaultValue: null, defaultValue: null,
comment: "入职时间", comment: "入职时间",
primaryKey: false, primaryKey: false,
field: "hiredate", field: "hiredate",
autoIncrement: false autoIncrement: false
}, },
turnProbationPeriod: { turnProbationPeriod: {
type: DataTypes.DATEONLY, type: DataTypes.DATEONLY,
allowNull: true, allowNull: true,
defaultValue: null, defaultValue: null,
comment: "转试用期时间", comment: "转试用期时间",
primaryKey: false, primaryKey: false,
field: "turn_probation_period", field: "turn_probation_period",
autoIncrement: false autoIncrement: false
}, },
regularDate: { regularDate: {
type: DataTypes.DATEONLY, type: DataTypes.DATEONLY,
allowNull: true, allowNull: true,
defaultValue: null, defaultValue: null,
comment: "转正时间", comment: "转正时间",
primaryKey: false, primaryKey: false,
field: "regular_date", field: "regular_date",
autoIncrement: false autoIncrement: false
}, },
dimissionDate: { dimissionDate: {
type: DataTypes.DATEONLY, type: DataTypes.DATEONLY,
allowNull: true, allowNull: true,
defaultValue: null, defaultValue: null,
comment: "离职时间", comment: "离职时间",
primaryKey: false, primaryKey: false,
field: "dimission_date", field: "dimission_date",
autoIncrement: false autoIncrement: false
}, },
experienceYear: { experienceYear: {
type: DataTypes.INTEGER, type: DataTypes.INTEGER,
allowNull: true, allowNull: true,
defaultValue: null, defaultValue: null,
comment: "工作经验/年", comment: "工作经验/年",
primaryKey: false, primaryKey: false,
field: "experience_year", field: "experience_year",
autoIncrement: false autoIncrement: false
}, },
occupationalHistory: { occupationalHistory: {
type: DataTypes.TEXT, type: DataTypes.TEXT,
allowNull: true, allowNull: true,
defaultValue: null, defaultValue: null,
comment: "工作经历", comment: "工作经历",
primaryKey: false, primaryKey: false,
field: "occupational_history", field: "occupational_history",
autoIncrement: false autoIncrement: false
}, },
vitae: { vitae: {
type: DataTypes.STRING, type: DataTypes.STRING,
allowNull: true, allowNull: true,
defaultValue: null, defaultValue: null,
comment: "简历", comment: "简历",
primaryKey: false, primaryKey: false,
field: "vitae", field: "vitae",
autoIncrement: false autoIncrement: false
}, },
del: { del: {
type: DataTypes.BOOLEAN, type: DataTypes.BOOLEAN,
allowNull: true, allowNull: true,
defaultValue: null, defaultValue: null,
comment: null, comment: null,
primaryKey: false, primaryKey: false,
field: "del", field: "del",
autoIncrement: false autoIncrement: false
} }
}, { }, {
tableName: "member", tableName: "member",
comment: "", comment: "",
indexes: [] indexes: []
}); });
dc.models.Member = Member; dc.models.Member = Member;
return Member; return Member;
}; };

4
api/app/lib/utils/member.js

@ -67,7 +67,7 @@ module.exports = function (app, opts) {
INNER JOIN ${pepEmis}.user AS user INNER JOIN ${pepEmis}.user AS user
ON member.pep_user_id = user.id ON member.pep_user_id = user.id
${keywordTarget == 'number' && keyword ? ` ${keywordTarget == 'number' && keyword ? `
AND user.id LIKE '%${keyword}%' AND toString(user.id) LIKE '%${keyword}%'
`: ''} `: ''}
${keywordTarget == 'name' && keyword ? ` ${keywordTarget == 'name' && keyword ? `
AND user.name LIKE '%${keyword}%' AND user.name LIKE '%${keyword}%'
@ -138,7 +138,7 @@ module.exports = function (app, opts) {
${whereOption.length ? `WHERE ${whereOption.join(' AND ')}` : ''} ${whereOption.length ? `WHERE ${whereOption.join(' AND ')}` : ''}
`).toPromise() `).toPromise()
return userRes return userRes
} }

6
api/config.js

@ -107,6 +107,12 @@ const product = {
'INTERNALLY_TERMINATED' //流程异常结束 'INTERNALLY_TERMINATED' //流程异常结束
] ]
}, },
qiniu: {
domain: QINIU_DOMAIN_QNDMN_RESOURCE,
bucket: QINIU_BUCKET_RESOURCE,
accessKey: QINIU_AK,
secretKey: QINIU_SK
},
redis: { redis: {
host: IOTA_REDIS_SERVER_HOST, host: IOTA_REDIS_SERVER_HOST,
port: IOTA_REDIS_SERVER_PORT, port: IOTA_REDIS_SERVER_PORT,

131
web/client/src/sections/humanAffairs/containers/import-members-modal.js

@ -1,4 +1,5 @@
'use strict'; 'use strict';
import moment from 'moment';
import React, { useState } from 'react'; import React, { useState } from 'react';
import { connect } from 'react-redux'; import { connect } from 'react-redux';
import { Modal, Form, Button, Notification } from '@douyinfe/semi-ui'; import { Modal, Form, Button, Notification } from '@douyinfe/semi-ui';
@ -10,7 +11,7 @@ import ExportJsonExcel from 'js-export-excel';
import { rule } from './table-input-rule' import { rule } from './table-input-rule'
//下载模板和上传文件读取 //下载模板和上传文件读取
const ImportMembersModal = props => { const ImportMembersModal = props => {
const { dispatch, onCancel } = props const { dispatch, onCancel, xqMembers } = props
const [msg, setMsg] = useState('') const [msg, setMsg] = useState('')
const [loading, setLoading] = useState('') const [loading, setLoading] = useState('')
const [postData, setPostData] = useState([]) const [postData, setPostData] = useState([])
@ -20,13 +21,13 @@ const ImportMembersModal = props => {
setLoading(true) setLoading(true)
dispatch(membersBulkAdd(postData)).then(res => { dispatch(membersBulkAdd(postData)).then(res => {
if (res.success) { if (res.success) {
Notification.success('导入员工信息成功') //Notification.success({ content: '导入员工信息成功', duration: 2 })
onCancel() onCancel()
} }
setLoading(false) setLoading(false)
}) })
} else { } else {
Notification.warn('没有数据可以提交,请上传数据文件') Notification.warning({ content: '没有数据可以提交,请上传数据文件', duration: 2 })
} }
} }
@ -110,6 +111,9 @@ const ImportMembersModal = props => {
const judgePlace = (place) => { const judgePlace = (place) => {
let valid = true; let valid = true;
if (!place) {//可以不填
return valid;
}
if (place.split('-').length == 1) {//判断籍贯 if (place.split('-').length == 1) {//判断籍贯
if (['北京市', '上海市', '天津市', '重庆市'].indexOf(place) == -1) { if (['北京市', '上海市', '天津市', '重庆市'].indexOf(place) == -1) {
valid = false; valid = false;
@ -132,10 +136,35 @@ const ImportMembersModal = props => {
return valid; return valid;
} }
const judgeTimeValid = (time) => {
let valid = true;
if (!time) {
return valid;//可以不填
}
const ymd = /^((19|20)[0-9]{2})[\/\-]((0[1-9])|(1[0-2]))[\/\-]((0[1-9])|((1|2)[0-9])|(3[0-1]))$/;//年月日
if (time instanceof Date) {
let timeStr = moment(time).format('YYYY/MM/DD');
if (!ymd.test(timeStr)) {
valid = false;
}
} else {
valid = false;
}
return valid;
}
const judgeNull = (value) => { const judgeNull = (value) => {
return value ? String(value).trim().replace(/\s*/g, "") : null; return value ? String(value).trim().replace(/\s*/g, "") : null;
} }
const judgeNullTime = (v) => {
//注意的点:xlsx将excel中的时间内容解析后,会小一天
//如2020/8/1,xlsx会解析成 Fri Jul 31 2020 23:59:17 GMT+0800 小了43秒
let a = new Date(v);
a.setTime(a.getTime() + 43 * 1000);
return v ? a : null;
}
return ( return (
<Modal <Modal
title="导入信息" visible={true} title="导入信息" visible={true}
@ -154,6 +183,10 @@ const ImportMembersModal = props => {
label={'员工信息'} labelPosition='left' label={'员工信息'} labelPosition='left'
action={'/'} accept={fileLimit} action={'/'} accept={fileLimit}
maxSize={200} limit={1} maxSize={200} limit={1}
onRemove={(currentFile, fileList, fileItem) => {
setMsg('');
setPostData([]);
}}
customRequest={(data) => { customRequest={(data) => {
const { file, onSuccess, onError } = data const { file, onSuccess, onError } = data
getFileBlob(file.url).then(res => { getFileBlob(file.url).then(res => {
@ -173,7 +206,7 @@ const ImportMembersModal = props => {
const zmsz = /^[A-Za-z0-9]+$/;//字母数字组合 const zmsz = /^[A-Za-z0-9]+$/;//字母数字组合
const pattern = /^1[3|4|5|6|7|8|9]\d{9}$/; const pattern = /^1[3|4|5|6|7|8|9]\d{9}$/;
const sfz = /^[1-9]\d{5}(18|19|([23]\d))\d{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\d{3}[0-9Xx]$/;//身份证 const sfz = /^[1-9]\d{5}(18|19|([23]\d))\d{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\d{3}[0-9Xx]$/;//身份证
const ymd = /^((19|20)[0-9]{2})[\/\-]((0[1-9])|(1[0-2]))[\/\-]((0[1-9])|((1|2)[0-9])|(3[0-1]))$/;//年月日 //const ymd = /^((19|20)[0-9]{2})[\/\-]((0[1-9])|(1[0-2]))[\/\-]((0[1-9])|((1|2)[0-9])|(3[0-1]))$/;//年月日
const num0 = /^\d+$/;//正整数+0 const num0 = /^\d+$/;//正整数+0
for (let i = 0; i < res.length; i++) { for (let i = 0; i < res.length; i++) {
let d = res[i]; let d = res[i];
@ -182,7 +215,7 @@ const ImportMembersModal = props => {
let name = judgeNull(d['姓名']); let name = judgeNull(d['姓名']);
let idNumber = judgeNull(d['证件号']); let idNumber = judgeNull(d['证件号']);
let gender = judgeNull(d['性别(男/女)']); let gender = judgeNull(d['性别(男/女)']);
let birthday = judgeNull(d['出生年月日(例2022/02/01)']); let birthday = judgeNullTime(d['出生年月日(例2022/02/01)']);//-------判断时间
let nativePlace = judgeNull(d['籍贯']); let nativePlace = judgeNull(d['籍贯']);
let marital = judgeNull(d['婚育状态(已婚/未婚/已婚已育)']); let marital = judgeNull(d['婚育状态(已婚/未婚/已婚已育)']);
@ -192,12 +225,12 @@ const ImportMembersModal = props => {
let graduatedFrom = judgeNull(d['毕业院校']); let graduatedFrom = judgeNull(d['毕业院校']);
let educationBackground = judgeNull(d['学历']); let educationBackground = judgeNull(d['学历']);
let specialty = judgeNull(d['专业']); let specialty = judgeNull(d['专业']);
let graduationDate = judgeNull(d['毕业时间']); let graduationDate = judgeNullTime(d['毕业时间']);//-------------------判断时间
let hiredate = judgeNull(d['入职时间']); let hiredate = judgeNullTime(d['入职时间']);//-------------------------判断时间
let turnProbationPeriod = judgeNull(d['转试用期时间']); let turnProbationPeriod = judgeNullTime(d['转试用期时间']);//-----------判断时间
let regularDate = judgeNull(d['转正时间']); let regularDate = judgeNullTime(d['转正时间']);//----------------------判断时间
let dimissionDate = judgeNull(d['离职日期']); let dimissionDate = judgeNullTime(d['离职日期']);//---------------------判断时间
let experienceYear = judgeNull(d['工作经验(年)']); let experienceYear = judgeNull(d['工作经验(年)']);
let occupationalHistory = judgeNull(d['历史工作经历与职务']); let occupationalHistory = judgeNull(d['历史工作经历与职务']);
@ -217,18 +250,20 @@ const ImportMembersModal = props => {
error(`${i + 1}行姓名为空,请填写`) error(`${i + 1}行姓名为空,请填写`)
return return
} }
if (!sfz.test(idNumber)) { if (idNumber && !sfz.test(idNumber)) {
error(`${i + 1}行证件号错误`) error(`${i + 1}行证件号错误`)
return return
} }
if (['男', '女'].indexOf(gender) == -1) { if (gender && ['男', '女'].indexOf(gender) == -1) {
error(`${i + 1}行性别错误`) error(`${i + 1}行性别错误`)
return return
} }
// if (!ymd.test(birthday)) {
// error(`第${i + 1}行出生年月日错误,请填写yyyy/mm/dd格式`) let bsdValid = judgeTimeValid(birthday);
// return if (!bsdValid) {
// } error(`${i + 1}行出生年月日错误,请填写yyyy/mm/dd格式`)
return
}
let jgValid = judgePlace(nativePlace); let jgValid = judgePlace(nativePlace);
if (!jgValid) { if (!jgValid) {
@ -236,15 +271,15 @@ const ImportMembersModal = props => {
return return
} }
if (['已婚', '未婚', '已婚已育'].indexOf(marital) == -1) { if (marital && ['已婚', '未婚', '已婚已育'].indexOf(marital) == -1) {
error(`${i + 1}行婚育状态错误`) error(`${i + 1}行婚育状态错误`)
return return
} }
if (['群众', '党员'].indexOf(politicsStatus) == -1) { if (politicsStatus && ['群众', '党员'].indexOf(politicsStatus) == -1) {
error(`${i + 1}行政治面貌错误`) error(`${i + 1}行政治面貌错误`)
return return
} }
if (!pattern.test(phoneNumber)) { if (phoneNumber && !pattern.test(phoneNumber)) {
error(`${i + 1}行联系方式错误`) error(`${i + 1}行联系方式错误`)
return return
} }
@ -253,43 +288,49 @@ const ImportMembersModal = props => {
error(`${i + 1}行工作地点错误`) error(`${i + 1}行工作地点错误`)
return return
} }
if (['小学', '初中', '高中', '大专', '本科', '研究生', '博士'].indexOf(educationBackground) == -1) { if (educationBackground && ['小学', '初中', '高中', '大专', '本科', '研究生', '博士'].indexOf(educationBackground) == -1) {
error(`${i + 1}行学历错误`) error(`${i + 1}行学历错误`)
return return
} }
// if (!ymd.test(graduationDate)) { let byValid = judgeTimeValid(graduationDate);
// error(`第${i + 1}行毕业时间错误,请填写yyyy/mm/dd格式`) if (!byValid) {
// return error(`${i + 1}行毕业时间错误,请填写yyyy/mm/dd格式`)
// } return
// if (!ymd.test(hiredate)) { }
// error(`第${i + 1}行入职时间错误,请填写yyyy/mm/dd格式`) let rzhValid = judgeTimeValid(hiredate);
// return if (!rzhValid) {
// } error(`${i + 1}行入职时间错误,请填写yyyy/mm/dd格式`)
// if (!ymd.test(turnProbationPeriod)) { return
// error(`第${i + 1}行转试用期时间错误,请填写yyyy/mm/dd格式`) }
// return let shyValid = judgeTimeValid(turnProbationPeriod);
// } if (!shyValid) {
// if (!ymd.test(regularDate)) { error(`${i + 1}行转试用期时间错误,请填写yyyy/mm/dd格式`)
// error(`第${i + 1}行转正时间错误,请填写yyyy/mm/dd格式`) return
// return }
// } let zhzhValid = judgeTimeValid(regularDate);
// if (!ymd.test(dimissionDate)) { if (!zhzhValid) {
// error(`第${i + 1}行离职日期错误,请填写yyyy/mm/dd格式`) error(`${i + 1}行转正时间错误,请填写yyyy/mm/dd格式`)
// return return
// } }
if (!num0.test(experienceYear)) { let lzhValid = judgeTimeValid(dimissionDate);
if (!lzhValid) {
error(`${i + 1}行离职日期错误,请填写yyyy/mm/dd格式`)
return
}
if (experienceYear && !num0.test(experienceYear)) {
error(`${i + 1}行工作经验(年)错误,请填写非负整数`) error(`${i + 1}行工作经验(年)错误,请填写非负整数`)
return return
} }
postData.push({//人员编号 待办todotodo postData.push({//人员编号 待办todotodo
pepUserId: 555, name, idNumber, gender, birthday, nativePlace, marital, pepUserId: 555, name, idNumber, gender, birthday, nativePlace, marital,
politicsStatus, phoneNumber, workPlace, graduatedFrom, educationBackground, specialty, graduationDate, politicsStatus, phoneNumber, workPlace, graduatedFrom, educationBackground, specialty, graduationDate,
hiredate, turnProbationPeriod, regularDate, dimissionDate, experienceYear, occupationalHistory hiredate, turnProbationPeriod, regularDate, dimissionDate, experienceYear, occupationalHistory,
del: false
}) })
} }
if (postData.length) { //if (postData.length) {
setPostData(postData) setPostData(postData)
} //}
let msg = '文件解析完成,点击确定按钮上传保存!' let msg = '文件解析完成,点击确定按钮上传保存!'
setMsg(msg) setMsg(msg)
onSuccess({ message: msg }) onSuccess({ message: msg })

14
web/client/src/sections/humanAffairs/containers/personnelFiles.jsx

@ -3,12 +3,12 @@ import { connect } from 'react-redux';
import { Select, Input, Button, CheckboxGroup, Tooltip } from '@douyinfe/semi-ui'; import { Select, Input, Button, CheckboxGroup, Tooltip } from '@douyinfe/semi-ui';
import { IconSearch } from '@douyinfe/semi-icons'; import { IconSearch } from '@douyinfe/semi-icons';
import PersonnelModal from '../components/personnelModal'; import PersonnelModal from '../components/personnelModal';
import ExportMembersModal from './import-members-modal' import ImportMembersModal from './import-members-modal'
import '../style.less' import '../style.less'
import moment from 'moment' import moment from 'moment'
const Rest = (props) => { const Rest = (props) => {
const { dispatch, actions, history, user, loading, socket } = props const { dispatch, actions, history, user, loading, socket, xqMembers } = props
const { humanAffairs } = actions; const { humanAffairs } = actions;
let [departmentValue, setDepartmentValue] = useState(''); let [departmentValue, setDepartmentValue] = useState('');
@ -275,20 +275,20 @@ const Rest = (props) => {
</PersonnelModal> : '' </PersonnelModal> : ''
} }
{ {
exportModalVs ? <ExportMembersModal user={user} exportModalVs ? <ImportMembersModal user={user}
onCancel={() => setExportModalVs(false)} /> : '' onCancel={() => setExportModalVs(false)} xqMembers={xqMembers} /> : ''
} }
</> </>
) )
} }
function mapStateToProps (state) { function mapStateToProps(state) {
const { auth, global, members, webSocket } = state; const { auth, global, MemberSearch, webSocket } = state;
return { return {
// loading: members.isRequesting, // loading: members.isRequesting,
user: auth.user, user: auth.user,
actions: global.actions, actions: global.actions,
// members: members.data, xqMembers: MemberSearch.data,
// socket: webSocket.socket // socket: webSocket.socket
}; };
} }

2
web/client/src/sections/humanAffairs/containers/table-input-rule.js

@ -5,6 +5,6 @@ export const rule = [
"地址:格式为“省-市”,如“江苏省-镇江市”,直辖市直接显示市,如“北京市”;", "地址:格式为“省-市”,如“江苏省-镇江市”,直辖市直接显示市,如“北京市”;",
"政治面貌:党员或群众;", "政治面貌:党员或群众;",
"学历:小学、初中、高中、大专、本科、研究生或博士;", "学历:小学、初中、高中、大专、本科、研究生或博士;",
"工作经验:0或正数;", "工作经验:0或正数;",
"没有的数据可不填写。" "没有的数据可不填写。"
] ]
Loading…
Cancel
Save