|
|
@ -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" }, |
|
|
|
]; |
|
|
|