修复库存商品新增时辅助条码无法保存

This commit is contained in:
weiwei committed 2025-06-12 17:42:42 +08:00
1 parent a5bdf3aa72
commit f1669fb843
1 file changed
+12 -4
@@ -31,11 +31,11 @@
<vxe-column type="checkbox" width="40" fixed="left" />
<vxe-column type="seq" width="50" fixed="left" />
<vxe-column field="unit" title="单位" :edit-render="{}">
<template #edit="{ row }">
<el-select v-model="row.unitId">
<div v-for="item in computedSmErpUnitEntityList">
<template #edit="{ row, $rowIndex }">
<el-select v-model="row.unitId" @change="handleUnitIdChange(row.unitId, $rowIndex)">
<template v-for="item in computedSmErpUnitEntityList">
<el-option :label="item.unit" :value="item.id" />
</div>
</template>
</el-select>
</template>
<template #default="{ row }">
@@ -63,6 +63,7 @@ import { type rowVU } from "./package-unit.vue"
export interface rowVC {
id: string
unitId: string
unit: string
barCode: string
isNew?: boolean
}
@@ -72,6 +73,7 @@ const auxiliaryCodeList = defineModel("modelValue", {
{
id: nanoid(5),
unitId: "",
unit: "",
barCode: "",
},
],
@@ -100,6 +102,7 @@ const pushEvent = () => {
const newRow: rowVC = {
id: nanoid(5),
unitId: "",
unit: "",
barCode: "",
isNew: true,
}
@@ -125,6 +128,11 @@ watch(
// 计算辅助条码中可选择的包装单位下拉菜单
const computedSmErpUnitEntityList = computed(() => props.smErpUnitEntityList?.filter((item: rowVU) => item.unit))
// 包装单位下拉选择变化
const handleUnitIdChange = (unitId: string, rowIndex: number) => {
;(auxiliaryCodeList.value[rowIndex] as any).unit = computedSmErpUnitEntityList.value?.find((item: rowVU) => item.id == unitId)?.unit
}
// 删除选中的行
const removeSelectRowEvent = () => {
const $table = editableTableRef.value