Browse Source

去掉“待研发项目”,调整页面布局,优化人员计划(仅展示有数据的星期版本)。

master
Julin 1 year ago
parent
commit
ce5e67f8a5
  1. 77
      web/client/src/sections/homePage/containers/index.js
  2. 37
      web/client/src/sections/homePage/containers/index.less

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

@ -7,7 +7,6 @@ import { push } from 'react-router-redux';
import moment from 'moment'; import moment from 'moment';
import request from 'superagent'; import request from 'superagent';
import ProTable from '@ant-design/pro-table'; import ProTable from '@ant-design/pro-table';
import { getWait } from '../actions/profile';
import styles from './index.less'; import styles from './index.less';
const schedule = require('node-schedule'); const schedule = require('node-schedule');
@ -19,11 +18,14 @@ const pointImg = '/assets/images/point.png';
let cachePeopleData = null; let cachePeopleData = null;
function hideWeekdayInTable(weekday) {
return !cachePeopleData || cachePeopleData.every((d) => d[`${weekday}`] == 'undefined');
}
function Management(props) { function Management(props) {
const { dispatch, user } = props; const { dispatch, user } = props;
const [projectData, setProjectData] = useState(null); const [projectData, setProjectData] = useState(null);
const [peopleData, setPeopleData] = useState([]); const [peopleData, setPeopleData] = useState([]);
const [waitData, setWaitData] = useState([]);
const ref = useRef(); const ref = useRef();
function getOngoingProjects() { function getOngoingProjects() {
@ -46,11 +48,8 @@ function Management(props) {
getOngoingProjects(); getOngoingProjects();
getOngoingPersons(); getOngoingPersons();
}); });
dispatch(getWait()).then((res) => {
setWaitData(res?.payload.data?.projects);
});
}, []); }, []);
const projectCol = [ const projectCol = [
{ {
title: '执行ID', title: '执行ID',
@ -168,6 +167,7 @@ function Management(props) {
key: 'monday', key: 'monday',
dataIndex: 'monday', dataIndex: 'monday',
hideInSearch: true, hideInSearch: true,
hideInTable: hideWeekdayInTable('monday'),
render: (dom, record) => <div>{record.monday == 'undefined' ? '--' : record.monday}</div>, render: (dom, record) => <div>{record.monday == 'undefined' ? '--' : record.monday}</div>,
}, },
{ {
@ -175,6 +175,7 @@ function Management(props) {
key: 'tuesday', key: 'tuesday',
dataIndex: 'tuesday', dataIndex: 'tuesday',
hideInSearch: true, hideInSearch: true,
hideInTable: hideWeekdayInTable('tuesday'),
render: (dom, record) => <div>{record.tuesday == 'undefined' ? '--' : record.tuesday}</div>, render: (dom, record) => <div>{record.tuesday == 'undefined' ? '--' : record.tuesday}</div>,
}, },
{ {
@ -182,6 +183,7 @@ function Management(props) {
key: 'wednesday', key: 'wednesday',
dataIndex: 'wednesday', dataIndex: 'wednesday',
hideInSearch: true, hideInSearch: true,
hideInTable: hideWeekdayInTable('wednesday'),
render: (dom, record) => <div>{record.wednesday == 'undefined' ? '--' : record.wednesday}</div>, render: (dom, record) => <div>{record.wednesday == 'undefined' ? '--' : record.wednesday}</div>,
}, },
{ {
@ -189,6 +191,7 @@ function Management(props) {
key: 'thursday', key: 'thursday',
dataIndex: 'thursday', dataIndex: 'thursday',
hideInSearch: true, hideInSearch: true,
hideInTable: hideWeekdayInTable('thursday'),
render: (dom, record) => <div>{record.thursday == 'undefined' ? '--' : record.thursday}</div>, render: (dom, record) => <div>{record.thursday == 'undefined' ? '--' : record.thursday}</div>,
}, },
{ {
@ -196,6 +199,7 @@ function Management(props) {
key: 'friday', key: 'friday',
dataIndex: 'friday', dataIndex: 'friday',
hideInSearch: true, hideInSearch: true,
hideInTable: hideWeekdayInTable('friday'),
render: (dom, record) => <div>{record.friday == 'undefined' ? '--' : record.friday}</div>, render: (dom, record) => <div>{record.friday == 'undefined' ? '--' : record.friday}</div>,
}, },
{ {
@ -203,6 +207,7 @@ function Management(props) {
key: 'saturday', key: 'saturday',
dataIndex: 'saturday', dataIndex: 'saturday',
hideInSearch: true, hideInSearch: true,
hideInTable: hideWeekdayInTable('saturday'),
render: (dom, record) => <div>{record.saturday == 'undefined' ? '--' : record.saturday}</div>, render: (dom, record) => <div>{record.saturday == 'undefined' ? '--' : record.saturday}</div>,
}, },
{ {
@ -210,6 +215,7 @@ function Management(props) {
key: 'sunday', key: 'sunday',
dataIndex: 'sunday', dataIndex: 'sunday',
hideInSearch: true, hideInSearch: true,
hideInTable: hideWeekdayInTable('sunday'),
render: (dom, record) => <div>{record.sunday == 'undefined' ? '--' : record.sunday}</div>, render: (dom, record) => <div>{record.sunday == 'undefined' ? '--' : record.sunday}</div>,
}, },
{ {
@ -219,45 +225,12 @@ function Management(props) {
dataIndex: 'search_keyword', dataIndex: 'search_keyword',
order: 6, order: 6,
fieldProps: { fieldProps: {
placeholder: '请输入关键字进行搜索', placeholder: '请输入关键字搜索',
getPopupContainer: (triggerNode) => triggerNode.parentNode, getPopupContainer: (triggerNode) => triggerNode.parentNode,
}, },
}, },
]; ];
const waitCol = [
{
title: '项目',
dataIndex: 'name_project',
key: 'name_project',
align: 'center',
},
{
title: '需求来源',
dataIndex: 'from_project',
key: 'from_project',
align: 'center',
},
{
title: '对接人',
dataIndex: 'contacts',
key: 'contacts',
align: 'center',
}, {
title: '评估工时',
dataIndex: 'consum_time',
key: 'consum_time',
align: 'center',
},
{
title: '处理进度',
dataIndex: 'progress',
key: 'progress',
align: 'center',
},
];
return ( return (
<> <>
<div className={CX('index')}> <div className={CX('index')}>
@ -268,23 +241,11 @@ function Management(props) {
<div className={CX('index-main-box-title')}>本月在研项目</div> <div className={CX('index-main-box-title')}>本月在研项目</div>
<div className={CX('index-main-box-en')}>/Research project this month</div> <div className={CX('index-main-box-en')}>/Research project this month</div>
<Spin spinning={!projectData}> <Spin spinning={!projectData}>
<Table dataSource={projectData} columns={projectCol} size="small" pagination={false} scroll={{ y: '32vh' }} /> <Table dataSource={projectData} columns={projectCol} size="small" pagination={false} scroll={{ y: '78vh' }} />
</Spin> </Spin>
</div> </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: '32vh' }} />
</div>
</div>
<div
className={CX('index-main-box')}
style={{
width: '90%', margin: '0 auto', marginTop: '2.8rem', height: '42.5vh',
}}
>
<img className={CX('index-main-box-point')} src={pointImg} /> <img className={CX('index-main-box-point')} src={pointImg} />
<div className={CX('index-main-box-title')}>人员情况</div> <div className={CX('index-main-box-title')}>人员情况</div>
<div className={CX('index-main-box-en')}>/Information on Personnel</div> <div className={CX('index-main-box-en')}>/Information on Personnel</div>
@ -295,7 +256,7 @@ function Management(props) {
columns={peopleCol} columns={peopleCol}
size="small" size="small"
pagination={false} pagination={false}
scroll={{ y: '20vh' }} scroll={{ y: '69vh' }}
request={async (params) => { request={async (params) => {
const { search_keyword, post_people } = params; const { search_keyword, post_people } = params;
if (search_keyword || post_people) { if (search_keyword || post_people) {
@ -324,15 +285,11 @@ function Management(props) {
/> />
</div> </div>
</div> </div>
</div>
<a <a
style={{ style={{
fontSize: '16px', fontSize: '16px', position: 'absolute', color: '#000', right: '40px', top: '20px', zIndex: 10000,
position: 'absolute',
color: '#000',
right: '40px',
top: '20px',
zIndex: 10000,
}} }}
onClick={() => { onClick={() => {
if (user && user.authorized && JSON.parse(sessionStorage.getItem('user'))) { if (user && user.authorized && JSON.parse(sessionStorage.getItem('user'))) {

37
web/client/src/sections/homePage/containers/index.less

@ -119,35 +119,55 @@
&-main { &-main {
display: flex; display: flex;
width: 90%; width: 96%;
margin: 0 auto; margin: 0 auto;
height: 40vh; height: 85vh;
justify-content: space-between; justify-content: space-between;
&-box { &-box {
width: 49%; &:first-child {
height: 42vh; width: 41%;
}
&:last-child {
width: 58%;
}
height: 87vh;
box-shadow: 0px 0px 5px 0px rgba(0, 0, 0, 0.5); box-shadow: 0px 0px 5px 0px rgba(0, 0, 0, 0.5);
text-align: left; text-align: left;
padding: 5px; padding: 5px;
.ant-table-tbody>tr>td { .ant-table-tbody>tr>td {
background-color: #ffffff !important; background-color: #ffffff !important;
} }
.ant-col-offset-6 { .ant-col-offset-6 {
text-align: left !important; text-align: left !important;
margin-left: 0% !important; margin-left: 0% !important;
} }
.ant-col-offset-6 { .ant-col-offset-6 {
margin-left: -12%; margin-left: -12%;
} }
.ant-col ant-form-item-control { .ant-col ant-form-item-control {
flex-grow: 0 !important; flex-grow: 0 !important;
} }
.ant-pro-card-body { .ant-pro-card-body {
padding: 0px 24px 0 24px !important; padding: 0px 24px 0 24px !important;
} }
// .ant-table-column-sorter-inner{
// display: none !important; .ant-pro-table {
// } .ant-card-body {
padding: 0;
}
.ant-pro-table-search {
margin-bottom: 0;
}
}
&-point { &-point {
width: 14px; width: 14px;
@ -181,6 +201,3 @@ justify-content: space-between;
.cell-class { .cell-class {
background-color: skyblue; background-color: skyblue;
} }
// .ant-tooltip-content{
// display: none !important;
// }

Loading…
Cancel
Save