diff --git a/web/client/src/app.js b/web/client/src/app.js index 9e47938..6aace3a 100644 --- a/web/client/src/app.js +++ b/web/client/src/app.js @@ -1,6 +1,6 @@ import React, { useEffect } from 'react'; import { - Auth, AlarmConfure, Article, Party,Personnel + Auth, AlarmConfure, Article, Party, Personnel } from './sections'; import Layout from './layout'; @@ -19,7 +19,7 @@ function App(props) { return ( ); } diff --git a/web/client/src/sections/homePage/actions/profile.js b/web/client/src/sections/homePage/actions/profile.js index 4367774..abf34e2 100644 --- a/web/client/src/sections/homePage/actions/profile.js +++ b/web/client/src/sections/homePage/actions/profile.js @@ -65,72 +65,6 @@ export function editName(userId, params) { msg: { option: "修改姓名" }, }); } - -// export function modifyEmailEnable(userId) { -// return (dispatch) => -// basicAction({ -// type: "post", -// dispatch: dispatch, -// actionType: "MODIFY_EMAILENABLE", -// url: ApiTable.modifyEmailEnable.replace("{userId}", userId), -// msg: { option: "启用邮件通知" }, -// }); -// } - -// export function modifyEmailDisable(userId) { -// return (dispatch) => -// basicAction({ -// type: "post", -// dispatch: dispatch, -// actionType: "MODIFY_EMAILDISABLE", -// url: ApiTable.modifyEmailDisable.replace("{userId}", userId), -// msg: { option: "禁用邮件通知" }, -// }); -// } - -// export function modifySmsEnable(userId) { -// return (dispatch) => -// basicAction({ -// type: "post", -// dispatch: dispatch, -// actionType: "MODIFY_SMSENABLE", -// url: ApiTable.modifySmsEnable.replace("{userId}", userId), -// msg: { option: "启用短信通知" }, -// }); -// } - -// export function modifySmsDisable(userId) { -// return (dispatch) => -// basicAction({ -// type: "post", -// dispatch: dispatch, -// actionType: "MODIFY_SMSDISABLE", -// url: ApiTable.modifySmsDisable.replace("{userId}", userId), -// msg: { option: "禁用短信通知" }, -// }); -// } - -// export function midifyDndEnable(userId) { -// return (dispatch) => -// basicAction({ -// type: "post", -// dispatch: dispatch, -// actionType: "MIDIFY_DNDENABLE", -// url: ApiTable.midifyDndEnable.replace("{userId}", userId), -// msg: { option: "开启免打扰" }, -// }); -// } - -// export function modifyDndDisable(userId) { -// return (dispatch) => -// basicAction({ -// type: "post", -// dispatch: dispatch, -// actionType: "MIDIFY_DNDDISABLE", -// url: ApiTable.modifyDndDisable.replace("{userId}", userId), -// msg: { option: "关闭免打扰" }, -// }); -// } export function getText(id) { return (dispatch) => basicAction({ @@ -158,17 +92,54 @@ export function getPartyMember() { }, }); } + +export function getProject() { + return (dispatch) => + basicAction({ + type: "post", + dispatch: dispatch, + actionType: "PROJECT", + url: ApiTable.projectUrl, + msg: { option: "获取本周在研项目" }, + reducer: { + name: "project", + }, + }); +} + +export function getPeople() { + return (dispatch) => + basicAction({ + type: "post", + dispatch: dispatch, + actionType: "PEOPLE", + url: ApiTable.peopleUrl, + msg: { option: "获取人员情况" }, + reducer: { + name: "people", + }, + }); +} + +export function getWait() { + return (dispatch) => + basicAction({ + type: "post", + dispatch: dispatch, + actionType: "WAIT", + url: ApiTable.waitUrl, + msg: { option: "获取待研发项目" }, + reducer: { + name: "wait", + }, + }); +} + export default { getProfile, editProfile, editpassword, editName, getText, - // modifyEmailEnable, - // modifyEmailDisable, - // modifySmsEnable, - // modifySmsDisable, - // midifyDndEnable, - // modifyDndDisable, getPartyMember, }; diff --git a/web/client/src/sections/homePage/containers/index.js b/web/client/src/sections/homePage/containers/index.js index a112d7d..116f4e2 100644 --- a/web/client/src/sections/homePage/containers/index.js +++ b/web/client/src/sections/homePage/containers/index.js @@ -2,17 +2,12 @@ import React, { useState, useEffect } from "react"; import { connect } from "react-redux"; import { Spin, Tabs, Table } from "antd"; -import { LayoutContent } from "@peace/components"; import classnames from "classnames/bind"; import styles from "./index.less"; import { push } from "react-router-redux"; import moment from "moment"; -import { getPartyMember } from "../actions/profile"; -// const ROOTLESSNAME = "ly-alarm-configure-container-indexjs"; +import { getProject, getPeople, getWait } from "../actions/profile"; const CX = classnames.bind(styles); -// function cx_(name) { -// return CX(`${ROOTLESSNAME}${name}`); -// } const topImg = "/assets/images/top.png"; const pointImg = "/assets/images/point.png"; @@ -22,29 +17,33 @@ function Management(props) { const [dataSource, setDataSource] = useState([]) - const currentCol = [ + const [projectData, setProjectData] = useState([]) + const [peopleData, setPeopleData] = useState([]) + const [waitData, setWaitData] = useState([]) + + const projectCol = [ { title: '项目名称', - dataIndex: 'name', - key: 'name', + dataIndex: 'name_project', + key: 'name_project', align: 'center' }, { title: '投入人力', - dataIndex: 'worker', - key: 'worker', + dataIndex: 'part_people', + key: 'part_people', align: 'center' }, { title: '构建时间', - dataIndex: 'buildTime', - key: 'buildTime', + dataIndex: 'build_time', + key: 'build_time', align: 'center' }, { title: '发布时间', - dataIndex: 'releaseTime', - key: 'releaseTime', + dataIndex: 'publish_time', + key: 'publish_time', align: 'center' }, { @@ -74,7 +73,7 @@ function Management(props) { key: 'monday', align: 'center', onCell: (record, index) => { - console.log("record, index: ", record, index); + // console.log("record, index: ", record, index); return { className: "cell-class", colSpan: 2 @@ -110,20 +109,20 @@ function Management(props) { const waitCol = [ { title: '项目', - dataIndex: 'name', - key: 'name', + dataIndex: 'name_project', + key: 'name_project', align: 'center' }, { title: '需求来源', - dataIndex: 'source', - key: 'source', + dataIndex: 'from_project', + key: 'from_project', align: 'center' }, { title: '对接人', - dataIndex: 'head', - key: 'head', + dataIndex: 'contacts', + key: 'contacts', align: 'center' }, { @@ -135,7 +134,34 @@ function Management(props) { ]; useEffect(() => { - // dispatch(getPartyMember()).then((res) => { }); + dispatch(getProject()).then((res) => { + if (res.success) { + const nextData = res.payload?.data?.projects?.map((d, i) => ({ + ...d, + key: i, + build_time: moment(d.build_time).format("YYYY/MM/DD"), + publish_time: moment(d.publish_time).format("YYYY/MM/DD"), + part_people: d.part_people?.map(p => p.name_people).join(), + })); + setProjectData(nextData) + } + }) + + dispatch(getPeople()).then((res) => { + console.log(res, 'getPeople') + }) + + dispatch(getWait()).then((res) => { + if (res.success) { + const nextData = res.payload?.data?.projects?.map((d, i) => ({ + ...d, + key: i, + })); + setWaitData(nextData) + } + }) + + let nextData = [] for (let i = 1; i <= 34; i++) { nextData.push({ @@ -158,7 +184,7 @@ function Management(props) {
本周在研项目
/Research project this week
- +
@@ -171,7 +197,7 @@ function Management(props) {
待研发项目
/Project to be developed
-
+
@@ -203,13 +229,10 @@ function Management(props) { ); } function mapStateToProps(state) { - const { auth, global, party, articlesfrom } = state; + const { auth, global } = state; return { - loding: party.isRequesting, user: auth.user, actions: global.actions, - articlesfrom: articlesfrom, - party: party || [], }; } export default connect(mapStateToProps)(Management); diff --git a/web/client/src/sections/index.js b/web/client/src/sections/index.js index 7752219..5eceed5 100644 --- a/web/client/src/sections/index.js +++ b/web/client/src/sections/index.js @@ -5,5 +5,5 @@ import Party from './party' import Personnel from './personnel' export { - Auth, AlarmConfure, Article, Party,Personnel + Auth, AlarmConfure, Article, Party, Personnel }; diff --git a/web/client/src/utils/webapi.js b/web/client/src/utils/webapi.js index 707cac9..09bf6bd 100644 --- a/web/client/src/utils/webapi.js +++ b/web/client/src/utils/webapi.js @@ -2,6 +2,11 @@ import request from "superagent"; import noCache from "superagent-no-cache"; export const ApiTable = { + /* 研发看板 */ + projectUrl: "outProject", // 在研项目 + peopleUrl: "outPeople", // 人员情况 + waitUrl: "outWait", // 待研项目 + getDataList: "article/management", //全部资讯 delDataList: "article/management", //删除资讯 addArticle: "article/management",