From 7e6bb3c7145ce4d4c107ceb65db68029cc9818f4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B0=A2=E6=80=9D?= <2897217417@qq.com> Date: Fri, 24 Dec 2021 09:27:06 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BC=96=E8=BE=91=E8=AF=84=E5=AE=A1=E8=A7=84?= =?UTF-8?q?=E5=88=99=E5=92=8C=E9=80=89=E6=8B=A9=E8=AF=84=E5=AE=A1=E4=B8=93?= =?UTF-8?q?=E5=AE=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/paginationTable/index.jsx | 5 +- .../expert/{register => }/image/warning.svg | 0 src/military/expert/index.scss | 65 ++++ src/military/expert/register/index.scss | 63 ---- src/military/expert/registerList/index.jsx | 2 +- src/military/expert/selectExpert/index.jsx | 295 +++++++++++++++--- src/military/expert/selectExpert/index.scss | 36 +++ src/military/task/taskAdmin/index.jsx | 2 +- 8 files changed, 367 insertions(+), 101 deletions(-) rename src/military/expert/{register => }/image/warning.svg (100%) diff --git a/src/military/components/paginationTable/index.jsx b/src/military/components/paginationTable/index.jsx index f834a62b..4fe03e27 100644 --- a/src/military/components/paginationTable/index.jsx +++ b/src/military/components/paginationTable/index.jsx @@ -3,7 +3,7 @@ import { Table, Pagination } from 'antd'; import './index.scss'; export default (props) => { - const { loading, dataSource, columns, handleRow, total, setCurPage, current } =props; + const { loading, dataSource, columns, handleRow, total, setCurPage, current, rowSelection, expandedRowRender, expandIconColumnIndex } =props; return ( @@ -14,6 +14,9 @@ export default (props) => { columns={columns} pagination={false} onRow={handleRow} + rowSelection={rowSelection} + expandedRowRender={expandedRowRender} + expandIconColumnIndex={expandIconColumnIndex} {...props} /> {total > 10 && diff --git a/src/military/expert/register/image/warning.svg b/src/military/expert/image/warning.svg similarity index 100% rename from src/military/expert/register/image/warning.svg rename to src/military/expert/image/warning.svg diff --git a/src/military/expert/index.scss b/src/military/expert/index.scss index 1f07496a..41b8c720 100644 --- a/src/military/expert/index.scss +++ b/src/military/expert/index.scss @@ -50,3 +50,68 @@ border-color: #5d6eff; } } + +//弹出确认框样式 +.expert_modal .ant-modal-content{ + width: 550px; + height: 318px; + & .ant-modal-header{ + padding: 0.6em 2.1em; + background: #F2F2FF; + & .ant-modal-title { + text-align: left; + } + } + & .ant-modal-body{ + padding-left: 120px; + & p{ + font-size: 16px; + color: #666666; + font-family: PingFangSC-Regular, PingFang SC; + line-height: 2.9em; + } + & .weight_bold{ + font-weight: bold; + } + & .warning::before{ + content: url('./image/warning.svg'); + width: 32px; + position: relative; + top: 11px; + left: -15px; + } + } + & .ant-btn{ + padding: 0 1.3em; + height: 2.55em; + border-radius: 4px; + cursor: pointer; + color: #404660; + border: 1px solid #E3E7ED; + width: 7em; + &:hover{ + background-color: #F8F8F8; + border: 1px solid #E3E7ED; + } + &:active{ + background-color: #F3F3F3; + border: 1px solid #E3E7ED; + } + } + & .ant-btn.ant-btn-primary{ + color: white; + background-color: #4154F1; + margin-left: 2.5em; + &:hover{ + background-color: #5D6EFF; + } + &:active{ + background-color: #374BF2; + } + } + & .ant-modal-footer {margin-top: 15px; } +} +.expert_modal.submit .ant-modal-body{ + padding-left: 0; + text-align: center; +} \ No newline at end of file diff --git a/src/military/expert/register/index.scss b/src/military/expert/register/index.scss index f8b9f384..c1af51c5 100644 --- a/src/military/expert/register/index.scss +++ b/src/military/expert/register/index.scss @@ -80,66 +80,3 @@ .expert_register .ant-select-dropdown-menu-item:hover, .ant-select-dropdown-menu-item-active:not(.ant-select-dropdown-menu-item-disabled){ background-color: #F2F3FF; } -.expert_modal .ant-modal-content{ - width: 550px; - height: 318px; - & .ant-modal-header{ - padding: 0.6em 2.1em; - background: #F2F2FF; - & .ant-modal-title { - text-align: left; - } - } - & .ant-modal-body{ - padding-left: 120px; - & p{ - font-size: 16px; - color: #666666; - font-family: PingFangSC-Regular, PingFang SC; - line-height: 2.9em; - } - & .weight_bold{ - font-weight: bold; - } - & .warning::before{ - content: url('./image/warning.svg'); - width: 32px; - position: relative; - top: 11px; - left: -15px; - } - } - & .ant-btn{ - padding: 0 1.3em; - height: 2.55em; - border-radius: 4px; - cursor: pointer; - color: #404660; - border: 1px solid #E3E7ED; - width: 7em; - &:hover{ - background-color: #F8F8F8; - border: 1px solid #E3E7ED; - } - &:active{ - background-color: #F3F3F3; - border: 1px solid #E3E7ED; - } - } - & .ant-btn.ant-btn-primary{ - color: white; - background-color: #4154F1; - margin-left: 2.5em; - &:hover{ - background-color: #5D6EFF; - } - &:active{ - background-color: #374BF2; - } - } - & .ant-modal-footer {margin-top: 15px; } -} -.expert_modal.submit .ant-modal-body{ - padding-left: 0; - text-align: center; -} \ No newline at end of file diff --git a/src/military/expert/registerList/index.jsx b/src/military/expert/registerList/index.jsx index 86cfeaf9..3b6b74a9 100644 --- a/src/military/expert/registerList/index.jsx +++ b/src/military/expert/registerList/index.jsx @@ -62,7 +62,7 @@ function RegisterList({ showNotification }) { dataIndex: 'professionalYears', }, { - title: '专业类别', + title: '专家类别', dataIndex: 'expertType', }, { diff --git a/src/military/expert/selectExpert/index.jsx b/src/military/expert/selectExpert/index.jsx index 85fd5408..e5a7cb94 100644 --- a/src/military/expert/selectExpert/index.jsx +++ b/src/military/expert/selectExpert/index.jsx @@ -1,13 +1,22 @@ -import React, { Component, useCallback } from "react"; -import { Tabs, Input, Select } from 'antd'; -import { unitType, reviewArea } from '../static.js'; +import React, { useState, useEffect, useMemo } from "react"; +import { Tabs, Input, Select, Button, Modal, Form } from 'antd'; +import { professionalType, reviewArea } from '../static.js'; +import { expertList } from "../api.js"; +import Paginationtable from "../../components/paginationTable"; import './index.scss'; import '../index.scss'; +import { Link } from "react-router-dom"; const { TabPane } = Tabs; const { Option } = Select; +const { Search } = Input; -function SelectExpert() { +function SelectExpert(props) { + console.log('选择专家', props); + const { form, location } = props; + const { getFieldDecorator, setFieldsValue, getFieldsValue } = form; + const { taskRecord } = location && location.state; + console.log('信息',taskRecord); // const TaskDetail = ( //
@@ -15,7 +24,143 @@ function SelectExpert() { //

任务名称

//

任务链接

//
- // ) + // ) + const [reload, setReload] = useState(); + const [loading, setLoading] = useState(false); + const [curPage, setCurPage] = useState(1); + const [dataList, setDataList] = useState([]); + const [total, setTotal] = useState(0); + const [pageSize, setPageSize] = useState(10); + const [searchInput, setSearchInput] = useState(''); + const [expertType, setExpertType] = useState(''); + const [reviewAreaSel, setReviewAreaSel] = useState(''); + //是否支持多选 + const [selectExperts, setSelectExperts] = useState(false); + //专家多选确认框 + const [okConfirmExps, setOkConfirmExps] = useState(false); + //专家多选-选择个数 + const [selectExpertCount, setSelectExpertCount] = useState(0); + //随机抽取专家确认框 + const [okConfirmExtract, setOkConfirmExtract] = useState(false); + //批量删除专家 + const [deleteExperts, setDeleteExperts] = useState(false); + + const columns = useMemo(() => { + return [ + { + title: '编号', + dataIndex: 'index', + width: 80, + align: 'center', + }, + { + title: '专家姓名', + dataIndex: 'expertName', + key: 'expertName', + }, + { + title: '手机号码', + dataIndex: 'phone', + width: 150, + key: 'phone', + }, + { + title: '最高学历', + dataIndex: 'highestDegree', + key: 'highestDegree', + }, + { + title: '专业职称', + dataIndex: 'professionalTitle', + }, + { + title: '专家类别', + dataIndex: 'expertType', + }, + { + title: '评审领域', + dataIndex: 'reviewAreas', + align: 'center', + }, + { + title: '专家评分', + dataIndex: 'expertScore', + align: 'center', + }, + { + title: '操作', + dataIndex: 'action', + width: 180, + align: 'center', + render: (text, record) => { + return + + + + } + } + ]; + }, []); + + const rowSelection = { + onChange: (selectedRowKeys, selectedRows) => { + setSelectExpertCount(selectedRows.length); + console.log(`selectedRowKeys: ${selectedRowKeys}`, 'selectedRows: ', selectedRows, selectedRows.length); + }, + getCheckboxProps: record => ({ + name: record.name, + }), + }; + + // const SelectExpertsBus = ( + // + // ) + + // 获取列表 + useEffect(() => { + setLoading(true); + let params = { + searchInput, + expertType: expertType === 'all' ? '' : expertType, + reviewArea: reviewAreaSel === 'all' ? '' : reviewAreaSel, + pageSize, + curPage, + statusString: '1', + }; + expertList(params).then(data => { + if (data && Array.isArray(data.rows)) { + let index = 1; + for (const item of data.rows) { + item.reviewAreas = `${item.reviewAreaOne} ${item.reviewAreaTwo && `、`} ${item.reviewAreaTwo} ${item.reviewAreaThree && `、`} ${item.reviewAreaThree} `; + item.index = (index++) + (curPage > 1 ? (curPage - 1) * 10 : 0); + } + } + setDataList(data.rows || []); + setLoading(false); + setTotal(data.total); + }); + }, [curPage, reload, searchInput, expertType, reviewAreaSel]); + + function check(record, checkStatus) { + Modal.confirm({ + title: "警告", + content: checkStatus == '1' ? "确认通过吗?通过后该用户将成为专家库的一员" : "确认拒绝吗?拒绝后该用户此次不能成为专家", + okText: '确定', + cancelText: '取消', + onOk() { + registerCheck({ + expertId: record.id, + isPassed: checkStatus, + userId: record.userId, + }).then(res => { + if (res.message === 'success') { + showNotification('操作成功!'); + setReload(Math.random()); + } + }); + }, + }); + } return (
@@ -24,47 +169,127 @@ function SelectExpert() {
-

任务信息

-

任务名称

-

任务链接

+

任务信息

+

任务名称{taskRecord.name}

+

任务链接{`/task/taskDetail/${taskRecord.id}`}

+
+

已选取评审专家

+
+ {!deleteExperts && } + {deleteExperts && } + {deleteExperts && } + { history.go(-1) }} + onCancel={() => setOkConfirmExps(false)} + wrapClassName="expert_modal" + > +

您确定要添加选中的{selectExpertCount}个专家吗?

+

此操作将添加选中的{selectExpertCount}个专家,请进行确认

+
+
+
+
-

任务信息

-

任务名称

-

任务链接

+

任务信息

+

任务名称{taskRecord.name}

+

任务链接{`/task/taskDetail/${taskRecord.id}`}

-
-

添加评审专家

+
+

添加评审专家

- - + {!selectExperts && } + {selectExperts && } + {selectExperts && } + + { history.go(-1) }} + onCancel={() => setOkConfirmExps(false)} + wrapClassName="expert_modal" + > +

您确定要添加选中的{selectExpertCount}个专家吗?

+

此操作将添加选中的{selectExpertCount}个专家,请进行确认

+
+ + { history.go(-1) }} + onCancel={() => setOkConfirmExtract(false)} + wrapClassName="expert_modal extract" + > + 请输入数量: +
-
- 查询条件: - 专家类别: - - 评审领域: - - - +
+
+ + {getFieldDecorator('searchInput', {})( { setSearchInput(value); setCurPage(1); }} + />)} + + + {getFieldDecorator('expertType', {})( + )} + + + {getFieldDecorator('reviewAreaSel', {})( + )} + +
+
+

{record.graduatedFrom}

} + expandIconColumnIndex={10} + /> -
) } -export default SelectExpert; \ No newline at end of file +export default Form.create()(SelectExpert); \ No newline at end of file diff --git a/src/military/expert/selectExpert/index.scss b/src/military/expert/selectExpert/index.scss index abc4c255..0f71c28e 100644 --- a/src/military/expert/selectExpert/index.scss +++ b/src/military/expert/selectExpert/index.scss @@ -1,4 +1,6 @@ .centerbox.select_expert{ + margin: -10px auto; + padding-top: 16px; background: white; .title_one, .ant-tabs-nav-wrap, .ant-tabs .ant-tabs-top-content{ padding: 0 2em; @@ -12,5 +14,39 @@ display: flex; justify-content: space-between; align-items: center; + &.ant-form{ + width: 78vw; + } + } + .search{ + .ant-form-item{ + display: flex; + } + } + .ant-pagination{ + text-align: right; + margin: 20px 0; + } + .ant-table-thead > tr > th, .ant-table-tbody > tr > td{ + padding: 16px 0 16px 10px; + } + .ml120{ + margin-left: 120px; + width: 6em; + } + .taskLink{color:#4154F1} +} +.expert_modal.extract{ + .ant-modal-content { + width: 387px; + height: 230px; + .ant-modal-body { + padding: 3.5vh 2.1em; + display: flex; + align-items: center; + } + } + .ant-input{ + width: 12vw; } } \ No newline at end of file diff --git a/src/military/task/taskAdmin/index.jsx b/src/military/task/taskAdmin/index.jsx index e0af60bc..6c2074b4 100644 --- a/src/military/task/taskAdmin/index.jsx +++ b/src/military/task/taskAdmin/index.jsx @@ -242,7 +242,7 @@ export default Form.create()(({ form, showNotification, match, history }) => { title: '专家选取', dataIndex: 'expertSelectedCount', render: (text, record) => { - return record.expertReview ? '' : 选择 + return record.expertReview ? '' : 选择 } }, {