From b583c1422cfb97987205a9c992ac6ce385170423 Mon Sep 17 00:00:00 2001 From: zhangminghua Date: Wed, 21 Dec 2022 09:49:07 +0800 Subject: [PATCH] =?UTF-8?q?(*)=E9=83=A8=E9=97=A8=E5=9F=B9=E8=AE=AD?= =?UTF-8?q?=E8=AE=B0=E5=BD=95-=E5=87=A0=E9=A1=B9=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E4=B8=BA=E5=9B=BA=E5=AE=9A=E5=80=BC=EF=BC=8C=E5=AF=BC=E5=85=A5?= =?UTF-8?q?=E7=BC=96=E8=BE=91=E5=8A=9F=E8=83=BD=E5=AF=B9=E5=BA=94=E8=B0=83?= =?UTF-8?q?=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../departmentTrain/departmentTrainRecord.jsx | 10 ++- .../containers/departmentTrain/editModal.js | 70 ++++++++++--------- .../containers/departmentTrain/importModal.js | 27 ++++++- 3 files changed, 72 insertions(+), 35 deletions(-) diff --git a/web/client/src/sections/humanAffairs/containers/departmentTrain/departmentTrainRecord.jsx b/web/client/src/sections/humanAffairs/containers/departmentTrain/departmentTrainRecord.jsx index 9790ff7..65a0cd1 100644 --- a/web/client/src/sections/humanAffairs/containers/departmentTrain/departmentTrainRecord.jsx +++ b/web/client/src/sections/humanAffairs/containers/departmentTrain/departmentTrainRecord.jsx @@ -6,7 +6,9 @@ import EditModal from './editModal' import ImportModal from './importModal' import { SkeletonScreen } from "$components"; import '../../style.less' - +const DepartmentTrainType = ["部门内部培训", "跨部门培训", "外部培训", "公司内训"]; +const DepartmentTrainMethod = ["线上", "线下"]; +const DepartmentTrainAppraisalMethod = ["笔试", "线上考试", "培训总结", "口试", "实操", "无"]; const DepartmentTrainRecord = (props) => { const { dispatch, actions } = props; const { humanAffairs } = actions; @@ -220,11 +222,17 @@ const DepartmentTrainRecord = (props) => { { modalV ? closeAndFetch()} onCancel={() => setModalV(false)} /> : '' } { importModalV ? { setImportModalV(false); getDepartmentTrainRecordList(); diff --git a/web/client/src/sections/humanAffairs/containers/departmentTrain/editModal.js b/web/client/src/sections/humanAffairs/containers/departmentTrain/editModal.js index 8589533..7a2d842 100644 --- a/web/client/src/sections/humanAffairs/containers/departmentTrain/editModal.js +++ b/web/client/src/sections/humanAffairs/containers/departmentTrain/editModal.js @@ -3,7 +3,8 @@ import { connect } from "react-redux"; import { Select, Modal, Form, Button, Toast } from "@douyinfe/semi-ui"; import { IconUpload } from '@douyinfe/semi-icons'; const EditModal = (props) => { - const { dispatch, actions, user, onCancel, dataToEdit, apiRoot, close } = props; + const { dispatch, actions, user, onCancel, dataToEdit, apiRoot, close, + DepartmentTrainType, DepartmentTrainMethod, DepartmentTrainAppraisalMethod } = props; const { humanAffairs } = actions; const form = useRef();//表单 const [options, setOptions] = useState([]); @@ -121,16 +122,20 @@ const EditModal = (props) => { > {options} - + placeholder='请选择培训类型' + filter + rules={[{ required: true, message: '请选择培训类型' }]} + > + {DepartmentTrainType.map((d, i) => + {d} + )} + { rules={[{ required: true, message: "培训时间不可空" }]} disabled={dataToEdit?.id ? true : false} /> - { placeholder="请输入培训讲师" showClear /> - - + {DepartmentTrainMethod.map((d, i) => + {d} + )} + + + placeholder='请选择考核形式' + filter + rules={[{ required: true, message: '请选择考核形式' }]} + > + {DepartmentTrainAppraisalMethod.map((d, i) => + {d} + )} + + { - const { dispatch, actions, user, onCancel } = props + const { dispatch, actions, user, onCancel, + DepartmentTrainType, DepartmentTrainMethod, DepartmentTrainAppraisalMethod } = props; const { humanAffairs } = actions; const [msg, setMsg] = useState('') const [loading, setLoading] = useState('') @@ -161,6 +162,12 @@ const ImportModal = props => { if (!trainingType) { error(`第${i + 2}行【实际培训类型】为空,请填写`) return + } else { + let item = DepartmentTrainType.find(d => d === trainingType); + if (!item) { + error(`第${i + 2}行【实际培训类型】数据有误,请确认后重新填写`) + return + } } if (!trainDate) { error(`第${i + 2}行【培训时间】为空,请填写`) @@ -181,18 +188,36 @@ const ImportModal = props => { if (!trainContent) { error(`第${i + 2}行【培训内容】为空,请填写`) return + } else if (trainContent.length > 200) { + error(`第${i + 2}行【培训内容】超出200字符,请调整`) + return } if (!trainMethod) { error(`第${i + 2}行【培训方式】为空,请填写`) return + } else { + let item = DepartmentTrainMethod.find(d => d === trainMethod); + if (!item) { + error(`第${i + 2}行【培训方式】数据有误,请确认后重新填写`) + return + } } if (!appraisalMethod) { error(`第${i + 2}行【考核形式】为空,请填写`) return + } else { + let item = DepartmentTrainAppraisalMethod.find(d => d === appraisalMethod); + if (!item) { + error(`第${i + 2}行【考核形式】数据有误,请确认后重新填写`) + return + } } if (!trainTime) { error(`第${i + 2}行【培训时长】为空,请填写`) return + } else if (trainTime.length > 20) { + error(`第${i + 2}行【培训时长】超出20字符,请调整`) + return } postData.push({ departmentName, trainingType, trainDate, trainContent,