59
59
import {defineComponent , ref } from ' vue' ;
60
60
import {BasicTable , useTable } from ' /src/components/Table' ;
61
61
import {BasicModal , useModalInner } from " @/components/Modal" ;
62
- import {getLinkShipmentsDetail } from " @/api/retail/shipments" ;
62
+ import {getLinkShipmentsDetail , exportShipmentsDetail } from " @/api/retail/shipments" ;
63
63
import printJS from ' print-js' ;
64
64
import {
65
65
Descriptions ,
@@ -68,6 +68,7 @@ import {
68
68
Statistic ,
69
69
} from ' ant-design-vue' ;
70
70
import {retailShipmentsTableColumns } from " @/views/retail/shipments/shipments.data" ;
71
+ import {getTimestamp } from " @/utils/dateUtil" ;
71
72
72
73
export default defineComponent ({
73
74
name: ' ViewShipmentModal' ,
@@ -82,18 +83,18 @@ export default defineComponent({
82
83
setup() {
83
84
const receiptNumber = ref (' ' );
84
85
const otherReceipt = ref (' ' );
85
- const memberName = ref ( 0 );
86
+ const memberName = ref < any >( ' ' );
86
87
const paymentType = ref (' ' );
87
88
const receiptDate = ref (' ' );
88
89
const receiptType = ref (' ' );
89
- const receiptAmount = ref (' ' );
90
+ const receiptAmount = ref < any > (' ' );
90
91
const collectAmount = ref (' ' );
91
- const backAmount = ref (' ' );
92
+ const backAmount = ref < any > (' ' );
92
93
const accountName = ref (' ' );
93
94
const remark = ref (' ' )
94
95
const status = ref ();
95
96
96
- const tableData = ref ([]);
97
+ const tableData = ref < any > ([]);
97
98
const [registerTable] = useTable ({
98
99
title: ' 出库商品表数据' ,
99
100
columns: retailShipmentsTableColumns ,
@@ -106,7 +107,6 @@ export default defineComponent({
106
107
const [registerModal, {setModalProps, closeModal}] = useModalInner (async (data ) => {
107
108
setModalProps ({confirmLoading: false , destroyOnClose: true , width: 1200 , showOkBtn: false });
108
109
const res = await getLinkShipmentsDetail (data .receiptNumber );
109
- console .info (res .data );
110
110
tableData .value = res .data .tableData ;
111
111
receiptNumber .value = res .data .receiptNumber ;
112
112
memberName .value = res .data .memberName ;
@@ -129,8 +129,17 @@ export default defineComponent({
129
129
closeModal ();
130
130
}
131
131
132
- function exportTable() {
133
-
132
+ async function exportTable() {
133
+ const file: any = await exportShipmentsDetail (receiptNumber .value )
134
+ if (file .size > 0 ) {
135
+ const blob = new Blob ([file ]);
136
+ const link = document .createElement (" a" );
137
+ const timestamp = getTimestamp (new Date ());
138
+ link .href = URL .createObjectURL (blob );
139
+ link .download = " 零售出库单据详情" + timestamp + " .xlsx" ;
140
+ link .target = " _blank" ;
141
+ link .click ();
142
+ }
134
143
}
135
144
136
145
const flexContainer = ' display: flex; justify-content: space-between; border-bottom: 1px solid #ddd; padding: 8px;' ;
0 commit comments