Commit cbd723a9 authored by 卢均锐's avatar 卢均锐

chore: 采购竞价不需要缓存的列表的加入props keepAlive=false

parent 9ac7e002
......@@ -91,7 +91,7 @@ const LowestQuotationRecord: React.FC<TableCommonLayoutProps> = (props: any) =>
const _returnBadge = (number) => {
const _number = Number(number ?? 0);
switch (_number) {
case 0:
case 0:
return '-';
case 1:
return <img src={level1} alt='第一名' />;
......@@ -119,6 +119,7 @@ const LowestQuotationRecord: React.FC<TableCommonLayoutProps> = (props: any) =>
<h5 className={selfStyles.content}>{effect?.reportPrice ? `¥ ${priceFormat(effect?.reportPrice)}` : '-'}</h5>
</div>
<StandardTable
keepAlive={false}
currentRef={currentRef}
columns={columns}
tableProps={{ rowKew: 'id' }}
......
......@@ -126,6 +126,7 @@ const MaterialLayout: React.FC<IPROPS> = (props: any) => {
title={layoutTitle}
>
<StandardTable
keepAlive={false}
currentRef={currentRef}
columns={column ? column : columns}
tableProps={{ rowKey: 'id' }}
......
......@@ -10,152 +10,153 @@ import { Context } from '../context';
import style from './index.less';
const TYPE = {
1: '发布至平台',
2: '系统匹配',
3: '邀请会员',
1: '发布至平台',
2: '系统匹配',
3: '邀请会员',
}
const ColStyle = {
display: 'flex',
alignItems: 'center',
border: '1px solid #1fbf87',
paddingTop: ' 6px',
paddingBottom: '6px',
margin: '5px',
borderRadius: '4px',
display: 'flex',
alignItems: 'center',
border: '1px solid #1fbf87',
paddingTop: ' 6px',
paddingBottom: '6px',
margin: '5px',
borderRadius: '4px',
}
const TextStyle = {
color: '#1fbf87',
marginLeft: '10px',
color: '#1fbf87',
marginLeft: '10px',
}
export interface DemandLayoutIProps {
storeList?: any,
title?: string,
bidId: number,
number: string,
fetch?: () => Promise<unknown>
storeList?: any,
title?: string,
bidId: number,
number: string,
fetch?: () => Promise<unknown>
}
const DemandLayout: React.FC<DemandLayoutIProps> = (props: any) => {
const { storeList, title, bidId, number, fetch } = props;
const tableRef = useRef<any>({});
const context = useContext(Context);
const { storeList, title, bidId, number, fetch } = props;
const tableRef = useRef<any>({});
const context = useContext(Context);
const columns = [
{
title: '序号',
key: 'number',
dataIndex: 'number',
render: (text: any, record: any, index: number) => <>{index + 1}</>
},
{
title: '会员名称',
key: 'memberName',
dataIndex: 'memberName',
},
{
title: '会员类型',
key: 'memberTypeName',
dataIndex: 'memberTypeName',
},
{
title: '会员角色',
key: 'roleName',
dataIndex: 'roleName',
},
{
title: '会员等级',
key: 'levelTag',
dataIndex: 'levelTag',
},
{
title: '是否归属会员',
key: 'membershipOrNot',
dataIndex: 'membershipOrNot',
render: (text: any) => (<StatusTag type={text ? 'success' : 'danger'} title={text ? '是' : '否'} />)
},
{
title: (
<>
<span>需求发送</span>
<Tooltip placement="top" title='打开开关,审核通过后,将发送需求至选择的归属会员'>
<QuestionCircleOutlined
style={{
marginLeft: '5px',
fontSize: '14px',
color: '#909399'
}}
/>
</Tooltip>
</>
),
key: 'state',
dataIndex: 'state',
render: (text: any) => (
<Switch checked={text} disabled={true} />
)
},
{
title: '操作',
key: 'operate',
dataIndex: 'operate',
render: (_text: any, _record: any) => (
<Typography.Link href={`/shop?shopId=${btoa(JSON.stringify({ roleId: _record.roleId, memberId: _record.memberId }))}`} target="_blank">
进入店铺
</Typography.Link>
)
},
]
const columns = [
{
title: '序号',
key: 'number',
dataIndex: 'number',
render: (text: any, record: any, index: number) => <>{index + 1}</>
},
{
title: '会员名称',
key: 'memberName',
dataIndex: 'memberName',
},
{
title: '会员类型',
key: 'memberTypeName',
dataIndex: 'memberTypeName',
},
{
title: '会员角色',
key: 'roleName',
dataIndex: 'roleName',
},
{
title: '会员等级',
key: 'levelTag',
dataIndex: 'levelTag',
},
{
title: '是否归属会员',
key: 'membershipOrNot',
dataIndex: 'membershipOrNot',
render: (text: any) => (<StatusTag type={text ? 'success' : 'danger'} title={text ? '是' : '否'} />)
},
{
title: (
<>
<span>需求发送</span>
<Tooltip placement="top" title='打开开关,审核通过后,将发送需求至选择的归属会员'>
<QuestionCircleOutlined
style={{
marginLeft: '5px',
fontSize: '14px',
color: '#909399'
}}
/>
</Tooltip>
</>
),
key: 'state',
dataIndex: 'state',
render: (text: any) => (
<Switch checked={text} disabled={true} />
)
},
{
title: '操作',
key: 'operate',
dataIndex: 'operate',
render: (_text: any, _record: any) => (
<Typography.Link href={`/shop?shopId=${btoa(JSON.stringify({ roleId: _record.roleId, memberId: _record.memberId }))}`} target="_blank">
进入店铺
</Typography.Link>
)
},
]
/** 列表数据 */
const fetchData = (params?: any) => {
return new Promise((resolve, reject) => {
fetch({ id: bidId, number: number, ...params }).then(res => {
resolve(res.data)
})
})
}
/** 列表数据 */
const fetchData = (params?: any) => {
return new Promise((resolve, reject) => {
fetch({ id: bidId, number: number, ...params }).then(res => {
resolve(res.data)
})
})
}
return (
<Card
id='demandLayout'
title='需求对接'
>
<div className={style.list}>
<h5 className={style.listLable} style={{ flex: '0 0 100px' }}>{title}</h5>
<h5 className={style.listContent}>{TYPE[context.type]}</h5>
</div>
{context.type === 1
&& (
<Row gutter={[16, 16]}>
{storeList.map(item => (
<Col
span={6}
key={item.id}
style={ColStyle}
>
<Image width={32} height={32} src={item.logoUrl} />
<span style={TextStyle}>{item.name}</span>
</Col>
))}
</Row>
)}
{context.type !== 1
&& (
<StandardTable
currentRef={tableRef}
columns={columns}
tableProps={{ rowKew: 'id' }}
fetchTableData={(params: any) => fetchData(params)}
/>
)}
</Card>
)
return (
<Card
id='demandLayout'
title='需求对接'
>
<div className={style.list}>
<h5 className={style.listLable} style={{ flex: '0 0 100px' }}>{title}</h5>
<h5 className={style.listContent}>{TYPE[context.type]}</h5>
</div>
{context.type === 1
&& (
<Row gutter={[16, 16]}>
{storeList.map(item => (
<Col
span={6}
key={item.id}
style={ColStyle}
>
<Image width={32} height={32} src={item.logoUrl} />
<span style={TextStyle}>{item.name}</span>
</Col>
))}
</Row>
)}
{context.type !== 1
&& (
<StandardTable
keepAlive={false}
currentRef={tableRef}
columns={columns}
tableProps={{ rowKew: 'id' }}
fetchTableData={(params: any) => fetchData(params)}
/>
)}
</Card>
)
}
DemandLayout.defaultProps = {
title: '发布方式'
title: '发布方式'
}
export default DemandLayout;
......@@ -123,6 +123,7 @@ const QuotationDetailsDrawer:React.FC<QuotationDetailsDrawerProps> = (props: any
}
>
<StandardTable
keepAlive={false}
currentRef={tableRef}
columns={columns}
tableProps={{ rowKew: 'id' }}
......
......@@ -101,6 +101,7 @@ const TableCommonLayout: React.FC<TableCommonLayoutProps> = (props: any) => {
title={layoutTitle}
>
<StandardTable
keepAlive={false}
currentRef={currentRef}
columns={columns}
tableProps={{ rowKew: 'id' }}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment