From 80106696468a42b0b1b3c6ba4bf864bf82b8cd21 Mon Sep 17 00:00:00 2001 From: zhangsiqi <2825463979@qq.com> Date: Fri, 26 Jul 2024 16:25:55 +0800 Subject: [PATCH] =?UTF-8?q?[feat]bom=E4=BF=AE=E6=94=B9=E5=AF=B9=E9=BD=90?= =?UTF-8?q?=E5=88=97=E5=AE=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/resources/templates/erp/bom/bom.html | 49 ++++++++++++++++--- 1 file changed, 43 insertions(+), 6 deletions(-) diff --git a/ruoyi-admin/src/main/resources/templates/erp/bom/bom.html b/ruoyi-admin/src/main/resources/templates/erp/bom/bom.html index af806cde..e9a48b32 100644 --- a/ruoyi-admin/src/main/resources/templates/erp/bom/bom.html +++ b/ruoyi-admin/src/main/resources/templates/erp/bom/bom.html @@ -76,7 +76,7 @@ 添加 - + 导出 @@ -130,6 +130,7 @@ rightFixedColumns:1, fixedRightNumber: 1, // 冻结右列个数 height: $(window).height() - 100, + width: $(window).width() - 100, //指定父id列 onExpandRow : function(index, row, $detail) { $detail.html('

一阶

' + @@ -191,11 +192,7 @@ return $.table.selectDictLabel(levelDatas, value); } }, - { - field: 'sortNo', - title: '排序', - visible: false - }, + {field: 'sortNo',title: '排序',visible: false}, { title: '操作', align: 'center', @@ -740,6 +737,45 @@ } }); } + function exportExcel() { + table.set(); + console.log(table); + const $table = $('#' + table.options.id); + const rows = $table.bootstrapTable('getSelections'); + if (rows.length > 0) { + const ids = rows.map(row => row.id); + confirmExport(ids, 'selected', rows.length); + } else { + confirmExport(null, 'all'); + } + } + function confirmExport(ids, type, count) { + const message = type === 'selected' + ? `确认要导出选中的${count}条数据吗?` + : `确定导出所有bom信息吗?`; + //通过模态框确认 + $.modal.confirm(message, function() { + $.modal.loading("正在导出数据,请稍后..."); + //导出 + if (type === 'selected') { + $.post(table.options.exportUrl, {'exportType': 'selected','ids': ids}, handleExportResponse); + $.modal.closeLoading(); + } else { + $.post(table.options.exportUrl, {'exportType': 'all'}, handleExportResponse); + $.modal.closeLoading(); + } + }); + } + function handleExportResponse(result) { + $.modal.closeLoading(); + if (result.code === web_status.SUCCESS) { + window.location.href = ctx + "common/download?fileName=" + encodeURI(result.msg) + "&delete=" + true; + } else if (result.code === web_status.WARNING) { + $.modal.alertWarning(result.msg); + } else { + $.modal.alertError(result.msg); + } + } @@ -756,5 +792,6 @@ + \ No newline at end of file