Merge branch '20220328-zjl-供应商开标列表定时刷新相关优化' into 'master-0401-合并'
4.1 供应商开标列表定时刷新相关优化 See merge request eshop/fe_service_ebtp_frontend!7
This commit is contained in:
@ -1,7 +1,7 @@
|
|||||||
import React, { useEffect, useRef, useState, } from 'react';
|
import React, { useEffect, useRef, useState, } from 'react';
|
||||||
import { Spin, message, Popconfirm, Button, Modal } from 'antd';
|
import { Spin, message, Popconfirm, Button, Modal } from 'antd';
|
||||||
import ProTable, { ActionType, ProColumns } from '@ant-design/pro-table';
|
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 { getProId, getSessionRoleData, getProMethod } from '@/utils/session';
|
||||||
import FileDown from '@/utils/Download';
|
import FileDown from '@/utils/Download';
|
||||||
import { getURLInformation } from '@/utils/CommonUtils'
|
import { getURLInformation } from '@/utils/CommonUtils'
|
||||||
@ -54,6 +54,8 @@ const Sing: React.FC<{}> = () => {
|
|||||||
//控制字段 角色、开标状态、唱标阶段、是否需要ipass解密
|
//控制字段 角色、开标状态、唱标阶段、是否需要ipass解密
|
||||||
const juese = getSessionRoleData().roleCode//ebtp-agency-project-manager 代理 ebtp-supplier 供应商
|
const juese = getSessionRoleData().roleCode//ebtp-agency-project-manager 代理 ebtp-supplier 供应商
|
||||||
const [data, dataSet] = useState<any>([]);
|
const [data, dataSet] = useState<any>([]);
|
||||||
|
const dataRef = useRef<any>([]);//存储ref定时器使用
|
||||||
|
dataRef.current = data;
|
||||||
const [count, countSet] = useState<any>(0);
|
const [count, countSet] = useState<any>(0);
|
||||||
const [pageData, pageDataSet] = useState<any>({
|
const [pageData, pageDataSet] = useState<any>({
|
||||||
pageNo: 1,
|
pageNo: 1,
|
||||||
@ -67,17 +69,22 @@ const Sing: React.FC<{}> = () => {
|
|||||||
} else {
|
} else {
|
||||||
showNameT = { tbr: '供应商', bd: '采购包', kb: '开启' }
|
showNameT = { tbr: '供应商', bd: '采购包', kb: '开启' }
|
||||||
}
|
}
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (juese === 'ebtp-supplier') {
|
if (juese === 'ebtp-supplier') {
|
||||||
getDataGys();
|
getDataGys();
|
||||||
} else {
|
} else {
|
||||||
getData();
|
getData();
|
||||||
}
|
}
|
||||||
|
}, [pageData])
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (juese === 'ebtp-supplier') {
|
||||||
|
getStatusGys();
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
countSet(count + 1)
|
countSet(count + 1)
|
||||||
}, 2000);
|
}, 5000);
|
||||||
}, [count, pageData])
|
}
|
||||||
|
}, [count])
|
||||||
async function getData() {//代理获取列表
|
async function getData() {//代理获取列表
|
||||||
await getList({ projectId: getProId(), ...pageData, roomType: roomType }).then((res) => {
|
await getList({ projectId: getProId(), ...pageData, roomType: roomType }).then((res) => {
|
||||||
if (res?.code == 200) {
|
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) {//环节流转提示
|
async function showConfirm(record: any) {//环节流转提示
|
||||||
confirm({
|
confirm({
|
||||||
@ -209,6 +232,7 @@ const Sing: React.FC<{}> = () => {
|
|||||||
if (success) {
|
if (success) {
|
||||||
window.open(`/room/index?aa=${record.assessRoomId}&bb=${record.turnSort}&roomType=${roomType}`);
|
window.open(`/room/index?aa=${record.assessRoomId}&bb=${record.turnSort}&roomType=${roomType}`);
|
||||||
}
|
}
|
||||||
|
getData();
|
||||||
actionRef.current?.reload();
|
actionRef.current?.reload();
|
||||||
setSpin(false);
|
setSpin(false);
|
||||||
}
|
}
|
||||||
|
@ -29,3 +29,10 @@ export async function updateState(params?: any) {
|
|||||||
export async function getMan(reviewTurnId?: any) {
|
export async function getMan(reviewTurnId?: any) {
|
||||||
return request(`/api/biz-service-ebtp-tender/v1/supplier_register/get_register/${reviewTurnId}`);
|
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,
|
||||||
|
});
|
||||||
|
}
|
Reference in New Issue
Block a user