1:导出功能完善
2:库位查询功能完善
This commit is contained in:
parent
842c03043f
commit
788c4153df
184
src/api/excel.js
184
src/api/excel.js
|
|
@ -1,6 +1,6 @@
|
||||||
import request from "@/http/request";
|
import request from "@/http/request";
|
||||||
|
|
||||||
const downlocadExcel = () => {
|
const downloadExcel = () => {
|
||||||
return request.get('/test/testExcelExport', {
|
return request.get('/test/testExcelExport', {
|
||||||
responseType: 'blob'
|
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) => {
|
const uploadExcelParts = (data) => {
|
||||||
return request({
|
return request({
|
||||||
url: '/excel/uploadStocks',
|
url: '/excel/uploadStocks',
|
||||||
|
|
@ -60,95 +24,55 @@ const uploadExcelParts = (data) => {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
const uploadBoxConfig = (data) => {
|
const downloadStockExcel = (params) => {
|
||||||
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 = () => {
|
|
||||||
return request({
|
return request({
|
||||||
url: '/excel/downloadStockExcel',
|
url: '/excel/downloadStockExcel',
|
||||||
method: 'get',
|
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({
|
return request({
|
||||||
url: '/excel/downloadKateTaskExcel',
|
url: '/excel/downloadInRecordExcel',
|
||||||
method: 'get',
|
method: 'get',
|
||||||
responseType: 'blob'
|
responseType: 'blob',
|
||||||
|
params: {
|
||||||
|
vehicleId: params.vehicleId,
|
||||||
|
goodsId: params.goodsId
|
||||||
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
const downloadPeijianExcel = () => {
|
const downloadOutRecordExcel = (params) => {
|
||||||
return request({
|
return request({
|
||||||
url: '/excel/downloadPeijianExcel',
|
url: '/excel/downloadOutRecordExcel',
|
||||||
method: 'get',
|
method: 'get',
|
||||||
responseType: 'blob'
|
responseType: 'blob',
|
||||||
|
params: {
|
||||||
|
vehicleId: params.vehicleId,
|
||||||
|
goodsId: params.goodsId
|
||||||
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
const downloadRukuExcel = () => {
|
const downloadInventoryRecordExcel = (params) => {
|
||||||
return request({
|
return request({
|
||||||
url: '/excel/downloadRukuExcel',
|
url: '/excel/downloadInventoryRecordExcel',
|
||||||
method: 'get',
|
method: 'get',
|
||||||
responseType: 'blob'
|
responseType: 'blob',
|
||||||
})
|
params: {
|
||||||
|
vehicleId: params.vehicleId,
|
||||||
|
goodsId: params.goodsId
|
||||||
}
|
}
|
||||||
|
|
||||||
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'
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -174,25 +98,29 @@ const downloadVehicleExcel = (vehicleQuery) => {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
export {
|
const downloadLocationsExcel = (params) => {
|
||||||
downlocadExcel,
|
return request({
|
||||||
uploadExcel,
|
url: '/excel/downloadLocationsExcel',
|
||||||
uploadExcelPeijian,
|
method: 'get',
|
||||||
uploadExcelHejian,
|
responseType: 'blob',
|
||||||
uploadExcelParts,
|
params: {
|
||||||
distributePeijianTasks,
|
locationId: params.locationId,
|
||||||
distributeHejianTasks,
|
areaId: params.areaId,
|
||||||
downloadStockExcel,
|
isLock: params.isLock,
|
||||||
downloadKateTaskExcel,
|
locationStatus: params.locationStatus
|
||||||
uploadExcelJinji,
|
}
|
||||||
distributeJinjiTasks,
|
})
|
||||||
downloadPeijianExcel,
|
}
|
||||||
downloadRukuExcel,
|
|
||||||
downloadHejianExcel,
|
export {
|
||||||
downloadJinjiExcel,
|
downloadExcel,
|
||||||
downloadPackageExcel,
|
uploadExcel,
|
||||||
uploadBoxConfig,
|
uploadExcelParts,
|
||||||
uploadExcelKatePackage,
|
downloadStockExcel,
|
||||||
downloadMaterialExcel,
|
downloadMaterialExcel,
|
||||||
downloadVehicleExcel
|
downloadVehicleExcel,
|
||||||
|
downloadInRecordExcel,
|
||||||
|
downloadOutRecordExcel,
|
||||||
|
downloadInventoryRecordExcel,
|
||||||
|
downloadLocationsExcel
|
||||||
}
|
}
|
||||||
|
|
@ -41,10 +41,9 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import { getTaskRecords } from '@/api/record.js'
|
import { getTaskRecords } from '@/api/record.js'
|
||||||
import { dateFormatter, taskStatusFormatter, timeFormatter } from '@/utils/formatter.js'
|
import { dateFormatter, taskStatusFormatter, timeFormatter } from '@/utils/formatter.js'
|
||||||
import { downloadRukuExcel } from '@/api/excel.js'
|
import { downloadInRecordExcel } from '@/api/excel.js'
|
||||||
import zhCn from 'element-plus/dist/locale/zh-cn.mjs'
|
import zhCn from 'element-plus/dist/locale/zh-cn.mjs'
|
||||||
import { ElMessage } from 'element-plus'
|
import { ElMessage } from 'element-plus'
|
||||||
import store from '@/store'
|
|
||||||
</script>
|
</script>
|
||||||
<script>
|
<script>
|
||||||
export default {
|
export default {
|
||||||
|
|
@ -107,12 +106,16 @@ export default {
|
||||||
this.loading = false
|
this.loading = false
|
||||||
},
|
},
|
||||||
reset() {
|
reset() {
|
||||||
this.goodsTypeQuery = ''
|
this.goodsIdQuery = ''
|
||||||
this.specificationQuery = ''
|
this.vehicleIdQuery = ''
|
||||||
this.search()
|
this.search()
|
||||||
},
|
},
|
||||||
exportExcel() {
|
exportExcel() {
|
||||||
downloadRukuExcel().then(res => {
|
const params = {
|
||||||
|
vehicleId: this.vehicleIdQuery.trim(),
|
||||||
|
goodsId: this.goodsIdQuery.trim()
|
||||||
|
}
|
||||||
|
downloadInRecordExcel(params).then(res => {
|
||||||
const link = document.createElement('a');//创建a标签
|
const link = document.createElement('a');//创建a标签
|
||||||
try {
|
try {
|
||||||
// let blob = new Blob([res.data],{type: 'application/vnd.ms-excel'}); //如果后台返回的不是blob对象类型,先定义成blob对象格式,该type导出为xls格式,
|
// let blob = new Blob([res.data],{type: 'application/vnd.ms-excel'}); //如果后台返回的不是blob对象类型,先定义成blob对象格式,该type导出为xls格式,
|
||||||
|
|
|
||||||
284
src/layout/locationsTable.vue
Normal file
284
src/layout/locationsTable.vue
Normal file
|
|
@ -0,0 +1,284 @@
|
||||||
|
<template>
|
||||||
|
<div style="margin-bottom: 10px">
|
||||||
|
<el-config-provider :locale="zhCn">
|
||||||
|
<el-row style="align-items: flex-start;">
|
||||||
|
<el-input v-model="queryKey" style="width: 196px; margin-left: auto; margin-right: 10px;" placeholder="载具号" />
|
||||||
|
<el-button type="primary" @click="search()">搜索</el-button>
|
||||||
|
<el-button type="warning" @click="reset()">重置</el-button>
|
||||||
|
<el-button type="success" @click="exportExcel()">导出信息</el-button>
|
||||||
|
</el-row>
|
||||||
|
<br />
|
||||||
|
<el-table :data="vehicles" stripe border v-loading="loading" class="table-class" max-height="650px"
|
||||||
|
highlight-current-row @row-click="getCurrentRow" :header-cell-style="{ 'text-align': 'center' }"
|
||||||
|
:cell-style="{ 'text-align': 'center' }">
|
||||||
|
<el-table-column width="65px" fixed="left">
|
||||||
|
<template v-slot="scope">
|
||||||
|
<el-radio :label="scope.row.vehicleId" v-model="vehicleId"> </el-radio>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column prop="vehicleId" label="托盘号" fixed="left" min-width="120px" />
|
||||||
|
<el-table-column prop="currentLocation" label="所在位置" fixed="left" :formatter="locationFormat" min-width="120px" show-overflow-tooltip />
|
||||||
|
<el-table-column prop="vehicleStatus" label="状态" :formatter="vehicleStatusFormat" min-width="120px" />
|
||||||
|
<el-table-column prop="isEmpty" label="空托" :formatter="isEmptyFormat" min-width="120px" />
|
||||||
|
<el-table-column fixed="right" label="操作" width="120px" v-if="selVehicle == null">
|
||||||
|
<template v-slot="scope">
|
||||||
|
<el-button plain type="primary" @click="editCurrentRowVehicle(scope.row)">编辑</el-button>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
|
<br />
|
||||||
|
<el-pagination v-model:current-page="currentPage" v-model:page-size="pageSize" :page-sizes="[10, 25, 50]"
|
||||||
|
:small="false" :disabled="false" :background="false" :default-page-size="10"
|
||||||
|
layout="total, sizes, prev, pager, next, jumper" :total="total" @size-change="search"
|
||||||
|
@current-change="search" />
|
||||||
|
<el-dialog v-model="dialogVisible" title="托盘信息" width="40%" draggable :show-close="false">
|
||||||
|
<el-form ref="vehicleFormRef" :model="vehicleFormEntity" :label-position="labelPosition" label-width="100px"
|
||||||
|
style="max-width: 100%" :rules="rules" status-icon>
|
||||||
|
<el-row :gutter="16">
|
||||||
|
<el-col :span="12" :offset="0">
|
||||||
|
<el-form-item label="载具号" prop="vehicleId">
|
||||||
|
<el-input v-model="vehicleFormEntity.vehicleId" disabled />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item label="库位" prop="locationId">
|
||||||
|
<el-input v-model="vehicleFormEntity.currentLocation" placeholder="请输入库位号" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
<el-row :gutter="16">
|
||||||
|
<el-col :span="12" :offset="0">
|
||||||
|
<el-form-item label="空托" prop="isEmpty">
|
||||||
|
<el-select-v2 v-model="vehicleFormEntity.isEmpty" placeholder="请选择是否空托"
|
||||||
|
:options="isEmptyOptions"></el-select-v2>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item label="托盘状态" prop="vehicleStatus">
|
||||||
|
<el-select-v2 v-model="vehicleFormEntity.vehicleStatus" placeholder="请选择托盘状态"
|
||||||
|
:options="vehicleStatusOptions"></el-select-v2>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
</el-form>
|
||||||
|
<template #footer>
|
||||||
|
<span class="dialog-footer">
|
||||||
|
<el-button @click="dialogVisible = false">取消</el-button>
|
||||||
|
<el-button type="primary" @click="submitVehicleInfo(vehicleFormEntity)">
|
||||||
|
确定
|
||||||
|
</el-button>
|
||||||
|
</span>
|
||||||
|
</template>
|
||||||
|
</el-dialog>
|
||||||
|
</el-config-provider>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup>
|
||||||
|
import { getAllVehicles, updateVehicleInfo } from '@/api/vehicle'
|
||||||
|
import zhCn from 'element-plus/dist/locale/zh-cn.mjs'
|
||||||
|
import { ElMessage } from 'element-plus'
|
||||||
|
import { ref, reactive } from 'vue'
|
||||||
|
import { vehicleStatusFormatter, locationFormatter, dateFormatter } from '@/utils/formatter.js'
|
||||||
|
import { downloadLocationsExcel } from '@/api/excel.js'
|
||||||
|
</script>
|
||||||
|
<script>
|
||||||
|
export default {
|
||||||
|
name: 'locationsTable',
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
pageInfo: {},
|
||||||
|
vehicles: [],
|
||||||
|
currentPage: 1,
|
||||||
|
pageSize: 10,
|
||||||
|
total: 0,
|
||||||
|
queryKey: '',
|
||||||
|
loading: true,
|
||||||
|
dialogVisible: false,
|
||||||
|
vehicleId: '',
|
||||||
|
vehicleFormEntity: reactive({}),
|
||||||
|
labelPosition: 'top',
|
||||||
|
vehicleFormRef: ref(),
|
||||||
|
rules: reactive({
|
||||||
|
vehicleId: [
|
||||||
|
{ required: true, message: '请输入托盘号' }
|
||||||
|
],
|
||||||
|
currentLocation: [
|
||||||
|
{ required: true, message: '请输入库位' }
|
||||||
|
]
|
||||||
|
}),
|
||||||
|
// 物料高度
|
||||||
|
isEmptyOptions: [
|
||||||
|
{
|
||||||
|
value: 0,
|
||||||
|
label: '带料'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
value: 1,
|
||||||
|
label: '空托'
|
||||||
|
}
|
||||||
|
],
|
||||||
|
// 托盘状态
|
||||||
|
vehicleStatusOptions: [
|
||||||
|
{
|
||||||
|
value: 1,
|
||||||
|
label: '在库中'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
value: 2,
|
||||||
|
label: '在站台'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
value: 3,
|
||||||
|
label: '移动中'
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
mounted() {
|
||||||
|
this.search()
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
search() {
|
||||||
|
this.loading = true
|
||||||
|
const tableRequest = {
|
||||||
|
pageNo: this.currentPage,
|
||||||
|
pageSize: this.pageSize,
|
||||||
|
vehicleId: this.queryKey.trim()
|
||||||
|
}
|
||||||
|
getAllVehicles(tableRequest).then(res => {
|
||||||
|
const tableResponse = res.data
|
||||||
|
if (tableResponse.code != 0) {
|
||||||
|
ElMessage.error(tableResponse.message)
|
||||||
|
}
|
||||||
|
this.vehicles = tableResponse.returnData.lists
|
||||||
|
this.total = tableResponse.returnData.total
|
||||||
|
}).catch(err => {
|
||||||
|
ElMessage.error('查询载具信息错误' + err.message)
|
||||||
|
})
|
||||||
|
this.loading = false
|
||||||
|
},
|
||||||
|
vehicleStatusFormat: (row, column, cellValue, index) => {
|
||||||
|
return vehicleStatusFormatter(cellValue)
|
||||||
|
},
|
||||||
|
locationFormat: (row, column, cellValue, index) => {
|
||||||
|
return locationFormatter(cellValue)
|
||||||
|
},
|
||||||
|
isEmptyFormat: (row, column, cellValue, index) => {
|
||||||
|
if (cellValue == 0) {
|
||||||
|
return '带料'
|
||||||
|
}
|
||||||
|
if (cellValue == 1) {
|
||||||
|
return '空载具'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
reset() {
|
||||||
|
this.queryKey = ''
|
||||||
|
this.search()
|
||||||
|
},
|
||||||
|
editCurrentRowVehicle(row) {
|
||||||
|
this.vehicleFormEntity = row
|
||||||
|
this.dialogVisible = true
|
||||||
|
},
|
||||||
|
submitVehicleInfo(formData) {
|
||||||
|
const request = {
|
||||||
|
vehicleId: formData.vehicleId,
|
||||||
|
currentLocation: formData.currentLocation,
|
||||||
|
isEmpty: formData.isEmpty,
|
||||||
|
vehicleStatus: formData.vehicleStatus
|
||||||
|
}
|
||||||
|
updateVehicleInfo(request).then(res => {
|
||||||
|
if (res.data.code == 0) {
|
||||||
|
this.dialogVisible = false
|
||||||
|
ElMessage({
|
||||||
|
message: '更新载具信息成功',
|
||||||
|
type: 'success',
|
||||||
|
})
|
||||||
|
this.search()
|
||||||
|
} else {
|
||||||
|
ElMessage.error(res.data.message)
|
||||||
|
}
|
||||||
|
}).catch(err => {
|
||||||
|
ElMessage.error('更新载具信息失败:' + err)
|
||||||
|
})
|
||||||
|
},
|
||||||
|
getCurrentRow(row) {
|
||||||
|
this.vehicleId = row.vehicleId
|
||||||
|
this.$emit('update:selVehicle', row)
|
||||||
|
},
|
||||||
|
exportExcel() {
|
||||||
|
const request = {
|
||||||
|
vehicleId: formData.vehicleId,
|
||||||
|
currentLocation: formData.currentLocation,
|
||||||
|
isEmpty: formData.isEmpty,
|
||||||
|
vehicleStatus: formData.vehicleStatus
|
||||||
|
}
|
||||||
|
downloadLocationsExcel(request).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
|
||||||
|
})
|
||||||
|
})
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
.el-pagination {
|
||||||
|
padding-left: 5px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.el-row .el-button {
|
||||||
|
width: 72px;
|
||||||
|
margin-left: 0px;
|
||||||
|
margin-right: 5px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.table-class {
|
||||||
|
width: 100%;
|
||||||
|
/* font-size: 5px; */
|
||||||
|
}
|
||||||
|
|
||||||
|
.el-row .el-form-item {
|
||||||
|
width: 10% inherit;
|
||||||
|
justify-content: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.el-row .el-form-item .el-select-v2 {
|
||||||
|
width: 100% !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.el-row .el-form-item .el-input-number {
|
||||||
|
width: 100% !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.el-row .el-form-item .el-button {
|
||||||
|
margin: auto;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
@ -3,10 +3,11 @@
|
||||||
<div style="margin-bottom: 15px">
|
<div style="margin-bottom: 15px">
|
||||||
<el-config-provider :locale="zhCn">
|
<el-config-provider :locale="zhCn">
|
||||||
<el-row>
|
<el-row>
|
||||||
<el-input v-model="goodsTypeQuery" style="width: 256px; margin-right: 10px;" placeholder="型号" />
|
<el-input v-model="goodsIdQuery" style="width: 256px; margin-right: 10px;" placeholder="物料编号" />
|
||||||
<el-input v-model="specificationQuery" style="width: 256px; margin-right: 10px;" placeholder="规格" />
|
<el-input v-model="vehicleIdQuery" style="width: 256px; margin-right: 10px;" placeholder="载具号" />
|
||||||
<el-button type="primary" @click="search()">搜索</el-button>
|
<el-button type="primary" @click="search()">搜索</el-button>
|
||||||
<el-button type="warning" @click="reset()">重置</el-button>
|
<el-button type="warning" @click="reset()">重置</el-button>
|
||||||
|
<el-button type="success" @click="exportExcel()">导出记录</el-button>
|
||||||
</el-row>
|
</el-row>
|
||||||
<br />
|
<br />
|
||||||
<el-table :data="tasks" stripe border v-loading="loading" style="width: 100%" max-height="684px"
|
<el-table :data="tasks" stripe border v-loading="loading" style="width: 100%" max-height="684px"
|
||||||
|
|
@ -39,6 +40,7 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import { getTaskRecords } from '@/api/record.js'
|
import { getTaskRecords } from '@/api/record.js'
|
||||||
import { dateFormatter, taskStatusFormatter, timeFormatter } from '@/utils/formatter.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 zhCn from 'element-plus/dist/locale/zh-cn.mjs'
|
||||||
import { ElMessage } from 'element-plus'
|
import { ElMessage } from 'element-plus'
|
||||||
import store from '@/store'
|
import store from '@/store'
|
||||||
|
|
@ -53,8 +55,8 @@ export default {
|
||||||
currentPage: 1,
|
currentPage: 1,
|
||||||
pageSize: 10,
|
pageSize: 10,
|
||||||
total: 0,
|
total: 0,
|
||||||
goodsTypeQuery: '',
|
goodsIdQuery: '',
|
||||||
specificationQuery: '',
|
vehicleIdQuery: '',
|
||||||
loading: true
|
loading: true
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
@ -82,16 +84,12 @@ export default {
|
||||||
},
|
},
|
||||||
search() {
|
search() {
|
||||||
this.loading = true
|
this.loading = true
|
||||||
this.pageInfo.pageNum = this.currentPage
|
|
||||||
this.pageInfo.pageSize = this.pageSize
|
|
||||||
const tableRequest = {
|
const tableRequest = {
|
||||||
page: this.pageInfo,
|
pageNo: this.currentPage,
|
||||||
param: {
|
pageSize: this.pageSize,
|
||||||
taskType: 2,
|
taskType: 2,
|
||||||
goodsType: this.goodsTypeQuery.trim(),
|
goodsId: this.goodsIdQuery.trim(),
|
||||||
specification: this.specificationQuery.trim(),
|
vehicleId: this.vehicleIdQuery.trim()
|
||||||
userName: store.getters.getUserName
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
getTaskRecords(tableRequest).then(res => {
|
getTaskRecords(tableRequest).then(res => {
|
||||||
const tableResponse = res.data
|
const tableResponse = res.data
|
||||||
|
|
@ -111,6 +109,43 @@ export default {
|
||||||
this.specificationQuery = ''
|
this.specificationQuery = ''
|
||||||
this.search()
|
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
|
||||||
|
})
|
||||||
|
})
|
||||||
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
|
||||||
|
|
@ -135,23 +135,20 @@ export default {
|
||||||
methods: {
|
methods: {
|
||||||
search() {
|
search() {
|
||||||
this.loading = true
|
this.loading = true
|
||||||
this.pageInfo.pageNum = this.currentPage
|
|
||||||
this.pageInfo.pageSize = this.pageSize
|
|
||||||
const tableRequest = {
|
const tableRequest = {
|
||||||
page: this.pageInfo,
|
pageNo: this.currentPage,
|
||||||
param: {
|
pageSize: this.pageSize,
|
||||||
logRequest: this.queryKey.trim()
|
queryParam: this.queryKey.trim()
|
||||||
},
|
|
||||||
}
|
}
|
||||||
queryLogs(tableRequest).then(res => {
|
queryLogs(tableRequest).then(res => {
|
||||||
const tableResponse = res.data
|
const tableResponse = res.data
|
||||||
if (tableResponse.code != 0) {
|
if (tableResponse.code != 0) {
|
||||||
ElMessage.error(tableResponse.message)
|
ElMessage.error(tableResponse.message)
|
||||||
}
|
}
|
||||||
this.wmsLogs = tableResponse.rows
|
this.wmsLogs = tableResponse.returnData.lists
|
||||||
this.total = tableResponse.total
|
this.total = tableResponse.returnData.total
|
||||||
}).catch(err => {
|
}).catch(err => {
|
||||||
ElMessage.error('查询物料错误' + err.message)
|
ElMessage.error('查询日志错误' + err.message)
|
||||||
})
|
})
|
||||||
this.loading = false
|
this.loading = false
|
||||||
},
|
},
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user