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 打开新增/编辑弹窗