diff --git a/src/views/erp/stock/out/components/StockOutItemForm.vue b/src/views/erp/stock/out/components/StockOutItemForm.vue index e7c369c2..4be62c0b 100644 --- a/src/views/erp/stock/out/components/StockOutItemForm.vue +++ b/src/views/erp/stock/out/components/StockOutItemForm.vue @@ -526,6 +526,16 @@ const resolveStockOutCategoryType = (outType?: string) => { const activeCategoryType = computed(() => resolveStockOutCategoryType(props.outType)) const isProductMaterialStockOut = computed(() => Boolean(activeCategoryType.value)) const isProductStockOut = computed(() => activeCategoryType.value === 1) +const getDefaultOutUsageType = () => { + if (isProductStockOut.value) return '4' + if (activeCategoryType.value === 2) return '5' + return undefined +} +const setDefaultOutUsageType = (row: any) => { + const defaultOutUsageType = getDefaultOutUsageType() + if (!defaultOutUsageType || row.outUsageType !== undefined && row.outUsageType !== null && row.outUsageType !== '') return + row.outUsageType = defaultOutUsageType +} const isPurchaseUnitStockOut = computed(() => activeCategoryType.value === 2 || activeCategoryType.value === 3) const isSparePartStockOut = computed(() => activeCategoryType.value === 3) const showOutboundPurposeColumn = computed(() => isProductMaterialStockOut.value) @@ -782,7 +792,7 @@ const handleAdd = () => { lockedStockCount: undefined, count: isProductMaterialStockOut.value ? undefined : 1, outMode: isProductStockOut.value ? 1 : undefined, - outUsageType: undefined, + outUsageType: getDefaultOutUsageType(), pallets: [], palletCode: undefined, repairId: undefined, @@ -886,6 +896,7 @@ const normalizeRow = (row: any) => { if (row.outUsageType !== undefined && row.outUsageType !== null) { row.outUsageType = String(row.outUsageType) } + setDefaultOutUsageType(row) row.inputCount = row.inputCount ?? row.count if (isProductStockOut.value) { row.outMode = Number(row.outMode || 1)