diff --git a/src/military/task.js b/src/military/task.js index c47e0273..8fa95994 100644 --- a/src/military/task.js +++ b/src/military/task.js @@ -66,6 +66,11 @@ const PayProof = Loadable({ loading: Loading, }); +const TaskAdmin = Loadable({ + loader: () => import("./task/taskAdmin"), + loading: Loading, +}); + const Index = (propsTransmit) => { // 开发时,从代理的位置获取用户信息 const [currentUser, setCurrentUser] = useState(null); @@ -166,7 +171,7 @@ const Index = (propsTransmit) => { )} > - {/* 管理员待办 */} + {/* 管理员上传支付凭证 */} ( @@ -174,7 +179,15 @@ const Index = (propsTransmit) => { )} > - {/* 成果列表 */} + {/* 管理员任务列表 */} + ( + + )} + > + + {/* 任务列表 */} ( diff --git a/src/military/task/api.js b/src/military/task/api.js index 8a05051d..1c62d087 100644 --- a/src/military/task/api.js +++ b/src/military/task/api.js @@ -59,6 +59,23 @@ export async function getTaskList(params) { } } +// 管理员任务列表查询 +export async function getTaskAdminList(params) { + let res = await fetch({ + url: '/api/tasks/backend/list', + method: 'get', + params, + }); + if (res.data) { + return res.data; + } else { + notification.open({ + message: "提示", + description: res.message || '请求错误', + }); + } +} + // 我的任务列表查询 export async function getMyTaskList(params) { let res = await fetch({ @@ -499,12 +516,20 @@ export function uploadPayProof(data){ } - - // 胜出者确认收款 export function confirmReceipt(paperId) { return fetch({ url: `/api/sign/paper/money/${paperId}`, method: 'post', }); -} \ No newline at end of file +} + + +// 管理员修改任务公示方式 +export function changeShowUserMode(data) { + return fetch({ + url: `/api/tasks/backend/changeShowUserMode`, + method: 'post', + data, + }); +} diff --git a/src/military/task/components/proofModal/index.jsx b/src/military/task/components/proofModal/index.jsx index 29d48a93..c61a1520 100644 --- a/src/military/task/components/proofModal/index.jsx +++ b/src/military/task/components/proofModal/index.jsx @@ -99,135 +99,132 @@ export default Form.create()(props => { dataIndex: 'action', render: (text, record) => { // return 查看详情 - return { goToDeatil(e,record.task.id) }}> 查看详情 + return { goToDeatil(e, record.task.id) }}> 查看详情 } }]; }, [taskId]); -const rowSelection = useMemo(() => { - return { - type: taskModeId === 1 ? 'radio' : 'checkbox', - onChange: (selectedRowKeys, selectedRows) => { - setSelectedRows(selectedRows); - }, - } -}, [taskModeId]); - -function goToDeatil(e,taskId){ - e.stopPropagation(); - window.location.href=`/task/taskDetail/${taskId}`; -} - -const handleRow = record => { - return { - onClick: event => { - if (event.currentTarget.getElementsByClassName("ant-checkbox-wrapper")) { - event.currentTarget.getElementsByClassName("ant-checkbox-wrapper")[0].click(); - } else { - event.currentTarget.getElementsByClassName("ant-radio-wrapper")[0].click(); - } - }, - }; -}; - -function proofItem() { - if (!selectedRows.length) { - showNotification("请至少选择一条数据!"); - return; - } - - validateFields((err, values) => { - if (!err) { - let paperNumber = []; - let winnerIds = []; - let winnerName = []; - - for (const item of selectedRows) { - paperNumber.push(item.number); - winnerIds.push(item.user.id); - winnerName.push(item.user.nickname || item.user.login); - } - - let params = { - paperNumber: paperNumber.join(), - winnerIds: winnerIds.join(), - winnerName: winnerName.join(), - proofFileNumbers: values.files, - status: 2, - taskId, - }; - proofAdd(params).then(res => { - if (res && res.message === 'success') { - changeVisible(false); - reloadList(); - } - }); + const rowSelection = useMemo(() => { + return { + type: taskModeId === 1 ? 'radio' : 'checkbox', + onChange: (selectedRowKeys, selectedRows) => { + setSelectedRows(selectedRows); + }, } - }); + }, [taskModeId]); -} + function goToDeatil(e, taskId) { + e.stopPropagation(); + window.location.href = `/task/taskDetail/${taskId}`; + } -return ( - { changeVisible(false) }} - className="proof-modal" - draggable={true} - > -

选出胜出者*

-
- {helper( - "number", - [{ max: 20, message: '长度不能超过20个字符' }], - - )} + const handleRow = record => { + return { + onClick: event => { + let chooseDom = event.currentTarget.getElementsByClassName("ant-checkbox-wrapper") || event.currentTarget.getElementsByClassName("ant-radio-wrapper"); + chooseDom && chooseDom[0] && chooseDom[0].click(); + }, + }; + }; - {helper( - "userName", - [{ max: 20, message: '长度不能超过20个字符' }], - - )} - - -
- row.id} - dataSource={dataList} - columns={columns} - pagination={false} - rowSelection={rowSelection} - onRow={handleRow} - /> - {total > 10 && - { setCurPage(page) }} - current={curPage} - total={total} - />} + function proofItem() { + if (!selectedRows.length) { + showNotification("请至少选择一条数据!"); + return; + } - - { + if (!err) { + let paperNumber = []; + let winnerIds = []; + let winnerName = []; + + for (const item of selectedRows) { + paperNumber.push(item.number); + winnerIds.push(item.user.id); + winnerName.push(item.user.nickname || item.user.login); + } + + let params = { + paperNumber: paperNumber.join(), + winnerIds: winnerIds.join(), + winnerName: winnerName.join(), + proofFileNumbers: values.files, + status: 2, + taskId, + }; + proofAdd(params).then(res => { + if (res && res.message === 'success') { + changeVisible(false); + reloadList(); + } + }); + } + }); + + } + + return ( + { changeVisible(false) }} + className="proof-modal" + draggable={true} + > +

选出胜出者*

+
+ {helper( + "number", + [{ max: 20, message: '长度不能超过20个字符' }], + + )} + + {helper( + "userName", + [{ max: 20, message: '长度不能超过20个字符' }], + + )} + + +
+
row.id} + dataSource={dataList} + columns={columns} + pagination={false} + rowSelection={rowSelection} + onRow={handleRow} /> - {getFieldDecorator('files', { - rules: [{ required: visible, message: "请上传文件" }], - validateFirst: true - })()} - - + {total > 10 && + { setCurPage(page) }} + current={curPage} + total={total} + />} -) + + + {getFieldDecorator('files', { + rules: [{ required: visible, message: "请上传文件" }], + validateFirst: true + })()} + + + + ) } ) \ No newline at end of file diff --git a/src/military/task/index.scss b/src/military/task/index.scss index c53f8947..8f9db3d3 100644 --- a/src/military/task/index.scss +++ b/src/military/task/index.scss @@ -15,6 +15,9 @@ .ant-form-item { margin: 0 1rem 0 0; } + .ant-form-item-control-wrapper { + display: inline-block; + } } .center-left-but { .circle-button { @@ -23,6 +26,10 @@ } } + // .center-right-but { + + // } + .ant-select { min-width: 200px; } diff --git a/src/military/task/payProof/index.js b/src/military/task/payProof/index.js index e388c7cf..8b19a69e 100644 --- a/src/military/task/payProof/index.js +++ b/src/military/task/payProof/index.js @@ -10,7 +10,7 @@ agreementArr.splice(1,1); export default Form.create()(({ current_user, form, showNotification, match, history }) => { const { getFieldDecorator, validateFields, setFieldsValue, } = form; - const [approve, setApprove] = useState(1); + const [approve, setApprove] = useState(2); const [loading, setLoading] = useState(false); const [searchObj, setSearchObj] = useState({}); const [curPage, setCurPage] = useState(1); @@ -78,8 +78,8 @@ export default Form.create()(({ current_user, form, showNotification, match, his
- - + +
diff --git a/src/military/task/static.js b/src/military/task/static.js index 8bb0c738..678341af 100644 --- a/src/military/task/static.js +++ b/src/military/task/static.js @@ -102,6 +102,11 @@ export const paperComplainStatusArr=[ { dicItemCode: '2', name: "待审核", dicItemName: '待审核' }, ] +export const showUserModeArr=[ + { dicItemCode: 0, name: "不公示", dicItemName: '不公示' }, + { dicItemCode: 1, name: "自动公示", dicItemName: '自动公示' }, + { dicItemCode: 2, name: "手动公示", dicItemName: '手动公示' }, +] export const formItemLayout = { labelCol: { diff --git a/src/military/task/taskAdmin/index.jsx b/src/military/task/taskAdmin/index.jsx new file mode 100644 index 00000000..4ba54c9a --- /dev/null +++ b/src/military/task/taskAdmin/index.jsx @@ -0,0 +1,237 @@ +import React, { useCallback, useEffect, useState, useMemo } from 'react'; +import { Input, Select, Button, Form, DatePicker, Table, Pagination, } from 'antd'; +import { Link } from "react-router-dom"; +import { paperCheckStatusArr, publishModeArr, taskStatusAllArr, showUserModeArr } from '../static'; +import { getTaskAdminList, changeShowUserMode } from '../api'; +import '../index.scss'; +import './index.scss'; +const format = "YYYY-MM-DD HH:mm:ss"; +const Option = Select.Option; + +const statusArr = []; +for (const item of taskStatusAllArr) { + statusArr[item.dicItemCode] = item.dicItemName; +} +const checkStatusArr = []; +for (const item of paperCheckStatusArr) { + checkStatusArr[item.dicItemCode] = item.dicItemName; +} +export default Form.create()(({ current_user, form, showNotification, match, history }) => { + + + const { getFieldDecorator, validateFields, setFieldsValue, getFieldsValue } = form; + + const [loading, setLoading] = useState(false); + const [searchObj, setSearchObj] = useState({ + // checkStatus: '0' + }); + const [curPage, setCurPage] = useState(1); + const [total, setTotal] = useState(0); + const [taskList, setTaskList] = useState([]); + + const [reload, setReload] = useState(0); + const [visible, setVisible] = useState(false); + const [activeId, setActiveId] = useState(''); + + + useEffect(() => { + const params = { + ...searchObj, + curPage, + pageSize: 10, + }; + setLoading(true); + getTaskAdminList(params).then(data => { + if (data) { + setTaskList(data.rows); + setTotal(data.total); + } + setLoading(false); + }) + }, [reload, curPage, searchObj]); + + + const helper = useCallback( + (label, name, rules, widget, initialValue) => ( + + {getFieldDecorator(name, { rules, initialValue, validateFirst: true, })(widget)} + + ), []); + + + function onSearch() { + let values = getFieldsValue(['checkStatus', 'endCreatedAt', 'startCreatedAt']); + if (values.startCreatedAt) values.startCreatedAt = values.startCreatedAt.format(format); + if (values.endCreatedAt) values.endCreatedAt = values.endCreatedAt.format(format); + if (values.checkStatus === '0,1,2') values.checkStatus = ''; + setSearchObj(values); + } + + function clearSearch() { + setFieldsValue({ + startCreatedAt: '', + endCreatedAt: '', + checkStatus: '0,1,2' + }); + setSearchObj({}); + } + + const columns = useMemo(() => { + return [ + { + title: '序号', + dataIndex: 'index', + render: (text, record, index) => { + return
{index + 1}
+ } + }, + { + title: '任务编号', + dataIndex: 'number', + }, + { + title: '任务名称', + dataIndex: 'name', + width: "20%", + render: (text, record) => ( + {text} + ), + }, + { + title: '发布方式', + dataIndex: 'publishMode', + render: (text, record) => { + return publishModeArr[text] + } + }, + { + title: '任务状态', + dataIndex: 'status', + render: (text, record) => { + return statusArr[text] + } + }, + { + title: '提交时间', + dataIndex: 'createdAt', + }, + { + title: '截稿时间', + dataIndex: 'collectingEndTime', + }, + { + title: '应征者名单公示', + dataIndex: 'showUserMode', + render: (text, record) => { + return + } + }, + // { + // title: '操作', + // key: 'action', + // render: (text, record) => ( + // + // {/* */} + // 查看 + // + // ), + // }, + ] + }, []); + + function changeStatus(showUserMode, taskId) { + changeShowUserMode({ + taskId, + showUserMode + }).then(res=>{ + console.log(res); + }) + } + + return ( +
+
+ {helper( + "任务名称", + "nameInput", + [{ max: 20, message: '长度不能超过20个字符' }], + + )} + + {helper( + "发布主体名称", + "enterpriseNameInput", + [{ max: 20, message: '长度不能超过20个字符' }], + + )} + +
+ + {helper( + "发布时间:", + "startCreatedAt", + [], + + )} + + {helper( + "", + "endCreatedAt", + [], + + )} + + + + +
+
+ + +
+ +
row.id} + dataSource={taskList} + columns={columns} + pagination={false} + className="mt10" + /> + {total > 10 && + { setCurPage(page) }} + current={curPage} + total={total} + />} + + + + + + ) +} +) \ No newline at end of file diff --git a/src/military/task/taskAdmin/index.scss b/src/military/task/taskAdmin/index.scss new file mode 100644 index 00000000..b66f0d77 --- /dev/null +++ b/src/military/task/taskAdmin/index.scss @@ -0,0 +1,25 @@ +.search-screen { + display: flex; + flex-flow: row wrap; + justify-content: space-between; + margin: 1.25rem 0; + padding:1.25rem; + background-color: #fff; + border-bottom: 1px solid #dedede; + + >.ant-row{ + min-width: 40%; + .ant-form-item-control-wrapper{ + min-width: 60%; + } + } + .ant-form-item-control-wrapper{ + display: inline-block; + } + .center-right-but{ + .ant-form-item{ + margin: 0 1rem 0 0;; + } + } + +}