From 8d52ce4402877c9ac8b442becf0ba539b822c193 Mon Sep 17 00:00:00 2001
From: fengyuan_yang <1976974459@qq.com>
Date: Thu, 4 Jun 2026 17:07:23 +0800
Subject: [PATCH] =?UTF-8?q?2026-06-04=20RoHs=E4=BC=98=E5=8C=96?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/views/modules/rohs/rohsRecord.vue | 104 +++++++++++++++++++++++---
1 file changed, 93 insertions(+), 11 deletions(-)
diff --git a/src/views/modules/rohs/rohsRecord.vue b/src/views/modules/rohs/rohsRecord.vue
index d383577..003da44 100644
--- a/src/views/modules/rohs/rohsRecord.vue
+++ b/src/views/modules/rohs/rohsRecord.vue
@@ -28,7 +28,22 @@
查询
新增
- 导出
+
+
+ {{ "导出" }}
+
搜索
@@ -54,7 +69,7 @@
-
+
{{ normalizeDateOnly(scope.row.plannedMassProductionDate) }}
@@ -88,7 +103,7 @@
-
+
{{ getValidUntilDisplay(scope.row.validUntilValue, scope.row.validUntil) }}
@@ -951,6 +966,13 @@ export default {
currentApprover: '',
nodeId: ''
},
+ exportLoading: false,
+ exportData: [],
+ exportFieldMap: {},
+ exportName: '',
+ exportHeader: ['RoHs记录'],
+ exportFooter: [],
+ resultList: [],
dataList: [],
pageIndex: 1,
pageSize: 20,
@@ -1930,7 +1952,7 @@ export default {
if (!target) {
return
}
- const fields = ['applicantName', 'pmName', 'npdEngineerName', 'technicalPlanName', 'buyerName', 'endCustomerName', 'projectName', 'commGroup1Desc', 'commGroup2Desc', 'commGroup3Desc']
+ const fields = ['nodeId', 'nodeName', 'currentApprover', 'applicantName', 'pmName', 'npdEngineerName', 'technicalPlanName', 'buyerName', 'endCustomerName', 'projectName', 'commGroup1Desc', 'commGroup2Desc', 'commGroup3Desc']
fields.forEach(field => {
const value = target[field] || fallbackData[field] || ''
this.$set(target, field, value)
@@ -2060,6 +2082,73 @@ export default {
this.pageIndex = 1
this.getDataList()
},
+ buildExportName () {
+ const now = new Date()
+ const year = String(now.getFullYear())
+ const month = String(now.getMonth() + 1).padStart(2, '0')
+ const day = String(now.getDate()).padStart(2, '0')
+ const hour = String(now.getHours()).padStart(2, '0')
+ const minute = String(now.getMinutes()).padStart(2, '0')
+ const second = String(now.getSeconds()).padStart(2, '0')
+ return 'RoHs记录' + year + month + day + hour + minute + second
+ },
+ async createExportData () {
+ const params = {
+ ...this.searchData,
+ site: this.$store.state.user.site,
+ menuId: this.menuId,
+ page: 1,
+ limit: -1
+ }
+ this.resultList = []
+ await api.getRohsList(params).then(({data}) => {
+ if (data && data.code === 0 && data.page && Array.isArray(data.page.list)) {
+ this.resultList = (data.page.list || []).map(item => {
+ const row = {
+ ...item
+ }
+ row.applicationDate = this.normalizeDateOnly(row.applicationDate)
+ row.plannedMassProductionDate = this.normalizeDateOnly(row.plannedMassProductionDate)
+ row.materialValidityTime = this.normalizeDateOnly(row.materialValidityTime)
+ row.expiredDate = this.normalizeDateOnly(row.expiredDate)
+ row.validUntilDisplay = this.getValidUntilDisplay(row.validUntilValue, row.validUntil)
+ return row
+ })
+ } else {
+ this.$message.warning((data && data.msg) || '导出数据获取失败')
+ }
+ }).catch(() => {
+ this.$message.error('导出数据获取失败')
+ })
+ return this.resultList
+ },
+ startDownload () {
+ this.exportName = this.buildExportName()
+ this.exportFieldMap = this.buildExportFields()
+ if (!this.exportFieldMap || Object.keys(this.exportFieldMap).length === 0) {
+ this.$message.warning('未获取到可导出的列,请稍后重试')
+ }
+ this.exportLoading = true
+ },
+ finishDownload () {
+ this.exportLoading = false
+ },
+ buildExportFields () {
+ const tableRef = this.$refs.rohsTable
+ if (!tableRef || !Array.isArray(tableRef.columns)) {
+ return {}
+ }
+ const fields = {}
+ tableRef.columns.forEach(column => {
+ const label = column && column.label ? String(column.label).trim() : ''
+ const property = column && column.property ? String(column.property).trim() : ''
+ if (!label || !property || label === '操作') {
+ return
+ }
+ fields[label] = property
+ })
+ return fields
+ },
// 单选可取消
radioClick (field, value) {
if (this.modalData[field] === value) {
@@ -2068,13 +2157,6 @@ export default {
this.modalData[field] = value
}
},
- // 导出
- exportHandle () {
- if (!this.authSearch) {
- return
- }
- this.$message.info('导出功能开发中')
- },
// 新增 / 修改
addOrUpdateHandle (row) {
if (!row && !this.authUpdate) {