diff --git a/src/views/modules/schedule/order_schedule_expand.vue b/src/views/modules/schedule/order_schedule_expand.vue index e230199..91b65c0 100644 --- a/src/views/modules/schedule/order_schedule_expand.vue +++ b/src/views/modules/schedule/order_schedule_expand.vue @@ -60,6 +60,9 @@ {{ buttons.scheduleBatch ? buttons.scheduleBatch : '批量排产' }} + + {{ buttons.exportButton ? buttons.exportButton : '导出' }} + @@ -315,6 +318,7 @@ import Chooselist from '@/views/modules/common/Chooselist';/*列表组件*/ import comPartStock from "../common/com_part_stock";/*展示物料库存的组件*/ import comScheduleOrderExpand from '@/views/modules/schedule/com_schedule_order_expand';/*排产扩展 排产单个工单*/ import column from '@/views/modules/common/column';/*动态表头*/ +import excel from "@/utils/excel-util.js"; /*导出工具类*/ import { getShopOrderList, @@ -1178,6 +1182,7 @@ export default { settingTable: '设置列表', defaultTable: '设置默认配置', scheduleBatch: '批量排产', + exportButton: '导出', }, buttonList: [ { @@ -1216,6 +1221,12 @@ export default { objectId: 'defaultTable', objectType: 'button', tableId: '*' + }, { + functionId: functionId, + languageValue: '导出', + objectId: 'exportButton', + objectType: 'button', + tableId: '*' }, ], queryButton: { @@ -1788,6 +1799,26 @@ export default { }); }, + // 导出Excel + async exportExcel() { + // 准备导出参数,查询所有数据(不分页) + const exportParams = { + ...this.pageData, + page: 1, + limit: -1 // -1表示查询所有数据 + } + + excel.exportTable({ + url: "/scheduling/getShopOrderList", // 使用正确的后端接口路径 + columnMapping: this.columnList, // 使用当前表格的列配置 + mergeSetting: [], // 需要合并的列(如果有的话) + params: exportParams, + fileName: "订单排产_" + this.dayjs().format('YYYYMMDDHHmmss') + ".xlsx", + rowFetcher: res => res.data.page.list, // 根据后端返回结构:R.ok().put("page", page) + columnFormatter: [], // 列格式化(如果需要) + dropColumns: ['resourceList', 'availResource'] // 剔除不适合导出的列(对象或特殊格式) + }); + }, }, created() {