Skip to content

Commit

Permalink
fetch: update sale retail purchase views use new export function eair…
Browse files Browse the repository at this point in the history
  • Loading branch information
Jzow committed Dec 1, 2023
1 parent 87af741 commit c863aa4
Show file tree
Hide file tree
Showing 8 changed files with 92 additions and 49 deletions.
11 changes: 11 additions & 0 deletions web/src/api/purchase/order.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ enum API {
UpdateStatus = '/purchase/order/updateStatus',
Delete = '/purchase/order/delete',
GetLinkOrderDetail = '/purchase/order/getLinkOrderDetail',
Export = '/purchase/order/export',
}

export function getPurchaseOrderPageList(params: QueryPurchaseOrderReq) {
Expand Down Expand Up @@ -73,4 +74,14 @@ export function deletePurchaseOrder(ids: number[], successMode: SuccessMessageMo
errorMessageMode: errorMode,
}
);
}

export function exportOrder(params: QueryPurchaseOrderReq) {
return defHttp.get<BaseDataResp<Blob>>(
{
url: `${API.Export}`,
params,
responseType: "blob"
}
);
}
11 changes: 11 additions & 0 deletions web/src/api/purchase/refund.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ enum API {
UpdateStatus = '/purchase/refund/updateStatus',
Delete = '/purchase/refund/delete',
GetLinkRefundDetail = '/purchase/refund/getLinkRefundDetail',
Export = '/purchase/refund/export',
}

export function getPurchaseRefundPageList(params: QueryPurchaseRefundReq) {
Expand Down Expand Up @@ -73,4 +74,14 @@ export function getLinkRefundDetail(receiptNumber: string) {
url: `${API.GetLinkRefundDetail}/${receiptNumber}`,
}
);
}

export function exportRefund(params: QueryPurchaseRefundReq) {
return defHttp.get<BaseDataResp<Blob>>(
{
url: `${API.Export}`,
params,
responseType: "blob"
}
);
}
11 changes: 11 additions & 0 deletions web/src/api/purchase/storage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ enum API {
UpdateStatus = '/purchase/storage/updateStatus',
Delete = '/purchase/storage/delete',
GetLinkStorageDetail = '/purchase/storage/getLinkStorageDetail',
Export = '/purchase/storage/export',
}

export function getPurchaseStoragePageList(params: QueryPurchaseStorageReq) {
Expand Down Expand Up @@ -73,4 +74,14 @@ export function getLinkStorageDetail(receiptNumber: string) {
url: `${API.GetLinkStorageDetail}/${receiptNumber}`,
}
);
}

export function exportStorage(params: QueryPurchaseStorageReq) {
return defHttp.get<BaseDataResp<Blob>>(
{
url: `${API.Export}`,
params,
responseType: "blob"
}
);
}
24 changes: 13 additions & 11 deletions web/src/views/purchase/order/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,9 @@ import {defineComponent, ref} from "vue";
import {BasicTable, TableAction, useTable} from "@/components/Table";
import {useMessage} from "@/hooks/web/useMessage";
import {columns, searchFormSchema} from "@/views/purchase/order/purchaseOrder.data";
import {exportXlsx} from "@/api/basic/common";
import {useI18n} from "vue-i18n";
import {Tag} from "ant-design-vue";
import {getPurchaseOrderPageList, updatePurchaseOrderStatus, deletePurchaseOrder} from "@/api/purchase/order";
import {getPurchaseOrderPageList, updatePurchaseOrderStatus, deletePurchaseOrder, exportOrder} from "@/api/purchase/order";
import AddEditModal from "@/views/purchase/order/components/AddEditModal.vue";
import ViewOrderModal from "@/views/purchase/order/components/ViewOrderModal.vue";
import {useModal} from "@/components/Modal";
Expand All @@ -67,7 +66,7 @@ export default defineComponent({
const addEditModalRef = ref(null);
const [receiptViewOrderModal, {openModal: openViewOrderModal}] = useModal();
const { createMessage } = useMessage();
const [registerTable, { reload, getSelectRows }] = useTable({
const [registerTable, { reload, getSelectRows, getForm }] = useTable({
title: '采购订单列表',
rowKey: 'id',
api: getPurchaseOrderPageList,
Expand Down Expand Up @@ -168,14 +167,17 @@ export default defineComponent({
}
async function handleExport() {
const file = await exportXlsx("采购订单列表")
const blob = new Blob([file]);
const link = document.createElement("a");
link.href = URL.createObjectURL(blob);
const timestamp = getTimestamp(new Date());
link.download = "采购订单数据" + timestamp + ".xlsx";
link.target = "_blank";
link.click();
const data = getForm().getFieldsValue();
const file: any = await exportOrder(data)
if (file.size > 0) {
const blob = new Blob([file]);
const link = document.createElement("a");
link.href = URL.createObjectURL(blob);
const timestamp = getTimestamp(new Date());
link.download = "采购订单数据" + timestamp + ".xlsx";
link.target = "_blank";
link.click();
}
}
Expand Down
24 changes: 13 additions & 11 deletions web/src/views/purchase/refund/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,9 @@ import {defineComponent, ref} from "vue";
import {BasicTable, TableAction, useTable} from "@/components/Table";
import {useMessage} from "@/hooks/web/useMessage";
import {columns, searchFormSchema} from "@/views/purchase/refund/purchaseRefund.data";
import {exportXlsx} from "@/api/basic/common";
import {useI18n} from "vue-i18n";
import {Tag} from "ant-design-vue";
import {getPurchaseRefundPageList, updatePurchaseRefundStatus, deletePurchaseRefund} from "@/api/purchase/refund";
import {getPurchaseRefundPageList, updatePurchaseRefundStatus, deletePurchaseRefund, exportRefund} from "@/api/purchase/refund";
import AddEditModal from "@/views/purchase/refund/components/AddEditModal.vue";
import ViewRefundModal from "@/views/purchase/refund/components/ViewRefundModal.vue"
import {useModal} from "@/components/Modal";
Expand All @@ -68,7 +67,7 @@ export default defineComponent({
const [viewRefundReceiptModal, {openModal: openViewRefundModal}] = useModal();
const { createMessage } = useMessage();
const [registerTable, { reload, getSelectRows }] = useTable({
const [registerTable, { reload, getSelectRows, getForm }] = useTable({
title: '采购退货列表',
rowKey: 'id',
api: getPurchaseRefundPageList,
Expand Down Expand Up @@ -171,14 +170,17 @@ export default defineComponent({
}
async function handleExport() {
const file = await exportXlsx("采购退货列表")
const blob = new Blob([file]);
const link = document.createElement("a");
link.href = URL.createObjectURL(blob);
const timestamp = getTimestamp(new Date());
link.download = "采购退货单数据" + timestamp + ".xlsx";
link.target = "_blank";
link.click();
const data = getForm().getFieldsValue();
const file: any = await exportRefund(data)
if (file.size > 0) {
const blob = new Blob([file]);
const link = document.createElement("a");
link.href = URL.createObjectURL(blob);
const timestamp = getTimestamp(new Date());
link.download = "采购退货单数据" + timestamp + ".xlsx";
link.target = "_blank";
link.click();
}
}
Expand Down
24 changes: 13 additions & 11 deletions web/src/views/purchase/storage/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,9 @@ import {defineComponent, ref} from "vue";
import {BasicTable, TableAction, useTable} from "@/components/Table";
import {useMessage} from "@/hooks/web/useMessage";
import {columns, searchFormSchema} from "@/views/purchase/storage/purchaseStorage.data";
import {exportXlsx} from "@/api/basic/common";
import {useI18n} from "vue-i18n";
import {Tag} from "ant-design-vue";
import {getPurchaseStoragePageList, updatePurchaseStorageStatus, deletePurchaseStorage} from "@/api/purchase/storage";
import {getPurchaseStoragePageList, updatePurchaseStorageStatus, deletePurchaseStorage, exportStorage} from "@/api/purchase/storage";
import AddEditModal from "@/views/purchase/storage/components/AddEditModal.vue";
import ViewStorageModal from "@/views/purchase/storage/components/ViewStorageModal.vue";
import {useModal} from "@/components/Modal";
Expand All @@ -67,7 +66,7 @@ export default defineComponent({
const addEditModalRef = ref(null);
const { createMessage } = useMessage();
const [viewStorageReceiptModal, {openModal: openViewStorageReceiptModal}] = useModal();
const [registerTable, { reload, getSelectRows }] = useTable({
const [registerTable, { reload, getSelectRows, getForm }] = useTable({
title: '采购入库列表',
rowKey: 'id',
api: getPurchaseStoragePageList,
Expand Down Expand Up @@ -173,14 +172,17 @@ export default defineComponent({
}
async function handleExport() {
const file = await exportXlsx("采购入库列表")
const blob = new Blob([file]);
const link = document.createElement("a");
link.href = URL.createObjectURL(blob);
const timestamp = getTimestamp(new Date());
link.download = "采购入库单数据" + timestamp + ".xlsx";
link.target = "_blank";
link.click();
const data = getForm().getFieldsValue();
const file: any = await exportStorage(data)
if (file.size > 0) {
const blob = new Blob([file]);
const link = document.createElement("a");
link.href = URL.createObjectURL(blob);
const timestamp = getTimestamp(new Date());
link.download = "采购入库单数据" + timestamp + ".xlsx";
link.target = "_blank";
link.click();
}
}
Expand Down
18 changes: 10 additions & 8 deletions web/src/views/retail/refund/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -169,14 +169,16 @@ export default defineComponent({
async function handleExport() {
const data = getForm().getFieldsValue();
const file = await exportRefund(data);
const blob = new Blob([file]);
const link = document.createElement("a");
link.href = URL.createObjectURL(blob);
const timestamp = getTimestamp(new Date());
link.download = "零售退货数据" + timestamp + ".xlsx";
link.target = "_blank";
link.click();
const file: any = await exportRefund(data);
if (file.size > 0) {
const blob = new Blob([file]);
const link = document.createElement("a");
link.href = URL.createObjectURL(blob);
const timestamp = getTimestamp(new Date());
link.download = "零售退货数据" + timestamp + ".xlsx";
link.target = "_blank";
link.click();
}
}
Expand Down
18 changes: 10 additions & 8 deletions web/src/views/retail/shipments/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -171,14 +171,16 @@ export default defineComponent({
async function handleExport() {
// 获取getForm().getFieldsValue()的数据传给后端打印接口
const data = getForm().getFieldsValue();
const file = await exportShipments(data);
const blob = new Blob([file]);
const link = document.createElement("a");
link.href = URL.createObjectURL(blob);
const timestamp = getTimestamp(new Date());
link.download = "零售出库数据" + timestamp + ".xlsx";
link.target = "_blank";
link.click();
const file: any = await exportShipments(data);
if (file.size > 0) {
const blob = new Blob([file]);
const link = document.createElement("a");
link.href = URL.createObjectURL(blob);
const timestamp = getTimestamp(new Date());
link.download = "零售出库数据" + timestamp + ".xlsx";
link.target = "_blank";
link.click();
}
}
Expand Down

0 comments on commit c863aa4

Please sign in to comment.