|  |  | @ -2,12 +2,12 @@ | 
			
		
	
		
			
				
					|  |  |  | import React, { useState, useEffect } from 'react'; | 
			
		
	
		
			
				
					|  |  |  | import { connect } from 'react-redux'; | 
			
		
	
		
			
				
					|  |  |  | import moment from 'moment'; | 
			
		
	
		
			
				
					|  |  |  | import { Modal, Form, Button, Notification,Toast } from '@douyinfe/semi-ui'; | 
			
		
	
		
			
				
					|  |  |  | import { Modal, Form, Button, Notification, Toast } from '@douyinfe/semi-ui'; | 
			
		
	
		
			
				
					|  |  |  | import { IconUpload } from '@douyinfe/semi-icons'; | 
			
		
	
		
			
				
					|  |  |  | import XLSX from 'xlsx' | 
			
		
	
		
			
				
					|  |  |  | //下载模板和上传文件读取 | 
			
		
	
		
			
				
					|  |  |  | const ImportPerformanceSummaryModal = props => { | 
			
		
	
		
			
				
					|  |  |  |     const { dispatch, actions, onCancel,query } = props; | 
			
		
	
		
			
				
					|  |  |  |     const { dispatch, actions, onCancel, query, user } = props; | 
			
		
	
		
			
				
					|  |  |  |     const { businessManagement } = actions | 
			
		
	
		
			
				
					|  |  |  |     const [msg, setMsg] = useState(''); | 
			
		
	
		
			
				
					|  |  |  |     const [loading, setLoading] = useState(''); | 
			
		
	
	
		
			
				
					|  |  | @ -18,7 +18,7 @@ const ImportPerformanceSummaryModal = props => { | 
			
		
	
		
			
				
					|  |  |  |     const confirm = () => { | 
			
		
	
		
			
				
					|  |  |  |         if (postData.length) { | 
			
		
	
		
			
				
					|  |  |  |             setLoading(true) | 
			
		
	
		
			
				
					|  |  |  |             const { postAllPersonalTrainRecord,getPersonalTrainRecord } = actions.humanAffairs | 
			
		
	
		
			
				
					|  |  |  |             const { postAllPersonalTrainRecord, getPersonalTrainRecord } = actions.humanAffairs | 
			
		
	
		
			
				
					|  |  |  |             dispatch(postAllPersonalTrainRecord(postData)).then(res => { | 
			
		
	
		
			
				
					|  |  |  |                 if (res.success) { | 
			
		
	
		
			
				
					|  |  |  |                     onCancel() | 
			
		
	
	
		
			
				
					|  |  | @ -32,7 +32,7 @@ const ImportPerformanceSummaryModal = props => { | 
			
		
	
		
			
				
					|  |  |  |     } | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |     const download = () => { | 
			
		
	
		
			
				
					|  |  |  |         const head = [["姓名", "部门", "培训类型", "课程主题", "培训讲师", "培训时间", "培训时长", "培训方式", "考勤分数","考核形式","考核分数","总分"]]; | 
			
		
	
		
			
				
					|  |  |  |         const head = [["姓名", "部门", "培训类型", "课程主题", "培训讲师", "培训时间", "培训时长", "培训方式", "考勤分数", "考核形式", "考核分数", "总分"]]; | 
			
		
	
		
			
				
					|  |  |  |         let sheetName = '个人培训'; | 
			
		
	
		
			
				
					|  |  |  |         let workbook = { SheetNames: [sheetName], Sheets: {} }; | 
			
		
	
		
			
				
					|  |  |  |         workbook.Sheets[sheetName] = XLSX.utils.aoa_to_sheet(head);//json转excel    | 
			
		
	
	
		
			
				
					|  |  | @ -149,6 +149,21 @@ const ImportPerformanceSummaryModal = props => { | 
			
		
	
		
			
				
					|  |  |  |                                     Toast.error(`第${i + 2}行,部门为空,请填写`) | 
			
		
	
		
			
				
					|  |  |  |                                     return | 
			
		
	
		
			
				
					|  |  |  |                                 } | 
			
		
	
		
			
				
					|  |  |  |                                 if (user.allDepartment && user.allDepartment.departments) { | 
			
		
	
		
			
				
					|  |  |  |                                     let dept = user.allDepartment.departments.find(d => !d.delete && d.name === obj.departmentName); | 
			
		
	
		
			
				
					|  |  |  |                                     let personal = dept && dept.departmentUsers.find(e => e.user.name === obj.personalName); | 
			
		
	
		
			
				
					|  |  |  |                                     if (dept) { | 
			
		
	
		
			
				
					|  |  |  |                                         obj.departmentName = dept.name; | 
			
		
	
		
			
				
					|  |  |  |                                     } else if (!dept) { | 
			
		
	
		
			
				
					|  |  |  |                                         Toast.error(`第${i + 2}行【部门】数据有误,请确认后重新填写`) | 
			
		
	
		
			
				
					|  |  |  |                                         return | 
			
		
	
		
			
				
					|  |  |  |                                     } else if (personal) { | 
			
		
	
		
			
				
					|  |  |  |                                         obj.personalName = personal.user.name; | 
			
		
	
		
			
				
					|  |  |  |                                     } else if (!personal) { | 
			
		
	
		
			
				
					|  |  |  |                                         Toast.error(`第${i + 2}行【姓名】数据有误,请确认后重新填写`) | 
			
		
	
		
			
				
					|  |  |  |                                         return | 
			
		
	
		
			
				
					|  |  |  |                                     } | 
			
		
	
		
			
				
					|  |  |  |                                 } | 
			
		
	
		
			
				
					|  |  |  |                                 if (!obj.trainingType) { | 
			
		
	
		
			
				
					|  |  |  |                                     Toast.error(`第${i + 2}行,培训类型为空,请填写`) | 
			
		
	
		
			
				
					|  |  |  |                                     return | 
			
		
	
	
		
			
				
					|  |  | 
 |