From 61ae7845b9f29dc68e674ed1d924a4ef1f9fe55c Mon Sep 17 00:00:00 2001 From: "han\\hanst" Date: Mon, 8 Jun 2026 16:20:40 +0800 Subject: [PATCH] =?UTF-8?q?BU=20=E9=80=89=20RFID=20=E5=AF=BC=E5=87=BA?= =?UTF-8?q?=EF=BC=8C=E7=A1=AE=E8=AE=A4=E6=96=B0=E5=A2=9E=2011=20=E5=88=97?= =?UTF-8?q?=E5=AD=98=E5=9C=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/modules/eam/eam_device_list.vue | 56 ++++++++++++++++++++++- 1 file changed, 55 insertions(+), 1 deletion(-) diff --git a/src/views/modules/eam/eam_device_list.vue b/src/views/modules/eam/eam_device_list.vue index 7b87cf5..c268d93 100644 --- a/src/views/modules/eam/eam_device_list.vue +++ b/src/views/modules/eam/eam_device_list.vue @@ -1127,6 +1127,7 @@ searchData: { site: this.$store.state.user.site, userName: this.$store.state.user.name, + buDesc: '', objectID: '', objectDesc: '', locationID: '', @@ -4112,7 +4113,7 @@ this.searchData.page = 1 excel.exportTable({ url: "/pms/eamObject/getEamObjectList", - columnMapping: this.columnList,//可以直接用table,不需要的列就剔除 + columnMapping: this.getExportColumnMapping(),//可以直接用table,不需要的列就剔除 mergeSetting: [],//需要合并的列 params: this.searchData, fileName: this.exportName+".xlsx", @@ -4122,6 +4123,59 @@ }); }, + // 导出时判断是否是RFID BU(仅RFID追加扩展字段列) + isRfidBuForExport () { + const normalizeBu = (value) => value == null ? '' : String(value).toUpperCase() + const currentBuDesc = normalizeBu(this.searchData.buDesc) + if (currentBuDesc !== '') { + return currentBuDesc.indexOf('RFID') !== -1 + } + if (Array.isArray(this.userBuList) && this.userBuList.length === 1) { + const buItem = this.userBuList[0] || {} + const buDesc = normalizeBu(buItem.buDesc) + const buNo = normalizeBu(buItem.buNo) + return buDesc.indexOf('RFID') !== -1 || buNo.indexOf('RFID') !== -1 + } + return false + }, + + // 设备导出列:RFID在基础列后追加扩展列,其他BU保持不变 + getExportColumnMapping () { + const exportColumnList = Array.isArray(this.columnList) ? [...this.columnList] : [] + if (!this.isRfidBuForExport()) { + return exportColumnList + } + const rfidExtraColumnList = [ + { columnProp: 'workshop', columnLabel: '车间' }, + { columnProp: 'warrantyStartDate', columnLabel: '保修开始时间' }, + { columnProp: 'warrantyEndDate', columnLabel: '保修结束时间' }, + { columnProp: 'warrantyExpiredFlag', columnLabel: '是否已过保' }, + { columnProp: 'voltage', columnLabel: '电压' }, + { columnProp: 'currentA', columnLabel: '电流A' }, + { columnProp: 'powerKw', columnLabel: '功率KW' }, + { columnProp: 'totalSize', columnLabel: '设备总尺寸:长*宽*高(m)' }, + { columnProp: 'splitSize', columnLabel: '设备分体尺寸:长*宽*高(m)' }, + { columnProp: 'totalWeight', columnLabel: '设备总重量' }, + { columnProp: 'splitModuleWeight', columnLabel: '设备分体模块重量' }, + ] + const existColumnMap = exportColumnList.reduce((map, item) => { + if (!item) { + return map + } + const propKey = item.columnProp || item.property + if (propKey) { + map[propKey] = true + } + return map + }, {}) + rfidExtraColumnList.forEach((column) => { + if (!existColumnMap[column.columnProp]) { + exportColumnList.push(column) + } + }) + return exportColumnList + }, + // 导出excel // async createExportData () { // this.searchData.limit = -1