Archer_cdm 2 years ago
parent
commit
1bf620d2e8
  1. 10
      web/client/src/sections/humanAffairs/containers/departmentTrain/departmentTrainRecord.jsx
  2. 70
      web/client/src/sections/humanAffairs/containers/departmentTrain/editModal.js
  3. 27
      web/client/src/sections/humanAffairs/containers/departmentTrain/importModal.js

10
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 ? <EditModal
dataToEdit={dataToEdit}
DepartmentTrainType={DepartmentTrainType}
DepartmentTrainMethod={DepartmentTrainMethod}
DepartmentTrainAppraisalMethod={DepartmentTrainAppraisalMethod}
close={() => closeAndFetch()}
onCancel={() => setModalV(false)} /> : ''
}
{
importModalV ? <ImportModal
DepartmentTrainType={DepartmentTrainType}
DepartmentTrainMethod={DepartmentTrainMethod}
DepartmentTrainAppraisalMethod={DepartmentTrainAppraisalMethod}
onCancel={() => {
setImportModalV(false);
getDepartmentTrainRecordList();

70
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}
</Form.Select>
<Form.Input
<Form.Select
field="trainingType"
label="培训类型"
label={{ text: '培训类型', required: true }}
style={{ width: '100%' }}
initValue={dataToEdit?.trainingType || ""}
placeholder="请输入培训类型"
showClear
validate={validate}
validateStatus={validateStatus}
/>
placeholder='请选择培训类型'
filter
rules={[{ required: true, message: '请选择培训类型' }]}
>
{DepartmentTrainType.map((d, i) => <Select.Option value={d} key={`type-${i}`}>
{d}
</Select.Option>)}
</Form.Select>
<Form.DatePicker
field='trainDate'
type='dateTime'
@ -141,21 +146,16 @@ const EditModal = (props) => {
rules={[{ required: true, message: "培训时间不可空" }]}
disabled={dataToEdit?.id ? true : false}
/>
<Form.Input
<Form.TextArea
field="trainContent"
label="培训内容"
label={{ text: '培训内容', required: true }}
style={{ width: '100%' }}
initValue={dataToEdit?.trainContent || ""}
placeholder="请输入培训内容"
showClear
rows={3} maxCount={200}
validate={validateContent}
validateStatus={validateStatus}
// rules={[{
// required: true, message: "培训内容不可空"
// }, {
// max: 200, message: "最多200个字符"
// }]}
/>
<Form.Input
field="trainWho"
@ -173,34 +173,38 @@ const EditModal = (props) => {
placeholder="请输入培训讲师"
showClear
/>
<Form.Input
<Form.Select
field="trainMethod"
label='培训方式'
label={{ text: '培训方式', required: true }}
style={{ width: '100%' }}
initValue={dataToEdit?.trainMethod || ""}
placeholder="请输入培训方式"
showClear
validate={validate}
validateStatus={validateStatus}
/>
<Form.Input
placeholder='请选择培训方式'
filter
rules={[{ required: true, message: '请选择培训方式' }]}
>
{DepartmentTrainMethod.map((d, i) => <Select.Option value={d} key={`trainMethod-${i}`}>
{d}
</Select.Option>)}
</Form.Select>
<Form.Select
field="appraisalMethod"
label='考核形式'
label={{ text: '考核形式', required: true }}
style={{ width: '100%' }}
initValue={dataToEdit?.appraisalMethod || ""}
placeholder="请输入考核形式"
showClear
validate={validate}
validateStatus={validateStatus}
// rules={[{
// required: true, message: "考核形式不可空"
// }, {
// max: 20, message: "最多20个字符"
// }]}
/>
placeholder='请选择考核形式'
filter
rules={[{ required: true, message: '请选择考核形式' }]}
>
{DepartmentTrainAppraisalMethod.map((d, i) => <Select.Option value={d} key={`appraisalMethod-${i}`}>
{d}
</Select.Option>)}
</Form.Select>
<Form.Input
field="trainTime"
label='培训时长'
label={{ text: '培训时长', required: true }}
style={{ width: '100%' }}
initValue={dataToEdit?.trainTime || ""}
placeholder="请输入培训时长"

27
web/client/src/sections/humanAffairs/containers/departmentTrain/importModal.js

@ -8,7 +8,8 @@ import moment from 'moment';
//下载模板和上传文件读取
const ImportModal = props => {
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,

Loading…
Cancel
Save