fix: 配方编辑器禁止重复添加同一精油
All checks were successful
PR Preview / teardown-preview (pull_request) Has been skipped
Test / unit-test (push) Successful in 5s
Test / build-check (push) Successful in 3s
PR Preview / test (pull_request) Successful in 5s
PR Preview / deploy-preview (pull_request) Successful in 21s
Test / e2e-test (push) Successful in 51s

选择已存在的精油时提示"请直接修改滴数"。

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-04-12 13:53:34 +00:00
parent 28ab51c437
commit 0e530e5ba6

View File

@@ -864,6 +864,13 @@ function filteredOilNames(search) {
} }
function selectOil(ing, name) { function selectOil(ing, name) {
// Check for duplicate oil in current recipe
const existing = formIngredients.value.find(i => i !== ing && i.oil === name)
if (existing) {
ui.showToast(`已有「${name}」,请直接修改滴数`)
ing._open = false
return
}
ing.oil = name ing.oil = name
ing._search = name ing._search = name
ing._open = false ing._open = false