Browse Source

代码提交

master
xingyongchun 2 years ago
parent
commit
417fa2e9ee
  1. BIN
      web/client/assets/排队项目.xlsx
  2. 47
      web/client/src/sections/article/containers/index.js
  3. 18
      web/client/src/sections/homePage/actions/profile.js
  4. 143
      web/client/src/sections/homePage/containers/index.js
  5. 13
      web/client/src/sections/homePage/containers/index.less
  6. 41
      web/client/src/sections/personnel/containers/index.js
  7. 162
      web/client/src/sections/wait/components/import_model.js
  8. 1
      web/client/src/sections/wait/components/modeal.js
  9. 65
      web/client/src/sections/wait/containers/index.js
  10. 4
      web/client/src/utils/webapi.js

BIN
web/client/assets/排队项目.xlsx

Binary file not shown.

47
web/client/src/sections/article/containers/index.js

@ -111,7 +111,7 @@ export const Default = (props) => {
key: "direction",
hideInTable: true,
dataIndex: "direction",
order: 6,
renderFormItem: (item, { type, defaultRender, ...rest }, form) => {
return (
<Button
@ -125,6 +125,26 @@ export const Default = (props) => {
</Button>
);
},
},{
key: "direction",
hideInTable: true,
dataIndex: "direction",
renderFormItem: (item, { type, defaultRender, ...rest }, form) => {
return (
<Popconfirm
title=" 是否全部删除?"
onConfirm={confirm}
okText="确认"
cancelText="取消"
>
<Button
style={{ width: "200px" }}
>
一键删除
</Button>
</Popconfirm>
);
},
},
];
const handleCancel = () => {
@ -168,6 +188,20 @@ export const Default = (props) => {
}
});
};
//一键删除
const confirm = (record) => {
const query = {
table_name: "test_project",
delete_all:'1'
};
dispatch(delCancel(query)).then((res) => {
if (res.success) {
// 刷新
// tableActionRef.current.reload();
handleCancel();
}
});
};
//编辑
const editor = (record) => {
setVisible(true);
@ -190,13 +224,14 @@ export const Default = (props) => {
setCounts(res.payload.data.projects);
return {
...res,
total: res.payload.data ? res.payload.data.total : 0,
// total: res.payload.data ? res.payload.data.total : 0,
};
}}
rowKey="id"
pagination={{
showSizeChanger: true,
}}
/>
</Scroller>
<ProjectModeal
@ -221,11 +256,3 @@ Default.propTypes = {
const mapStateToProps = (state) => ({});
export default connect(mapStateToProps)(Default);
const data = [
{ name: "yongchu", age: "18", 任务1: "v1", 计划1: "time1" },
{ name: "yongchu", age: "18", 任务1: "v1", 计划1: "time1" },
{ name: "yongchu", age: "18", 任务1: "v1", 计划1: "time1" },
{ name: "大王", age: "18", 任务1: "v1", 计划1: "time1" },
{ name: "大王", age: "18", 任务1: "v1", 计划1: "time1" },
];

18
web/client/src/sections/homePage/actions/profile.js

@ -107,11 +107,12 @@ export function getProject() {
});
}
export function getPeople() {
export function getPeople(query) {
return (dispatch) =>
basicAction({
type: "post",
dispatch: dispatch,
data:query,
actionType: "PEOPLE",
url: ApiTable.peopleUrl,
msg: { option: "获取人员情况" },
@ -134,7 +135,20 @@ export function getWait() {
},
});
}
export function postKeySearch(query) {
return (dispatch) =>
basicAction({
type: "post",
dispatch: dispatch,
data:query,
actionType: "PEOPLE",
url: ApiTable.postKeySearch,
msg: { option: "获取人员情况" },
reducer: {
name: "people",
},
});
}
export default {
// getProfile,
// editProfile,

143
web/client/src/sections/homePage/containers/index.js

@ -1,13 +1,14 @@
/* eslint-disable react-hooks/exhaustive-deps */
import React, { useState, useEffect } from "react";
import React, { useState, useEffect,useRef } from "react";
import { connect } from "react-redux";
import { Spin, Tabs, Table } from "antd";
import classnames from "classnames/bind";
import styles from "./index.less";
import { push } from "react-router-redux";
import moment from "moment";
import { getProject, getPeople, getWait } from "../actions/profile";
import { getProject, getPeople, getWait,postKeySearch } from "../actions/profile";
import { Scroller } from "$components";
import ProTable from "@ant-design/pro-table";
const CX = classnames.bind(styles);
const topImg = "/assets/images/top.png";
@ -15,16 +16,19 @@ const pointImg = "/assets/images/point.png";
function Management(props) {
const { dispatch, user } = props
const height = document.body.clientHeight
const width=document.body.clientWidth
const [dataSource, setDataSource] = useState([])
const [name, setName] = useState()//名字查询
const [ajob, setAjob] = useState()//岗位查询
const [projectData, setProjectData] = useState([])
const [peopleData, setPeopleData] = useState([])
const [waitData, setWaitData] = useState([])
const [counts,setCounts]=useState()
const ref = useRef();
useEffect(() => {
dispatch(getProject()).then((res) => {
setProjectData(res.payload.data.projects)
setProjectData(res?.payload.data?.projects)
})
dispatch(getPeople()).then((res) => {
setPeopleData(res.payload.data.projects)
@ -54,8 +58,16 @@ function Management(props) {
dataIndex: 'build_time',
key: 'build_time',
align: 'center',
defaultSortOrder: 'ascend',
sorter: {
compare: (a, b) => {
const one = moment(a.build_time).format('YYYYMMDD')
const two=moment(b.build_time).format('YYYYMMDD')
return one - two
},
},
render: (dom, record) => {
return moment(record.build_time).format('YYYY-MM-DD')
return <>{moment(record.build_time).format('YYYY-MM-DD')=='1999-01-01'?'待定':moment(record.build_time).format('YYYY-MM-DD')}</>
},
},
{
@ -73,23 +85,67 @@ function Management(props) {
key: 'progress',
align: 'center'
},
{
title: '状态',
dataIndex: 'deferred_payment',
key: 'deferred_payment',
align: 'center',
render: (dom, record) => {
const current = new Date()
return <>
{(record.progress == '研发中' && Number(moment(current).format('YYYYMMDD')) > Number(moment(record.build_time).format('YYYYMMDD')))&&moment(record.build_time).format('YYYY-MM-DD')!=='1999-01-01'||(record.progress == '测试中' && Number(moment(current).format('YYYYMMDD')) > Number(moment(record.publish_time).format('YYYYMMDD')))&&moment(record.build_time).format('YYYY-MM-DD')!=='1999-01-01'? <div style={{ color: '#fb3838' }}>已延期</div>:<div style={{ color: '#23d96e' }}></div> }
</>
},
},
];
const peopleCol = [
{
title: "人员姓名",
dataIndex: "name_people",
key: "name_people",
hideInSearch: true,
title: '人员姓名',
dataIndex: 'name_people',
key: 'name_people',
ellipsis: true,
width: 300,
render: (dom, record) => {
return record.name_people;
},
fieldProps: {
onChange: (value, cs) => {
setName(value.target.value);
},
placeholder: '请输入人员名称进行搜索',
getPopupContainer: (triggerNode) => triggerNode.parentNode,
},
}, {
title: '岗位',
key: 'post_people',
dataIndex: 'post_people',
valueType: "select",
initialValue: null,
fieldProps: {
onChange: (value, cs) => {
console.log(value)
setAjob(value);
},
options: [
{
title: "岗位",
key: "post_people",
dataIndex: "post_people",
hideInSearch: true,
label: "全部岗位",
value: null,
},
{
label: "研发",
value: '研发',
},
{
label: "测试",
value: '测试',
},
{
label: "UI",
value: 'UI',
},
],
},
render: (dom, record) => {
return record.post_people;
},
@ -99,7 +155,7 @@ function Management(props) {
key: "md",
dataIndex: "md",
hideInSearch: true,
width:220,
render: (dom, record) => {
return <div>{record.md=='undefined'?'--' :record.md}</div>;
},
@ -109,7 +165,7 @@ function Management(props) {
key: "td",
dataIndex: "td",
hideInSearch: true,
width:220,
render: (dom, record) => {
return <div>{record.td=='undefined'?'--' :record.td}</div>;
},
@ -119,7 +175,7 @@ function Management(props) {
key: "wd",
dataIndex: "wd",
hideInSearch: true,
width:220,
render: (dom, record) => {
return <div>{record.wd=='undefined'?'--' :record.wd}</div>;
},
@ -129,7 +185,7 @@ function Management(props) {
key: "thd ",
dataIndex: "thd ",
hideInSearch: true,
width:220,
render: (dom, record) => {
return <div>{record.thd=='undefined'?'--' :record.thd}</div>;
},
@ -139,7 +195,7 @@ function Management(props) {
key: "fd",
dataIndex: "fd",
hideInSearch: true,
width:220,
render: (dom, record) => {
return <div>{record.fd=='undefined'?'--' :record.fd}</div>;
},
@ -196,33 +252,64 @@ function Management(props) {
},
];
return (
<>
<div className={CX("index")}>
<div className={CX("index")} >
<img className={CX("index-img")} src={topImg} />
<div className={CX("index-main")}>
<div className={CX("index-main-box")}>
<div className={CX("index-main")} >
<div className={CX("index-main-box")} >
<img className={CX("index-main-box-point")} src={pointImg} />
<div className={CX("index-main-box-title")}>本周在研项目</div>
<div className={CX("index-main-box-en")}>/Research project this week</div>
<Spin spinning={false}>
<Table dataSource={projectData} columns={projectCol} size="small" pagination={false} scroll={{ y: 340 }}/>
<Table dataSource={projectData} columns={projectCol} size="small" pagination={false} scroll={{ y: height*0.3 }}/>
</Spin>
</div>
<div className={CX("index-main-box")}>
<div className={CX("index-main-box")} >
<img className={CX("index-main-box-point")} src={pointImg} />
<div className={CX("index-main-box-title")}>待研发项目</div>
<div className={CX("index-main-box-en")}>/Project to be developed</div>
<Table dataSource={waitData} columns={waitCol} size="small" pagination={false} scroll={{ y: 340 }}/>
<Table dataSource={waitData} columns={waitCol} size="small" pagination={false} scroll={{ y: height*0.3 }}/>
</div>
</div>
<div className={CX("index-main-box")} style={{width:'80%',margin:'0 auto',marginTop:'1rem'}}>
<div className={CX("index-main-box")} style={{width:'90%',margin:'0 auto',marginTop:'1rem',height:'42vh'}}>
<img className={CX("index-main-box-point")} src={pointImg} />
<div className={CX("index-main-box-title")}>人员情况</div>
<div className={CX("index-main-box-en")}>/Information on Personnel</div>
{/* <Scroller containerId={"article-container-query"} height={"80%"}> */}
<Table dataSource={peopleData} columns={peopleCol} size="small" pagination={false} scroll={{ y: 300 }} />
<ProTable options={false} actionRef={ref} dataSource={peopleData} columns={peopleCol} size="small" pagination={false} scroll={{ y: height*0.3 }}
request={async () => {
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)
}}
/>
{/* </Scroller> */}

13
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;

41
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 (
<Button
type="primary"
@ -145,8 +146,32 @@ export const Default = (props) => {
setImportVisible(true);
}}
>
项目信息导入
人员任务导入
</Button>
);
},
},{
key: "direction",
hideInTable: true,
dataIndex: "direction",
renderFormItem: (record, { type, defaultRender, ...rest }, form) => {
console.log(record)
return (
<Popconfirm
title=" 是否全部删除?"
onConfirm={confirm}
okText="确认"
cancelText="取消"
>
<Button
style={{ width: "200px" }}
>
一键删除
</Button>
</Popconfirm>
);
},
},
@ -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);

162
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 (
<Modal
visible={props.importVisible}
onOk={confirm}
confirmLoading={loading}
onCancel={() => {
setMsg("");
setLoading(false);
setPostData([]);
handleCancel();
}}
destroyOnClose
>
{/* <Button size="small" type='primary' onClick={() => {
Request.get(`attachments?src=upload/files/1.jpg&filename=${encodeURIComponent('1.jpg')}&token=${user.token}`).then(res => {
})
}}>下载模板</Button> */}
<a href={`/assets/排队项目.xlsx`} >
<Button size="small" type='primary' >下载模板</Button>
</a>
<div style={{ marginTop: 10 }}>下载模板后填写完整后上传</div>
<div style={{ marginTop: 10 }}>
<Upload
{...{
name: "user_d",
action: "/",
maxCount: 1,
showUploadList: {
showRemoveIcon: false,
},
beforeUpload: (file) => {
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); // 读取数据
},
}}
>
<Button>上传文件</Button>
</Upload>
<br />
<span>{msg}</span>
</div>
</Modal>
);
};
function mapStateToProps(state) {
const { auth, customizeList } = state;
return {
user: auth.user,
};
}
export default connect(mapStateToProps)(ImportUser);

1
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({

65
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 (
<Button
@ -105,6 +105,44 @@ export const Default = (props) => {
);
},
},
{
key: "direction",
hideInTable: true,
dataIndex: "direction",
renderFormItem: (item, { type, defaultRender, ...rest }, form) => {
return (
<Button
type="primary"
style={{ width: "200px" }}
onClick={() => {
setImportVisible(true);
}}
>
排队项目导入
</Button>
);
},
},{
key: "direction",
hideInTable: true,
dataIndex: "direction",
renderFormItem: (item, { type, defaultRender, ...rest }, form) => {
return (
<Popconfirm
title=" 是否全部删除?"
onConfirm={confirm}
okText="确认"
cancelText="取消"
>
<Button
style={{ width: "200px" }}
>
一键删除
</Button>
</Popconfirm>
);
},
},
];
const handleCancel = () => {
tableActionRef.current.reload();
@ -143,7 +181,10 @@ export const Default = (props) => {
}
});
};
const importHandleCancel = () => {
tableActionRef.current.reload();
setImportVisible(false);
};
//删除资讯
const delDataList = (record) => {
const query = {
@ -159,6 +200,20 @@ export const Default = (props) => {
}
});
};
//一键删除
const confirm = (record) => {
const query = {
table_name: "test_waiting",
delete_all:'1'
};
dispatch(delCancel(query)).then((res) => {
if (res.success) {
// 刷新
// tableActionRef.current.reload();
handleCancel();
}
});
};
//编辑
const editor = (record) => {
if (record) {
@ -201,6 +256,10 @@ export const Default = (props) => {
setState={setState}
></ProjectModeal>
<ImportModeal
importVisible={importVisible}
handleCancel={importHandleCancel}
></ImportModeal>
</div>
);
};

4
web/client/src/utils/webapi.js

@ -12,7 +12,9 @@ export const ApiTable = {
delCancel: 'deleteDB', //删除信息
//下载项目模板
getDownProject:'downProject'
getDownProject: 'downProject',
//查询人员信息
postKeySearch:'keySearch'
};
export const RouteTable = {

Loading…
Cancel
Save