From f72ee906889dc0bc1c93885ec62b77ce38cd3234 Mon Sep 17 00:00:00 2001 From: Apple <> Date: Wed, 24 Aug 2022 14:07:51 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B0=81=E8=A3=85table=E8=A1=A8=E6=A0=BC?= =?UTF-8?q?=E7=BB=84=E4=BB=B6=E5=8A=A0=E8=BD=BD=E6=95=88=E6=9E=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/gird/main.js | 15 ++++----------- src/pages/plan/keyList/index.jsx | 10 +++++++++- 2 files changed, 13 insertions(+), 12 deletions(-) diff --git a/src/components/gird/main.js b/src/components/gird/main.js index 95b8d8dd..92c6468a 100644 --- a/src/components/gird/main.js +++ b/src/components/gird/main.js @@ -135,7 +135,7 @@ export default class menu extends React.Component { indeterminate: false, pageNum: 0, pageCount: props.dataCount, - pageLoading: false, + pageLoading: true, editShow: false, postion: null, historyrow_id: null, @@ -160,7 +160,6 @@ export default class menu extends React.Component { } //Safari与Chrome属于同一类型 dom.onmousewheel = this.scrollFunc - this.gridPageLoad() } //多选 @@ -265,12 +264,11 @@ export default class menu extends React.Component { componentWillReceiveProps(nextProps) { if (this.state.tableData != nextProps.tableData) { - this.setState({ tableData: nextProps.tableData }) + this.setState({ tableData: nextProps.tableData ,pageLoading:false}) this.setState({ page: nextProps.page }) this.setState({ page: nextProps.page, emptyText: nextProps.emptyText }) this.setState({ dataCount: nextProps.dataCount }) this.scrollPosition() - this.gridPageLoad() } } @@ -307,13 +305,8 @@ export default class menu extends React.Component { this.props.countChange(e) this.setState({ pageCount: e }) } - gridPageLoad() { - if (!this.state.pageLoading) { - this.setState({ pageLoading: true }) - setTimeout(() => { - this.setState({ pageLoading: false }) - }, 800) - } + gridPageLoad(flag) { + this.setState({ pageLoading: flag }) } pageShow(e) {} gridEditChange(e) {} diff --git a/src/pages/plan/keyList/index.jsx b/src/pages/plan/keyList/index.jsx index b74bc5b5..3d0d7d62 100644 --- a/src/pages/plan/keyList/index.jsx +++ b/src/pages/plan/keyList/index.jsx @@ -1,4 +1,4 @@ -import React, { useRef } from 'react' +import React, { useRef,useEffect } from 'react' import { useUpdateEffect, useSetState } from 'ahooks' import { getNowTime } from '@/utils.js' @@ -188,6 +188,7 @@ const UseKeyList = () => { * 获取表格 */ const getTable = () => { + plan_list_el.current.gridPageLoad(true); const param = getParam() getKeysList(param).then((res) => { handelResponse( @@ -212,6 +213,12 @@ const UseKeyList = () => { getTable() }, [state.isQuery]) + useEffect(()=>{ + plan_list_el.current.gridPageLoad(false); + return ()=>{//在函数组件卸载前执行 + + } + }, []); /** * 获取查询值 */ @@ -252,6 +259,7 @@ const UseKeyList = () => { */ const clearSelectTableBtn = () => { plan_list_el.current.allChecked(false) + plan_list_el.current.gridPageLoad(false); setState({ selectTable: [] }) }