This commit is contained in:
lyp 2024-12-02 15:31:39 +08:00
commit 82d446ffe2
3 changed files with 43 additions and 41 deletions

View File

@ -1,4 +1,4 @@
import React, { useState } from 'react' import {useState} from 'react'
import {post, Axios, get} from "../../util/AjaxUtils.ts"; import {post, Axios, get} from "../../util/AjaxUtils.ts";
import useMessage from "antd/es/message/useMessage"; import useMessage from "antd/es/message/useMessage";
import { import {
@ -8,6 +8,7 @@ import {
} from 'antd'; } from 'antd';
import ContractText from '../ContractText/ContractText' import ContractText from '../ContractText/ContractText'
import {useDispatch} from 'react-redux' import {useDispatch} from 'react-redux'
export default function ContractModal(props: any) { export default function ContractModal(props: any) {
const [messageApi, messageApiHolder] = useMessage(); const [messageApi, messageApiHolder] = useMessage();
const [modalOpen, setModalOpen] = useState(false) const [modalOpen, setModalOpen] = useState(false)
@ -15,6 +16,7 @@ export default function ContractModal(props: any) {
const [name, setName] = useState(''); // 甲方姓名状态 const [name, setName] = useState(''); // 甲方姓名状态
const [phone, setPhone] = useState(''); // 电话状态 const [phone, setPhone] = useState(''); // 电话状态
const [address, setAddress] = useState(''); // 地址状态 const [address, setAddress] = useState(''); // 地址状态
const [isSaving, setIsSaving] = useState(false);
const onFinish = (values: any) => { const onFinish = (values: any) => {
setName(values.name); setName(values.name);
setPhone(values.phone); setPhone(values.phone);
@ -48,6 +50,9 @@ export default function ContractModal(props: any) {
}) })
} }
const downContract = () => { const downContract = () => {
if (isSaving) {
return;
}
post<any>({ post<any>({
messageApi, messageApi,
url: `/api/contract/management/save`, url: `/api/contract/management/save`,
@ -57,7 +62,7 @@ export default function ContractModal(props: any) {
firstPartyPhone: phone firstPartyPhone: phone
}, },
onBefore() { onBefore() {
setIsSaving(true);
}, },
onSuccess(data) { onSuccess(data) {
// console.log(data.data.data); // console.log(data.data.data);
@ -67,10 +72,9 @@ export default function ContractModal(props: any) {
getContractArray(1) getContractArray(1)
setModalOpen(false) setModalOpen(false)
props.closeModal() props.closeModal()
}, },
onFinally() { onFinally() {
setIsSaving(false);
} }
}) })
@ -170,7 +174,6 @@ export default function ContractModal(props: any) {
</div> </div>
<Form.Item> <Form.Item>
<div className='refunModal-btn'> <div className='refunModal-btn'>
<Button type="primary" htmlType="submit" style={{ <Button type="primary" htmlType="submit" style={{

View File

@ -1,4 +1,3 @@
import React from 'react'
import './ContractText.css' import './ContractText.css'
export default function ContractText(props: any) { export default function ContractText(props: any) {
const height = window.innerHeight - 200; const height = window.innerHeight - 200;

View File

@ -1,4 +1,4 @@
import React, { useEffect, useState } from 'react' import { useEffect, useState } from 'react'
import { // Table, import { // Table,
Pagination, Pagination,
Table, Table,