From 788c4153df995b51035b6764fe9ccd7b92bafa0a Mon Sep 17 00:00:00 2001 From: liangzhou <594755172@qq.com> Date: Mon, 15 Jul 2024 13:13:17 +0800 Subject: [PATCH] =?UTF-8?q?1=EF=BC=9A=E5=AF=BC=E5=87=BA=E5=8A=9F=E8=83=BD?= =?UTF-8?q?=E5=AE=8C=E5=96=84=202=EF=BC=9A=E5=BA=93=E4=BD=8D=E6=9F=A5?= =?UTF-8?q?=E8=AF=A2=E5=8A=9F=E8=83=BD=E5=AE=8C=E5=96=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/excel.js | 176 +++++++-------------- src/layout/inTaskRecord.vue | 13 +- src/layout/locationsTable.vue | 284 ++++++++++++++++++++++++++++++++++ src/layout/outTaskRecord.vue | 61 ++++++-- src/layout/wmsLog.vue | 15 +- 5 files changed, 398 insertions(+), 151 deletions(-) create mode 100644 src/layout/locationsTable.vue diff --git a/src/api/excel.js b/src/api/excel.js index 4832571..3ce2aef 100644 --- a/src/api/excel.js +++ b/src/api/excel.js @@ -1,6 +1,6 @@ import request from "@/http/request"; -const downlocadExcel = () => { +const downloadExcel = () => { return request.get('/test/testExcelExport', { responseType: 'blob' }) @@ -15,42 +15,6 @@ const uploadExcel = (formData) => { }) } -const uploadExcelPeijian = (data) => { - return request({ - url: '/excel/uploadExcelPeijian', - method: 'post', - data: data, - timeout: 100000 - }) -} - -const uploadExcelHejian = (data) => { - return request({ - url: '/excel/uploadExcelHejian', - method: 'post', - data: data, - timeout: 100000 - }) -} - -const uploadExcelJinji = (data) => { - return request({ - url: '/excel/uploadExcelJinji', - method: 'post', - data: data, - timeout: 100000 - }) -} - -const uploadExcelKatePackage = (data) => { - return request({ - url: '/excel/uploadExcelKatePackage', - method: 'post', - data: data, - timeout: 100000 - }) -} - const uploadExcelParts = (data) => { return request({ url: '/excel/uploadStocks', @@ -60,95 +24,55 @@ const uploadExcelParts = (data) => { }) } -const uploadBoxConfig = (data) => { - return request({ - url: '/excel/uploadBoxConfig', - method: 'post', - data: data, - timeout: 100000 - }) -} - -const distributePeijianTasks = (data) => { - return request({ - url: '/excel/distributePeijianTasks', - method: 'post', - data: data, - timeout: 100000 - }) -} - -const distributeHejianTasks = (data) => { - return request({ - url: '/excel/distributeHejianTasks', - method: 'post', - data: data, - timeout: 100000 - }) -} - -const distributeJinjiTasks = (data) => { - return request({ - url: '/excel/distributeJinjiTasks', - method: 'post', - data: data, - timeout: 100000 - }) -} - -const downloadStockExcel = () => { +const downloadStockExcel = (params) => { return request({ url: '/excel/downloadStockExcel', method: 'get', - responseType: 'blob' + responseType: 'blob', + params: { + stockStatus: params.stockStatus, + goodsStatus: params.goodsStatus, + locationId: params.locationId, + vehicleId: params.vehicleId, + goodsId: params.goodsId, + goodsName: params.goodsName + } }) } -const downloadKateTaskExcel = () => { +const downloadInRecordExcel = (params) => { return request({ - url: '/excel/downloadKateTaskExcel', + url: '/excel/downloadInRecordExcel', method: 'get', - responseType: 'blob' + responseType: 'blob', + params: { + vehicleId: params.vehicleId, + goodsId: params.goodsId + } }) } -const downloadPeijianExcel = () => { +const downloadOutRecordExcel = (params) => { return request({ - url: '/excel/downloadPeijianExcel', + url: '/excel/downloadOutRecordExcel', method: 'get', - responseType: 'blob' + responseType: 'blob', + params: { + vehicleId: params.vehicleId, + goodsId: params.goodsId + } }) } -const downloadRukuExcel = () => { +const downloadInventoryRecordExcel = (params) => { return request({ - url: '/excel/downloadRukuExcel', + url: '/excel/downloadInventoryRecordExcel', method: 'get', - responseType: 'blob' - }) -} - -const downloadHejianExcel = () => { - return request({ - url: '/excel/downloadHejianExcel', - method: 'get', - responseType: 'blob' - }) -} - -const downloadJinjiExcel = () => { - return request({ - url: '/excel/downloadJinjiExcel', - method: 'get', - responseType: 'blob' - }) -} - -const downloadPackageExcel = () => { - return request({ - url: '/excel/downloadPackageExcel', - method: 'get', - responseType: 'blob' + responseType: 'blob', + params: { + vehicleId: params.vehicleId, + goodsId: params.goodsId + } }) } @@ -174,25 +98,29 @@ const downloadVehicleExcel = (vehicleQuery) => { }) } +const downloadLocationsExcel = (params) => { + return request({ + url: '/excel/downloadLocationsExcel', + method: 'get', + responseType: 'blob', + params: { + locationId: params.locationId, + areaId: params.areaId, + isLock: params.isLock, + locationStatus: params.locationStatus + } + }) +} + export { - downlocadExcel, + downloadExcel, uploadExcel, - uploadExcelPeijian, - uploadExcelHejian, uploadExcelParts, - distributePeijianTasks, - distributeHejianTasks, downloadStockExcel, - downloadKateTaskExcel, - uploadExcelJinji, - distributeJinjiTasks, - downloadPeijianExcel, - downloadRukuExcel, - downloadHejianExcel, - downloadJinjiExcel, - downloadPackageExcel, - uploadBoxConfig, - uploadExcelKatePackage, downloadMaterialExcel, - downloadVehicleExcel + downloadVehicleExcel, + downloadInRecordExcel, + downloadOutRecordExcel, + downloadInventoryRecordExcel, + downloadLocationsExcel } \ No newline at end of file diff --git a/src/layout/inTaskRecord.vue b/src/layout/inTaskRecord.vue index 837cfa2..0ded0da 100644 --- a/src/layout/inTaskRecord.vue +++ b/src/layout/inTaskRecord.vue @@ -41,10 +41,9 @@ + + + \ No newline at end of file diff --git a/src/layout/outTaskRecord.vue b/src/layout/outTaskRecord.vue index 5d386a7..f82a474 100644 --- a/src/layout/outTaskRecord.vue +++ b/src/layout/outTaskRecord.vue @@ -3,10 +3,11 @@
- - + + 搜索 重置 + 导出记录
import { getTaskRecords } from '@/api/record.js' import { dateFormatter, taskStatusFormatter, timeFormatter } from '@/utils/formatter.js' +import { downloadOutRecordExcel } from '@/api/excel.js' import zhCn from 'element-plus/dist/locale/zh-cn.mjs' import { ElMessage } from 'element-plus' import store from '@/store' @@ -53,8 +55,8 @@ export default { currentPage: 1, pageSize: 10, total: 0, - goodsTypeQuery: '', - specificationQuery: '', + goodsIdQuery: '', + vehicleIdQuery: '', loading: true } }, @@ -82,16 +84,12 @@ export default { }, search() { this.loading = true - this.pageInfo.pageNum = this.currentPage - this.pageInfo.pageSize = this.pageSize const tableRequest = { - page: this.pageInfo, - param: { - taskType: 2, - goodsType: this.goodsTypeQuery.trim(), - specification: this.specificationQuery.trim(), - userName: store.getters.getUserName - } + pageNo: this.currentPage, + pageSize: this.pageSize, + taskType: 2, + goodsId: this.goodsIdQuery.trim(), + vehicleId: this.vehicleIdQuery.trim() } getTaskRecords(tableRequest).then(res => { const tableResponse = res.data @@ -111,6 +109,43 @@ export default { this.specificationQuery = '' this.search() }, + exportExcel() { + const params = { + vehicleId: this.vehicleIdQuery.trim(), + goodsId: this.goodsIdQuery.trim() + } + downloadOutRecordExcel(params).then(res => { + const link = document.createElement('a');//创建a标签 + try { + // let blob = new Blob([res.data],{type: 'application/vnd.ms-excel'}); //如果后台返回的不是blob对象类型,先定义成blob对象格式,该type导出为xls格式, + let blob = res.data //如果后台返回的直接是blob对象类型,直接获取数据 + // let _fileName = res.headers['content-disposition'].split(';')[1].split('=')[1]; //拆解获取文件名,如果后端有给返回文件名的话 + let _fileName = "导出出库记录" + dateFormatter(new Date) + ".xlsx" + link.style.display = 'none'//隐藏 + + // 兼容不同浏览器的URL对象 + const url = window.URL || window.webkitURL || window.moxURL + link.href = url.createObjectURL(blob) + link.setAttribute('download', _fileName.substring(_fileName.lastIndexOf('_') + 1)) + document.body.appendChild(link) + link.click() + document.body.removeChild(link) + url.revokeObjectURL(link.href)//移除url对象 + } catch (e) { + ElMessage({ + message: '下载文件失败:: ' + e, + type: 'error', + showClose: true + }) + } + }).catch(err => { + ElMessage({ + message: '导出失败:: ' + err, + type: 'error', + showClose: true + }) + }) + }, }, } diff --git a/src/layout/wmsLog.vue b/src/layout/wmsLog.vue index 8680b64..ff085ea 100644 --- a/src/layout/wmsLog.vue +++ b/src/layout/wmsLog.vue @@ -135,23 +135,20 @@ export default { methods: { search() { this.loading = true - this.pageInfo.pageNum = this.currentPage - this.pageInfo.pageSize = this.pageSize const tableRequest = { - page: this.pageInfo, - param: { - logRequest: this.queryKey.trim() - }, + pageNo: this.currentPage, + pageSize: this.pageSize, + queryParam: this.queryKey.trim() } queryLogs(tableRequest).then(res => { const tableResponse = res.data if (tableResponse.code != 0) { ElMessage.error(tableResponse.message) } - this.wmsLogs = tableResponse.rows - this.total = tableResponse.total + this.wmsLogs = tableResponse.returnData.lists + this.total = tableResponse.returnData.total }).catch(err => { - ElMessage.error('查询物料错误' + err.message) + ElMessage.error('查询日志错误' + err.message) }) this.loading = false },