From e274cc8e7ff6ebc90114c93ec197cf56200b03be Mon Sep 17 00:00:00 2001 From: itcast Date: Fri, 12 Dec 2025 17:36:56 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/EquipmentLedger/details.vue | 21 ++-- src/views/EquipmentLedger/index.vue | 1 + .../outboundRecord/index.vue | 39 ++++++- src/views/business/warehouse/details.vue | 12 +- .../toolsManage/codeToolsLedger/index.vue | 22 ++++ .../toolsApplication/components/AddNum.vue | 108 ++++++++++++------ src/views/toolsManage/toolsLedger/index.vue | 51 ++++++--- 7 files changed, 190 insertions(+), 64 deletions(-) diff --git a/src/views/EquipmentLedger/details.vue b/src/views/EquipmentLedger/details.vue index 41c6152c..d7199fb5 100644 --- a/src/views/EquipmentLedger/details.vue +++ b/src/views/EquipmentLedger/details.vue @@ -57,18 +57,24 @@ + + + + + + + + - - @@ -84,11 +90,7 @@ - - - - - + + + + + + diff --git a/src/views/EquipmentLedger/index.vue b/src/views/EquipmentLedger/index.vue index c0cd78a0..8f001b74 100644 --- a/src/views/EquipmentLedger/index.vue +++ b/src/views/EquipmentLedger/index.vue @@ -804,6 +804,7 @@ export default { { key: 17, label: `出厂日期`, prop: 'productionDate', visible: true }, { key: 18, label: `采购日期`, prop: 'purchaseDate', visible: true }, { key: 19, label: `资产原值(万元)`, prop: 'originalValue', visible: true }, + { key: 19, label: `资产净值(万元)`, prop: 'value', visible: true }, { key: 20, label: `最大使用年限(年)`, prop: 'maxServiceLifeYears', visible: true }, { key: 21, label: `下次维保日期`, prop: 'nextMaintenanceDate', visible: true }, { key: 22, label: `装备外观`, prop: 'appearanceImages', visible: true }, diff --git a/src/views/EquipmentRoamRecord/outboundRecord/index.vue b/src/views/EquipmentRoamRecord/outboundRecord/index.vue index 65cc8cac..60448b8a 100644 --- a/src/views/EquipmentRoamRecord/outboundRecord/index.vue +++ b/src/views/EquipmentRoamRecord/outboundRecord/index.vue @@ -262,9 +262,42 @@ export default { ) }, - // 下载 + // 下载PDF方法 onHandleDownload() { - this.download('material-mall/decChange/exportDetails', { id: this.recordId }, `出库记录单.xlsx`) + this.downloadPDF('material-mall/decChange/exportDetails', { id: this.recordId }, '出库记录单.pdf'); + }, + +// 封装PDF下载逻辑 + async downloadPDF(url, params, fileName) { + try { + // 关键:设置responseType为blob(二进制流) + const response = await this.$axios({ + method: 'post', + url: url, + data: params, // POST请求参数 + responseType: 'blob', // 必须指定为blob + headers: { + 'Content-Type': 'application/json;charset=UTF-8' // 匹配后端接收格式 + } + }); + + // 创建下载链接 + const blob = new Blob([response.data], { type: 'application/pdf' }); + const downloadUrl = window.URL.createObjectURL(blob); + const link = document.createElement('a'); + link.href = downloadUrl; + link.download = fileName; // 文件名 + document.body.appendChild(link); + link.click(); // 触发下载 + + // 释放资源 + document.body.removeChild(link); + window.URL.revokeObjectURL(downloadUrl); + + this.$message.success('PDF导出成功!'); + } catch (error) { + this.$message.error('PDF导出失败:' + (error.message || '未知错误')); + } }, // 打印 @@ -319,7 +352,7 @@ export default { display: flex; flex-direction: column; overflow: hidden; - + ::v-deep .el-card__body { display: flex !important; flex-direction: column !important; diff --git a/src/views/business/warehouse/details.vue b/src/views/business/warehouse/details.vue index f88d96f6..c3b146fa 100644 --- a/src/views/business/warehouse/details.vue +++ b/src/views/business/warehouse/details.vue @@ -34,7 +34,17 @@ :label="item.proName" :value="item.proCode" v-for="item in useProjectList" - /> + style="width: 200px" + > + + {{ item.proName }} + + + diff --git a/src/views/toolsManage/codeToolsLedger/index.vue b/src/views/toolsManage/codeToolsLedger/index.vue index 23ec6b58..fccb3c48 100644 --- a/src/views/toolsManage/codeToolsLedger/index.vue +++ b/src/views/toolsManage/codeToolsLedger/index.vue @@ -85,6 +85,17 @@
编码工具台账列表
+ + + 导出数据 + +
@@ -565,6 +576,17 @@ export default { if (!val) return this.getSelectList() }, + + /** + * 导出数据 + */ + handleExport() { + this.download('/material-mall/toolLedger/export', { + ...this.queryParams + }, `编码工具台账_${new Date().getTime()}.xlsx`) + }, + + // 获取厂家 async getManufacturerSelect() { try { diff --git a/src/views/toolsManage/toolsApplication/components/AddNum.vue b/src/views/toolsManage/toolsApplication/components/AddNum.vue index 4cbfc1e9..fe79a2a8 100644 --- a/src/views/toolsManage/toolsApplication/components/AddNum.vue +++ b/src/views/toolsManage/toolsApplication/components/AddNum.vue @@ -7,17 +7,13 @@ - - 点击填充 - + @@ -38,9 +34,11 @@ :prop="column.prop" align="center" > - -