修复了【其他配置】循环更新的问题

main
白封羽 2023-01-05 23:01:54 +08:00
parent d6230497c0
commit 02c9127c8f
1 changed files with 7 additions and 6 deletions

View File

@ -4,11 +4,12 @@ import {ActionType} from "@ant-design/pro-components";
import {FormInstance} from "antd/es/form";
import Column from "antd/es/table/Column";
import RedoOutlined from "@ant-design/icons/lib/icons/RedoOutlined";
class OtherConfig extends React.Component<any, any> {
refresh = () => {
//TODO: refresh
this.setState({forced: true, limit: 0})
this.setState({forced: true, limit: 0, activated: true})
}
submit = () => {
//TODO: submit
@ -27,14 +28,14 @@ class OtherConfig extends React.Component<any, any> {
}
static getDerivedStateFromProps(props: any, state: any) {
if (props.activate !== state.activated && typeof state.refresh === "function")
if (props.activate && props.activate !== state.activated && typeof state.refresh === "function")
state.refresh()
return {activated: props.activate};
}
render() {
return (
<div style={{paddingTop: 50,paddingLeft:50}}>
<div style={{paddingTop: 50, paddingLeft: 50}}>
<Row>
{"强制总经理审批:"}
<Switch checked={this.state.forced} onChange={(e) => {
@ -47,7 +48,7 @@ class OtherConfig extends React.Component<any, any> {
min={0} max={100000} defaultValue={500}
disabled={this.state.forced} value={this.state.limit}
onChange={(value) => {
if (isNaN(value)||Number(value) < 0) {
if (isNaN(value) || Number(value) < 0) {
this.setState({limit: 0})
} else if (value.toString().split(".").length === 1) {
this.setState({limit: Number(value)})
@ -58,10 +59,10 @@ class OtherConfig extends React.Component<any, any> {
}
}}/>
</Row>
<Row style={{marginTop: 30,paddingBottom:30}}>
<Row style={{marginTop: 30, paddingBottom: 30}}>
<Button style={{marginLeft: 30}} type={"default"} onClick={() => {
this.refresh()
}}><RedoOutlined /></Button>
}}><RedoOutlined/></Button>
<Button style={{marginLeft: 60}} type={"default"} onClick={() => {
}}></Button>