handleOk(null)}
- onCancel={onCancel}>
-
- } theme="light">
- 请选择文件
-
-
- 最大不超过200M,导入文件需与
- download()} style={{ cursor: 'pointer', color: '#0066FF' }}>导入模板
- 一致
-
-
- )
-}
-
-
-export default ExportMembersModal;
\ No newline at end of file
diff --git a/web/client/src/sections/humanAffairs/containers/import-members-modal.js b/web/client/src/sections/humanAffairs/containers/import-members-modal.js
new file mode 100644
index 0000000..82cd629
--- /dev/null
+++ b/web/client/src/sections/humanAffairs/containers/import-members-modal.js
@@ -0,0 +1,220 @@
+'use strict';
+import React, { useState } from 'react';
+import { connect } from 'react-redux';
+//import { Button, Input, Card, Modal, Upload, message } from 'antd';
+import { Modal, Form, Button, Upload, Notification } from '@douyinfe/semi-ui';
+import { IconUpload } from '@douyinfe/semi-icons';
+//import { Request } from '@peace/utils'
+//import request from 'superagent'
+import XLSX from 'xlsx'
+//import { userBulkAdd } from '../../actions'
+
+//TODO 下载模板和上传文件读取
+const ImportUser = props => {
+ const { user, dispatch, onCancel } = props
+ const [msg, setMsg] = useState('')
+ const [loading, setLoading] = useState('')
+ const [postData, setPostData] = useState([])
+
+ const confirm = () => {
+ if (postData.length) {
+ setLoading(true)
+ // dispatch(userBulkAdd(postData, params.departmentId ? params.departmentId : null)).then(res => {
+ // if (res.success) {
+
+ // }
+ // setLoading(false)
+ // })
+ } else {
+ Notification.warn('没有数据可以提交,请上传数据文件')
+ }
+ }
+
+ const download = () => {
+ dldTemplate();
+ dldText("填写说明.txt", "12121212121212");
+ }
+
+ const dldTemplate = () => {
+ let dataTable = [];
+ let option = {};
+ option.fileName = '人资系统人员信息导入模板';
+ option.datas = [
+ {
+ sheetData: dataTable,
+ sheetName: '人资系统人员信息导入模板',
+ sheetFilter: ['人员编号', '姓名', '证件号', '性别(男/女)', '出生年月日(例2022/02/01)', '籍贯', '婚育状态(已婚/未婚/已婚已育)', '政治面貌', '联系方式', '工作地点', '毕业院校', '学历', '专业', '毕业时间', '入职时间', '转试用期时间', '转正时间', '离职日期', '工作经验(年)', '历史工作经历与职务'], //excel文件中需显示的列数据
+ sheetHeader: ['人员编号', '姓名', '证件号', '性别(男/女)', '出生年月日(例2022/02/01)', '籍贯', '婚育状态(已婚/未婚/已婚已育)', '政治面貌', '联系方式', '工作地点', '毕业院校', '学历', '专业', '毕业时间', '入职时间', '转试用期时间', '转正时间', '离职日期', '工作经验(年)', '历史工作经历与职务'], //excel文件中每列的表头名称
+ }
+ ]
+ let toExcel = new ExportJsonExcel(option); //生成excel文件
+ toExcel.saveExcel(); //下载excel文件
+ }
+
+ const dldText = (filename, text) => {
+ var element = document.createElement('a');
+ element.setAttribute('href', 'data:text/plain;charset=utf-8,' + encodeURIComponent(text));
+ element.setAttribute('download', filename);
+
+ element.style.display = 'none';
+ document.body.appendChild(element);
+
+ element.click();
+ document.body.removeChild(element);
+ }
+ //const action = '/file/qiniu/upload?type=excel&token=' + user.token;
+ const fileLimit = '.xls,.xlsx,.csv';
+
+ const getFileBlob = (url) => {
+ return new Promise((resolve, reject) => {
+ let request = new XMLHttpRequest()
+ request.open("GET", url, true)
+ request.responseType = "blob"
+ request.onreadystatechange = e => {
+ if (request.readyState == 4) {
+ if (request.status == 200) {
+ if (window.FileReader) {
+ let reader = new FileReader();
+ reader.readAsBinaryString(request.response);
+ reader.onload = event => {
+ try {
+ const { result } = event.target;
+ // 以二进制流方式读取得到整份excel表格对象
+ const workbook = XLSX.read(result, {
+ type: "binary",
+ cellDates: true,//设为true,将天数的时间戳转为时间格式
+ });
+ let data = []; // 存储获取到的数据
+ // 遍历每张工作表进行读取(这里默认只读取第一张表)
+ for (const sheet in workbook.Sheets) {
+ if (workbook.Sheets.hasOwnProperty(sheet)) {
+ data = data.concat(XLSX.utils.sheet_to_json(workbook.Sheets[sheet]));
+ }
+ }
+ resolve(data);//导出数据
+ } catch (e) {
+ reject("失败");
+ }
+ }
+ }
+ }
+ }
+ }
+ })
+ }
+
+ return (
+