From b40e84f09cb3c1726b59ba8e0f76b4fc1b39c042 Mon Sep 17 00:00:00 2001 From: "han\\hanst" Date: Thu, 23 Jul 2026 15:58:48 +0800 Subject: [PATCH] site --- src/utils/export.js | 49 +++++++++++++++++++ .../modules/eam/com_project_proof_record.vue | 24 +++++++++ .../modules/eam/eamProjectInfoForUploads.vue | 1 - src/views/modules/eam/eamProjectPartInfo.vue | 48 ++++++++++++++++++ 4 files changed, 121 insertions(+), 1 deletion(-) diff --git a/src/utils/export.js b/src/utils/export.js index 585ced3..5c68be8 100644 --- a/src/utils/export.js +++ b/src/utils/export.js @@ -1,3 +1,42 @@ +import Vue from "vue"; + +function parseExportErrorMessage(payload) { + if (!payload) { + return "导出失败,请稍后重试"; + } + if (typeof payload === "object") { + if (payload.msg || payload.message) { + return payload.msg || payload.message; + } + if (payload.response && payload.response.data) { + return parseExportErrorMessage(payload.response.data); + } + } + const raw = String(payload); + try { + const json = JSON.parse(raw); + return json.msg || json.message || "导出失败,请稍后重试"; + } catch (e) { + return raw; + } +} + +function showExportError(message) { + const msg = message || "导出失败,请稍后重试"; + if (Vue.prototype && Vue.prototype.$message) { + Vue.prototype.$message.error(msg); + return; + } + alert(msg); +} + +function isErrorBlob(resp) { + const type = (resp && resp.type ? resp.type : "").toLowerCase(); + return type.indexOf("application/json") > -1 + || type.indexOf("text/plain") > -1 + || type.indexOf("text/html") > -1; +} + export default { export(url, searchParameter, filenameRep) { ajax.file(url, JSON.stringify(searchParameter), @@ -5,6 +44,14 @@ export default { var filename = filenameRep || "export.xls"; var linkelem = document.createElement("a"); try { + if (isErrorBlob(resp)) { + var fr = new FileReader(); + fr.onload = function() { + showExportError(parseExportErrorMessage(fr.result)); + }; + fr.readAsText(resp); + return; + } var blob = new Blob([resp], { type: "application/octet-stream" }); @@ -30,10 +77,12 @@ export default { } } catch (ex) { console.log(ex); + showExportError("导出失败,请稍后重试"); } }, error => { console.error(error); + showExportError(parseExportErrorMessage(error)); } ); }, diff --git a/src/views/modules/eam/com_project_proof_record.vue b/src/views/modules/eam/com_project_proof_record.vue index b4d2cad..4da1857 100644 --- a/src/views/modules/eam/com_project_proof_record.vue +++ b/src/views/modules/eam/com_project_proof_record.vue @@ -1585,6 +1585,30 @@ } else { this.proofDocumentList[i].projectLeader = '' } + } else if (this.proofDocumentList[i].responsibleDepartment === '前道工程师'){ + if (this.searchData.cQualityEngineer7 !== null && this.searchData.cQualityEngineer7 !== ''){ + this.proofDocumentList[i].projectLeader = this.searchData.cQualityEngineer7.split("-")[1] + } else { + this.proofDocumentList[i].projectLeader = '' + } + } else if (this.proofDocumentList[i].responsibleDepartment === 'QC'){ + if (this.searchData.qcEngineer !== null && this.searchData.qcEngineer !== ''){ + this.proofDocumentList[i].projectLeader = this.searchData.qcEngineer.split("-")[1] + } else { + this.proofDocumentList[i].projectLeader = '' + } + } else if (this.proofDocumentList[i].responsibleDepartment === 'PE'){ + if (this.searchData.peEngineer !== null && this.searchData.peEngineer !== ''){ + this.proofDocumentList[i].projectLeader = this.searchData.peEngineer.split("-")[1] + } else { + this.proofDocumentList[i].projectLeader = '' + } + } else if (this.proofDocumentList[i].responsibleDepartment === 'EE'){ + if (this.searchData.eeEngineer !== null && this.searchData.eeEngineer !== ''){ + this.proofDocumentList[i].projectLeader = this.searchData.eeEngineer.split("-")[1] + } else { + this.proofDocumentList[i].projectLeader = '' + } } } if (this.totalPage > 0) { diff --git a/src/views/modules/eam/eamProjectInfoForUploads.vue b/src/views/modules/eam/eamProjectInfoForUploads.vue index 87d555a..4089611 100644 --- a/src/views/modules/eam/eamProjectInfoForUploads.vue +++ b/src/views/modules/eam/eamProjectInfoForUploads.vue @@ -1817,7 +1817,6 @@ export default { let conSql = '' if (val === 1056 ) { strVal = this.searchData.documentTypeId ? this.searchData.documentTypeId.toString() : '' - conSql = " and a.site = '" + this.$store.state.user.site + "'" this.$refs.baseList.init(val, strVal, conSql) } diff --git a/src/views/modules/eam/eamProjectPartInfo.vue b/src/views/modules/eam/eamProjectPartInfo.vue index a6402c0..8ef15b5 100644 --- a/src/views/modules/eam/eamProjectPartInfo.vue +++ b/src/views/modules/eam/eamProjectPartInfo.vue @@ -4114,6 +4114,18 @@ import {uploadFileList} from '@/api/base/baseFunction.js'; if (this.exportList[i].cQualityEngineer7 !== null && this.exportList[i].cQualityEngineer7 !== '') { this.exportList[i].projectLeader = this.exportList[i].cQualityEngineer7.split("-")[1]; } + } else if (this.exportList[i].responsibleDepartment === 'QC' || this.exportList[i].responsibleDepartment === 'R018') { + if (this.exportList[i].qcEngineer !== null && this.exportList[i].qcEngineer !== '') { + this.exportList[i].projectLeader = this.exportList[i].qcEngineer.split("-")[1]; + } + } else if (this.exportList[i].responsibleDepartment === 'PE' || this.exportList[i].responsibleDepartment === 'R019') { + if (this.exportList[i].peEngineer !== null && this.exportList[i].peEngineer !== '') { + this.exportList[i].projectLeader = this.exportList[i].peEngineer.split("-")[1]; + } + } else if (this.exportList[i].responsibleDepartment === 'EE' || this.exportList[i].responsibleDepartment === 'R020') { + if (this.exportList[i].eeEngineer !== null && this.exportList[i].eeEngineer !== '') { + this.exportList[i].projectLeader = this.exportList[i].eeEngineer.split("-")[1]; + } } } }) @@ -5305,6 +5317,18 @@ import {uploadFileList} from '@/api/base/baseFunction.js'; if (this.proofingCurrentRow.cQualityEngineer7 != null && this.proofingCurrentRow.cQualityEngineer7 !== '') { this.projectPartDocumentList[i].projectLeader = this.proofingCurrentRow.cQualityEngineer7.split('-')[1] // 截取用户名 } + } else if (this.projectPartDocumentList[i].responsibleDepartment === 'QC') { + if (this.proofingCurrentRow.qcEngineer != null && this.proofingCurrentRow.qcEngineer !== '') { + this.projectPartDocumentList[i].projectLeader = this.proofingCurrentRow.qcEngineer.split('-')[1] // 截取用户名 + } + } else if (this.projectPartDocumentList[i].responsibleDepartment === 'PE') { + if (this.proofingCurrentRow.peEngineer != null && this.proofingCurrentRow.peEngineer !== '') { + this.projectPartDocumentList[i].projectLeader = this.proofingCurrentRow.peEngineer.split('-')[1] // 截取用户名 + } + } else if (this.projectPartDocumentList[i].responsibleDepartment === 'EE') { + if (this.proofingCurrentRow.eeEngineer != null && this.proofingCurrentRow.eeEngineer !== '') { + this.projectPartDocumentList[i].projectLeader = this.proofingCurrentRow.eeEngineer.split('-')[1] // 截取用户名 + } } else { this.projectPartDocumentList[i].projectLeader = '' @@ -5464,6 +5488,18 @@ import {uploadFileList} from '@/api/base/baseFunction.js'; if (this.proofingCurrentRow.cQualityEngineer7 != null && this.proofingCurrentRow.cQualityEngineer7 !== '') { this.projectOtherDocumentList[i].projectLeader = this.proofingCurrentRow.cQualityEngineer7.split('-')[1] // 截取用户名 } + } else if (this.projectOtherDocumentList[i].responsibleDepartment === 'QC') { + if (this.proofingCurrentRow.qcEngineer != null && this.proofingCurrentRow.qcEngineer !== '') { + this.projectOtherDocumentList[i].projectLeader = this.proofingCurrentRow.qcEngineer.split('-')[1] // 截取用户名 + } + } else if (this.projectOtherDocumentList[i].responsibleDepartment === 'PE') { + if (this.proofingCurrentRow.peEngineer != null && this.proofingCurrentRow.peEngineer !== '') { + this.projectOtherDocumentList[i].projectLeader = this.proofingCurrentRow.peEngineer.split('-')[1] // 截取用户名 + } + } else if (this.projectOtherDocumentList[i].responsibleDepartment === 'EE') { + if (this.proofingCurrentRow.eeEngineer != null && this.proofingCurrentRow.eeEngineer !== '') { + this.projectOtherDocumentList[i].projectLeader = this.proofingCurrentRow.eeEngineer.split('-')[1] // 截取用户名 + } } else { this.projectOtherDocumentList[i].projectLeader = '' @@ -5734,6 +5770,18 @@ import {uploadFileList} from '@/api/base/baseFunction.js'; if (this.proofingCurrentRow.cQualityEngineer7 != null && this.proofingCurrentRow.cQualityEngineer7 !== '') { this.projectAllDocumentList[i].projectLeader = this.proofingCurrentRow.cQualityEngineer7.split('-')[1] // 截取用户名 } + } else if (this.projectAllDocumentList[i].responsibleDepartment === 'QC') { + if (this.proofingCurrentRow.qcEngineer != null && this.proofingCurrentRow.qcEngineer !== '') { + this.projectAllDocumentList[i].projectLeader = this.proofingCurrentRow.qcEngineer.split('-')[1] // 截取用户名 + } + } else if (this.projectAllDocumentList[i].responsibleDepartment === 'PE') { + if (this.proofingCurrentRow.peEngineer != null && this.proofingCurrentRow.peEngineer !== '') { + this.projectAllDocumentList[i].projectLeader = this.proofingCurrentRow.peEngineer.split('-')[1] // 截取用户名 + } + } else if (this.projectAllDocumentList[i].responsibleDepartment === 'EE') { + if (this.proofingCurrentRow.eeEngineer != null && this.proofingCurrentRow.eeEngineer !== '') { + this.projectAllDocumentList[i].projectLeader = this.proofingCurrentRow.eeEngineer.split('-')[1] // 截取用户名 + } } else { this.projectAllDocumentList[i].projectLeader = '' }