封装table表格组件加载效果

This commit is contained in:
Apple 2022-08-24 14:07:51 +08:00
parent abca49beae
commit f72ee90688
2 changed files with 13 additions and 12 deletions

View File

@ -135,7 +135,7 @@ export default class menu extends React.Component {
indeterminate: false, indeterminate: false,
pageNum: 0, pageNum: 0,
pageCount: props.dataCount, pageCount: props.dataCount,
pageLoading: false, pageLoading: true,
editShow: false, editShow: false,
postion: null, postion: null,
historyrow_id: null, historyrow_id: null,
@ -160,7 +160,6 @@ export default class menu extends React.Component {
} }
//Safari与Chrome属于同一类型 //Safari与Chrome属于同一类型
dom.onmousewheel = this.scrollFunc dom.onmousewheel = this.scrollFunc
this.gridPageLoad()
} }
//多选 //多选
@ -265,12 +264,11 @@ export default class menu extends React.Component {
componentWillReceiveProps(nextProps) { componentWillReceiveProps(nextProps) {
if (this.state.tableData != nextProps.tableData) { 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 })
this.setState({ page: nextProps.page, emptyText: nextProps.emptyText }) this.setState({ page: nextProps.page, emptyText: nextProps.emptyText })
this.setState({ dataCount: nextProps.dataCount }) this.setState({ dataCount: nextProps.dataCount })
this.scrollPosition() this.scrollPosition()
this.gridPageLoad()
} }
} }
@ -307,13 +305,8 @@ export default class menu extends React.Component {
this.props.countChange(e) this.props.countChange(e)
this.setState({ pageCount: e }) this.setState({ pageCount: e })
} }
gridPageLoad() { gridPageLoad(flag) {
if (!this.state.pageLoading) { this.setState({ pageLoading: flag })
this.setState({ pageLoading: true })
setTimeout(() => {
this.setState({ pageLoading: false })
}, 800)
}
} }
pageShow(e) {} pageShow(e) {}
gridEditChange(e) {} gridEditChange(e) {}

View File

@ -1,4 +1,4 @@
import React, { useRef } from 'react' import React, { useRef,useEffect } from 'react'
import { useUpdateEffect, useSetState } from 'ahooks' import { useUpdateEffect, useSetState } from 'ahooks'
import { getNowTime } from '@/utils.js' import { getNowTime } from '@/utils.js'
@ -188,6 +188,7 @@ const UseKeyList = () => {
* 获取表格 * 获取表格
*/ */
const getTable = () => { const getTable = () => {
plan_list_el.current.gridPageLoad(true);
const param = getParam() const param = getParam()
getKeysList(param).then((res) => { getKeysList(param).then((res) => {
handelResponse( handelResponse(
@ -212,6 +213,12 @@ const UseKeyList = () => {
getTable() getTable()
}, [state.isQuery]) }, [state.isQuery])
useEffect(()=>{
plan_list_el.current.gridPageLoad(false);
return ()=>{//
}
}, []);
/** /**
* 获取查询值 * 获取查询值
*/ */
@ -252,6 +259,7 @@ const UseKeyList = () => {
*/ */
const clearSelectTableBtn = () => { const clearSelectTableBtn = () => {
plan_list_el.current.allChecked(false) plan_list_el.current.allChecked(false)
plan_list_el.current.gridPageLoad(false);
setState({ selectTable: [] }) setState({ selectTable: [] })
} }