+ }
+
+ const { departments } = this.props
+
+ return (
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {/*TODO 增加方法校验,当一个部门没有人时不允许选择 */}
+
+ (
+ {
+ value: item1.id,
+ label: item1.name,
+ children: this.props.userList.filter(item2 => item2.departmentId === item1.id).map(item3 => (
+ {
+ value: item3.userId,
+ label: item3.realName,
+ }
+ ))
+ }
+ ))
+ }
+ />
+
+
+
+
+
+
+ )
+ }
+}
+
+ActivityReleaseComponent.propTypes = {
+ releaseActivityAsync: PropTypes.func,
+ userList: PropTypes.array,
+}
+
+ActivityReleaseComponent = connect(
+ ({
+ $ActivityState: { activityCheck },
+ $LoginState: { userId },
+ $UserState: { departments }
+ }) => ({
+ activityCheck,
+ studentId: userId,
+ departments
+ }),
+ {
+ checkActivityNameAsync,
+ releaseActivityAsync,
+ getDepartmentsAsync,
+ }
+)(ActivityReleaseComponent)
+
+export default ActivityReleaseComponent
\ No newline at end of file
diff --git a/src/components/activity-component/ActivityReleaseComponent.module.css b/src/components/activity-component/ActivityReleaseComponent.module.css
new file mode 100644
index 0000000..d8f9c0d
--- /dev/null
+++ b/src/components/activity-component/ActivityReleaseComponent.module.css
@@ -0,0 +1,6 @@
+.container {
+}
+
+.submit {
+ margin: 0 auto;
+}
\ No newline at end of file
diff --git a/src/components/activity-component/ActivityStateComponent.js b/src/components/activity-component/ActivityStateComponent.js
new file mode 100644
index 0000000..edfc491
--- /dev/null
+++ b/src/components/activity-component/ActivityStateComponent.js
@@ -0,0 +1,140 @@
+import React, { Component } from 'react'
+import { Modal, Space, Steps, Table, Tag } from 'antd'
+import PropTypes from 'prop-types'
+import { connect } from 'react-redux'
+import { getTaskListAsync } from '../../redux/async-actions'
+
+const { Step } = Steps
+
+class ActivityStateComponent extends Component {
+ state = {
+ page: 0,
+ pageSize: 100,
+ showModal: false,
+ }
+
+ UNSAFE_componentWillMount () {
+ this.columns = [
+ {
+ title: '名称',
+ dataIndex: 'taskName',
+ key: 'taskName',
+ width: 150,
+ ellipsis: true,
+ render: (text, record) =>
+ this.props.taskList.length >= 1 ? (
+
+ this.handleJumpPage(record.id)}>{text}
+
+ ) : null
+ },
+ {
+ title: '承担者',
+ dataIndex: 'acceptorName',
+ key: 'acceptorName',
+ },
+ {
+ title: '截止日期',
+ dataIndex: 'deadline',
+ key: 'deadline',
+ },
+ {
+ title: '任务状态',
+ dataIndex: 'taskStatus',
+ key: 'taskStatus',
+ render: (text, _) => {
+ let color = text === true ? 'green' : 'red'
+ let word = text === true ? '已完成' : '未完成'
+ return (
+
+ {word}
+
+ )
+ }
+ },
+ ]
+ }
+
+ handleCheckTask = async status => {
+ const { page, pageSize } = this.state
+ const { activityId } = this.props
+ await this.props.getTaskListAsync({ page, pageSize, activityId: activityId, status: status, timeOrder: true })
+ await this.showModal()
+ }
+
+ showModal = () => {
+ this.setState({ showModal: true })
+ }
+
+ handleCancel = () => {
+ this.setState({ showModal: false })
+ }
+
+ handleJumpPage = taskId => {
+ window.open(`/index/task/${taskId}/content`)
+ }
+
+ render () {
+ const { status, taskCount } = this.props
+ const { release, prepare, process, summarize } = taskCount
+ return (
+
+
+
+ this.handleCheckTask(0)}
+ description={release === 0 ? '该阶段暂时没有任务噢~' : `该阶段有${release}个任务!`}/>
+ this.handleCheckTask(1)}
+ description={prepare === 0 ? '该阶段暂时没有任务噢~' : `该阶段有${prepare}个任务!`}/>
+ this.handleCheckTask(2)}
+ description={process === 0 ? '该阶段暂时没有任务噢~' : `该阶段有${process}个任务!`}/>
+ this.handleCheckTask(3)}
+ description={summarize === 0 ? '该阶段暂时没有任务噢~' : `该阶段有${summarize}个任务!`}/>
+
+
+
+
+
+ this.handlePageChange(page, pageSize),//返回分页的页码和大小
+ pageSize: 5,
+ }}
+ />
+
+
+
+ )
+ }
+}
+
+ActivityStateComponent.propTypes = {
+ status: PropTypes.number,
+ activityId: PropTypes.number,
+ taskCount: PropTypes.any,
+}
+
+ActivityStateComponent = connect(
+ ({
+ $TaskState: { taskList }
+ }) => ({
+ taskList,
+ }),
+ {
+ getTaskListAsync,
+ }
+)(ActivityStateComponent)
+
+export default ActivityStateComponent
\ No newline at end of file
diff --git a/src/components/task-component/TaskReleaseComponent.js b/src/components/task-component/TaskReleaseComponent.js
new file mode 100644
index 0000000..03a0508
--- /dev/null
+++ b/src/components/task-component/TaskReleaseComponent.js
@@ -0,0 +1,128 @@
+import React, { Component } from 'react'
+import moment from 'moment'
+import 'moment/locale/zh-cn'
+import styles from './TaskReleaseComponent.module.css'
+import { Button, Cascader, DatePicker, Form, Input, Select } from 'antd'
+import PropTypes from 'prop-types'
+import locale from 'antd/es/date-picker/locale/zh_CN'
+import { Redirect } from 'react-router-dom'
+
+const layout = {
+ labelCol: { span: 8 },
+ wrapperCol: { span: 8 },
+}
+
+const validateMessages = {
+ // eslint-disable-next-line
+ required: '${label} 未填写!',
+}
+
+class TaskReleaseComponent extends Component {
+ state = {
+ flag: false
+ }
+
+ handleFinish = async form => {
+ const { taskName, acceptor, activity, activityStatus, deadline, content } = form
+ await this.props.releaseTaskAsync({
+ taskName: taskName,
+ acceptorId: acceptor[1],
+ activityId: activity,
+ activityStatus: activityStatus,
+ deadline: deadline.format('YYYY-MM-DD HH:mm:ss'),
+ content: content
+ })
+ await this.setState({ flag: true })
+ }
+
+ render () {
+ if (this.state.flag) {
+ return
+ }
+ const { userList, departments, activities } = this.props
+ return (
+
+
+
+
+
+ (
+ {
+ value: item1.id,
+ label: item1.name,
+ children: userList.filter(item2 => item2.departmentId === item1.id).map(item3 => (
+ {
+ value: item3.userId,
+ label: item3.realName,
+ }
+ ))
+ }
+ ))
+ }
+ />
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ )
+ }
+}
+
+TaskReleaseComponent.propTypes = {
+ releaseTaskAsync: PropTypes.func,
+ userList: PropTypes.array,
+ activities: PropTypes.array,
+ studentId: PropTypes.number,
+ departments: PropTypes.array,
+}
+
+export default TaskReleaseComponent
\ No newline at end of file
diff --git a/src/components/task-component/TaskReleaseComponent.module.css b/src/components/task-component/TaskReleaseComponent.module.css
new file mode 100644
index 0000000..2470f17
--- /dev/null
+++ b/src/components/task-component/TaskReleaseComponent.module.css
@@ -0,0 +1,7 @@
+.container {
+
+}
+
+.submit {
+ margin: 0 auto;
+}
\ No newline at end of file
--
Gitee
From ed923ec3e638f94bd4a2b9a25a572218a27bc56d Mon Sep 17 00:00:00 2001
From: Zhang Yifu <281105611@qq.com>
Date: Thu, 24 Jun 2021 23:31:12 +0800
Subject: [PATCH 11/11] =?UTF-8?q?=E3=80=90feat=E3=80=91=E5=AE=8C=E6=88=90s?=
=?UTF-8?q?ync=E7=9A=84=E6=B3=A8=E5=86=8C=E9=83=A8=E5=88=86=EF=BC=8Casync?=
=?UTF-8?q?=E4=BB=BB=E5=8A=A1=E9=83=A8=E5=88=86?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/redux/action-types.js | 12 +++++++++-
src/redux/async-actions.js | 46 +-------------------------------------
src/redux/sync-actions.js | 44 +++++++++++++++++++++++++++++++++++-
3 files changed, 55 insertions(+), 47 deletions(-)
diff --git a/src/redux/action-types.js b/src/redux/action-types.js
index 87fe7b9..65253fe 100644
--- a/src/redux/action-types.js
+++ b/src/redux/action-types.js
@@ -12,4 +12,14 @@ export const T_LOGIN_STATE = 't_login_state'
*/
export const U_SET_USER_LIST = 'u_set_user_list'
export const U_SET_USER_INFO = 'u_set_user_info'
-export const U_DELETE_USER = 'u_delete_user'
\ No newline at end of file
+export const U_DELETE_USER = 'u_delete_user'
+
+/**
+ * 活动模块
+ * @type {string}
+ */
+export const A_SET_ACTIVITY_LIST = 'a_set_activity_list'
+export const A_SET_ACTIVITY_CONTENT = 'a_set_activity_content'
+export const A_SET_ACTIVITY_STATUS = 'a_set_activity_status'
+export const A_DELETE_ACTIVITY = 'a_delete_activity'
+export const A_SET_ACTIVITY_CHECK = 'a_set_activity_check'
\ No newline at end of file
diff --git a/src/redux/async-actions.js b/src/redux/async-actions.js
index faf1da3..1c0501e 100644
--- a/src/redux/async-actions.js
+++ b/src/redux/async-actions.js
@@ -1,48 +1,4 @@
-import {
- deleteInit,
- getInit,
- postInit,
- putInit,
- query,
- request,
- rest,
-} from '../api/http'
-import { asyncResponseHandler } from './base'
-import {
- a_delete_activity,
- a_set_activity_content,
- a_set_activity_list,
- a_set_activity_status,
- f_delete_file,
- r_set_reimbursement_approve_list,
- r_set_reimbursement_create_list,
- r_set_reimbursement_info,
- r_set_reimbursement_list,
- r_delete_reimbursement_list,
- t_login,
- t_logout,
- t_set_task_content,
- t_set_task_list,
- t_set_task_status,
- u_set_user_info,
- u_set_user_list,
- t_delete_task,
- m_set_msgboard_list,
- m_delete_msgboard_list,
- a_set_activity_check,
- r_approve_reimbursement_list,
- r_delete_create_reimbursement,
- as_set_asset_list,
- d_set_department_list,
- c_set_class_list,
- t_set_task_count,
- n_set_news_list,
- u_delete_user,
- n_set_simple_news_list,
- n_read_news_list,
- s_set_search_result_list,
-} from './sync-actions'
-import { message } from 'antd'
+
/**
* 用户登陆,向后端发送POST
diff --git a/src/redux/sync-actions.js b/src/redux/sync-actions.js
index 213836d..564068a 100644
--- a/src/redux/sync-actions.js
+++ b/src/redux/sync-actions.js
@@ -1,3 +1,45 @@
-
+import {
+ A_DELETE_ACTIVITY,
+ A_SET_ACTIVITY_CHECK,
+ A_SET_ACTIVITY_CONTENT,
+ A_SET_ACTIVITY_LIST,
+ A_SET_ACTIVITY_STATUS,
+ AS_SET_ASSET_LIST,
+ C_SET_CLASS_LIST,
+ D_SET_DEPARTMENT_LIST,
+ F_DELETE_FILE,
+ M_DELETE_MSGBOARD_LIST,
+ M_SET_MSGBOARD_LIST,
+ N_READ_NEWS_LIST,
+ N_SET_NEWS_LIST,
+ N_SET_SIMPLE_NEWS_LIST,
+ R_APPROVE_REIMBURSEMENT_LIST,
+ R_DELETE_CREATE_REIMBURSEMENT,
+ R_DELETE_REIMBURSEMENT_LIST,
+ R_SET_REIMBURSEMENT_APPROVE_LIST,
+ R_SET_REIMBURSEMENT_CREATE_LIST,
+ R_SET_REIMBURSEMENT_INFO,
+ R_SET_REIMBURSEMENT_LIST,
+ S_SET_SEARCH_RESULT_LIST,
+ T_DELETE_TASK,
+ T_LOGIN,
+ T_LOGIN_STATE,
+ T_LOGOUT,
+ T_SET_TASK_CONTENT,
+ T_SET_TASK_COUNT,
+ T_SET_TASK_LIST,
+ T_SET_TASK_STATUS,
+ U_DELETE_USER,
+ U_SET_USER_INFO,
+ U_SET_USER_LIST,
+} from './action-types'
export const actionFactory = (type, data = undefined) => ({ type, data })
+
+/**
+ * 注册登陆模块
+ * @returns {{data: undefined, type}}
+ */
+export const t_login = data => actionFactory(T_LOGIN, data)
+export const t_logout = () => actionFactory(T_LOGOUT)
+export const loadUserState = () => actionFactory(T_LOGIN_STATE)
\ No newline at end of file
--
Gitee