feat(库位信息): 增加添加托盘信息
This commit is contained in:
parent
c92fab3cbd
commit
92cb3caf78
|
|
@ -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
|
||||
}
|
||||
|
|
|
|||
|
|
@ -167,8 +167,13 @@
|
|||
</span>
|
||||
</el-button>
|
||||
<el-button v-if="activeTabName == 'vehicle'" type="primary"
|
||||
@click="updateCurrentVehicleInfo">
|
||||
更新托盘信息
|
||||
>
|
||||
<span v-if="isAddVehicle" @click="addVehicle">
|
||||
添加托盘信息
|
||||
</span>
|
||||
<span v-else @click="updateCurrentVehicleInfo">
|
||||
更新托盘信息
|
||||
</span>
|
||||
</el-button>
|
||||
</span>
|
||||
</template>
|
||||
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user