From 1a29c1411b225c5ee4c87724677110f05b82b5fa Mon Sep 17 00:00:00 2001 From: xingyongchun Date: Thu, 1 Dec 2022 16:53:48 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=AD=97=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/sections/homePage/containers/index.js | 12 +- .../sections/wait/components/import_model.js | 163 ------------------ .../src/sections/wait/components/modeal.js | 7 + .../src/sections/wait/containers/index.js | 8 +- 4 files changed, 23 insertions(+), 167 deletions(-) delete mode 100644 web/client/src/sections/wait/components/import_model.js diff --git a/web/client/src/sections/homePage/containers/index.js b/web/client/src/sections/homePage/containers/index.js index 134b489..5a530df 100644 --- a/web/client/src/sections/homePage/containers/index.js +++ b/web/client/src/sections/homePage/containers/index.js @@ -171,6 +171,11 @@ function Management(props) { dataIndex: 'contacts', key: 'contacts', align: 'center' + },{ + title: '评估工时', + dataIndex: 'consum_time', + key: 'consum_time', + align: 'center' }, { title: '处理进度', @@ -178,6 +183,7 @@ function Management(props) { key: 'progress', align: 'center' }, + ]; return ( <> @@ -189,20 +195,20 @@ function Management(props) {
本周在研项目
/Research project this week
- +
人员情况
/Information on Personnel
-
+
待研发项目
/Project to be developed
-
+
diff --git a/web/client/src/sections/wait/components/import_model.js b/web/client/src/sections/wait/components/import_model.js deleted file mode 100644 index 51b1368..0000000 --- a/web/client/src/sections/wait/components/import_model.js +++ /dev/null @@ -1,163 +0,0 @@ -/* - * @description : - * @Date : 2021-04-07 14:39:33 - * @FilePath : \web\client\src\sections\user\components\userManagement\importUser.js - * @useStrict : use strict - */ - -'use strict'; -import React, { useState } from 'react'; -import { connect } from 'react-redux'; -import { Button, Input, Card, Modal, Upload, message } from 'antd'; -import { Request } from '@peace/utils' -import request from 'superagent' -import XLSX from 'xlsx' -// import { userBulkAdd } from '../../actions' - -//TODO 下载模板和上传文件读取 -const ImportUser = props => { - const { user, dispatch, handleCancel, params,editData } = 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 { - message.warn('没有数据可以提交,请上传数据文件') - } - } - - return ( - { - setMsg('') - setLoading(false) - setPostData([]) - handleCancel() - }} - destroyOnClose - > - {/* */} - - - -
下载模板后填写完整后上传
-
- { - setMsg('') - setPostData([]) - const extNames = file.name.split('.'); - let isDAE = false; - if (extNames.length > 0) { - let fileType = extNames[extNames.length - 1].toLowerCase(); - isDAE = ['xlsx', 'xls'].some((f) => f == fileType); - } - if (!isDAE) { - setMsg(`只能上传 ${['xlsx', 'xls'].join()} 格式的文件!`); - return false; - } - }, - onChange(info) { - - }, - customRequest: async (data) => { - const { file, onSuccess, onError } = data - - const reader = new FileReader(); // 使用 FileReader 读取数据 - reader.onload = function (e) { // 数据读取完成后的回调函数 - const data = new Uint8Array(e.target.result); - const workbook = XLSX.read(data, { type: 'array' }); // workbook 是 xlsx 解析 excel 后返回的对象 - - const firstSheetName = workbook.SheetNames[0]; // 获取第一个 sheet 的名字 - const worksheet = workbook.Sheets[firstSheetName]; // 获取第一个 sheet 的内容 - const res = XLSX.utils.sheet_to_json(worksheet); // 使用 utils 里的方法转换内容为便于使用的数组 - const error = (msg) => { - setMsg(msg) - onError({ message: msg }) - } - if (res.length > 1000) { - error('一次性上传数据行数应小于1000行,请分批上传') - return - } - if (!res.length) { - error('请填写至少一行数据') - return - } - let postData = [] - const pattern = /^1[3|4|5|6|7|8|9]\d{9}$/ - for (let i = 0; i < res.length; i++) { - let d = res[i] - let name = String(d['姓名']).trim(); - let phone = String(d['手机号码']).trim(); - let account = String(d['账号']).trim(); - let peopleCode = d['人员编号'] && String(d['人员编号']).trim(); - if (!name || !phone || !account || !peopleCode) { - error(`第${i + 1} 行有空值,请填写后重新上传`) - return - } - if (!pattern.test(phone)) { - error(`第${i + 1} 行手机号码错误`) - return - } - if (name.length > 128 || account.length > 128) { - error(`第${i + 1} 行数据字符长度大于 128,请更改后重新上传`) - return - } - if (postData.some(p => p.account == account)) { - error(`第${i + 1} 行账号重复,请更改后重新上传`) - return - } - postData.push({ - name, phone, account, peopleCode - }) - } - if (postData.length) { - setPostData(postData) - } - let msg = '文件解析完成,点击确定按钮上传保存!' - setMsg(msg) - onSuccess({ message: msg }) - }; - reader.readAsArrayBuffer(file); // 读取数据 - }, - }}> - - -
- {msg} -
-
- ) -} - -function mapStateToProps(state) { - const { auth, customizeList } = state; - return { - user: auth.user, - } -} - - -export default connect(mapStateToProps)(ImportUser); \ No newline at end of file diff --git a/web/client/src/sections/wait/components/modeal.js b/web/client/src/sections/wait/components/modeal.js index 3782a04..ac28946 100644 --- a/web/client/src/sections/wait/components/modeal.js +++ b/web/client/src/sections/wait/components/modeal.js @@ -50,6 +50,13 @@ function modeal(props) { label="对接人" name="contacts" rules={[{ required: true, message: '请输入对接人' }]} + > + + + diff --git a/web/client/src/sections/wait/containers/index.js b/web/client/src/sections/wait/containers/index.js index d625bfa..c1de870 100644 --- a/web/client/src/sections/wait/containers/index.js +++ b/web/client/src/sections/wait/containers/index.js @@ -8,7 +8,6 @@ import moment from "moment"; import { push } from "react-router-redux"; import { Scroller } from "$components"; import ProjectModeal from "../components/modeal"; -import ImportModeal from "../components/import_model"; export const Default = (props) => { const { dispatch } = props; @@ -45,6 +44,11 @@ export const Default = (props) => { render: (dom, record) => { return record.contacts; }, + },{ + title: '评估工时', + dataIndex: 'consum_time', + key: 'consum_time', + align: 'center' }, { title: "处理进度", @@ -114,6 +118,7 @@ export const Default = (props) => { from_project: values.from_project, contacts: values.contacts, progress: values.progress, + consum_time:values.consum_time, o_name_project: editData?.name_project, }, ]; @@ -124,6 +129,7 @@ export const Default = (props) => { from_project: values.from_project, contacts: values.contacts, progress: values.progress, + consum_time:values.consum_time, }, ]; }