From 783f92bf188cf04319fb419409e940dcba33f1de Mon Sep 17 00:00:00 2001 From: louis <869322496@qq.com> Date: Mon, 15 Apr 2024 13:50:28 +0800 Subject: [PATCH] feat: sale_quotation --- src/api/backend/api/index.ts | 2 ++ src/api/backend/api/saleQuotation.ts | 9 +++++++++ src/views/sale_quotation/template/index.vue | 17 +++++++++++++++-- 3 files changed, 26 insertions(+), 2 deletions(-) create mode 100644 src/api/backend/api/saleQuotation.ts diff --git a/src/api/backend/api/index.ts b/src/api/backend/api/index.ts index b000249..74fd81b 100644 --- a/src/api/backend/api/index.ts +++ b/src/api/backend/api/index.ts @@ -35,6 +35,7 @@ import * as vehicleUsage from './vehicleUsage'; import * as saleQuotationGroup from './saleQuotationGroup'; import * as saleQuotationComponent from './saleQuotationComponent'; import * as saleQuotationTemplate from './saleQuotationTemplate'; +import * as saleQuotation from './saleQuotation'; export default { auth, @@ -70,4 +71,5 @@ export default { saleQuotationGroup, saleQuotationComponent, saleQuotationTemplate, + saleQuotation }; diff --git a/src/api/backend/api/saleQuotation.ts b/src/api/backend/api/saleQuotation.ts new file mode 100644 index 0000000..2b177e1 --- /dev/null +++ b/src/api/backend/api/saleQuotation.ts @@ -0,0 +1,9 @@ +import { request, type RequestOptions } from '@/utils/request'; +const baseApi = '/api/sale_quotation/sale_quotation'; +/** 导出原材料盘点表 GET /api/sale_quotation/export*/ +export async function exportSaleQuotation(id: number, options?: RequestOptions) { + return request(`${baseApi}/export/${id}`, { + method: 'GET', + ...(options || { responseType: 'blob', isReturnResult: false }), + }); +} diff --git a/src/views/sale_quotation/template/index.vue b/src/views/sale_quotation/template/index.vue index 8844bc0..9e2c56a 100644 --- a/src/views/sale_quotation/template/index.vue +++ b/src/views/sale_quotation/template/index.vue @@ -26,6 +26,7 @@ import { useFormModal, useModal } from '@/hooks/useModal'; import { formSchemas } from './formSchemas'; import { ref, onMounted } from 'vue'; +import fileDownload from 'js-file-download'; defineOptions({ name: 'SaleQuotationTemplate', }); @@ -46,6 +47,7 @@ onMounted(() => { dataIndex: 'ACTION', hideInSearch: true, actions: ({ record }) => [ + { icon: 'ant-design:edit-outlined', tooltip: '编辑', @@ -66,14 +68,25 @@ onMounted(() => { onConfirm: () => delRowConfirm(record.id), }, }, - + { + icon: 'ant-design:file-excel-outlined', + tooltip: '导出', + auth: { + perm: 'sale_quotation:sale_quotation:export', + effect: 'disable', + }, + onClick: () => onExport(record), + }, ], }, ]; }); - +const onExport = async (record:TableListItem) => { + const response = await Api.saleQuotation.exportSaleQuotation(record.id); + fileDownload(response, `${record.name}.xls`); +} /** * @description 打开新增/编辑弹窗