From 50e9a40ac746c7d46bd0b9f74e98d4d478cf5e64 Mon Sep 17 00:00:00 2001 From: lyh <925863403@qq.com> Date: 星期三, 10 九月 2025 15:43:22 +0800 Subject: [PATCH] 优化二保批量导入,改为返回文件让用户自己查询对应设备型号 --- src/views/eam/base/EamMaintenanceStandardList.vue | 86 ++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 85 insertions(+), 1 deletions(-) diff --git a/src/views/eam/base/EamMaintenanceStandardList.vue b/src/views/eam/base/EamMaintenanceStandardList.vue index e0c16ed..e669c1e 100644 --- a/src/views/eam/base/EamMaintenanceStandardList.vue +++ b/src/views/eam/base/EamMaintenanceStandardList.vue @@ -96,6 +96,12 @@ :pagination="ipagination" :loading="loading" :scroll="{x:'max-content'}" :rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}" :customRow='clickThenSelect' @change="handleTableChange"> + + <!--浣跨敤閮ㄩ棬--> + <template slot="factoryOrgCode" slot-scope="text,record"> + {{[record.zxfactoryOrgCode_dictText].filter(item=>item).join('/')}} + </template> + <span slot="action" slot-scope="text, record"> <a v-has="'standard:upgrade'" v-if="record.standardStatus === 'START'" @click.stop="handleUpgrade(record)">鍗囩増</a> @@ -230,6 +236,11 @@ dataIndex: 'equipmentModel', }, { + title: '浣跨敤閮ㄩ棬', + align: 'center', + scopedSlots: { customRender: 'factoryOrgCode' }, + }, + { title: '瑙勮寖鐘舵��', align: 'center', dataIndex: 'standardStatus_dictText', @@ -281,7 +292,7 @@ inspectionImportExcel: '/eam/maintenanceStandard/importPointInspection', secondMaintenanceImportExcel: '/eam/maintenanceStandard/importSecondMaintenanceStandard', thirdMaintenanceImportExcel: '/eam/maintenanceStandard/importThirdMaintenanceStandard', - inspectionXlsDownloadUrl: '瀵煎叆妯℃澘/璁惧鐐规鏍囧噯瀵煎叆妯℃澘.xlsx', + inspectionXlsDownloadUrl: '瀵煎叆妯℃澘/璁惧鐐规鏍囧噯瀵煎叆妯℃澘.xls', secondMaintenanceXlsDownloadUrl: '瀵煎叆妯℃澘/鐢熶骇璁惧浜岀骇淇濆吇瑙勮寖.docx', thirdMaintenanceXlsDownloadUrl: '瀵煎叆妯℃澘/鐢熶骇璁惧涓夌骇淇濆吇瑙勮寖.docx' }, @@ -410,6 +421,79 @@ this.loadData(); }, + /* 瀵煎叆 */ + handleImportExcel(info) { + this.loading = true; + + if (info.file.status === 'done') { + this.loading = false; + + // 妫�鏌ュ搷搴斿唴瀹规槸鍚︿负CSV鏍煎紡锛堝寘鍚湭鎵惧埌鐨勮澶囩紪鐮侊級 + if (info.file.response && typeof info.file.response === 'string' && + info.file.response.includes('鏈壘鍒扮殑璁惧缂栫爜')) { + + // 鍒涘缓CSV鏂囦欢骞朵笅杞� + const blob = new Blob([info.file.response], { type: 'text/csv;charset=utf-8' }); + const downloadUrl = window.URL.createObjectURL(blob); + const link = document.createElement('a'); + link.href = downloadUrl; + link.setAttribute('download', '鏈壘鍒扮殑璁惧缂栫爜.csv'); + document.body.appendChild(link); + link.click(); + document.body.removeChild(link); + window.URL.revokeObjectURL(downloadUrl); + + // 鏄剧ず鎻愮ず淇℃伅 + this.$notification.warning({ + message: '瀵煎叆瀹屾垚', + description: '瀵煎叆鎴愬姛浣嗗瓨鍦ㄦ湭鎵惧埌鐨勮澶囩紪鐮侊紝宸蹭笅杞芥湭鎵惧埌鐨勮澶囩紪鐮佸垪琛�' + }); + + this.loadData(); + return; + } + + // 澶勭悊甯歌JSON鍝嶅簲 + if (info.file.response && info.file.response.success) { + this.$notification.success({ + message: '瀵煎叆鎴愬姛', + description: info.file.response.message || `${info.file.name} 鏂囦欢涓婁紶鎴愬姛` + }); + this.loadData(); + } else { + const fileName = info.file.name || '鏈煡鏂囦欢'; + const errorMessage = info.file.response && info.file.response.message + ? info.file.response.message + : '瀵煎叆澶辫触锛屾湭鐭ラ敊璇�'; + + this.$notification.error({ + message: '瀵煎叆澶辫触', + description: `${fileName} ${errorMessage}` + }); + } + } else if (info.file.status === 'error') { + this.loading = false; + + const fileName = info.file.name || '鏈煡鏂囦欢'; + let errorMessage = '涓婁紶澶辫触锛屾湭鐭ラ敊璇�'; + + if (info.file.response) { + if (info.file.response.message) { + errorMessage = info.file.response.message; + } else if (info.file.response.error) { + errorMessage = info.file.response.error; + } + } else if (info.file.error) { + errorMessage = info.file.error.message || info.file.error; + } + + this.$notification.error({ + message: '涓婁紶澶辫触', + description: `${fileName} ${errorMessage}` + }); + } + }, + batchDel() { var ids = '' for (var a = 0; a < this.selectedRowKeys.length; a++) { -- Gitblit v1.9.3