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 | 113 ++++++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 files changed, 109 insertions(+), 4 deletions(-) diff --git a/src/views/eam/base/EamMaintenanceStandardList.vue b/src/views/eam/base/EamMaintenanceStandardList.vue index a3af2bd..e669c1e 100644 --- a/src/views/eam/base/EamMaintenanceStandardList.vue +++ b/src/views/eam/base/EamMaintenanceStandardList.vue @@ -96,9 +96,19 @@ :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> + + <a-divider v-has="'standard:add:upgrade'" v-if="record.standardStatus === 'START'" type="vertical"/> + + <a v-has="'standard:add:upgrade'" v-if="record.standardStatus === 'START'" @click="handleAddUpgrade(record.id)" >鍗囩増瀵煎叆</a> <template v-if="record.standardStatus === 'WAIT_SUBMIT'"> <a v-has="'standard:edit'" @click.stop="handleEdit(record)">缂栬緫</a> @@ -125,8 +135,7 @@ </a-popconfirm> </template> - <template - v-if="record.standardStatus !== 'WAIT_SUBMIT'&&record.standardStatus!=='ABOLISH'&&record.standardStatus!=='START'"> + <template> <a-divider type="vertical"/> <a @click.stop="handleDetail(record)">璇︽儏</a> @@ -170,6 +179,9 @@ <!--瀹℃壒绐楀彛--> <maintenance-standard-approval-modal ref="maintenanceStandardApprovalModal" :selectShenpiData="selectedRowData"/> + + <!--瀵煎叆鏂囦欢--> + <MaintenanceStandardImportModule ref="fileImportModule" @ok="getTreeDataByApi" /> </a-card> </template> @@ -182,6 +194,7 @@ import LxSearchEquipmentSelect from '@views/eam/equipment/modules/LxSearchEquipmentSelect.vue' import MaintenanceStandardApprovalModal from '../../flowable/workflow/MaintenanceStandard/MaintenanceStandardApprovalModal' + import MaintenanceStandardImportModule from "@views/base/modules/file/MaintenanceStandardImportModule.vue"; export default { @@ -194,6 +207,7 @@ } }, components: { + MaintenanceStandardImportModule, MaintenanceStandardApprovalModal, LxSearchEquipmentSelect, EamMaintenanceStandardModal, @@ -220,6 +234,11 @@ title: '璁惧鍨嬪彿', align: 'center', dataIndex: 'equipmentModel', + }, + { + title: '浣跨敤閮ㄩ棬', + align: 'center', + scopedSlots: { customRender: 'factoryOrgCode' }, }, { title: '瑙勮寖鐘舵��', @@ -273,7 +292,7 @@ inspectionImportExcel: '/eam/maintenanceStandard/importPointInspection', secondMaintenanceImportExcel: '/eam/maintenanceStandard/importSecondMaintenanceStandard', thirdMaintenanceImportExcel: '/eam/maintenanceStandard/importThirdMaintenanceStandard', - inspectionXlsDownloadUrl: '瀵煎叆妯℃澘/璁惧鐐规鏍囧噯瀵煎叆妯℃澘.xlsx', + inspectionXlsDownloadUrl: '瀵煎叆妯℃澘/璁惧鐐规鏍囧噯瀵煎叆妯℃澘.xls', secondMaintenanceXlsDownloadUrl: '瀵煎叆妯℃澘/鐢熶骇璁惧浜岀骇淇濆吇瑙勮寖.docx', thirdMaintenanceXlsDownloadUrl: '瀵煎叆妯℃澘/鐢熶骇璁惧涓夌骇淇濆吇瑙勮寖.docx' }, @@ -300,7 +319,6 @@ dataIndex: 'action', align: 'center', scopedSlots: { customRender: 'action' }, - width: 200, fixed: 'right' } this.columns = [...this.columns, operationColumn] @@ -389,6 +407,93 @@ this.$refs.maintenanceStandardApprovalModal.handleDetail(record) }, + /** + * 鐐瑰嚮鍗囩増瀵煎叆鏃惰Е鍙戞椂瑙﹀彂 + * @param record + */ + handleAddUpgrade(id){ + this.$refs.fileImportModule.upload(id); + this.$refs.fileImportModule.title="鍗囩増瀵煎叆" + }, + + + getTreeDataByApi(){ + 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