forked from yoone/WEB
取消订单响应,取消物流二次确认
This commit is contained in:
parent
00ee8d8656
commit
081b87df7b
|
|
@ -26,6 +26,7 @@
|
||||||
"file-saver": "^2.0.5",
|
"file-saver": "^2.0.5",
|
||||||
"print-js": "^1.6.0",
|
"print-js": "^1.6.0",
|
||||||
"react-phone-input-2": "^2.15.1",
|
"react-phone-input-2": "^2.15.1",
|
||||||
|
"react-toastify": "^11.0.5",
|
||||||
"xlsx": "^0.18.5"
|
"xlsx": "^0.18.5"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
|
|
||||||
|
|
@ -5,19 +5,21 @@ import { stockcontrollerGetallstockpoints } from '@/servers/api/stock';
|
||||||
import { formatShipmentState } from '@/utils/format';
|
import { formatShipmentState } from '@/utils/format';
|
||||||
import { printPDF } from '@/utils/util';
|
import { printPDF } from '@/utils/util';
|
||||||
import { CopyOutlined } from '@ant-design/icons';
|
import { CopyOutlined } from '@ant-design/icons';
|
||||||
|
import { ToastContainer, toast } from 'react-toastify';
|
||||||
import {
|
import {
|
||||||
ActionType,
|
ActionType,
|
||||||
PageContainer,
|
PageContainer,
|
||||||
ProColumns,
|
ProColumns,
|
||||||
ProTable,
|
ProTable,
|
||||||
} from '@ant-design/pro-components';
|
} from '@ant-design/pro-components';
|
||||||
import { App, Button, Divider } from 'antd';
|
import { App, Button, Divider, Popconfirm } from 'antd';
|
||||||
import { useRef, useState } from 'react';
|
import { useRef, useState } from 'react';
|
||||||
|
|
||||||
const ListPage: React.FC = () => {
|
const ListPage: React.FC = () => {
|
||||||
const actionRef = useRef<ActionType>();
|
const actionRef = useRef<ActionType>();
|
||||||
const { message } = App.useApp();
|
const { message } = App.useApp();
|
||||||
const [selectedRows, setSelectedRows] = useState([]);
|
const [selectedRows, setSelectedRows] = useState([]);
|
||||||
|
const [isLoading, setIsLoading] = useState(false);
|
||||||
|
|
||||||
const columns: ProColumns<API.Service>[] = [
|
const columns: ProColumns<API.Service>[] = [
|
||||||
{
|
{
|
||||||
|
|
@ -86,24 +88,55 @@ const ListPage: React.FC = () => {
|
||||||
<>
|
<>
|
||||||
<Button
|
<Button
|
||||||
type="primary"
|
type="primary"
|
||||||
|
disabled={isLoading}
|
||||||
onClick={async () => {
|
onClick={async () => {
|
||||||
|
setIsLoading(true);
|
||||||
const { data } = await logisticscontrollerGetShipmentLabel(record.id);
|
const { data } = await logisticscontrollerGetShipmentLabel(record.id);
|
||||||
const content = data.content;
|
const content = data.content;
|
||||||
printPDF([content]);
|
printPDF([content]);
|
||||||
|
setIsLoading(false);
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
Label
|
Label
|
||||||
</Button>
|
</Button>
|
||||||
<Divider type="vertical" />
|
{/* <Divider type="vertical" /> */}
|
||||||
<Button
|
{/* <Button
|
||||||
type="primary"
|
type="primary"
|
||||||
|
disabled={isLoading}
|
||||||
onClick={async () => {
|
onClick={async () => {
|
||||||
|
setIsLoading(true);
|
||||||
const { data } = await logisticscontrollerDeleteShipment(record.id);
|
const { data } = await logisticscontrollerDeleteShipment(record.id);
|
||||||
console.log('data', data);// todo 刷新页面
|
console.log('data', data);// todo 刷新页面
|
||||||
|
setIsLoading(false);
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
Cancel
|
Cancel
|
||||||
</Button>
|
</Button> */}
|
||||||
|
<Popconfirm
|
||||||
|
disabled={isLoading}
|
||||||
|
title="删除"
|
||||||
|
description="确认删除?"
|
||||||
|
onConfirm={async () => {
|
||||||
|
try {
|
||||||
|
setIsLoading(true);
|
||||||
|
const { success, message: errMsg } =
|
||||||
|
await logisticscontrollerDeleteShipment(record.id);
|
||||||
|
if (!success) {
|
||||||
|
throw new Error(errMsg);
|
||||||
|
}
|
||||||
|
setIsLoading(false);
|
||||||
|
actionRef.current?.reload();
|
||||||
|
} catch (error: any) {
|
||||||
|
setIsLoading(false);
|
||||||
|
message.error(error.message);
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<Button type="primary" danger>
|
||||||
|
Cancel
|
||||||
|
</Button>
|
||||||
|
</Popconfirm>
|
||||||
|
<ToastContainer />
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue