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) => {
|
const deleteCurrentVehicle = (params) => {
|
||||||
return request({
|
return request({
|
||||||
url: '/location/deleteVehicle',
|
url: '/location/deleteVehicle',
|
||||||
|
|
@ -34,5 +42,6 @@ export {
|
||||||
getAllVehicles,
|
getAllVehicles,
|
||||||
updateVehicleInfo,
|
updateVehicleInfo,
|
||||||
deleteCurrentVehicle,
|
deleteCurrentVehicle,
|
||||||
getVehiclesByLocation
|
getVehiclesByLocation,
|
||||||
|
addVehicleInfo
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -167,8 +167,13 @@
|
||||||
</span>
|
</span>
|
||||||
</el-button>
|
</el-button>
|
||||||
<el-button v-if="activeTabName == 'vehicle'" type="primary"
|
<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>
|
</el-button>
|
||||||
</span>
|
</span>
|
||||||
</template>
|
</template>
|
||||||
|
|
@ -236,7 +241,7 @@ import {reactive} from "vue";
|
||||||
import {addStockInfo, getAllStocks, getStockByLocation, updateStockInfo} from "@/api/stock";
|
import {addStockInfo, getAllStocks, getStockByLocation, updateStockInfo} from "@/api/stock";
|
||||||
import {ElLoading, ElMessage} from "element-plus";
|
import {ElLoading, ElMessage} from "element-plus";
|
||||||
import {getStockList, getVehicleList, updateArea} from "@/api/location";
|
import {getStockList, getVehicleList, updateArea} from "@/api/location";
|
||||||
import {getAllVehicles, getVehiclesByLocation, updateVehicleInfo} from "@/api/vehicle";
|
import {addVehicleInfo, getAllVehicles, getVehiclesByLocation, updateVehicleInfo} from "@/api/vehicle";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'location',
|
name: 'location',
|
||||||
|
|
@ -280,6 +285,7 @@ export default {
|
||||||
direction: 'rtl',
|
direction: 'rtl',
|
||||||
openDrawer: false,
|
openDrawer: false,
|
||||||
isAddStock: true,
|
isAddStock: true,
|
||||||
|
isAddVehicle: true,
|
||||||
stock: {},
|
stock: {},
|
||||||
activeTabName: 'location',
|
activeTabName: 'location',
|
||||||
options: [{
|
options: [{
|
||||||
|
|
@ -317,6 +323,17 @@ export default {
|
||||||
this.getAllVechicle()
|
this.getAllVechicle()
|
||||||
},
|
},
|
||||||
methods: {
|
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() {
|
getAllStock() {
|
||||||
getStockList().then(res => {
|
getStockList().then(res => {
|
||||||
if (res.data.code == 0) {
|
if (res.data.code == 0) {
|
||||||
|
|
@ -345,10 +362,6 @@ export default {
|
||||||
if (locationInfo.locationStatus == 1) {
|
if (locationInfo.locationStatus == 1) {
|
||||||
const vehicleList = this.vehicleList.filter(item => item.currentLocation == locationInfo.locationId)
|
const vehicleList = this.vehicleList.filter(item => item.currentLocation == locationInfo.locationId)
|
||||||
const stockList = this.stockList.filter(item => item.locationId == 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) {
|
if (vehicleList.length == 0 || stockList.length == 0) {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
@ -359,7 +372,6 @@ export default {
|
||||||
},
|
},
|
||||||
updateCurrentVehicleInfo() {
|
updateCurrentVehicleInfo() {
|
||||||
updateVehicleInfo(this.vehicle).then(res => {
|
updateVehicleInfo(this.vehicle).then(res => {
|
||||||
console.log(res.data.code)
|
|
||||||
if (res.data.code == 0) {
|
if (res.data.code == 0) {
|
||||||
ElMessage.success(res.data.message)
|
ElMessage.success(res.data.message)
|
||||||
this.getCurrentVehicleInfo(this.currentSelectedLocation.locationId)
|
this.getCurrentVehicleInfo(this.currentSelectedLocation.locationId)
|
||||||
|
|
@ -370,15 +382,17 @@ export default {
|
||||||
ElMessage.error('更新托盘信息失败!', err)
|
ElMessage.error('更新托盘信息失败!', err)
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
getChangeAreaStyle(val) {
|
|
||||||
return 'change-area-style'
|
|
||||||
},
|
|
||||||
getCurrentVehicleInfo(locationId) {
|
getCurrentVehicleInfo(locationId) {
|
||||||
getVehiclesByLocation({locationId: locationId}).then(res => {
|
getVehiclesByLocation({locationId: locationId}).then(res => {
|
||||||
if (res.data.code === 0) {
|
if (res.data.code === 0) {
|
||||||
this.vehicle = res.data.returnData
|
this.vehicle = res.data.returnData
|
||||||
|
if (res.data.returnData.length > 0){
|
||||||
|
this.isAddVehicle = false
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
ElMessage.error(res.data.message)
|
ElMessage.error(res.data.message)
|
||||||
|
this.isAddVehicle = true
|
||||||
|
this.vehicle = {}
|
||||||
}
|
}
|
||||||
}).catch(err => {
|
}).catch(err => {
|
||||||
ElMessage.error('查询托盘信息失败!', err)
|
ElMessage.error('查询托盘信息失败!', err)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user