From 013fa92c8410f62953a1d7eb8b46d53d183dbe82 Mon Sep 17 00:00:00 2001 From: qb <1191961160@qq.com> Date: Mon, 24 Feb 2025 10:26:32 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E9=83=A8=E5=88=86=E6=98=BE?= =?UTF-8?q?=E7=A4=BA=EF=BC=8C=E4=BC=98=E5=8C=96=E5=AF=BC=E5=87=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../distribution/VehicleArrivalManagement.js | 2 +- src/utils/exportData.js | 21 ++- src/views/basic/forklift/basicForklift.vue | 124 ++++++++---------- .../basicdata/team/basicdataTeamGroup.vue | 100 ++++++-------- .../warehouse/basicdataWarehouse.vue | 108 +++++++-------- .../artery/VehicleStowageDetails.vue | 33 +---- .../delivery/distributionStockArticleSelf.vue | 11 +- 7 files changed, 178 insertions(+), 221 deletions(-) diff --git a/src/option/distribution/VehicleArrivalManagement.js b/src/option/distribution/VehicleArrivalManagement.js index b7a9d81b..8d3df916 100644 --- a/src/option/distribution/VehicleArrivalManagement.js +++ b/src/option/distribution/VehicleArrivalManagement.js @@ -360,7 +360,7 @@ export const columnList = [ label: '操作', type: 6, values: '', - width: '250', + width: '300', checkarr: [], fixed: 'right', sortable: false, diff --git a/src/utils/exportData.js b/src/utils/exportData.js index 2ef66adb..cd68b0a9 100644 --- a/src/utils/exportData.js +++ b/src/utils/exportData.js @@ -9,17 +9,25 @@ export function exportExcel(columnList = [], listData = [], name = 'excel') { const blackArr = ['序号', '复选框', '操作', '全选']; + const _columnData = columnList.filter(item => !blackArr.includes(item.label)); + const data = []; + const marginList = []; + for (let j = 0; j < listData.length; j++) { const item = listData[j]; const arr = []; - for (let i = 0; i < columnList.length; i++) { - const val = columnList[i]; + for (let i = 0; i < _columnData.length; i++) { + const val = _columnData[i]; if (blackArr.includes(val.label) || val.head) continue; + if (val.isColumnMerge && isNumber(item.mergeColumnIndex) && item.mergeColumnIndex > 1) { + marginList.push({ s: { r: j, c: i }, e: { r: j + item.mergeColumnIndex, c: i } }); + } + if (j === 0) headers.push(val.label); arr.push(item[val.prop] || item[val.prop] === 0 ? item[val.prop] : ''); } @@ -56,7 +64,7 @@ export function exportExcel(columnList = [], listData = [], name = 'excel') { let valueWidth = 0; if (value) if (/.*[\u4e00-\u9fa5]+.*$/.test(value)) { - valueWidth = parseFloat(value.trim().toString().length * 2.1) + 4; + valueWidth = parseFloat(value.trim().toString().length * 1.5) + 4; } else { valueWidth = parseFloat(value.toString().length * 1.1) + 4; } @@ -75,9 +83,9 @@ export function exportExcel(columnList = [], listData = [], name = 'excel') { // 3.对比每列最大值 let aotuWidth = []; - rowsWidth.map((row, index) => { + rowsWidth.forEach((row, index) => { let maxWidth = []; - row.map((value, i) => { + row.forEach((value, i) => { if (index === 0) { maxWidth.push({ wch: value, @@ -94,6 +102,7 @@ export function exportExcel(columnList = [], listData = [], name = 'excel') { // 4.给excel设置自适应宽度 ws['!cols'] = aotuWidth; + ws['!merges'] = marginList; const excludes = ['!cols', '!fullref', '!merges', '!ref', '!rows']; console.log('ws :>> ', ws); for (let key in ws) { @@ -102,7 +111,7 @@ export function exportExcel(columnList = [], listData = [], name = 'excel') { ws[key].s = { alignment: { // horizontal: 'center', //水平居中对齐 - // vertical: 'center', // 垂直居中 + vertical: 'center', // 垂直居中 wrapText: true, }, border: { diff --git a/src/views/basic/forklift/basicForklift.vue b/src/views/basic/forklift/basicForklift.vue index a4e77591..de58a784 100644 --- a/src/views/basic/forklift/basicForklift.vue +++ b/src/views/basic/forklift/basicForklift.vue @@ -46,76 +46,64 @@ - -
- -
- 新 增 - 删 除 -
- -
- - - - -
-
-
- - - - - - - -
-
勾选数量: {{ selectionList.length }}
- - + +
+ 新 增 + 删 除 -
- + +
+ + + + +
+
+ + + + + + +
+
勾选数量: {{ selectionList.length }}
+ + + +
- -
- -
- 新 增 - 删 除 -
- -
- - - -
+
+ +
+ 新 增 + 删 除
- - - - - - - + +
+ + + +
+
+ + + +
@@ -81,7 +65,7 @@ @size-change="sizeChange" @current-change="currentChange" :current-page="page.currentPage" - :page-sizes="[30, 50, 80, 120]" + :page-sizes="[30, 50, 80, 120, 5000]" :page-size="page.pageSize" layout="total, sizes, prev, pager, next, jumper" :total="page.total" diff --git a/src/views/basicdata/warehouse/warehouse/basicdataWarehouse.vue b/src/views/basicdata/warehouse/warehouse/basicdataWarehouse.vue index bc5a7c42..bac1baf2 100644 --- a/src/views/basicdata/warehouse/warehouse/basicdataWarehouse.vue +++ b/src/views/basicdata/warehouse/warehouse/basicdataWarehouse.vue @@ -37,7 +37,7 @@ 到期
-
+
- - - - - -
- - - -
@@ -487,6 +472,7 @@ import { useStore } from 'vuex'; import { ElMessage, ElMessageBox } from 'element-plus'; import { exportExcelByDom } from '@/utils/export'; import { dateNow } from '@/utils/date'; +import { exportExcel } from '@/utils/exportData'; /** 被合并的列 */ const mergeColumn = []; @@ -1158,20 +1144,13 @@ const handleBatchDelete = () => { const handleExport = () => { console.log('exportColumnListNode.value.$el :>> ', exportColumnListNode.value.$el); console.log('detailsRenderData.value :>> ', detailsRenderData.value); - exportExcelByDom(exportColumnListNode.value.$el, `${details.form.carsNo} - ${dateNow()}.xlsx`); + exportExcel( + details.detailsColumnList, + detailsRenderData.value, + `${details.form.carsNo} - ${dateNow()}.xlsx` + ); }; -// watch( -// () => $route.query, -// () => { -// console.log('1231 :>> ', 1231); -// if ($route.path !== '/distribution/artery/VehicleStowageDetails') return; -// onLoad(); -// }, -// { -// immediate: true, -// } -// ); onLoad(); diff --git a/src/views/distribution/inventory/delivery/distributionStockArticleSelf.vue b/src/views/distribution/inventory/delivery/distributionStockArticleSelf.vue index e81ea167..684a2360 100644 --- a/src/views/distribution/inventory/delivery/distributionStockArticleSelf.vue +++ b/src/views/distribution/inventory/delivery/distributionStockArticleSelf.vue @@ -55,8 +55,13 @@ - 修改运单收货人 + + 修改运单收货人 @@ -186,7 +191,7 @@ @size-change="sizeChange" @current-change="currentChange" :current-page="page.currentPage" - :page-sizes="[30, 50, 80, 120,200]" + :page-sizes="[30, 50, 80, 120, 200]" :page-size="page.pageSize" layout="total, sizes, prev, pager, next, jumper" :total="page.total"