Browse Source

全部提交

master
xingyongchun 2 years ago
parent
commit
97da162690
  1. BIN
      web/client/assets/人员信息.xlsx
  2. BIN
      web/client/assets/项目信息.xlsx
  3. 23
      web/client/src/sections/article/actions/article.js
  4. 22
      web/client/src/sections/article/components/import_model.js
  5. 9
      web/client/src/sections/article/components/modeal.js
  6. 112
      web/client/src/sections/article/containers/index.js
  7. 6
      web/client/src/sections/homePage/actions/profile.js
  8. 156
      web/client/src/sections/homePage/containers/index.js
  9. 12
      web/client/src/sections/personnel/actions/article.js
  10. 81
      web/client/src/sections/personnel/components/import_model.js
  11. 105
      web/client/src/sections/personnel/components/modeal.js
  12. 100
      web/client/src/sections/personnel/containers/index.js
  13. 56
      web/client/src/sections/wait/actions/article.js
  14. 2
      web/client/src/sections/wait/components/import_model.js
  15. 47
      web/client/src/sections/wait/components/modeal.js
  16. 139
      web/client/src/sections/wait/containers/index.js
  17. 12
      web/client/src/utils/webapi.js

BIN
web/client/assets/人员信息.xlsx

Binary file not shown.

BIN
web/client/assets/项目信息.xlsx

Binary file not shown.

23
web/client/src/sections/article/actions/article.js

@ -85,4 +85,27 @@ export function postInProject(articleObj) {
msg: { error: "上传项目信息失败" },
// reducer: { name: "articleInsertInfo" },
});
}
export function delCancel(query) {
return (dispatch) =>
basicAction({
type: "post",
dispatch: dispatch,
data: query,
actionType: "DEL_CANCEL",
url: `${ApiTable.delCancel}`,
msg: { error: "删除项目信息失败" },
// reducer: { name: "articleInsertInfo" },
});
}
export function getDownProject() {
return (dispatch) =>
basicAction({
type: "get",
dispatch: dispatch,
actionType: "DEL_CANCEL",
url: `${ApiTable.getDownProject}`,
msg: { error: "下载项目信息失败" },
// reducer: { name: "articleInsertInfo" },
});
}

22
web/client/src/sections/article/components/import_model.js

@ -12,7 +12,7 @@ import { Button, Input, Card, Modal, Upload, message } from "antd";
import { Request } from "@peace/utils";
import request from "superagent";
import XLSX from "xlsx";
import { postInProject } from "../actions/article";
import { postInProject,getDownProject } from "../actions/article";
//TODO 下载模板和上传文件读取
const ImportUser = (props) => {
@ -22,13 +22,16 @@ const ImportUser = (props) => {
const [postData, setPostData] = useState([]);
const confirm = () => {
handleCancel
if (postData.length) {
console.log(postData)
setLoading(true);
dispatch(postInProject(postData)).then((res) => {
console.log(res)
if (res.success) {
handleCancel();
message.success("上传成功");
handleCancel()
}
setLoading(false);
});
@ -55,18 +58,9 @@ const ImportUser = (props) => {
})
}}>下载模板</Button> */}
<a
href={
"/_api/" +
`attachments?src=files/用户信息导入模板.xlsx&filename=${encodeURIComponent(
"用户信息导入模板.xlsx"
)}&token=${user.token}`
}
>
<Button size="small" type="primary">
下载模板
</Button>
</a>
<a href={`/assets/项目信息.xlsx`} >
<Button size="small" type='primary' >下载模板</Button>
</a>
<div style={{ marginTop: 10 }}>下载模板后填写完整后上传</div>
<div style={{ marginTop: 10 }}>
<Upload

9
web/client/src/sections/article/components/modeal.js

@ -1,6 +1,7 @@
import React,{useState,useEffect} from 'react'
import { Modal, Form, Input, Button,DatePicker,Select } from 'antd'
import dayjs from 'dayjs';
import moment from 'moment';
function modeal(props) {
const [form] = Form.useForm();
const { visible, handleOk, handleCancel, editData } = props
@ -10,8 +11,8 @@ function modeal(props) {
form.setFieldsValue({
name_project: editData.name_project,
part_people: editData.part_people.map((i)=>i.name_people),
build_time: dayjs(editData?.build_time),
publish_time: dayjs(editData.publish_time),
build_time: moment(editData?.build_time).format('YYYY-MM-DD'),
publish_time: moment(editData?.publish_time).format('YYYY-MM-DD'),
progress:editData.progress
})
}
@ -49,14 +50,14 @@ function modeal(props) {
name="build_time"
rules={[{ required: true, message: '请选择时间' }]}
>
<DatePicker />
<Input/>
</Form.Item>
<Form.Item
label="发布时间"
name="publish_time"
rules={[{ required: true, message: '请选择时间' }]}
>
<DatePicker />
<Input/>
</Form.Item>
<Form.Item
label="目前进度"

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

@ -3,12 +3,12 @@ import React, { useEffect, useState, useRef } from "react";
import { connect } from "react-redux";
import { Button, Popconfirm } from "antd";
import ProTable from "@ant-design/pro-table";
import {postProject} from "../actions/article";
import { postProject, delCancel,postInProject } from "../actions/article";
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'
import ProjectModeal from "../components/modeal";
import ImportModeal from "../components/import_model";
export const Default = (props) => {
const { dispatch } = props;
@ -19,9 +19,7 @@ export const Default = (props) => {
const [visible, setVisible] = useState(false); //弹窗
const [editData, setEditData] = useState(); //数据
const [importVisible, setImportVisible] = useState(false); //弹窗
const tableActionRef = useRef();
const dataSore = [{ name_project: '企服v1.0.1', part_people: '投入研发3、测试1', build_time: new Date( ), publish_time: new Date( ), progress: '研发中' }]
const columns = [
{
title: "项目计划",
@ -38,7 +36,20 @@ export const Default = (props) => {
dataIndex: "part_people",
hideInSearch: true,
render: (dom, record) => {
return <div>{record.part_people.map((i, index) => record.part_people.length == 1 ? <span>{i.name_people}</span> : <span>{i.name_people}{index < record.part_people.length-1 ? '':'' }</span>) }</div>
return (
<div>
{record.part_people.map((i, index) =>
record.part_people.length == 1 ? (
<span>{i.name_people}</span>
) : (
<span>
{i.name_people}
{index < record.part_people.length - 1 ? "、" : ""}
</span>
)
)}
</div>
);
},
},
{
@ -47,7 +58,7 @@ export const Default = (props) => {
dataIndex: "build_time",
hideInSearch: true,
render: (dom, record) => {
return moment(record.build_time).format('YYYY-MM-DD')
return moment(record.build_time).format("YYYY-MM-DD");
},
},
{
@ -56,7 +67,7 @@ export const Default = (props) => {
dataIndex: "publish_time",
hideInSearch: true,
render: (dom, record) => {
return moment(record.publish_time).format('YYYY-MM-DD')
return moment(record.publish_time).format("YYYY-MM-DD");
},
},
{
@ -65,7 +76,7 @@ export const Default = (props) => {
hideInSearch: true,
order: 3,
render: (dom, record) => {
return record.progress
return record.progress;
},
},
{
@ -87,14 +98,13 @@ export const Default = (props) => {
<Popconfirm
title="确认删除?"
onConfirm={() => {
delDataList(record.id);
delDataList(record);
}}
>
<Button type="link">删除</Button>
</Popconfirm>
</div>
)
);
},
},
{
@ -108,7 +118,7 @@ export const Default = (props) => {
type="primary"
style={{ width: "200px" }}
onClick={() => {
setImportVisible(true)
setImportVisible(true);
}}
>
项目信息导入
@ -118,27 +128,50 @@ export const Default = (props) => {
},
];
const handleCancel = () => {
setVisible(false)
}
const handOk = () => {
}
tableActionRef.current.reload();
setVisible(false);
};
const handOk = (values) => {
const query = [{
build_time: values.build_time,
name_project: values.name_project,
part_people: values.part_people.map((i) => {
return {name_people:i}
}),
progress: values.progress,
publish_time: values.publish_time,
o_name_project:editData?.name_project,
}];
dispatch(postInProject(query)).then((res) => {
if (res.success) {
handleCancel();
// tableActionRef.current.reload();
}
});
};
const importHandleCancel = () => {
setImportVisible(false)
}
tableActionRef.current.reload();
setImportVisible(false);
};
//删除资讯
const delDataList = (ids, type) => {
dispatch(Action.delDataList(ids)).then((res) => {
const delDataList = (record) => {
const query = {
delete: record.name_project,
delete_state: record.progress,
table_name: "test_project",
};
dispatch(delCancel(query)).then((res) => {
if (res.success) {
// 刷新
tableActionRef.current.reload();
// tableActionRef.current.reload();
handleCancel()
}
});
};
//编辑
const editor = (record) => {
setVisible(true)
setEditData(record)
setVisible(true);
setEditData(record);
};
return (
<div style={{ height: "100%" }}>
@ -147,14 +180,13 @@ export const Default = (props) => {
actionRef={tableActionRef}
columns={columns}
options={false}
dataSource={counts||[]}
dataSource={counts || []}
search={{
optionRender: false,
collapsed: false,
}}
request={async (params) => {
const res = await dispatch(postProject());
console.log(res)
setCounts(res.payload.data.projects);
return {
...res,
@ -167,8 +199,17 @@ export const Default = (props) => {
}}
/>
</Scroller>
<ProjectModeal visible={visible} handleOk={handOk} editData={editData} handleCancel={handleCancel}></ProjectModeal>
<ImportModeal importVisible={importVisible} handleCancel={importHandleCancel} editData={editData}></ImportModeal>
<ProjectModeal
visible={visible}
handleOk={handOk}
editData={editData}
handleCancel={handleCancel}
></ProjectModeal>
<ImportModeal
importVisible={importVisible}
handleCancel={importHandleCancel}
editData={editData}
></ImportModeal>
</div>
);
};
@ -181,11 +222,10 @@ 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' }
]
{ 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" },
];

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

@ -99,7 +99,7 @@ export function getProject() {
type: "post",
dispatch: dispatch,
actionType: "PROJECT",
url: ApiTable.getProjectUrl,
url: ApiTable.projectUrl,
msg: { option: "获取本周在研项目" },
reducer: {
name: "project",
@ -113,7 +113,7 @@ export function getPeople() {
type: "post",
dispatch: dispatch,
actionType: "PEOPLE",
url: ApiTable.getPeopleUrl,
url: ApiTable.peopleUrl,
msg: { option: "获取人员情况" },
reducer: {
name: "people",
@ -127,7 +127,7 @@ export function getWait() {
type: "post",
dispatch: dispatch,
actionType: "WAIT",
url: ApiTable.getWaitUrl,
url: ApiTable.waitUrl,
msg: { option: "获取待研发项目" },
reducer: {
name: "wait",

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

@ -13,7 +13,7 @@ const topImg = "/assets/images/top.png";
const pointImg = "/assets/images/point.png";
function Management(props) {
const { dispatch, user } = props;
const { dispatch, user } = props
const [dataSource, setDataSource] = useState([])
@ -21,6 +21,17 @@ function Management(props) {
const [peopleData, setPeopleData] = useState([])
const [waitData, setWaitData] = useState([])
useEffect(() => {
dispatch(getProject()).then((res) => {
setProjectData(res.payload.data.projects)
})
dispatch(getPeople()).then((res) => {
setPeopleData(res.payload.data.projects)
})
dispatch(getWait()).then((res) => {
setWaitData(res.payload.data.projects)
})
},[])
const projectCol = [
{
title: '项目名称',
@ -32,19 +43,28 @@ function Management(props) {
title: '投入人力',
dataIndex: 'part_people',
key: 'part_people',
align: 'center'
align: 'center',
render: (dom, record) => {
return <div>{record.part_people.map((i, index) => record.part_people.length == 1 ? <span>{i.name_people}</span> : <span>{i.name_people}{index < record.part_people.length-1 ? '':'' }</span>) }</div>
},
},
{
title: '构建时间',
dataIndex: 'build_time',
key: 'build_time',
align: 'center'
align: 'center',
render: (dom, record) => {
return moment(record.build_time).format('YYYY-MM-DD')
},
},
{
title: '发布时间',
dataIndex: 'publish_time',
key: 'publish_time',
align: 'center'
align: 'center',
render: (dom, record) => {
return moment(record.publish_time).format('YYYY-MM-DD')
},
},
{
title: '进度',
@ -56,53 +76,80 @@ function Management(props) {
const peopleCol = [
{
title: '姓名',
dataIndex: 'name',
key: 'name',
align: 'center'
},
{
title: '部门',
dataIndex: 'dept',
key: 'dept',
align: 'center'
},
{
title: '11.28',
dataIndex: 'monday',
key: 'monday',
align: 'center',
onCell: (record, index) => {
// console.log("record, index: ", record, index);
return {
className: "cell-class",
colSpan: 2
};
}
},
{
title: '11.29',
dataIndex: 'tuesday',
key: 'tuesday',
align: 'center'
},
{
title: '11.30',
dataIndex: 'wednesday',
key: 'wednesday',
align: 'center'
},
{
title: '12.1',
dataIndex: 'thursday',
key: 'thursday',
align: 'center'
},
{
title: '12.2',
dataIndex: 'friday',
key: 'friday',
align: 'center'
title: "人员姓名",
dataIndex: "name_people",
key: "name_people",
hideInSearch: true,
render: (dom, record) => {
return record.name_people;
},
},
{
title: "岗位",
key: "post_people",
dataIndex: "post_people",
hideInSearch: true,
render: (dom, record) => {
return record.post_people
},
},
{
title: "周一",
key: "md",
dataIndex: "md",
hideInSearch: true,
render: (dom, record) => {
return record.md
},
},
{
title: "周二",
key: "td",
dataIndex: "td",
hideInSearch: true,
render: (dom, record) => {
return record.td
},
},{
title: "周三",
key: "wd",
dataIndex: "wd",
hideInSearch: true,
render: (dom, record) => {
return record.wd
},
},{
title: "周四",
key: "thd ",
dataIndex: "thd ",
hideInSearch: true,
render: (dom, record) => {
return record.thd
},
},{
title: "周五",
key: "fd",
dataIndex: "fd",
hideInSearch: true,
render: (dom, record) => {
return record.fd
},
},{
title: "周六",
key: "sd",
dataIndex: "sd",
hideInSearch: true,
render: (dom, record) => {
return record.sd
},
},{
title: "周日",
key: "ssd",
dataIndex: "ssd",
hideInSearch: true,
render: (dom, record) => {
return record.ssd
},
},
];
@ -132,11 +179,6 @@ function Management(props) {
align: 'center'
},
];
// useEffect(() => {
// dispatch(getPartyMember()).then((res) => {});
// }, []);
return (
<>
<div className={CX("index")}>
@ -154,7 +196,7 @@ function Management(props) {
<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>
<Table dataSource={dataSource} columns={peopleCol} size="middle" />
<Table dataSource={peopleData} columns={peopleCol} size="middle" />
</div>
<div className={CX("index-main-box")}>
<img className={CX("index-main-box-point")} src={pointImg} />

12
web/client/src/sections/personnel/actions/article.js

@ -86,3 +86,15 @@ export function postInPeople(articleObj) {
// reducer: { name: "articleInsertInfo" },
});
}
export function delCancel(query) {
return (dispatch) =>
basicAction({
type: "post",
dispatch: dispatch,
data: query,
actionType: "DEL_CANCEL",
url: `${ApiTable.delCancel}`,
msg: { error: "删除项目信息失败" },
// reducer: { name: "articleInsertInfo" },
});
}

81
web/client/src/sections/personnel/components/import_model.js

@ -54,18 +54,9 @@ const ImportUser = (props) => {
})
}}>下载模板</Button> */}
<a
href={
"/_api/" +
`attachments?src=files/用户信息导入模板.xlsx&filename=${encodeURIComponent(
"用户信息导入模板.xlsx"
)}&token=${user.token}`
}
>
<Button size="small" type="primary">
下载模板
</Button>
</a>
<a href={`/assets/人员信息.xlsx`} >
<Button size="small" type='primary' >下载模板</Button>
</a>
<div style={{ marginTop: 10 }}>下载模板后填写完整后上传</div>
<div style={{ marginTop: 10 }}>
<Upload
@ -121,46 +112,50 @@ const ImportUser = (props) => {
for (let i = 0; i < res.length; i++) {
let d = res[i];
let name_people = String(d["人员姓名"]).trim();
let post_people = String(d["岗位"]).trim();
let time = String(d["本周计划"]).trim();
let project = String(d["本周任务"]).trim();
if (!name_people || !post_people || !time || !project) {
let md = String(d["周一"]).trim();
let td = String(d["周二"]).trim();
let wd = String(d["周三"]).trim();
let thd = String(d["周四"]).trim();
let fd = String(d["周五"]).trim();
let sd = String(d["周六"]).trim();
let ssd = String(d["周日"]).trim();
if (!name_people || !post_people || !md || !td||!wd||!thd||!fd||!sd||!ssd) {
error(`${i + 1} 行有空值,请填写后重新上传`);
return;
}
postData.push({
name_people,
post_people,
time,
project,
post_people,md,td,wd,thd,fd,sd,ssd
});
}
if (postData.length) {
let newArray = postData.reduce((total, cur, index) => {
let hasValue = total.findIndex((current) => {
return current.name_people === cur.name_people;
});
let obj = {
name_people: cur.name_people,
post_people: cur.post_people,
work: [
{
time: cur.time,
project: cur.project,
},
],
};
let obj1 = {
time: cur.time,
project: cur.project,
};
hasValue === -1 && total.push(obj);
hasValue !== -1 && total[hasValue].work.push(obj1);
return total;
}, []);
console.log(newArray);
setPostData(newArray);
// let newArray = postData.reduce((total, cur, index) => {
// let hasValue = total.findIndex((current) => {
// return current.name_people === cur.name_people;
// });
// let obj = {
// name_people: cur.name_people,
// post_people: cur.post_people,
// work: [
// {
// time: cur.time,
// project: cur.project,
// },
// ],
// };
// let obj1 = {
// time: cur.time,
// project: cur.project,
// };
// hasValue === -1 && total.push(obj);
// hasValue !== -1 && total[hasValue].work.push(obj1);
// return total;
// }, []);
// console.log(newArray);
setPostData(postData);
}
let msg = "文件解析完成,点击确定按钮上传保存!";
setMsg(msg);

105
web/client/src/sections/personnel/components/modeal.js

@ -12,8 +12,14 @@ function modeal(props) {
name_people: editData.name_people,
post_people: editData.post_people,
progress: editData.progress,
time:editData.work.map((i)=>i.time),
project:editData.work.map((i)=>i.project)
md: editData.md,
td: editData.td,
wd: editData.wd,
thd: editData.thd,
fd: editData.fd,
sd: editData.sd,
ssd: editData.ssd,
})
}
@ -46,67 +52,58 @@ function modeal(props) {
>
<Input/>
</Form.Item>
{/* {editData?.work.map(() => {
return <> <Form.Item
label="本周计划"
name="time"
<Form.Item
label="周一"
name="md"
rules={[{ required: true, message: '请填写工作计划' }]}
>
<Input/>
</Form.Item>
<Form.Item
label="本周任务"
name="project"
label="周二"
name="td"
rules={[{ required: true, message: '请填写工作计划' }]}
>
<Input/>
</Form.Item></>
})} */}
<Form.List name="users">
{(fields, { add, remove }) => (
<>
{editData?.work.map(({ key, name, ...restField }) => (
<Space
key={key}
style={{
display: 'flex',
marginBottom: 8,
}}
align="baseline"
>
<Form.Item
{...restField}
name={[name, 'first']}
rules={[
{
required: true,
message: 'Missing first name',
},
]}
>
<Input placeholder="First Name" />
</Form.Item>
<Form.Item
{...restField}
name={[name, 'last']}
rules={[
{
required: true,
message: 'Missing last name',
},
]}
>
<Input placeholder="Last Name" />
</Form.Item>
</Form.Item>
<Form.Item
label="周三"
name="wd"
rules={[{ required: true, message: '请填写工作计划' }]}
>
<Input/>
</Form.Item> <Form.Item
label="周四"
name="thd"
rules={[{ required: true, message: '请填写工作计划' }]}
>
<Input/>
</Form.Item> <Form.Item
label="周五"
name="fd"
rules={[{ required: true, message: '请填写工作计划' }]}
>
<Input/>
</Form.Item> <Form.Item
label="周六"
name="sd"
rules={[{ required: true, message: '请填写工作计划' }]}
>
<Input/>
</Form.Item> <Form.Item
label="周日"
name="ssd"
rules={[{ required: true, message: '请填写工作计划' }]}
>
<Input/>
</Form.Item>
</Space>
))}
<Form.Item>
</Form.Item>
</>
)}
</Form.List>
<Form.Item noStyle={true}>
<div style={{
padding: '12px 0',

100
web/client/src/sections/personnel/containers/index.js

@ -3,7 +3,7 @@ import React, { useEffect, useState, useRef } from "react";
import { connect } from "react-redux";
import { Button, Popconfirm } from "antd";
import ProTable from "@ant-design/pro-table";
import {postOutPeople} from "../actions/article";
import {postOutPeople,postInPeople,delCancel} from "../actions/article";
import moment from "moment";
import { push } from "react-router-redux";
import { Scroller } from "$components";
@ -21,7 +21,6 @@ export const Default = (props) => {
const [importVisible, setImportVisible] = useState(false); //弹窗
const tableActionRef = useRef();
const dataSore = [{ name_project: '企服v1.0.1', part_people: '投入研发3、测试1', build_time: new Date( ), publish_time: new Date( ), progress: '研发中' }]
const columns = [
{
title: "人员姓名",
@ -42,14 +41,61 @@ export const Default = (props) => {
},
},
{
title: "本周工作计划",
key: "work",
dataIndex: "work",
title: "周一",
key: "md",
dataIndex: "md",
hideInSearch: true,
render: (dom, record) => {
return <div>{record?.work?.map((item) => {
return <div><span>{item.time}</span><span>{item.project }</span></div>
})}</div>
return record.md
},
},
{
title: "周二",
key: "td",
dataIndex: "td",
hideInSearch: true,
render: (dom, record) => {
return record.td
},
},{
title: "周三",
key: "wd",
dataIndex: "wd",
hideInSearch: true,
render: (dom, record) => {
return record.wd
},
},{
title: "周四",
key: "thd ",
dataIndex: "thd ",
hideInSearch: true,
render: (dom, record) => {
return record.thd
},
},{
title: "周五",
key: "fd",
dataIndex: "fd",
hideInSearch: true,
render: (dom, record) => {
return record.fd
},
},{
title: "周六",
key: "sd",
dataIndex: "sd",
hideInSearch: true,
render: (dom, record) => {
return record.sd
},
},{
title: "周日",
key: "ssd",
dataIndex: "ssd",
hideInSearch: true,
render: (dom, record) => {
return record.ssd
},
},
{
@ -71,7 +117,7 @@ export const Default = (props) => {
<Popconfirm
title="确认删除?"
onConfirm={() => {
delDataList(record.id);
delDataList(record);
}}
>
<Button type="link">删除</Button>
@ -103,19 +149,44 @@ export const Default = (props) => {
];
const handleCancel = () => {
setVisible(false)
tableActionRef.current.reload();
}
const handOk = () => {
const handOk = (values) => {
const query = [{
name_people: values.name_people,
post_people: values.post_people,
md: values.md,
td: values.td,
wd: values.wd,
thd: values.thd,
fd: values.fd,
sd: values.sd,
ssd: values.ssd,
o_name_people:editData?.name_people,
}];
dispatch(postInPeople(query)).then((res) => {
if (res.success) {
handleCancel();
// tableActionRef.current.reload();
}
});
}
const importHandleCancel = () => {
setImportVisible(false)
tableActionRef.current.reload();
}
//删除资讯
const delDataList = (ids, type) => {
dispatch(Action.delDataList(ids)).then((res) => {
const delDataList = (record) => {
const query = {
delete: record?.name_people,
delete_state: record?.post_people,
table_name: "test_people",
};
dispatch(delCancel(query)).then((res) => {
if (res.success) {
// 刷新
tableActionRef.current.reload();
// tableActionRef.current.reload();
handleCancel()
}
});
};
@ -137,7 +208,6 @@ export const Default = (props) => {
collapsed: false,
}}
request={async(params) => {
console.log(params)
const res = await dispatch(postOutPeople());
setCounts(res.payload.data.projects);

56
web/client/src/sections/wait/actions/article.js

@ -3,62 +3,38 @@ import { ApiTable } from "$utils";
import { Request } from "@peace/utils";
import { basicAction } from "@peace/utils";
export function addArticle(articleObj) {
export function postWaitUrl(articleObj) {
return (dispatch) =>
basicAction({
type: "post",
dispatch: dispatch,
data: articleObj,
actionType: "ADD_ARTICLE",
url: `${ApiTable.addArticle}`,
msg: { error: "新增文章失败" },
reducer: { name: "articleInsertInfo" },
actionType: "POST_WAITURL",
url: `${ApiTable.waitUrl}`,
msg: { error: "获取项目失败" },
});
}
export function editArticle(articleObj) {
export function postInWait(articleObj) {
return (dispatch) =>
basicAction({
type: "put",
type: "post",
dispatch: dispatch,
data: articleObj,
actionType: "EDIT_ARTICLE",
url: `${ApiTable.addArticle}`,
msg: { error: "编辑文章失败" },
reducer: { name: "articleInsertInfo" },
actionType: "POST_INWAIT",
url: `${ApiTable.postInWait}`,
msg: { error: "添加项目失败" },
});
}
export function getDataList(query) {
export function delCancel(query) {
return (dispatch) =>
basicAction({
type: "get",
type: "post",
dispatch: dispatch,
actionType: "GET_DATALIST",
url: ApiTable.getDataList,
query: query,
msg: { error: "获取文章信息失败" },
reducer: {
name: "articlesfrom",
},
data: query,
actionType: "DEL_CANCEL",
url: `${ApiTable.delCancel}`,
msg: { error: "删除项目信息失败" },
// reducer: { name: "articleInsertInfo" },
});
}
export function delDataList(id) {
return (dispatch) =>
basicAction({
type: "del",
dispatch: dispatch,
actionType: "DEL_DATALIST11",
url: ApiTable.delDataList + `?id=${id}`,
query: { id: id },
msg: { error: "删除文章信息失败" },
});
}
export const MODIFYARTICAL = {
REQUEST_SUCCESS: "MODIFY_ARTICAL_SUCCESS",
};
export function setModifyData(data) {
return (dispatch) => {
dispatch({ type: MODIFYARTICAL.REQUEST_SUCCESS, payload: { data } });
};
}

2
web/client/src/sections/wait/components/import_model.js

@ -53,7 +53,7 @@ const ImportUser = props => {
})
}}>下载模板</Button> */}
<a href={'/_api/' + `attachments?src=files/用户信息导入模板.xlsx&filename=${encodeURIComponent('用户信息导入模板.xlsx')}&token=${user.token}`} >
<a href={`/assets/人员信息.xlsx`} >
<Button size="small" type='primary' >下载模板</Button>
</a>
<div style={{ marginTop: 10 }}>下载模板后填写完整后上传</div>

47
web/client/src/sections/wait/components/modeal.js

@ -3,19 +3,21 @@ import { Modal, Form, Input, Button,DatePicker,Select } from 'antd'
import dayjs from 'dayjs';
function modeal(props) {
const [form] = Form.useForm();
const { visible, handleOk, handleCancel, editData } = props
const { visible, handleOk, handleCancel, editData ,setEditData,setState} = props
console.log(editData)
useEffect(() => {
if (editData && visible) {
form.setFieldsValue({
name_project: editData.name_project,
part_people: editData.part_people,
build_time: dayjs(editData?.build_time),
publish_time: dayjs(editData.publish_time),
from_project: editData.from_project,
contacts: editData.contacts,
progress:editData.progress
})
setState(true)
}
}, [editData, visible])
return (
<Modal
visible={visible}
@ -31,32 +33,25 @@ function modeal(props) {
autoComplete="off"
>
<Form.Item
label="项目计划"
label="项目"
name="name_project"
rules={[{ required: true, message: '请输入项目计划' }]}
rules={[{ required: true, message: '请输入项目' }]}
>
<Input/>
</Form.Item>
<Form.Item
label="投入人力"
name="part_people"
rules={[{ required: true, message: '请输入人员姓名' }]}
label="需求来源"
name="from_project"
rules={[{ required: true, message: '请输入来源' }]}
>
<Input/>
</Form.Item>
<Form.Item
label="构建时间"
name="build_time"
rules={[{ required: true, message: '请选择时间' }]}
</Form.Item>
<Form.Item
label="对接人"
name="contacts"
rules={[{ required: true, message: '请输入对接人' }]}
>
<DatePicker />
</Form.Item>
<Form.Item
label="发布时间"
name="publish_time"
rules={[{ required: true, message: '请选择时间' }]}
>
<DatePicker />
<Input/>
</Form.Item>
<Form.Item
label="目前进度"
@ -77,13 +72,17 @@ function modeal(props) {
}}>
<Button
style={{ marginRight: 16, width: 88 }}
onClick={handleCancel}
onClick={(() => {
// cancel()
handleCancel()
setEditData([])
})}
>取消</Button>
<Button
htmlType="submit"
type="primary"
style={{ marginRight: 16, width: 88 }}
// onClick={() => handleOk(form)}
// onClick={() => cancel()}
>确定</Button>
</div>
</Form.Item>

139
web/client/src/sections/wait/containers/index.js

@ -3,25 +3,21 @@ import React, { useEffect, useState, useRef } from "react";
import { connect } from "react-redux";
import { Button, Popconfirm } from "antd";
import ProTable from "@ant-design/pro-table";
import Action from "../actions/index";
import { postWaitUrl, postInWait,delCancel } from "../actions/article";
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'
import ProjectModeal from "../components/modeal";
import ImportModeal from "../components/import_model";
export const Default = (props) => {
const { dispatch } = props;
const [heading, setHeading] = useState(); //标题
const [state, setState] = useState(); //状态
const [day, setDay] = useState(); //发布时间
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 dataSore = [{ name_project: '企服v1.0.1', part_people: '投入研发3、测试1', build_time: new Date(), publish_time: new Date(), progress: '研发中' }]
const columns = [
{
title: "项目",
@ -38,7 +34,7 @@ export const Default = (props) => {
dataIndex: "from_project",
hideInSearch: true,
render: (dom, record) => {
return record.part_people
return record.from_project;
},
},
{
@ -47,14 +43,15 @@ export const Default = (props) => {
dataIndex: "contacts",
hideInSearch: true,
render: (dom, record) => {
return moment(record.build_time).format('YYYY-MM-DD')
return record.contacts;
},
},
{
title: '处理进度',
dataIndex: 'progress',
key: 'progress',
align: 'center'
title: "处理进度",
dataIndex: "progress",
key: "progress",
align: "center",
hideInSearch: true,
},
{
title: "操作",
@ -75,14 +72,13 @@ export const Default = (props) => {
<Popconfirm
title="确认删除?"
onConfirm={() => {
delDataList(record.id);
delDataList(record);
}}
>
<Button type="link">删除</Button>
</Popconfirm>
</div>
)
);
},
},
{
@ -96,37 +92,72 @@ export const Default = (props) => {
type="primary"
style={{ width: "200px" }}
onClick={() => {
setImportVisible(true)
editor();
}}
>
项目信息导入
添加
</Button>
);
},
},
];
const handleCancel = () => {
setVisible(false)
}
const handOk = () => {
tableActionRef.current.reload();
setVisible(false);
};
const handOk = (values) => {
let query = null;
if (state) {
query = [
{
name_project: values.name_project,
from_project: values.from_project,
contacts: values.contacts,
progress: values.progress,
o_name_project: editData?.name_project,
},
];
} else {
query = [
{
name_project: values.name_project,
from_project: values.from_project,
contacts: values.contacts,
progress: values.progress,
},
];
}
dispatch(postInWait(query)).then((res) => {
if (res.success) {
handleCancel();
setEditData([]);
tableActionRef.current.reload();
}
});
};
}
const importHandleCancel = () => {
setImportVisible(false)
}
//删除资讯
const delDataList = (ids, type) => {
dispatch(Action.delDataList(ids)).then((res) => {
const delDataList = (record) => {
const query = {
delete: record.name_project,
delete_state: record.progress,
table_name: "test_waiting",
};
dispatch(delCancel(query)).then((res) => {
if (res.success) {
// 刷新
tableActionRef.current.reload();
// tableActionRef.current.reload();
handleCancel()
}
});
};
//编辑
const editor = (record) => {
setVisible(true)
setEditData(record)
if (record) {
setEditData(record);
}
setVisible(true);
};
return (
<div style={{ height: "100%" }}>
@ -135,28 +166,14 @@ export const Default = (props) => {
actionRef={tableActionRef}
columns={columns}
options={false}
dataSource={dataSore}
dataSource={counts || []}
search={{
optionRender: false,
collapsed: false,
}}
request={async (params) => {
let query = {
type: -1,
searchValue: heading,
status: state,
page: params.current,
limit: params.pageSize,
publishTime:
day && day.length && day[0].trim() != ""
? JSON.stringify([
moment(day[0]).startOf("day"),
moment(day[1]).endOf("day"),
])
: null,
};
const res = await dispatch(Action.getDataList(query));
setCounts(res.payload.data);
const res = await dispatch(postWaitUrl());
setCounts(res.payload.data.projects);
return {
...res,
total: res.payload.data ? res.payload.data.total : 0,
@ -168,8 +185,15 @@ export const Default = (props) => {
}}
/>
</Scroller>
<ProjectModeal visible={visible} handleOk={handOk} editData={editData} handleCancel={handleCancel}></ProjectModeal>
<ImportModeal importVisible={importVisible} handleCancel={importHandleCancel} editData={editData}></ImportModeal>
<ProjectModeal
visible={visible}
handleOk={handOk}
editData={editData}
handleCancel={handleCancel}
setEditData={setEditData}
setState={setState}
></ProjectModeal>
</div>
);
};
@ -182,11 +206,10 @@ 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' }
]
{ 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" },
];

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

@ -7,12 +7,12 @@ export const ApiTable = {
peopleUrl: "outPeople", // 人员情况
waitUrl: "outWait", // 待研项目
postInProject:'inProject', // 增加项目
postInPeople:'inPeople',//增加人员任务
//支委会人员信息
getCommittee: "partyOrganizations", //获取支委会人员
postCommittee: "partyOrganization", //新增
putCommittee: "partyOrganization/:id", //修改
apiRoot: 'query/api/root',
postInPeople: 'inPeople',//增加人员任务
postInWait: 'inWait',//增加人员任务
delCancel: 'deleteDB', //删除信息
//下载项目模板
getDownProject:'downProject'
};
export const RouteTable = {

Loading…
Cancel
Save