Commit ee267e47 authored by 前端-钟卫鹏's avatar 前端-钟卫鹏

fix: 处理品类多次请求的问题

parent 1a4f6fe5
import React from 'react'
import React, { useState } from 'react'
import { Row, Col, Popconfirm, Button, Card } from 'antd';
import { PageHeaderWrapper } from '@ant-design/pro-layout';
import TabTree, { createTreeActions } from '@/components/TabTree';
......@@ -49,22 +49,26 @@ const ClassProperty: React.FC<{}> = () => {
fetchItemDetailData: getProductPlatformGetCategory
})
const [loading, setLoading] = useState<boolean>(false)
const formInitValue = (nodeRecord && treeStatus === FormState.EDIT) ? getTreeMaps(nodeRecord.key) : {}
const onFinish = (values) => {
setLoading(true)
const editOrAdd = nodeRecord && treeStatus === FormState.EDIT
const params = editOrAdd ? { ...values, parentId: nodeRecord.parentId } : {
...values,
parentId: nodeRecord ? nodeRecord.parentId : 0,
id: null,
}
postProductPlatformSaveOrUpdateCategory(params).then(res => {
postProductPlatformSaveOrUpdateCategory(params).then(() => {
resetMenu()
setTreeStatus(FormState.FREE)
setNodeRecord(undefined)
// 保存后要将是否填写过表单设为false
setIsEditForm(false)
flag = false
setLoading(false)
})
}
......@@ -122,7 +126,7 @@ const ClassProperty: React.FC<{}> = () => {
schema={classSchema}
>
<FormButtonGroup>
<Button htmlType='submit' type="primary" style={{ marginTop: 32, marginBottom: 16, marginRight: 24}}>
<Button htmlType='submit' type="primary" loading={loading} style={{ marginTop: 32, marginBottom: 16, marginRight: 24}}>
保存
</Button>
<Popconfirm title="确定要删除吗?" okText="是" cancelText="否" onConfirm={handleDeleteMenu}>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment