diff --git a/src/components/keyDelay/index.jsx b/src/components/keyDelay/index.jsx new file mode 100644 index 00000000..46927467 --- /dev/null +++ b/src/components/keyDelay/index.jsx @@ -0,0 +1,139 @@ +import FormItem from "@/components/form-item/main" +import Form from "@/components/form/main" +import { useSetState } from "ahooks" +import moment from "moment" +import { useRef } from "react" +import "./index.less" +import { Button, DateRangePicker, Input, Notify, Radio } from "zent" +export default ({ data, onColes }) => { + const ref = useRef() + const [model, setModel] = useSetState({ + expiration_type: "1", + expiration_value: "" + }) + + function submit() { + if (model.expiration_type == 2 && model.expiration_value.length < 1) { + return Notify.error("请选择固定时间段") + } + if (model.expiration_type == 3 && !model.expiration_value) { + return Notify.error("请输入接口调取后有效期") + } + + console.log(data) + } + + function onDisabledRange(date, type) { + let step1 = JSON.parse(sessionStorage.getItem("knockGold_effectDate")) + let isdisabled = false + let str = moment(date).format("YYYY-MM-DD HH:mm:ss") + let isDay = moment(step1.end_time).format("HH:mm:ss") + if (type == "start") { + if (isDay < "23:59:59") { + isdisabled = + moment(str).isBefore(step1.begin_time) || + moment(str).subtract(1, "days").isAfter(step1.end_time) + } else { + isdisabled = moment(str).isBefore(step1.begin_time) || moment(str).isAfter(step1.end_time) + } + } + + if (type == "end") { + isdisabled = + moment(str).add(1, "days").isBefore(step1.begin_time) || moment(str).isAfter(step1.end_time) + } + return isdisabled + } + + return ( + <> +
+ > + ) +} diff --git a/src/components/keyDelay/index.less b/src/components/keyDelay/index.less new file mode 100644 index 00000000..49b00bb9 --- /dev/null +++ b/src/components/keyDelay/index.less @@ -0,0 +1,15 @@ + .form { + #keyDelay { + margin-bottom: 20px; + } + + #keyDelay .form-compontent { + padding-top: 0 !important; + } + + .keyDelay-but { + display: flex; + justify-content: flex-end; + margin-top: 40px; + } + } \ No newline at end of file