diff --git a/web/client/assets/人员信息.xlsx b/web/client/assets/人员信息.xlsx new file mode 100644 index 0000000..ca46634 Binary files /dev/null and b/web/client/assets/人员信息.xlsx differ diff --git a/web/client/assets/项目信息.xlsx b/web/client/assets/项目信息.xlsx new file mode 100644 index 0000000..e95a5dd Binary files /dev/null and b/web/client/assets/项目信息.xlsx differ diff --git a/web/client/src/sections/article/actions/article.js b/web/client/src/sections/article/actions/article.js index 4ee0707..23b4ae9 100644 --- a/web/client/src/sections/article/actions/article.js +++ b/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" }, + }); } \ No newline at end of file diff --git a/web/client/src/sections/article/components/import_model.js b/web/client/src/sections/article/components/import_model.js index af133de..95af0de 100644 --- a/web/client/src/sections/article/components/import_model.js +++ b/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) => { }) }}>下载模板 */} - - - + + +
下载模板后填写完整后上传
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: '请选择时间' }]} > - + - + { 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
{record.part_people.map((i, index) => record.part_people.length == 1 ? {i.name_people} : {i.name_people}{index < record.part_people.length-1 ? '、':'' }) }
+ return ( +
+ {record.part_people.map((i, index) => + record.part_people.length == 1 ? ( + {i.name_people} + ) : ( + + {i.name_people} + {index < record.part_people.length - 1 ? "、" : ""} + + ) + )} +
+ ); }, }, { @@ -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) => { { - delDataList(record.id); + delDataList(record); }} >
- ) - + ); }, }, { @@ -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 (
@@ -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) => { }} /> - - + +
); }; @@ -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' } -] \ No newline at end of file + { 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" }, +]; diff --git a/web/client/src/sections/homePage/actions/profile.js b/web/client/src/sections/homePage/actions/profile.js index 5334716..5bd8588 100644 --- a/web/client/src/sections/homePage/actions/profile.js +++ b/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", diff --git a/web/client/src/sections/homePage/containers/index.js b/web/client/src/sections/homePage/containers/index.js index 5d300c7..134b489 100644 --- a/web/client/src/sections/homePage/containers/index.js +++ b/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
{record.part_people.map((i, index) => record.part_people.length == 1 ? {i.name_people} : {i.name_people}{index < record.part_people.length-1 ? '、':'' }) }
+ }, }, { 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 ( <>
@@ -154,7 +196,7 @@ function Management(props) {
人员情况
/Information on Personnel
- +
diff --git a/web/client/src/sections/personnel/actions/article.js b/web/client/src/sections/personnel/actions/article.js index 3e311cd..225eaad 100644 --- a/web/client/src/sections/personnel/actions/article.js +++ b/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" }, + }); +} diff --git a/web/client/src/sections/personnel/components/import_model.js b/web/client/src/sections/personnel/components/import_model.js index f144154..362e984 100644 --- a/web/client/src/sections/personnel/components/import_model.js +++ b/web/client/src/sections/personnel/components/import_model.js @@ -54,18 +54,9 @@ 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); diff --git a/web/client/src/sections/personnel/components/modeal.js b/web/client/src/sections/personnel/components/modeal.js index 8db4470..911de20 100644 --- a/web/client/src/sections/personnel/components/modeal.js +++ b/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) { > - {/* {editData?.work.map(() => { - return <> - - })} */} - - {(fields, { add, remove }) => ( - <> - {editData?.work.map(({ key, name, ...restField }) => ( - - - - - - - + + + + + + + + + + + + + - - ))} - - - - - )} - + + + + +
{ 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
{record?.work?.map((item) => { - return
{item.time}{item.project }
- })}
+ 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) => { { - delDataList(record.id); + delDataList(record); }} > @@ -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); diff --git a/web/client/src/sections/wait/actions/article.js b/web/client/src/sections/wait/actions/article.js index cdada0d..ffe43b9 100644 --- a/web/client/src/sections/wait/actions/article.js +++ b/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 } }); - }; -} diff --git a/web/client/src/sections/wait/components/import_model.js b/web/client/src/sections/wait/components/import_model.js index 41098a5..51b1368 100644 --- a/web/client/src/sections/wait/components/import_model.js +++ b/web/client/src/sections/wait/components/import_model.js @@ -53,7 +53,7 @@ const ImportUser = props => { }) }}>下载模板 */} - +
下载模板后填写完整后上传
diff --git a/web/client/src/sections/wait/components/modeal.js b/web/client/src/sections/wait/components/modeal.js index 53e5c41..3782a04 100644 --- a/web/client/src/sections/wait/components/modeal.js +++ b/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 ( - - + - - - - +
diff --git a/web/client/src/sections/wait/containers/index.js b/web/client/src/sections/wait/containers/index.js index 647d8dc..d625bfa 100644 --- a/web/client/src/sections/wait/containers/index.js +++ b/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) => { { - delDataList(record.id); + delDataList(record); }} >
- ) - + ); }, }, { @@ -96,37 +92,72 @@ export const Default = (props) => { type="primary" style={{ width: "200px" }} onClick={() => { - setImportVisible(true) + editor(); }} > - 项目信息导入 + 添加 ); }, }, ]; 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 (
@@ -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) => { }} /> - - +
); }; @@ -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' } -] \ No newline at end of file + { 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" }, +]; diff --git a/web/client/src/utils/webapi.js b/web/client/src/utils/webapi.js index 0521bde..957e728 100644 --- a/web/client/src/utils/webapi.js +++ b/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 = {