Commit f6b939d0 by wuqian

入库单导入优化

parent 01458b31
...@@ -323,6 +323,12 @@ ...@@ -323,6 +323,12 @@
<ElTableColumn <ElTableColumn
show-overflow-tooltip show-overflow-tooltip
align="center" align="center"
label="库位"
prop="locationCode"
/>
<ElTableColumn
show-overflow-tooltip
align="center"
label="成本价(¥)" label="成本价(¥)"
prop="costPrice" prop="costPrice"
/> />
......
...@@ -335,6 +335,12 @@ ...@@ -335,6 +335,12 @@
<ElTableColumn <ElTableColumn
show-overflow-tooltip show-overflow-tooltip
align="center" align="center"
label="库位"
prop="locationCode"
/>
<ElTableColumn
show-overflow-tooltip
align="center"
label="成本价(¥)" label="成本价(¥)"
prop="costPrice" prop="costPrice"
/> />
...@@ -344,18 +350,6 @@ ...@@ -344,18 +350,6 @@
label="总成本(¥)" label="总成本(¥)"
prop="totalPrice" prop="totalPrice"
/> />
<!-- <ElTableColumn
show-overflow-tooltip
align="center"
label="不良品数量"
prop="rejectsAmount"
/>
<ElTableColumn
show-overflow-tooltip
align="center"
label="不良品原因"
prop="rejectsAeason"
/> -->
<ElTableColumn <ElTableColumn
show-overflow-tooltip show-overflow-tooltip
align="center" align="center"
...@@ -377,7 +371,6 @@ ...@@ -377,7 +371,6 @@
/> />
</ElTable> </ElTable>
</div> </div>
<!-- <ElPagination <!-- <ElPagination
v-model:current-page="detailPager.page" v-model:current-page="detailPager.page"
v-model:page-size="detailPager.rows" v-model:page-size="detailPager.rows"
...@@ -551,13 +544,8 @@ ...@@ -551,13 +544,8 @@
/> />
<ElTableColumn align="center" label="库位" prop="locationCode"> <ElTableColumn align="center" label="库位" prop="locationCode">
<template #default="{ row }"> <template #default="{ row }">
<!-- +后有就正常展示,没有则通过搜索接口自己添加 --> <!-- <span v-if="formId&&row.locationCode">{{ row.locationCode }}</span> -->
<!-- remote
:remote-method="(query) => handleLocationSearch(query, row)"
:loading="locationLoading"-->
<span v-if="row.locationCode">{{ row.locationCode }}</span>
<ElSelect <ElSelect
v-else
v-model="row.locationId" v-model="row.locationId"
clearable clearable
placeholder="请输入库位" placeholder="请输入库位"
...@@ -1213,8 +1201,8 @@ const handleLocalImport = async ({ ...@@ -1213,8 +1201,8 @@ const handleLocalImport = async ({
warehouseSku: skuItem.sku, warehouseSku: skuItem.sku,
skuName: skuItem.skuName, skuName: skuItem.skuName,
productNo: skuItem.productNo, productNo: skuItem.productNo,
locationCode: skuItem.locationCode ?? '', locationCode: target?.locationCode ?? '',
locationId: skuItem.locationId || target?.locationId, locationId: target?.locationId,
costPrice: skuItem.factoryPrice, costPrice: skuItem.factoryPrice,
buyStored: importedItem?.buyStored ?? null, buyStored: importedItem?.buyStored ?? null,
totalPrice: new BigNumber( totalPrice: new BigNumber(
...@@ -1501,7 +1489,6 @@ watch( ...@@ -1501,7 +1489,6 @@ watch(
}, },
{ immediate: true }, { immediate: true },
) )
watch( watch(
() => editForm.value.warehouseId, () => editForm.value.warehouseId,
(newVal: number | string | undefined) => { (newVal: number | string | undefined) => {
...@@ -1718,6 +1705,27 @@ const fetchLocationList = async (query: string) => { ...@@ -1718,6 +1705,27 @@ const fetchLocationList = async (query: string) => {
locationCode: item.locationCode, locationCode: item.locationCode,
} }
}) })
if (otherPurchaseData.value?.length > 0) {
//const importedSkus = otherPurchaseData.value.map((item) => item.warehouseSku).join(',')
// // 3. 调用 batchAddCommodity 获取商品的完整信息并过滤掉已有的 SKU
// const filteredSkusList = await batchAddCommodity(importedSkus)
// console.log('filteredSkusList', otherPurchaseData.value)
// 新增时切换仓库将重新匹配表格库位,确保该商品的库位和仓库一一对应
otherPurchaseData.value = otherPurchaseData.value.map(
(item: InterProductList) => {
const foundItem = locationList.value.find(
(locationItem: ILocation) =>
locationItem.locationCode === item.locationCode,
)
// 创建新对象而不是修改原对象
return {
...item,
locationCode: foundItem ? foundItem.locationCode : '',
locationId: foundItem ? foundItem.locationId : null,
}
},
)
}
} catch (e) { } catch (e) {
locationList.value = [] locationList.value = []
} finally { } finally {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment