Files
fe_service_ebtp_frontend/src/pages/BidEvaluation/manager.js

567 lines
20 KiB
JavaScript
Raw Normal View History

2022-03-10 14:24:13 +08:00
import React, { PureComponent } from 'react';
import { Divider, Button, Form, Card, Tabs, Table, Tooltip, Input, Select, Row, Col, message, Modal, Popconfirm, Tag, InputNumber } from 'antd';
import { history } from 'umi';
import ProTable from '@ant-design/pro-table';
import { getDictBidMethodDict, getProMethod, getRoomId, getDefId, getQuotationMethodById } from '@/utils/session';
import { saveLeaderId, getJuryData, checkOpenBidSupplier, getPackageList, createReviewRoom, closingReviewRoom } from './components/service';
2020-12-23 11:14:35 +08:00
import './index.less';
import { connect } from "dva";
import { routerRedux } from 'dva/router';
2022-03-10 14:24:13 +08:00
import { getProId, getProSignDict } from '@/utils/session';
2021-01-16 11:29:42 +08:00
import ReviewDevided from '@/pages/BidEvaluation/components/ReviewDevided';
2022-03-10 14:24:13 +08:00
import CreateReviewRoom from '@/pages/BidEvaluation/components/CreateReviewRoom';
import { getURLInformation } from '@/utils/CommonUtils';
import { ExclamationCircleOutlined } from '@ant-design/icons';
import { btnAuthority } from '@/utils/authority';
import SetGroupLeader from './components/SetGroupLeader';
import { finish } from './components/simpleUploadServis';
import UploadReport from './components/UploadReport';
import CloseReasonModal from './components/CloseReasonModal';
import { getUrlRelativePath, isNotEmpty, isEmpty, getUrlParam } from '@/utils/CommonUtils';
2021-01-16 11:29:42 +08:00
//import SetLeader from '@/pages/BidEvaluation/components/SetLeader';
2020-12-23 11:14:35 +08:00
// @Form.create()
2021-01-16 11:29:42 +08:00
const InfId = getRoomId();
2022-03-10 14:24:13 +08:00
const { confirm } = Modal;
const modalHeight = window.innerHeight * 96 / 100;
@connect(({ bidev, loading }) => ({
...bidev,
managerlistLoading: loading.effects['bidev/fetchManagerList'],
2020-12-23 11:14:35 +08:00
}))
2022-03-10 14:24:13 +08:00
2020-12-23 11:14:35 +08:00
class manager extends PureComponent {
2022-03-10 14:24:13 +08:00
state = {
pageNo: 1,
pageSize: 10,
tpId: getProId(),
defId: getDefId(),
ratevisible: false,
2021-01-16 11:29:42 +08:00
visible: false,
2022-03-10 14:24:13 +08:00
data: {},
2021-01-16 11:29:42 +08:00
roomStatus: 1,
2022-03-10 14:24:13 +08:00
proMethod: getProMethod(),
createVisible: false,
sectionName: "采购包",
sectionType: "评审",
createIdList: [],
loading: false,
closeVisible: false,
name: '',
sort: '',
listParams: '',
2020-12-23 11:14:35 +08:00
}
2022-03-10 14:24:13 +08:00
//存储分页参数和查询条件
savePageAndParams = () => {
const { listParams } = this.state
let searchParams = JSON.parse(listParams);
let params = `${'?roomType=' + getURLInformation("roomType") + '&pageNo=' + searchParams.pageNo}${isEmpty(searchParams.sectionName) ? '' : '&name=' + searchParams.sectionName}${isEmpty(searchParams.roomSort) ? '' : '&sort=' + searchParams.roomSort}`;
let url = getUrlRelativePath() + params;
sessionStorage.setItem('roomReturnURL', url);//存储返回url
}
// 跳转评审配置
flowConfig = (record) => {
sessionStorage.setItem("roomId", record.id)
this.savePageAndParams();
this.props.dispatch(routerRedux.push(`/ProjectLayout/FlowConfig`))
}
//查询评审室列表
getManagerList = (params) => {
const { dispatch } = this.props;
this.setState({ listParams: JSON.stringify(params) })
dispatch({
type: "bidev/fetchManagerList",
payload: { ...params }
2021-01-16 11:29:42 +08:00
})
2022-03-10 14:24:13 +08:00
}
2021-01-16 11:29:42 +08:00
2022-03-10 14:24:13 +08:00
componentDidMount() {
//确定显示字段名称
let sectionName = "采购包";
let sectionType = "评审";
let proMethod = getProMethod();
if (proMethod == "procurement_mode_1" || proMethod == "procurement_mode_2") {
sectionName = "标段";
sectionType = "评标";
} else if (proMethod == "procurement_mode_5" || proMethod == "procurement_mode_6") {
sectionName = "采购包";
sectionType = "谈判";
} else if (proMethod == "procurement_mode_4") {
sectionName = "包件";
}
const pageNo = getURLInformation("pageNo");
const name = getUrlParam("name");
const sort = getUrlParam("sort");
2020-12-23 11:14:35 +08:00
this.setState({
2022-03-10 14:24:13 +08:00
sectionName,
sectionType,
name,
sort,
pageNo: Number(pageNo),
2020-12-23 11:14:35 +08:00
})
2022-03-10 14:24:13 +08:00
const params = {
pageNo: isNotEmpty(pageNo) ? Number(pageNo) : 1,
pageSize: 10,
roomType: getURLInformation('roomType'),
tpId: getProId(),//项目id
sectionName: isNotEmpty(name) ? name : '',
roomSort: isNotEmpty(sort) ? sort : '',
2020-12-23 11:14:35 +08:00
}
2022-03-10 14:24:13 +08:00
this.getManagerList(params)
}
handleRedirect = async (record) => {
sessionStorage.setItem("roomId", record.id)
sessionStorage.setItem("roomStatus", record.status)
sessionStorage.setItem("groupId", record.chatGroupId)
sessionStorage.setItem("expertGroupId", record.expertChatGroupId)
sessionStorage.setItem("roomTypeByEva", getURLInformation("roomType"))
this.setState({ loading: true })
await getQuotationMethodById(record.id)
// this.props.dispatch(routerRedux.push('/ProjectLayout/EvaRoom'))
this.setState({ loading: false })
window.open(`/EvaRoom`)
}
//评委会设置
onJurySet = (record) => {
this.savePageAndParams();
this.props.dispatch(routerRedux.push(`/ProjectLayout/JudgingPanel?roomId=${record.id}&secId=${record.sectionId}`))
}
//创建评审室
onCreateClick = async () => {
const { tpId, createIdList } = this.state
await getPackageList(tpId).then(res => {
if (res.code == 200) {
if (res.data.length == 0) {
message.info("当前项目无可选包件,无法创建评审室")
} else {
this.setState({
createIdList: res.data,
createVisible: true
})
}
}
2020-12-23 11:14:35 +08:00
})
}
2022-03-10 14:24:13 +08:00
//关闭评审室(多轮招募)
onCloseClick = (record) => {
this.setState({
data: record,
closeVisible: true
})
2020-12-23 11:14:35 +08:00
}
2022-03-10 14:24:13 +08:00
//关闭评审室关闭onOk
closeReasonOk = () => {
const { pageNo, pageSize, tpId, name, sort } = this.state;
this.setState({ closeVisible: false, data: {} });
const params = {
pageNo: pageNo,
pageSize: pageSize,
roomType: getURLInformation('roomType'),
tpId: tpId,//项目id
sectionName: name,
roomSort: sort,
2020-12-23 11:14:35 +08:00
}
2022-03-10 14:24:13 +08:00
this.getManagerList(params)
}
//关闭评审室关闭onCancel
closeReasonCancel = () => {
this.setState({ closeVisible: false, data: {} });
}
onCreateOut = () => {
this.setState({
createVisible: false
2020-12-23 11:14:35 +08:00
})
}
2022-03-10 14:24:13 +08:00
methodStatus() {
const { proMethod } = this.state
const biddingSignDict = getProSignDict();
let procurementMethod;
switch (proMethod) {
case 'procurement_mode_1':
procurementMethod = { visible: false, name: '评审' };
break;
case 'procurement_mode_2':
procurementMethod = { visible: false, name: '评审' };
break;
case 'procurement_mode_3':
switch (biddingSignDict) {
case 'selection_method_1':
procurementMethod = { visible: false, name: '评审' };
break;
case 'selection_method_2':
procurementMethod = { visible: true, name: '评审' };
break
default:
}
break;
case 'procurement_mode_4':
procurementMethod = { visible: true, name: '评审' };
break;
case 'procurement_mode_5':
procurementMethod = { visible: true, name: '谈判' };
break;
case 'procurement_mode_6':
procurementMethod = { visible: true, name: '谈判' };
break;
case 'procurement_mode_7':
procurementMethod = { visible: true, name: '评审' };
break;
case 'procurement_mode_8':
procurementMethod = { visible: false, name: '评审' };
break;
case 'procurement_mode_9':
procurementMethod = { visible: true, name: '谈判' };
break;
default:
}
return procurementMethod;
}
onOpenBizassessroom = async (record) => {
// const {checkOpenList} = this.props
const { onOpenRoom } = this
const { proMethod } = this.state
const params = {
id: record.id
2020-12-23 11:14:35 +08:00
}
this.props.dispatch({
2022-03-10 14:24:13 +08:00
type: "bidev/checkOpenBidSupplier",
payload: params.id,
callback: (response) => {
let checkOpenList = response.data
let methodDict = proMethod == null ? "procurement_mode_1" : proMethod
if (checkOpenList?.length == 0) {
message.error("应答的供应商为0家不能开启评审")
} else {
if (methodDict == "procurement_mode_5" && checkOpenList?.length < 2) {
confirm({
title: '确认开启评审室?',
icon: <ExclamationCircleOutlined />,
content: <span style={{ color: "#b30000" }}>注意应答的供应商少于2家</span>,
centered: true,
onOk() {
onOpenRoom(params)
},
onCancel() { },
});
} else if (methodDict == "procurement_mode_3" && checkOpenList?.length < 3) {
confirm({
title: '确认开启评审室?',
icon: <ExclamationCircleOutlined />,
content: <span style={{ color: "#b30000" }}>注意应答的供应商少于3家</span>,
centered: true,
onOk() {
onOpenRoom(params)
},
onCancel() { },
});
} else {
confirm({
title: '确认开启评审室?',
icon: <ExclamationCircleOutlined />,
centered: true,
onOk() {
onOpenRoom(params)
},
onCancel() { },
});
}
}
}
2020-12-23 11:14:35 +08:00
})
}
2022-03-10 14:24:13 +08:00
onOpenRoom = (params) => {
const { defId } = this.state
2020-12-23 11:14:35 +08:00
this.setState({
2022-03-10 14:24:13 +08:00
loading: true
2020-12-23 11:14:35 +08:00
})
2022-03-10 14:24:13 +08:00
if (defId == "recruit_multi") {
this.props.dispatch({
type: "bidev/zmmultiOpenBizassessroom",
payload: { ...params },
callback: () => {
this.setState({
loading: false
})
}
})
} else {
this.props.dispatch({
type: "bidev/openBizassessroom",
payload: { ...params },
callback: () => {
this.setState({
loading: false
})
}
})
}
2020-12-23 11:14:35 +08:00
}
2022-03-10 14:24:13 +08:00
onResetVerificationCode = (record) => {
const { pageNo, pageSize, tpId } = this.state;
const params = {
id: record.id,
pageNo: pageNo,
pageSize: pageSize,
tpId: tpId
}
this.props.dispatch({
type: "bidev/resetVerificationCode",
payload: { ...params }
2020-12-23 11:14:35 +08:00
})
}
2022-03-10 14:24:13 +08:00
// 跳转组建评委会
onRedirectRate = () => {
this.props.dispatch(routerRedux.push('/JudgingPanel/list'))
}
render() {
const { managerList, managerlistLoading, dispatch } = this.props;
const { pageNo, pageSize, tpId, ratevisible, visible, data, createVisible, sectionName, sectionType, createIdList, proMethod, defId, loading, closeVisible, name, sort } = this.state;
2020-12-23 11:14:35 +08:00
const pagination = {
current: pageNo,
2022-03-10 14:24:13 +08:00
total: managerList && managerList.total,
showSizeChanger: false,
// showQuickJumper: true,
defaultPageSize: 10,
// showTotal: (total,range) => `共 ${total} 条记录,第${range.slice(',')[0]}-${range.slice(',')[1]}条`,
onChange: (page, pageSize) => {
2020-12-23 11:14:35 +08:00
this.setState({
2022-03-10 14:24:13 +08:00
pageNo: page,
pageSize: pageSize,
2020-12-23 11:14:35 +08:00
});
2022-03-10 14:24:13 +08:00
const params = {
pageNo: page,
pageSize: pageSize,
roomType: getURLInformation('roomType'),
tpId: tpId,//项目id
sectionName: name,
roomSort: sort,
2020-12-23 11:14:35 +08:00
}
2022-03-10 14:24:13 +08:00
this.getManagerList(params)
2020-12-23 11:14:35 +08:00
},
2021-01-16 11:29:42 +08:00
}
2022-03-10 14:24:13 +08:00
2021-01-16 11:29:42 +08:00
const columns = [
{
2022-03-10 14:24:13 +08:00
title: '序号', dataIndex: 'id', width: '5%',
render: (text, record, index) => {
return (index + 1)
}
},
{ title: `${sectionName}名称`, dataIndex: 'sectionName', width: '10%' },
{ title: `${sectionName}编号`, dataIndex: 'sectionNum', width: '10%' },
{
title: defId == "recruit_multi" ? "轮次" : `${sectionType}次数`, hideInTable: proMethod == 'procurement_mode_9',
dataIndex: 'roomSort',
width: '10%',
render: (text, record, index) => {
return defId == "recruit_multi" ? <>{text}</> : record.reviewMark == 1 ? <>第{text + record.reviewSort}次{sectionType}</> : <>{text}{sectionType}</>
}
2021-01-16 11:29:42 +08:00
},
2022-03-10 14:24:13 +08:00
{ title: '评委信息', dataIndex: 'juryMember', width: '10%' },
{ title: '应答截止时间', dataIndex: 'responseEndTime', width: '10%', hideInTable: defId != "recruit_multi" },
{ title: `${sectionType}开始时间`, dataIndex: 'openTime', width: '10%' },
2021-01-16 11:29:42 +08:00
{
2022-03-10 14:24:13 +08:00
title: '校验码', dataIndex: 'verificationCode', width: '10%', hideInTable: proMethod == 'procurement_mode_9',
2021-01-16 11:29:42 +08:00
},
{
2022-03-10 14:24:13 +08:00
title: '状态', dataIndex: 'status', width: '10%', hideInTable: proMethod == 'procurement_mode_9',
render: (text, record, index) => {
let txt = record.status
return record.sectionStatus == 9 ? "异常处理" : txt == 0 || txt == 1 ? `准备${sectionType}` : (txt == 2 ? `正在${sectionType}` : (txt == 3 ? `${sectionType}结束` : null))
}
2021-01-16 11:29:42 +08:00
},
{
2022-03-10 14:24:13 +08:00
title: '操作', dataIndex: 'operation', width: '10%',
render: (text, record, index) => {
let status = record.status;
return (
<>
{
record.sectionStatus == 9 ? null :
status == 0 || status == 1 &&
<Button type="text" key="1"
onClick={() => { this.onOpenBizassessroom(record) }}
hidden={btnAuthority(["ebtp-agency-project-manager", "ebtp-purchase"]) || proMethod == 'procurement_mode_9'}
>
开启{sectionType}
</Button>
}
{
(status == 2 || (status == 3 && record?.closeReson == null)) &&
<Button
type="text"
key="2"
hidden={proMethod == 'procurement_mode_9'}
onClick={() => { this.handleRedirect(record) }}
>
进入{sectionType}
</Button>
}
{
defId == "recruit_multi" &&
<Button type="text" key="8" onClick={() => { this.onJurySet(record) }}>评委会设置</Button>
}
<Popconfirm
title="您确定要重置吗?"
onConfirm={() => { this.onResetVerificationCode(record) }}
okText="确定"
cancelText="取消"
>
<Button
type="text" key="5"
hidden={btnAuthority(["ebtp-agency-project-manager", "ebtp-purchase"]) || proMethod == 'procurement_mode_9'}
>
重置校验码
</Button>
</Popconfirm>
{
this.methodStatus().visible &&
<Button type="text" key="7"
onClick={() => { this.flowConfig(record) }}
hidden={btnAuthority(["ebtp-agency-project-manager", "ebtp-purchase"]) || proMethod == 'procurement_mode_9'}>
{this.methodStatus().name}配置
</Button>
}
{
defId == "recruit_multi" && (status == 1 || (status == 3 && record?.closeReson != null)) &&
<Button
type="text"
key="9"
style={{ margin: '0 20px 3px 0' }}
hidden={btnAuthority(["ebtp-agency-project-manager", "ebtp-purchase"])}
onClick={() => { this.onCloseClick(record) }}
>
{record?.closeReson == null ? '关闭评审室' : '查看关闭原因'}
</Button>
}
{/* 单一来源简化按钮 */}
{
proMethod == 'procurement_mode_9' &&
<>
<Button
type="text" key="simplify_1"
onClick={() => { history.push(`/ProjectLayout/SimpleUpload?roomId=${record.id}&bsId=${record.sectionId}&tpId=${this.state.tpId}&dis=${status}`) }}
hidden={btnAuthority(["ebtp-agency-project-manager", "ebtp-purchase"])}
>
{status == 3 ? '查看应答文件' : '上传应答文件'}
</Button>
<UploadReport assessId={record.id} tpId={this.state.tpId} sectionId={record.sectionId} dis={status == 3} />
<Popconfirm
title="您确定要提交吗?"
onConfirm={async () => {
this.setState({ loading: true });
await finish(record.id).then((res) => {
if (res.success) {
message.success('提交成功!');
const params = {
pageNo: pageNo,
pageSize: pageSize,
roomType: getURLInformation('roomType'),
tpId: tpId,//项目id
sectionName: name,
roomSort: sort,
}
this.getManagerList(params)
}
});
this.setState({ loading: false });
}}
okText="确定"
cancelText="取消"
>
<Button
type="text" key="simplify_2"
hidden={btnAuthority(["ebtp-agency-project-manager", "ebtp-purchase"]) || status == '3'}
>提交</Button>
</Popconfirm>
</>
}
</>
)
2021-01-16 11:29:42 +08:00
}
}
]
2022-03-10 14:24:13 +08:00
return (
<>
<Card bodyStyle={{ padding: '0px 24px' }} style={{ borderRadius: 6 }} bordered={false}>
<ProTable
options={false}
search={false}
size="small"
loading={managerlistLoading || loading}
columns={columns}
dataSource={managerList != "" && managerList.records}
pagination={pagination}
toolBarRender={() => [
<>
<Input type="text" placeholder={`${sectionName}名称`} value={name} onChange={(event) => this.setState({ name: event.target.value })} />
{defId == "recruit_multi" ? <Input type="number" placeholder='轮次' value={sort} onChange={(event) => this.setState({ sort: event.target.value })} /> : null}
<Button type="primary" key='c' onClick={() => {
const params = {
pageNo: 1,
pageSize: 10,
roomType: getURLInformation('roomType'),
tpId: tpId,//项目id
sectionName: name,
roomSort: sort,
}
this.getManagerList(params)
}}>查询</Button>
<Button key='reload' onClick={() => {
this.setState({ name: '', sort: '' })
const params = {
pageNo: 1,
pageSize: 10,
roomType: getURLInformation('roomType'),
tpId: tpId,//项目id
sectionName: '',
roomSort: '',
}
this.getManagerList(params)
}}>重置</Button>
{defId == "recruit_multi" ? <Button type="primary" key="create" onClick={() => this.onCreateClick()} loading={managerlistLoading || loading} hidden={btnAuthority(["ebtp-agency-project-manager", "ebtp-purchase"])}>创建评审室</Button> : null}
</>
]}
/>
</Card>
<CreateReviewRoom
modalVisible={createVisible}
onCancel={() => { this.onCreateOut() }}
onSubmit={async (value) =>
await createReviewRoom(value).then(res => {
if (res.code == 200) {
message.success("创建评审室成功")
this.onCreateOut()
const params = {
pageNo: pageNo,
pageSize: pageSize,
roomType: getURLInformation('roomType'),
tpId: tpId,//项目id
sectionName: name,
roomSort: sort,
}
this.getManagerList(params)
return true
} else {
return false
}
})
}
roomIdList={createIdList}
/>
{closeVisible && <CloseReasonModal modalVisible={closeVisible} onCancel={() => { this.closeReasonCancel() }} onOk={() => { this.closeReasonOk() }} recordData={data} />}
</>
)
2020-12-23 11:14:35 +08:00
}
}
export default manager;