其他配置结束

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