# Conflicts:
#	src/views/supermarketerp/supermarketSpu/components/package-unit.vue
This commit is contained in:
zjf committed 2025-08-21 17:36:14 +08:00
commit 341c6ed83d
2 files changed
+21 -16

No files matched your search

@@ -232,7 +232,24 @@ const pushEvent = (row?: rowVU | undefined) => {
tasteId: "",
}
Object.assign(newRow, row)
const pushEvent = (flag?: "flag" | undefined) => {
const newRow: rowVU = {
id: "tmp_" + nanoid(5),
barCode: "",
spec: "",
unit: "",
status: "0",
packageNum: 1,
purchasePrice: 0,
retailPrice: 0.01,
promotionPrice: 0,
costPrice: 0,
tasteName: "",
tasteId: "",
}
if (flag) newRow.flag = "defaultPackageUnitRow"
packageUnitList.value.push(newRow)
nextTick(() => {
const $table = tableRef.value
@@ -147,20 +147,8 @@ const setDefaultPackageUnit = () => {
if (!form.id && tabPaneActiveIndex.value == 1) {
const isFlagRowExist = form.smErpUnitEntityList.some((item: rowVU) => item.flag === "defaultPackageUnitRow")
if (isFlagRowExist) return
const row = {
id: "tmp_" + nanoid(5),
barCode: form.barCode,
spec: form.spec,
unit: form.unit,
status: form.unitStatus,
packageNum: form.packageNum,
purchasePrice: form.purchasePrice,
retailPrice: form.retailPrice,
promotionPrice: form.promotionPrice,
costPrice: form.costPrice,
flag: "defaultPackageUnitRow",
}
packageUnitRef.value.pushEvent(row)
packageUnitRef.value.pushEvent("flag")
packageUnitRef.value.setRadioRow(0) // 自动设置基础包装单位的radio单选行
}
}
@@ -248,7 +236,7 @@ const settlePackageUnitList = () => {
item.isBase = false
}
if (item.id.startsWith("tmp_")) item.id = ""
if (item.tasteId.startsWith("tmp_")) {
if (item.tasteId?.startsWith("tmp_")) {
item.tasteName = form.smErpTasteStockEntityList.find((tasteItem: any) => tasteItem.id === item.tasteId).tasteName
item.tasteId = ""
}
@@ -277,7 +265,7 @@ const settleAuxiliaryCode = () => {
const settleSmErpTasteStockEntityList = () => {
const smErpTasteStockEntityList = [...form.smErpTasteStockEntityList]
return smErpTasteStockEntityList.map((item: rowVC) => {
if (item.id.startsWith("tmp_")) item.id = ""
if (item.id && item.id.startsWith("tmp_")) item.id = ""
return item
})
}