其他配置框架
parent
2b3b45835a
commit
9e87f4861b
|
@ -1,12 +1,74 @@
|
|||
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";
|
||||
class OtherConfig extends React.Component<any, any> {
|
||||
|
||||
refresh = () => {
|
||||
//TODO: refresh
|
||||
this.setState({forced: true, limit: 0})
|
||||
}
|
||||
submit = () => {
|
||||
//TODO: submit
|
||||
|
||||
this.refresh()
|
||||
}
|
||||
|
||||
constructor(props: any) {
|
||||
super(props);
|
||||
this.state = {
|
||||
activated: props.activate,
|
||||
limit: 0,
|
||||
forced: true,
|
||||
refresh: this.refresh
|
||||
}
|
||||
}
|
||||
|
||||
static getDerivedStateFromProps(props: any, state: any) {
|
||||
if (props.activate !== state.activated && typeof state.refresh === "function")
|
||||
state.refresh()
|
||||
return {activated: props.activate};
|
||||
}
|
||||
|
||||
render() {
|
||||
return (
|
||||
<div>
|
||||
<h1>Other Config</h1>
|
||||
<div style={{paddingTop: 50,paddingLeft:50}}>
|
||||
<Row>
|
||||
{"强制总经理审批:"}
|
||||
<Switch checked={this.state.forced} onChange={(e) => {
|
||||
this.setState({forced: e, limit: 0})
|
||||
}}/>
|
||||
</Row>
|
||||
<Row style={{marginTop: 30, alignContent: "center"}}>
|
||||
{"总经理审批阈值:"}
|
||||
<InputNumber prefix={"¥"} controls={false}
|
||||
min={0} max={100000} defaultValue={500}
|
||||
disabled={this.state.forced} value={this.state.limit}
|
||||
onChange={(value) => {
|
||||
if (isNaN(value)||Number(value) < 0) {
|
||||
this.setState({limit: 0})
|
||||
} else if (value.toString().split(".").length === 1) {
|
||||
this.setState({limit: Number(value)})
|
||||
} else if (value.toString().split(".")[1].length <= 2) {
|
||||
this.setState({limit: Number(value)})
|
||||
} else {
|
||||
this.setState({limit: Number(value).toFixed(2)})
|
||||
}
|
||||
}}/>
|
||||
</Row>
|
||||
<Row style={{marginTop: 30,paddingBottom:30}}>
|
||||
<Button style={{marginLeft: 30}} type={"default"} onClick={() => {
|
||||
this.refresh()
|
||||
}}><RedoOutlined /></Button>
|
||||
<Button style={{marginLeft: 60}} type={"default"} onClick={() => {
|
||||
|
||||
}}>应用</Button>
|
||||
</Row>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
export default OtherConfig;
|
Loading…
Reference in New Issue