fix: sort warehouse tree by name, fix tree batch delete cascade, and implement safe history location autofill
This commit is contained in:
@ -559,6 +559,7 @@ import { ref, reactive, onMounted, watch, computed } from 'vue'
|
||||
import { Plus, Setting, Refresh, Search, Box, House, Link, InfoFilled, Printer, Camera, Picture } from '@element-plus/icons-vue'
|
||||
import { ElMessage, ElLoading } from 'element-plus'
|
||||
import dayjs from 'dayjs'
|
||||
import request from '@/utils/request'
|
||||
import {
|
||||
getProductList,
|
||||
createProductInbound,
|
||||
@ -1029,7 +1030,7 @@ const loadMoreMaterials = async () => {
|
||||
}
|
||||
}
|
||||
|
||||
const onMaterialSelected = (val: number) => {
|
||||
const onMaterialSelected = async (val: number) => {
|
||||
const item = materialOptions.value.find(i => i.id === val)
|
||||
if (item) {
|
||||
form.company_name = item.company_name // [新增]
|
||||
@ -1038,6 +1039,17 @@ const onMaterialSelected = (val: number) => {
|
||||
form.material_type = item.type
|
||||
form.category = item.category
|
||||
form.unit = item.unit
|
||||
|
||||
// 获取该物料历史入库库位(新增独立接口)
|
||||
try {
|
||||
const res = await request.get('/api/v1/inbound/product/last-location', { params: { base_id: val } })
|
||||
if (res.code === 200 && res.data.location) {
|
||||
form.warehouse_location = res.data.location
|
||||
ElMessage.info(`已自动带入该物料历史库位:【${res.data.location}】,请核对。`)
|
||||
}
|
||||
} catch (e) {
|
||||
console.error('获取历史库位失败', e)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user