Commit 8447bd23 authored by 李腾's avatar 李腾

fix: 修复售后订单管理的列表高度问题

parent 84801e00
...@@ -19,6 +19,7 @@ import CancelDetailTable from './components/CancelDetailTable'; ...@@ -19,6 +19,7 @@ import CancelDetailTable from './components/CancelDetailTable';
import { getColumns, getFormConfig, TAB_MAPPING_DATA } from './data.js'; import { getColumns, getFormConfig, TAB_MAPPING_DATA } from './data.js';
import { getDetail } from '@/pages/afterSale/appeal/services'; import { getDetail } from '@/pages/afterSale/appeal/services';
import { getClientInfo } from '@/utils/utils';
import { import {
searchList, searchList,
logisticsIntercept, logisticsIntercept,
...@@ -40,7 +41,6 @@ const AfterSale = props => { ...@@ -40,7 +41,6 @@ const AfterSale = props => {
const { permissions } = props; const { permissions } = props;
const canEditable = permissions[AFTER_SALE_ORDER.EDITABLE]; const canEditable = permissions[AFTER_SALE_ORDER.EDITABLE];
const location = useLocation(); const location = useLocation();
const [pageQueryOrderNo, setPageQueryOrderNo] = useState(location.query?.orderNo || '');
const actionRef = useRef(); const actionRef = useRef();
const formRef = useRef(); const formRef = useRef();
...@@ -284,12 +284,16 @@ const AfterSale = props => { ...@@ -284,12 +284,16 @@ const AfterSale = props => {
} }
}, [location]); }, [location]);
const calculationLayoutHeight = () => { // 动态计算表格滚动区域高度
setTableScrollY(scrollYRef.current.offsetTop + 330); const clientInfo = getClientInfo();
const calculationLayoutHeight = e => {
const otherHeight = typeof e === 'number' ? e : 330;
const h = clientInfo.height - scrollYRef.current.offsetTop - otherHeight;
setTableScrollY(h < 500 ? '500px' : h);
}; };
useEffect(() => { useEffect(() => {
setTableScrollY(scrollYRef.current.offsetTop + 350); calculationLayoutHeight(330);
}, []); }, []);
window.removeEventListener('resize', calculationLayoutHeight); window.removeEventListener('resize', calculationLayoutHeight);
...@@ -316,7 +320,7 @@ const AfterSale = props => { ...@@ -316,7 +320,7 @@ const AfterSale = props => {
columns, columns,
params: tableParams, params: tableParams,
bordered: true, bordered: true,
scroll: { x: '100%', y: `calc(100vh - ${tableScrollY}px)` }, scroll: { x: '100%', y: tableScrollY },
rowKey: r => r.serviceNo, rowKey: r => r.serviceNo,
request: async params => { request: async params => {
const [start, end] = params.afterTime || afterTime; const [start, end] = params.afterTime || afterTime;
...@@ -326,7 +330,6 @@ const AfterSale = props => { ...@@ -326,7 +330,6 @@ const AfterSale = props => {
const requestParams = { const requestParams = {
page, page,
size, size,
// orderNo: pageQueryOrderNo, // 首次请求需要直接使用 此方式,因为params中首次请求不存在orderNo
...params, ...params,
startDate, startDate,
endDate, endDate,
...@@ -339,8 +342,6 @@ const AfterSale = props => { ...@@ -339,8 +342,6 @@ const AfterSale = props => {
endDate, endDate,
}); });
const res = await searchList(requestParams); const res = await searchList(requestParams);
// 初始化获取订单编号后删除临时存储的订单编号
setPageQueryOrderNo('');
const { records = [], total } = res.data; const { records = [], total } = res.data;
if (countRes.code === '0000') { if (countRes.code === '0000') {
......
...@@ -56,3 +56,22 @@ export function toThousands(data, num) { ...@@ -56,3 +56,22 @@ export function toThousands(data, num) {
export const formatTime = (time, crm = 'YYYY-MM-DD HH:mm:ss') => time.format(crm); export const formatTime = (time, crm = 'YYYY-MM-DD HH:mm:ss') => time.format(crm);
export const resetTime = (time, crm = 'YYYY-MM-DD HH:mm:ss') => moment(time, crm); export const resetTime = (time, crm = 'YYYY-MM-DD HH:mm:ss') => moment(time, crm);
export const getClientInfo = () => {
if (window.innerHeight !== undefined) {
return {
width: window.innerWidth,
height: window.innerHeight,
};
}
if (document.compatMode === 'CSS1Compat') {
return {
width: document.documentElement.clientWidth,
height: document.documentElement.clientHeight,
};
}
return {
width: document.body.clientWidth,
height: document.body.clientHeight,
};
};
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