Prechádzať zdrojové kódy

update: 销售单删除增加额外提示

xyh 2 rokov pred
rodič
commit
1017d984bb

+ 2 - 2
packages/app/src/hooks/use-table-event/index.ts

@@ -55,7 +55,7 @@ export function useTableDeleteEvent<P>(
 
   const findPendintId = useLatest(findId);
   const onDelte = useCallback(
-    function(params: P, title: string) {
+    function(params: P, title: string, options?: {extra?: string}) {
       return function() {
         deleteConfirm(
           label,
@@ -66,7 +66,7 @@ export function useTableDeleteEvent<P>(
             setPendingId(pendintValue);
             mutate(params);
           },
-          {title},
+          {title, ...options},
         );
       };
     },

+ 6 - 2
packages/app/src/pages/sell-order/table/hooks.tsx

@@ -128,10 +128,14 @@ export function useColumns(refetch: () => void) {
         return (
           <>
             <Button
-              type='text'
+              type="text"
               danger
               loading={pendingId === id}
-              onClick={onDelete(id, deliveryCode)}
+              onClick={onDelete(
+                id,
+                deliveryCode,
+                {extra: '删除此销售单会删除该销售单下的所有物料。'},
+              )}
             >
               删除
             </Button>

+ 3 - 3
packages/app/src/utils/deleteConfirm.ts

@@ -3,13 +3,13 @@ import {Modal} from 'antd';
 export function deleteConfirm(
   label: string,
   onOk: () => void,
-  options?: {title?: string},
+  options?: {title?: string, extra?: string},
 ) {
-  const {title} = options ?? {};
+  const {title, extra} = options ?? {};
 
   Modal.confirm({
     title: title ?? `删除${label}`,
-    content: `你确定要删除当前${label}吗?`,
+    content: `你确定要删除当前${label}吗?${extra ?? ''}`,
     onOk,
   });
 }