fix: distributed servers info

This commit is contained in:
jialin
2025-06-25 20:29:48 +08:00
parent 3889c1fa71
commit 8751400ae3
23 changed files with 535 additions and 215 deletions
-26
View File
@@ -1,26 +0,0 @@
import { useIntl } from '@umijs/max';
import { Modal, message, type ModalFuncProps } from 'antd';
import { useRef } from 'react';
export default function useDeleteModal() {
const intl = useIntl();
const modalRef = useRef<any>();
const showDeleteModal = (config: ModalFuncProps = {}) => {
modalRef.current = Modal.confirm({
...config,
okText: intl.formatMessage({
id: 'common.button.delete'
}),
onCancel: () => {
config.onCancel?.();
modalRef.current.destroy?.();
},
onOk: async () => {
await config.onOk?.();
message.success(intl.formatMessage({ id: 'common.message.success' }));
}
});
};
return { showDeleteModal };
}
+7 -5
View File
@@ -1,3 +1,4 @@
import useDeleteModel from '@/components/delete-modal';
import useSetChunkRequest from '@/hooks/use-chunk-request';
import useTableRowSelection from '@/hooks/use-table-row-selection';
import useTableSort from '@/hooks/use-table-sort';
@@ -55,7 +56,7 @@ export default function useTableFetch<ListItem>(
perPage: 10,
search: ''
});
const { DeleteModal, show, hide, configuration } = useDeleteModel();
const { setChunkRequest } = useSetChunkRequest();
const { updateChunkedList, cacheDataListRef } = useUpdateChunkedList({
events: ['UPDATE', 'DELETE', 'INSERT'],
@@ -203,7 +204,7 @@ export default function useTableFetch<ListItem>(
row: ListItem & { name: string; id: number },
options?: any
) => {
modalRef.current.show({
show({
content: contentForDelete,
operation: 'common.delete.single.confirm',
name: row.name,
@@ -211,7 +212,7 @@ export default function useTableFetch<ListItem>(
async onOk() {
console.log('OK');
await deleteAPI?.(row.id, {
...modalRef.current?.configuration
...configuration
});
fetchData();
}
@@ -219,7 +220,7 @@ export default function useTableFetch<ListItem>(
};
const handleDeleteBatch = (options = {}) => {
modalRef.current.show({
show({
content: contentForDelete,
operation: 'common.delete.confirm',
selection: true,
@@ -231,7 +232,7 @@ export default function useTableFetch<ListItem>(
rowSelection.selectedRowKeys,
async (id: any) => {
await deleteAPI(id, {
...modalRef.current?.configuration
configuration
});
successIds.push(id);
}
@@ -274,6 +275,7 @@ export default function useTableFetch<ListItem>(
sortOrder,
queryParams,
modalRef,
DeleteModal,
setQueryParams,
handleDelete,
handleDeleteBatch,