fix: sort warehouse tree by name, fix tree batch delete cascade, and implement safe history location autofill

This commit is contained in:
DXC
2026-04-08 17:32:00 +08:00
parent c58a0a6d14
commit 4a4baa2f8f
11 changed files with 228 additions and 9 deletions

View File

@ -616,6 +616,7 @@ import {ref, reactive, onMounted, watch, computed} from 'vue'
import {Plus, Setting, Refresh, Search, Lock, Box, House, InfoFilled, Link, Printer, Camera, Picture} from '@element-plus/icons-vue'
import {ElMessage, ElLoading} from 'element-plus'
import dayjs from 'dayjs'
import request from '@/utils/request'
import {
getSemiList,
createSemiInbound,
@ -1027,7 +1028,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 // [新增]
@ -1037,6 +1038,17 @@ const onMaterialSelected = (val: number) => {
form.unit = item.unit
form.material_type = item.type
checkHistoryAndSetMode(item.id)
// 获取该物料历史入库库位(新增独立接口)
try {
const res = await request.get('/api/v1/inbound/semi/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)
}
}
}