|
@@ -294,31 +294,33 @@ function TableData(props: Prosp) {
|
|
/**表格 */
|
|
/**表格 */
|
|
const Tab = React.memo((props: any) => {
|
|
const Tab = React.memo((props: any) => {
|
|
const { size, newColumns, className, handelResize, scroll, isFull, page, isZj, rowClassName, pageSize, totalData, dataSource, onChange, expandedRowRender, total, ajax, summary } = props
|
|
const { size, newColumns, className, handelResize, scroll, isFull, page, isZj, rowClassName, pageSize, totalData, dataSource, onChange, expandedRowRender, total, ajax, summary } = props
|
|
|
|
+ let ran = Math.ceil(Math.random() * 100)
|
|
|
|
|
|
useEffect(() => {
|
|
useEffect(() => {
|
|
const contentBodyScroll = (e: any) => {
|
|
const contentBodyScroll = (e: any) => {
|
|
- let el = document.querySelector('.header_table_body .ant-table-body');
|
|
|
|
|
|
+ let el = document.querySelector(`.header_table_body_${ran} .ant-table-body`);
|
|
if (el) {
|
|
if (el) {
|
|
el.scrollLeft = e.target.scrollLeft
|
|
el.scrollLeft = e.target.scrollLeft
|
|
}
|
|
}
|
|
}
|
|
}
|
|
const headerBodyScroll = (e: any) => {
|
|
const headerBodyScroll = (e: any) => {
|
|
- let el = document.querySelector('.content_table_body .ant-table-body');
|
|
|
|
|
|
+ let el = document.querySelector(`.content_table_body_${ran} .ant-table-body`);
|
|
if (el) {
|
|
if (el) {
|
|
el.scrollLeft = e.target.scrollLeft
|
|
el.scrollLeft = e.target.scrollLeft
|
|
}
|
|
}
|
|
}
|
|
}
|
|
if (isZj) {
|
|
if (isZj) {
|
|
- document.querySelector('.content_table_body .ant-table-body')?.addEventListener('scroll', contentBodyScroll);
|
|
|
|
- document.querySelector('.header_table_body .ant-table-body')?.addEventListener('scroll', headerBodyScroll);
|
|
|
|
|
|
+ document.querySelector(`.content_table_body_${ran} .ant-table-body`)?.addEventListener('scroll', contentBodyScroll);
|
|
|
|
+ document.querySelector(`.header_table_body_${ran} .ant-table-body`)?.addEventListener('scroll', headerBodyScroll);
|
|
|
|
+ // document.querySelectorAll('.content_table_body .ant-table-body')
|
|
}
|
|
}
|
|
() => {
|
|
() => {
|
|
if (isZj) {
|
|
if (isZj) {
|
|
- document.querySelector('.content_table_body .ant-table-body')?.removeEventListener('scroll', contentBodyScroll);
|
|
|
|
- document.querySelector('.header_table_body .ant-table-body')?.removeEventListener('scroll', headerBodyScroll);
|
|
|
|
|
|
+ document.querySelector(`.content_table_body_${ran} .ant-table-body`)?.removeEventListener('scroll', contentBodyScroll);
|
|
|
|
+ document.querySelector(`.header_table_body_${ran} .ant-table-body`)?.removeEventListener('scroll', headerBodyScroll);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- }, [isZj])
|
|
|
|
|
|
+ }, [isZj, ran])
|
|
|
|
|
|
return < Col span={24} >
|
|
return < Col span={24} >
|
|
<div className={`${style[size]} ${className ? style[className] : ''} `}>
|
|
<div className={`${style[size]} ${className ? style[className] : ''} `}>
|
|
@@ -334,7 +336,7 @@ const Tab = React.memo((props: any) => {
|
|
current={page}
|
|
current={page}
|
|
pageSize={pageSize}
|
|
pageSize={pageSize}
|
|
loading={ajax?.loading}
|
|
loading={ajax?.loading}
|
|
- className={`all_table header_table_body ${className ? className : ''}`}
|
|
|
|
|
|
+ className={`all_table header_table_body_${ran} ${className ? className : ''}`}
|
|
sortDirections={['ascend', 'descend', null]}
|
|
sortDirections={['ascend', 'descend', null]}
|
|
handelResize={((columns: any) => handelResize(columns))}
|
|
handelResize={((columns: any) => handelResize(columns))}
|
|
onChange={(pagination: any, filters: any, sorter: any) => onChange && onChange({ pagination, filters, sortData: sorter })}
|
|
onChange={(pagination: any, filters: any, sorter: any) => onChange && onChange({ pagination, filters, sortData: sorter })}
|
|
@@ -342,7 +344,7 @@ const Tab = React.memo((props: any) => {
|
|
}
|
|
}
|
|
<Tables
|
|
<Tables
|
|
showHeader={!isZj}
|
|
showHeader={!isZj}
|
|
- className={`all_table content_table_body ${className ? className : ''}`}
|
|
|
|
|
|
+ className={`all_table content_table_body_${ran} ${className ? className : ''}`}
|
|
bordered
|
|
bordered
|
|
sortDirections={['ascend', 'descend', null]}
|
|
sortDirections={['ascend', 'descend', null]}
|
|
current={page}
|
|
current={page}
|