From 9e87f4861b3b78660f33066058a4ce4648663f12 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=99=BD=E5=B0=81=E7=BE=BD?= <2360164671@qq.com> Date: Thu, 5 Jan 2023 20:09:45 +0800 Subject: [PATCH] =?UTF-8?q?=E5=85=B6=E4=BB=96=E9=85=8D=E7=BD=AE=E6=A1=86?= =?UTF-8?q?=E6=9E=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../configuration/subpage/OtherConfig.tsx | 70 +++++++++++++++++-- 1 file changed, 66 insertions(+), 4 deletions(-) diff --git a/src/pages/configuration/subpage/OtherConfig.tsx b/src/pages/configuration/subpage/OtherConfig.tsx index e56f8b0..e1b3554 100644 --- a/src/pages/configuration/subpage/OtherConfig.tsx +++ b/src/pages/configuration/subpage/OtherConfig.tsx @@ -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 { + + 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}; + } -class OtherConfig extends React.Component { render() { return ( -
-

Other Config

-
+
+ + {"强制总经理审批:"} + { + this.setState({forced: e, limit: 0}) + }}/> + + + {"总经理审批阈值:"} + { + 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)}) + } + }}/> + + + + + +
); } } + export default OtherConfig; \ No newline at end of file