From ce5e67f8a5fefa3e2003f1e7f2a2c90347be70b3 Mon Sep 17 00:00:00 2001 From: Julin Date: Wed, 23 Aug 2023 17:11:15 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8E=BB=E6=8E=89=E2=80=9C=E5=BE=85=E7=A0=94?= =?UTF-8?q?=E5=8F=91=E9=A1=B9=E7=9B=AE=E2=80=9D=EF=BC=8C=E8=B0=83=E6=95=B4?= =?UTF-8?q?=E9=A1=B5=E9=9D=A2=E5=B8=83=E5=B1=80=EF=BC=8C=E4=BC=98=E5=8C=96?= =?UTF-8?q?=E4=BA=BA=E5=91=98=E8=AE=A1=E5=88=92=EF=BC=88=E4=BB=85=E5=B1=95?= =?UTF-8?q?=E7=A4=BA=E6=9C=89=E6=95=B0=E6=8D=AE=E7=9A=84=E6=98=9F=E6=9C=9F?= =?UTF-8?q?=E7=89=88=E6=9C=AC=EF=BC=89=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/sections/homePage/containers/index.js | 145 ++++++------------ .../sections/homePage/containers/index.less | 69 +++++---- 2 files changed, 94 insertions(+), 120 deletions(-) diff --git a/web/client/src/sections/homePage/containers/index.js b/web/client/src/sections/homePage/containers/index.js index 6795288..e7e2349 100644 --- a/web/client/src/sections/homePage/containers/index.js +++ b/web/client/src/sections/homePage/containers/index.js @@ -7,7 +7,6 @@ import { push } from 'react-router-redux'; import moment from 'moment'; import request from 'superagent'; import ProTable from '@ant-design/pro-table'; -import { getWait } from '../actions/profile'; import styles from './index.less'; const schedule = require('node-schedule'); @@ -19,11 +18,14 @@ const pointImg = '/assets/images/point.png'; let cachePeopleData = null; +function hideWeekdayInTable(weekday) { + return !cachePeopleData || cachePeopleData.every((d) => d[`${weekday}`] == 'undefined'); +} + function Management(props) { const { dispatch, user } = props; const [projectData, setProjectData] = useState(null); const [peopleData, setPeopleData] = useState([]); - const [waitData, setWaitData] = useState([]); const ref = useRef(); function getOngoingProjects() { @@ -46,11 +48,8 @@ function Management(props) { getOngoingProjects(); getOngoingPersons(); }); - - dispatch(getWait()).then((res) => { - setWaitData(res?.payload.data?.projects); - }); }, []); + const projectCol = [ { title: '执行ID', @@ -168,6 +167,7 @@ function Management(props) { key: 'monday', dataIndex: 'monday', hideInSearch: true, + hideInTable: hideWeekdayInTable('monday'), render: (dom, record) =>
{record.monday == 'undefined' ? '--' : record.monday}
, }, { @@ -175,6 +175,7 @@ function Management(props) { key: 'tuesday', dataIndex: 'tuesday', hideInSearch: true, + hideInTable: hideWeekdayInTable('tuesday'), render: (dom, record) =>
{record.tuesday == 'undefined' ? '--' : record.tuesday}
, }, { @@ -182,6 +183,7 @@ function Management(props) { key: 'wednesday', dataIndex: 'wednesday', hideInSearch: true, + hideInTable: hideWeekdayInTable('wednesday'), render: (dom, record) =>
{record.wednesday == 'undefined' ? '--' : record.wednesday}
, }, { @@ -189,6 +191,7 @@ function Management(props) { key: 'thursday', dataIndex: 'thursday', hideInSearch: true, + hideInTable: hideWeekdayInTable('thursday'), render: (dom, record) =>
{record.thursday == 'undefined' ? '--' : record.thursday}
, }, { @@ -196,6 +199,7 @@ function Management(props) { key: 'friday', dataIndex: 'friday', hideInSearch: true, + hideInTable: hideWeekdayInTable('friday'), render: (dom, record) =>
{record.friday == 'undefined' ? '--' : record.friday}
, }, { @@ -203,6 +207,7 @@ function Management(props) { key: 'saturday', dataIndex: 'saturday', hideInSearch: true, + hideInTable: hideWeekdayInTable('saturday'), render: (dom, record) =>
{record.saturday == 'undefined' ? '--' : record.saturday}
, }, { @@ -210,6 +215,7 @@ function Management(props) { key: 'sunday', dataIndex: 'sunday', hideInSearch: true, + hideInTable: hideWeekdayInTable('sunday'), render: (dom, record) =>
{record.sunday == 'undefined' ? '--' : record.sunday}
, }, { @@ -219,45 +225,12 @@ function Management(props) { dataIndex: 'search_keyword', order: 6, fieldProps: { - placeholder: '请输入关键字进行搜索', + placeholder: '请输入关键字搜索', 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 ( <>
@@ -268,71 +241,55 @@ function Management(props) {
本月在研项目
/Research project this month
- +
-
待研发项目
-
/Project to be developed
-
- - -
- -
人员情况
-
/Information on Personnel
- { - const { search_keyword, post_people } = params; - if (search_keyword || post_people) { - const data = cachePeopleData.filter((member) => { - if (!post_people) { - return member.name_people.includes(search_keyword); - } - if (!search_keyword) { - return member.post_people == post_people; - } - return member.name_people.includes(search_keyword) && member.post_people == post_people; - }); +
人员情况
+
/Information on Personnel
+ { + const { search_keyword, post_people } = params; + if (search_keyword || post_people) { + const data = cachePeopleData.filter((member) => { + if (!post_people) { + return member.name_people.includes(search_keyword); + } + if (!search_keyword) { + return member.post_people == post_people; + } + return member.name_people.includes(search_keyword) && member.post_people == post_people; + }); + setPeopleData(data); + return { data }; + } + if (cachePeopleData) { + setPeopleData(cachePeopleData); + return { data: cachePeopleData }; + } + const res = await request.get('/ongoing/persons'); + const data = res?.body?.projects; + cachePeopleData = data; setPeopleData(data); - return { data }; - } - if (cachePeopleData) { - setPeopleData(cachePeopleData); - return { data: cachePeopleData }; - } - const res = await request.get('/ongoing/persons'); - const data = res?.body?.projects; - cachePeopleData = data; - setPeopleData(data); - return { ...res }; - }} - /> + return { ...res }; + }} + /> +
{ if (user && user.authorized && JSON.parse(sessionStorage.getItem('user'))) { diff --git a/web/client/src/sections/homePage/containers/index.less b/web/client/src/sections/homePage/containers/index.less index e2b1cb6..004b98f 100644 --- a/web/client/src/sections/homePage/containers/index.less +++ b/web/client/src/sections/homePage/containers/index.less @@ -119,35 +119,55 @@ &-main { display: flex; - width: 90%; + width: 96%; margin: 0 auto; - height: 40vh; -justify-content: space-between; + height: 85vh; + justify-content: space-between; + &-box { - width: 49%; - height: 42vh; + &:first-child { + width: 41%; + } + + &:last-child { + width: 58%; + } + + height: 87vh; box-shadow: 0px 0px 5px 0px rgba(0, 0, 0, 0.5); text-align: left; padding: 5px; - .ant-table-tbody > tr > td{ + + .ant-table-tbody>tr>td { background-color: #ffffff !important; - } - .ant-col-offset-6{ - text-align: left !important; + } + + .ant-col-offset-6 { + text-align: left !important; margin-left: 0% !important; - } - .ant-col-offset-6{ - margin-left: -12%; - } - .ant-col ant-form-item-control{ - flex-grow:0 !important; - } -.ant-pro-card-body{ - padding: 0px 24px 0 24px !important; -} -// .ant-table-column-sorter-inner{ -// display: none !important; -// } + } + + .ant-col-offset-6 { + margin-left: -12%; + } + + .ant-col ant-form-item-control { + flex-grow: 0 !important; + } + + .ant-pro-card-body { + padding: 0px 24px 0 24px !important; + } + + .ant-pro-table { + .ant-card-body { + padding: 0; + } + + .ant-pro-table-search { + margin-bottom: 0; + } + } &-point { width: 14px; @@ -180,7 +200,4 @@ justify-content: space-between; .cell-class { background-color: skyblue; -} -// .ant-tooltip-content{ -// display: none !important; -// } +} \ No newline at end of file