From ae3ee586a1bd6d225eb79ce8275817e6e69a4566 Mon Sep 17 00:00:00 2001 From: wangyufei <2267742828@qq.com> Date: Thu, 11 Jul 2024 09:27:58 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AF=BC=E5=87=BA=E6=98=8E=E7=BB=86=EF=BC=8C?= =?UTF-8?q?=E4=BA=8C=E7=BB=B4=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/wms/purchasePlanMain/index.ts | 19 +++++++++- src/locales/en-US.ts | 6 +++- src/locales/zh-CN.ts | 6 ++-- src/utils/disposition/defaultButtons.ts | 25 +++++++++++++ .../purchasePlanMain/index.vue | 35 ++++++++++++++++++- 5 files changed, 86 insertions(+), 5 deletions(-) diff --git a/src/api/wms/purchasePlanMain/index.ts b/src/api/wms/purchasePlanMain/index.ts index 167e3ffd6..9d5e42230 100644 --- a/src/api/wms/purchasePlanMain/index.ts +++ b/src/api/wms/purchasePlanMain/index.ts @@ -85,7 +85,24 @@ export const exportPurchasePlanMain = async (params) => { return await request.download({ url: `/wms/purchase-plan-main/export-excel`, params }) } } - +// 导出明细要货计划主 Excel +export const exportDetailsPurchasePlanMain = async (params) => { + if (params.isSearch) { + const data = {...params} + return await request.downloadPost({ url: `/wms/purchase-plan-main/export-excel-senior`, data }) + } else { + return await request.download({ url: `/wms/purchase-plan-main/export-excel-detail`, params }) + } +} +// 导出要货计划二维表 Excel +export const exportTablePurchasePlanMain = async (params) => { + // if (params.isSearch) { + // const data = {...params} + // return await request.downloadPost({ url: `/wms/purchase-plan-main/export-excel-senior`, data }) + // } else { + return await request.download({ url: `/wms/purchase-plan-main/export-excel`, params }) + //} +} // 下载用户导入模板 export const importTemplate = () => { return request.download({ url: '/wms/purchase-plan-main/get-import-template' }) diff --git a/src/locales/en-US.ts b/src/locales/en-US.ts index 8b06e1779..e2d991a60 100644 --- a/src/locales/en-US.ts +++ b/src/locales/en-US.ts @@ -1144,7 +1144,11 @@ export default { 全部已读:'All read', '申请发货数量不能大于 计划数量 - 已发货数量':'The requested quantity cannot be greater than the planned quantity - the quantity shipped', 不允许超发:'Oversend is not allowed', - 总数量超出计划数量:'The total quantity exceeds the planned quantity' + 总数量超出计划数量:'The total quantity exceeds the planned quantity', + 导出二维表:'Exporting two-dimensional tables', + 要货计划明细:'Detailed requisition plan', + 要货计划二维表:'Two dimensional requisition schedule' + }, diff --git a/src/locales/zh-CN.ts b/src/locales/zh-CN.ts index 83b24fa03..48bd82c29 100644 --- a/src/locales/zh-CN.ts +++ b/src/locales/zh-CN.ts @@ -1144,8 +1144,10 @@ export default { 全部已读:'全部已读', '申请发货数量不能大于 计划数量 - 已发货数量':'申请发货数量不能大于 计划数量 - 已发货数量', 不允许超发:'不允许超发', - 总数量超出计划数量:'总数量超出计划数量' - + 总数量超出计划数量:'总数量超出计划数量', + 导出二维表:'导出二维表', + 要货计划明细:'要货计划明细', + 要货计划二维表:'要货计划二维表' }, } diff --git a/src/utils/disposition/defaultButtons.ts b/src/utils/disposition/defaultButtons.ts index 07d5bc1a7..9b36e0f6f 100644 --- a/src/utils/disposition/defaultButtons.ts +++ b/src/utils/disposition/defaultButtons.ts @@ -44,6 +44,31 @@ export function defaultExportBtn(option: any) { hasPermi: '' }) } +// 导出明细按钮 +export function defaultExportDetailsBtn(option: any) { + return __defaultBtnOption(option, { + label: t(`ts.导出明细`).replace('ts.', ''), + name: 'export-details', + hide: false, + type: 'success', + icon: 'ep:download', + color: '', + hasPermi: '' + }) +} +// 导出明细按钮 +export function defaultExportTableBtn(option: any) { + return __defaultBtnOption(option, { + label: t(`ts.导出二维表`).replace('ts.', ''), + name: 'export-table', + hide: false, + type: 'success', + icon: 'ep:download', + color: '', + hasPermi: '' + }) +} + // 字段设置 // export function defaultFieldSettingBtn(option:any) { diff --git a/src/views/wms/purchasereceiptManage/supplierdeliver/purchasePlanMain/index.vue b/src/views/wms/purchasereceiptManage/supplierdeliver/purchasePlanMain/index.vue index 67f401792..1e234687a 100644 --- a/src/views/wms/purchasereceiptManage/supplierdeliver/purchasePlanMain/index.vue +++ b/src/views/wms/purchasereceiptManage/supplierdeliver/purchasePlanMain/index.vue @@ -292,7 +292,9 @@ const getSearchTableData = async (number,formField,searchField)=>{ const HeadButttondata = [ defaultButtons.defaultAddBtn({ hasPermi: 'wms:purchase-plan-main:create' }), // 新增 defaultButtons.defaultImportBtn({ hasPermi: 'wms:purchase-plan-main:import' }), // 导入 - defaultButtons.defaultExportBtn({ hasPermi: 'wms:purchase-plan-main:export' }), // 导出 + // defaultButtons.defaultExportBtn({ hasPermi: 'wms:purchase-plan-main:export' }), // 导出 + defaultButtons.defaultExportDetailsBtn({ hasPermi: 'wms:purchase-plan-main:export' }), // 导出明细 + defaultButtons.defaultExportTableBtn({ hasPermi: 'wms:purchase-plan-main:export' }), // 导出二维表 // defaultButtons.mainListSelectionOrderPubBtn(null), // 批量发布 defaultButtons.defaultFreshBtn(null), // 刷新 defaultButtons.defaultFilterBtn(null), // 筛选 @@ -316,6 +318,10 @@ const getSearchTableData = async (number,formField,searchField)=>{ handleImport() } else if (val == 'export') { // 导出 handleExport() + } else if (val == 'export-details') { // 导出明细 + handleExportDetails() + } else if (val == 'export-table') { // 导出二维表 + handleExportTable() } else if (val == 'refresh') { // 刷新 if (tableObject.params.filters && tableObject.params.filters.length > 0 ) { searchFormClick({ @@ -628,6 +634,33 @@ const handleSelectionPublish = async ()=>{ } } + const handleExportDetails = async () => { + try { + // 导出的二次确认 + await message.exportConfirm() + // 发起导出 + exportLoading.value = true + const data = await PurchasePlanMainApi.exportDetailsPurchasePlanMain(tableObject.params) + download.excel(data, `${t('ts.要货计划明细')}.xlsx`) + } catch { + } finally { + exportLoading.value = false + } + } + + const handleExportTable = async () => { + try { + // 导出的二次确认 + await message.exportConfirm() + // 发起导出 + exportLoading.value = true + const data = await PurchasePlanMainApi.exportTablePurchasePlanMain(tableObject.params) + download.excel(data, `${t('ts.要货计划二维表')}.xlsx`) + } catch { + } finally { + exportLoading.value = false + } + } /** * tableForm方法 */