其他配置结束

main
白封羽 2023-01-06 15:32:19 +08:00
parent a6c7378398
commit b569844c4f
1 changed files with 18 additions and 9 deletions

View File

@ -1,20 +1,28 @@
import React from "react"; import React from "react";
import {Button, Col, Form, InputNumber, Row, Switch, Table} from "antd"; import {Button, Col, Form, InputNumber, Row, Switch, Table} from "antd";
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"; import RedoOutlined from "@ant-design/icons/lib/icons/RedoOutlined";
import axiosInstance from "../../../utils/axiosInstance";
class OtherConfig extends React.Component<any, any> { class OtherConfig extends React.Component<any, any> {
refresh = () => { refresh = () => {
//TODO: refresh axiosInstance.get("management/properties").then((res) => {
this.setState({forced: true, limit: 0, activated: true}) console.log(res.data)
this.setState({
forced: res.data.approvalLimit === 0,
limit: res.data.approvalLimit / 100.0,
activated: true
})
})
} }
submit = () => { submit = () => {
//TODO: submit let limit = this.state.limit * 100
if (this.state.forced) {
this.refresh() limit = 0
}
axiosInstance.put("management/properties", {approvalLimit: limit}).then((res) => {
this.refresh()
})
} }
constructor(props: any) { constructor(props: any) {
@ -25,6 +33,7 @@ class OtherConfig extends React.Component<any, any> {
forced: true, forced: true,
refresh: this.refresh refresh: this.refresh
} }
this.refresh()
} }
static getDerivedStateFromProps(props: any, state: any) { static getDerivedStateFromProps(props: any, state: any) {
@ -64,7 +73,7 @@ class OtherConfig extends React.Component<any, any> {
this.refresh() this.refresh()
}}><RedoOutlined/></Button> }}><RedoOutlined/></Button>
<Button style={{marginLeft: 60}} type={"default"} onClick={() => { <Button style={{marginLeft: 60}} type={"default"} onClick={() => {
this.submit()
}}></Button> }}></Button>
</Row> </Row>
</div> </div>