cl
5 天以前 01ab61191b93956954b463ab4416fda6b5f960ee
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
import { useState } from "react";
import { useRecordContext, useTranslate } from "react-admin";
import { Button } from "@mui/material";
import request from "@/utils/request";
 
/** 出入库历史单:云仓 ERP 反馈重发(权限 manager:asnOrderLog:cloudWmsResend) */
export default function AsnOrderLogCloudWmsResendButton() {
    const record = useRecordContext();
    const translate = useTranslate();
    const [loading, setLoading] = useState(false);
 
    if (!record?.id) {
        return null;
    }
 
    const onClick = async () => {
        const ok = window.confirm(
            translate("resources.asnOrderLog.cloudWmsResendConfirm", {
                _: "确认将该历史单的云仓入出库反馈重新加入发送队列?",
            })
        );
        if (!ok) return;
        setLoading(true);
        try {
            const res = await request.post(`/asnOrderLog/cloudWms/resendFeedback/${record.id}`);
            const { code, msg, data } = res.data || {};
            if (code === 200) {
                window.alert(msg || "OK");
            } else {
                window.alert(msg || "Error");
            }
        } catch (e) {
            window.alert(e?.message || String(e));
        } finally {
            setLoading(false);
        }
    };
 
    return (
        <Button size="small" variant="outlined" disabled={loading} onClick={onClick}>
            {translate("resources.asnOrderLog.cloudWmsResend", { _: "云仓反馈重发" })}
        </Button>
    );
}