fix:更新优化modal
This commit is contained in:
parent
fd12b053cb
commit
067522c87a
@ -1,12 +1,15 @@
|
||||
import { MyButtons } from '@/common';
|
||||
import { Modal } from 'antd';
|
||||
import { useImperativeHandle, useState } from 'react';
|
||||
import { useImperativeHandle, useState } from 'react';
|
||||
|
||||
export function MyModal(props?: any,ref?:any) {
|
||||
export function MyModal(props?: any) {
|
||||
const [open, setOpen] = useState(false);
|
||||
useImperativeHandle(ref,()=>({
|
||||
close: () => setOpen(false)
|
||||
}))
|
||||
const close = () => {
|
||||
setOpen(false)
|
||||
}
|
||||
useImperativeHandle(props.myRef, () => ({
|
||||
close
|
||||
}));
|
||||
return (
|
||||
<>
|
||||
{props?.trigger ? (
|
||||
|
||||
@ -8,11 +8,13 @@ import { MyModal } from '@/components/MyModal';
|
||||
import { Apis } from '@/gen/Apis';
|
||||
import { ProTable } from '@ant-design/pro-components';
|
||||
import { message } from 'antd';
|
||||
import { useState } from 'react';
|
||||
import { useRef, useState } from 'react';
|
||||
|
||||
export default function Index(props: MyBetaModalFormProps) {
|
||||
const modalRef:any = useRef(null);
|
||||
const [selectedProjectsIds, setSelectedProjectsIds] = useState<any>([]);
|
||||
const onShowContactPhone = () => {
|
||||
console.log(selectedProjectsIds,'selectedProjectsIds')
|
||||
Apis.Company.CompanyProjectReceiptAccounts.Store({
|
||||
companies_id: props?.item?.companies_id ?? 0,
|
||||
projects_id: props?.item?.id,
|
||||
@ -21,6 +23,8 @@ export default function Index(props: MyBetaModalFormProps) {
|
||||
.then(() => {
|
||||
props.reload?.();
|
||||
message.success('收款账号添加成功!');
|
||||
console.log(modalRef,'modalRef.current')
|
||||
modalRef.current?.close();
|
||||
// todo 关闭页面
|
||||
})
|
||||
.catch(() => false);
|
||||
@ -30,6 +34,7 @@ export default function Index(props: MyBetaModalFormProps) {
|
||||
<MyModal
|
||||
title={props.title || '查看'}
|
||||
width="800px"
|
||||
myRef={modalRef}
|
||||
trigger={
|
||||
<MyButtons.Default
|
||||
type="primary"
|
||||
@ -54,6 +59,7 @@ export default function Index(props: MyBetaModalFormProps) {
|
||||
rowSelection={{
|
||||
type: 'radio',
|
||||
onChange: (selectedRowKeys) => {
|
||||
console.log(selectedRowKeys,'selectedRowKeys')
|
||||
setSelectedProjectsIds(selectedRowKeys);
|
||||
},
|
||||
}}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user