修复keys查询bug以及grid

This commit is contained in:
wangsongsole 2022-08-24 16:44:20 +08:00
parent f72ee90688
commit 1510ce8664
2 changed files with 20 additions and 13 deletions

View File

@ -199,6 +199,15 @@ export default class menu extends React.Component {
this.setState({ tableData: tabledata }) this.setState({ tableData: tabledata })
} }
gridPageLoads() {
let clr = null
if (clr) clearTimeout(clr)
this.setState({ pageLoading: true })
clr = setTimeout(() => {
this.setState({ pageLoading: false })
}, 800)
}
checkChange(index, e) { checkChange(index, e) {
this.state.tableData[index].checked = e.target.checked this.state.tableData[index].checked = e.target.checked
this.setState({ this.setState({
@ -264,11 +273,12 @@ 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 ,pageLoading:false}) this.setState({ tableData: nextProps.tableData })
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.gridPageLoads()
} }
} }
@ -306,7 +316,7 @@ export default class menu extends React.Component {
this.setState({ pageCount: e }) this.setState({ pageCount: e })
} }
gridPageLoad(flag) { gridPageLoad(flag) {
this.setState({ pageLoading: flag }) this.setState({ pageLoading: flag })
} }
pageShow(e) {} pageShow(e) {}
gridEditChange(e) {} gridEditChange(e) {}
@ -319,7 +329,6 @@ export default class menu extends React.Component {
} }
rowItemClick(index) { rowItemClick(index) {
console.log(index) console.log(index)
this.setState({ curIndex: index }) this.setState({ curIndex: index })
} }

View File

@ -1,4 +1,4 @@
import React, { useRef,useEffect } 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,7 +188,7 @@ const UseKeyList = () => {
* 获取表格 * 获取表格
*/ */
const getTable = () => { const getTable = () => {
plan_list_el.current.gridPageLoad(true); plan_list_el.current.gridPageLoad(true)
const param = getParam() const param = getParam()
getKeysList(param).then((res) => { getKeysList(param).then((res) => {
handelResponse( handelResponse(
@ -213,12 +213,9 @@ const UseKeyList = () => {
getTable() getTable()
}, [state.isQuery]) }, [state.isQuery])
useEffect(()=>{ useEffect(() => {
plan_list_el.current.gridPageLoad(false); plan_list_el.current.gridPageLoad(false)
return ()=>{// }, [])
}
}, []);
/** /**
* 获取查询值 * 获取查询值
*/ */
@ -250,7 +247,8 @@ const UseKeyList = () => {
limit: 10, limit: 10,
hash: '', hash: '',
tableData: [], tableData: [],
lodgingTable: false lodgingTable: false,
dataCount: 0
}) })
} }
@ -259,7 +257,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); plan_list_el.current.gridPageLoad(false)
setState({ selectTable: [] }) setState({ selectTable: [] })
} }