Merge branch '20220328-zjl-供应商开标列表定时刷新相关优化' into 'master-0401-合并'

4.1 供应商开标列表定时刷新相关优化

See merge request eshop/fe_service_ebtp_frontend!7
This commit is contained in:
高海峰
2022-04-01 20:18:58 +08:00
2 changed files with 49 additions and 18 deletions

View File

@ -1,7 +1,7 @@
import React, { useEffect, useRef, useState, } from 'react';
import { Spin, message, Popconfirm, Button, Modal } from 'antd';
import ProTable, { ActionType, ProColumns } from '@ant-design/pro-table';
import { updateState, getList, getListGys, getMan } from './service';
import { updateState, getList, getListGys, getMan, getListStatus } from './service';
import { getProId, getSessionRoleData, getProMethod } from '@/utils/session';
import FileDown from '@/utils/Download';
import { getURLInformation } from '@/utils/CommonUtils'
@ -54,6 +54,8 @@ const Sing: React.FC<{}> = () => {
//控制字段 角色、开标状态、唱标阶段、是否需要ipass解密
const juese = getSessionRoleData().roleCode//ebtp-agency-project-manager 代理 ebtp-supplier 供应商
const [data, dataSet] = useState<any>([]);
const dataRef = useRef<any>([]);//存储ref定时器使用
dataRef.current = data;
const [count, countSet] = useState<any>(0);
const [pageData, pageDataSet] = useState<any>({
pageNo: 1,
@ -63,21 +65,26 @@ const Sing: React.FC<{}> = () => {
const { confirm } = Modal;
let showNameT: any = { tbr: '', bd: '', kb: '' }//投标人供应商
if (method === 'procurement_mode_1' || method === 'procurement_mode_2') {//招标
showNameT = { tbr: '投标人', bd: '标段', kb: '开标' };
showNameT = { tbr: '投标人', bd: '标段', kb: '开标' };
} else {
showNameT = { tbr: '供应商', bd: '采购包', kb: '开启' }
showNameT = { tbr: '供应商', bd: '采购包', kb: '开启' }
}
useEffect(() => {
if (juese === 'ebtp-supplier') {
getDataGys();
}else {
} else {
getData();
}
setTimeout(() => {
countSet(count + 1)
}, 2000);
}, [count, pageData])
}, [pageData])
useEffect(() => {
if (juese === 'ebtp-supplier') {
getStatusGys();
setTimeout(() => {
countSet(count + 1)
}, 5000);
}
}, [count])
async function getData() {//代理获取列表
await getList({ projectId: getProId(), ...pageData, roomType: roomType }).then((res) => {
if (res?.code == 200) {
@ -92,6 +99,22 @@ const Sing: React.FC<{}> = () => {
}
})
}
async function getStatusGys() {//供应商获取列表状态
if (dataRef.current?.records) {
let tableData = JSON.parse(JSON.stringify(dataRef.current));
const ids: any[] = tableData.records.map((item: any) => item?.id);
await getListStatus(ids).then((res) => {
if (res?.code == 200) {
const resData = res?.data
tableData.records = tableData.records.map((item: any) => {
item.roomState = resData.filter((i: any) => i.id == item.id)[0]?.roomState;
return item;
})
dataSet(tableData);
}
})
}
}
async function showConfirm(record: any) {//环节流转提示
confirm({
@ -133,8 +156,8 @@ const Sing: React.FC<{}> = () => {
{
title: '操作', valueType: 'option', width: 270,
render: (_, record) => {
const endTime = new Date(record.docEndTime?.replace(/-/g,'/'))
const currentTime = new Date(record.systemDate?.replace(/-/g,'/'))
const endTime = new Date(record.docEndTime?.replace(/-/g, '/'))
const currentTime = new Date(record.systemDate?.replace(/-/g, '/'))
return (
<>
{
@ -209,6 +232,7 @@ const Sing: React.FC<{}> = () => {
if (success) {
window.open(`/room/index?aa=${record.assessRoomId}&bb=${record.turnSort}&roomType=${roomType}`);
}
getData();
actionRef.current?.reload();
setSpin(false);
}

View File

@ -2,14 +2,14 @@ import request from '@/utils/request';
//获取列表
export async function getList(params?: any) {
return request(`/api/biz-service-ebtp-opening/v1/bizbidopenroom/openRoomList/${params.projectId}`,{
params:params
return request(`/api/biz-service-ebtp-opening/v1/bizbidopenroom/openRoomList/${params.projectId}`, {
params: params
});
}
//获取列表gys
export async function getListGys(params?: any) {
return request(`/api/biz-service-ebtp-opening/v1/bizbidopenroom/payerOpenRoomList/${params.projectId}`,{
params:params
return request(`/api/biz-service-ebtp-opening/v1/bizbidopenroom/payerOpenRoomList/${params.projectId}`, {
params: params
});
}
//获取北京时间
@ -18,9 +18,9 @@ export async function getTime() {
}
//修改状态
export async function updateState(params?: any) {
return request(`/api/biz-service-ebtp-opening/v1/bizbidopenroom/updateOpenRoom/`,{
method:'PUT',
data:{
return request(`/api/biz-service-ebtp-opening/v1/bizbidopenroom/updateOpenRoom/`, {
method: 'PUT',
data: {
...params
}
});
@ -28,4 +28,11 @@ export async function updateState(params?: any) {
//获取报名人数
export async function getMan(reviewTurnId?: any) {
return request(`/api/biz-service-ebtp-tender/v1/supplier_register/get_register/${reviewTurnId}`);
}
//供应商获取列表状态接口
export async function getListStatus(params?: any[]) {
return request(`/api/biz-service-ebtp-opening/v1/bizbidopenroom/openRoomStateByIds`, {
method: 'POST',
data: params,
});
}