人员情况
/Information on Personnel
{/*
*/}
-
+ {
+
+ if (name || ajob) {
+ const query = {
+ value1:name,
+ value2:ajob,
+ }
+ const res = await dispatch(postKeySearch(query));
+ setPeopleData(res?.payload.data.projects);
+ return {
+ ...res,
+ // total: res.payload.data.data ? res.payload.data.total : 0,
+ };
+ } else {
+ const res = await dispatch(getPeople());
+ console.log(res)
+ setPeopleData(res?.payload.data.projects);
+ return {
+ ...res,
+ // total: res.payload.data.data ? res.payload.data.total : 0,
+ };
+ }
+
+ }}
+ onReset={(v) => {
+ setName(null)
+ setAjob(null)
+ }}
+ />
{/* */}
diff --git a/web/client/src/sections/homePage/containers/index.less b/web/client/src/sections/homePage/containers/index.less
index b7a2005..2f847bc 100644
--- a/web/client/src/sections/homePage/containers/index.less
+++ b/web/client/src/sections/homePage/containers/index.less
@@ -119,18 +119,21 @@
&-main {
display: flex;
- width: 80%;
+ width: 90%;
margin: 0 auto;
+ height: 40vh;
justify-content: space-between;
&-box {
width: 49%;
- min-height: 200px;
- max-height: 800px;
- overflow-y: auto;
+ // min-height: 200px;
+ // max-height: 800px;
+ // overflow-y: auto;
box-shadow: 0px 0px 5px 0px rgba(0, 0, 0, 0.5);
text-align: left;
padding: 5px;
-
+.ant-pro-card-body{
+ padding: 0px 24px 0 24px !important;
+}
&-point {
width: 14px;
height: 14px;
diff --git a/web/client/src/sections/personnel/containers/index.js b/web/client/src/sections/personnel/containers/index.js
index fd74bc4..2ba6572 100644
--- a/web/client/src/sections/personnel/containers/index.js
+++ b/web/client/src/sections/personnel/containers/index.js
@@ -137,6 +137,7 @@ export const Default = (props) => {
dataIndex: "direction",
order: 6,
renderFormItem: (item, { type, defaultRender, ...rest }, form) => {
+
return (
);
},
+ },{
+ key: "direction",
+ hideInTable: true,
+ dataIndex: "direction",
+ renderFormItem: (record, { type, defaultRender, ...rest }, form) => {
+ console.log(record)
+ return (
+
+
+
+
+ );
+ },
},
];
const handleCancel = () => {
@@ -197,6 +222,20 @@ export const Default = (props) => {
}
});
};
+ //一键删除
+ const confirm = (record) => {
+ const query = {
+ table_name: "test_people",
+ delete_all:'1'
+ };
+ dispatch(delCancel(query)).then((res) => {
+ if (res.success) {
+ // 刷新
+ // tableActionRef.current.reload();
+ handleCancel();
+ }
+ });
+ };
//编辑
const editor = (record) => {
setVisible(true);
diff --git a/web/client/src/sections/wait/components/import_model.js b/web/client/src/sections/wait/components/import_model.js
new file mode 100644
index 0000000..a672a0f
--- /dev/null
+++ b/web/client/src/sections/wait/components/import_model.js
@@ -0,0 +1,162 @@
+/*
+ * @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 { postInWait } from "../actions/article";
+
+//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 = () => {
+ handleCancel
+ if (postData.length) {
+ console.log(postData)
+ setLoading(true);
+ dispatch(postInWait(postData)).then((res) => {
+ console.log(res)
+
+ if (res.success) {
+ message.success("上传成功");
+ handleCancel()
+ }
+ 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 = [];
+
+ for (let i = 0; i < res.length; i++) {
+ let d = res[i];
+ let name_project = String(d["项目"]).trim();
+
+ let from_project = String(d["需求来源"]).trim();
+ let contacts = String(d["对接人"]).trim();
+ let consum_time = String(d["评估工时"]).trim();
+ let progress = String(d["处理进度"]).trim();
+ let o_name_project=''
+ if (!name_project || !from_project || !consum_time || !contacts||!progress) {
+ error(`第${i + 1} 行有空值,请填写后重新上传`);
+ return;
+ }
+
+
+ postData.push({
+ name_project,
+ from_project,contacts,consum_time,progress
+ });
+ }
+ 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);
diff --git a/web/client/src/sections/wait/components/modeal.js b/web/client/src/sections/wait/components/modeal.js
index fb209f8..3435bc4 100644
--- a/web/client/src/sections/wait/components/modeal.js
+++ b/web/client/src/sections/wait/components/modeal.js
@@ -4,7 +4,6 @@ import dayjs from 'dayjs';
function modeal(props) {
const [form] = Form.useForm();
const { visible, handleOk, handleCancel, editData ,setEditData,setState} = props
- console.log(editData)
useEffect(() => {
if (editData && visible) {
form.setFieldsValue({
diff --git a/web/client/src/sections/wait/containers/index.js b/web/client/src/sections/wait/containers/index.js
index 06fc68f..23a591e 100644
--- a/web/client/src/sections/wait/containers/index.js
+++ b/web/client/src/sections/wait/containers/index.js
@@ -8,13 +8,14 @@ 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;
const [state, setState] = useState(false); //状态
const [counts, setCounts] = useState(); //数据
const [visible, setVisible] = useState(false); //弹窗
const [editData, setEditData] = useState(); //数据
+ const [importVisible, setImportVisible] = useState(false); //弹窗
const tableActionRef = useRef();
const columns = [
@@ -90,7 +91,6 @@ export const Default = (props) => {
key: "direction",
hideInTable: true,
dataIndex: "direction",
- order: 6,
renderFormItem: (item, { type, defaultRender, ...rest }, form) => {
return (
);
};
diff --git a/web/client/src/utils/webapi.js b/web/client/src/utils/webapi.js
index 957e728..a196f4e 100644
--- a/web/client/src/utils/webapi.js
+++ b/web/client/src/utils/webapi.js
@@ -12,7 +12,9 @@ export const ApiTable = {
delCancel: 'deleteDB', //删除信息
//下载项目模板
- getDownProject:'downProject'
+ getDownProject: 'downProject',
+ //查询人员信息
+ postKeySearch:'keySearch'
};
export const RouteTable = {