From 92cb3caf7885ab231ba428eaa5de2141063246b5 Mon Sep 17 00:00:00 2001 From: Huluwa22 <2667400744@qq.com> Date: Sun, 2 Mar 2025 08:53:20 +0800 Subject: [PATCH] =?UTF-8?q?feat(=E5=BA=93=E4=BD=8D=E4=BF=A1=E6=81=AF):=20?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E6=B7=BB=E5=8A=A0=E6=89=98=E7=9B=98=E4=BF=A1?= =?UTF-8?q?=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/vehicle.js | 11 ++++++++++- src/layout/location.vue | 36 +++++++++++++++++++++++++----------- 2 files changed, 35 insertions(+), 12 deletions(-) diff --git a/src/api/vehicle.js b/src/api/vehicle.js index de05360..a2dac5d 100644 --- a/src/api/vehicle.js +++ b/src/api/vehicle.js @@ -22,6 +22,14 @@ const updateVehicleInfo = (params) => { }) } + +const addVehicleInfo = (params) => { + return request({ + url: '/location/addVehicleInfo', + method: 'post', + data: params + }) +} const deleteCurrentVehicle = (params) => { return request({ url: '/location/deleteVehicle', @@ -34,5 +42,6 @@ export { getAllVehicles, updateVehicleInfo, deleteCurrentVehicle, - getVehiclesByLocation + getVehiclesByLocation, + addVehicleInfo } diff --git a/src/layout/location.vue b/src/layout/location.vue index d63b50d..35db01b 100644 --- a/src/layout/location.vue +++ b/src/layout/location.vue @@ -167,8 +167,13 @@ - 更新托盘信息 + > + + 添加托盘信息 + + + 更新托盘信息 + @@ -236,7 +241,7 @@ import {reactive} from "vue"; import {addStockInfo, getAllStocks, getStockByLocation, updateStockInfo} from "@/api/stock"; import {ElLoading, ElMessage} from "element-plus"; import {getStockList, getVehicleList, updateArea} from "@/api/location"; -import {getAllVehicles, getVehiclesByLocation, updateVehicleInfo} from "@/api/vehicle"; +import {addVehicleInfo, getAllVehicles, getVehiclesByLocation, updateVehicleInfo} from "@/api/vehicle"; export default { name: 'location', @@ -280,6 +285,7 @@ export default { direction: 'rtl', openDrawer: false, isAddStock: true, + isAddVehicle: true, stock: {}, activeTabName: 'location', options: [{ @@ -317,6 +323,17 @@ export default { this.getAllVechicle() }, methods: { + addVehicle(){ + addVehicleInfo(this.vehicle).then(res =>{ + if (res.data.code == 0) { + ElMessage.success(res.data.message) + } else { + ElMessage.error(res.data.message) + } + }).catch(err => { + ElMessage.error('添加托盘信息失败!', err) + }) + }, getAllStock() { getStockList().then(res => { if (res.data.code == 0) { @@ -345,10 +362,6 @@ export default { if (locationInfo.locationStatus == 1) { const vehicleList = this.vehicleList.filter(item => item.currentLocation == locationInfo.locationId) const stockList = this.stockList.filter(item => item.locationId == locationInfo.locationId) - console.log(locationInfo.locationId) - console.log(this.vehicleList) - console.log(stockList) - console.log(vehicleList) if (vehicleList.length == 0 || stockList.length == 0) { return true } @@ -359,7 +372,6 @@ export default { }, updateCurrentVehicleInfo() { updateVehicleInfo(this.vehicle).then(res => { - console.log(res.data.code) if (res.data.code == 0) { ElMessage.success(res.data.message) this.getCurrentVehicleInfo(this.currentSelectedLocation.locationId) @@ -370,15 +382,17 @@ export default { ElMessage.error('更新托盘信息失败!', err) }) }, - getChangeAreaStyle(val) { - return 'change-area-style' - }, getCurrentVehicleInfo(locationId) { getVehiclesByLocation({locationId: locationId}).then(res => { if (res.data.code === 0) { this.vehicle = res.data.returnData + if (res.data.returnData.length > 0){ + this.isAddVehicle = false + } } else { ElMessage.error(res.data.message) + this.isAddVehicle = true + this.vehicle = {} } }).catch(err => { ElMessage.error('查询托盘信息失败!', err)