辅助条码单位重复选择校验并提示
This commit is contained in:
1 parent
f1669fb843
commit
bd0e9c3dd2
2 files changed
+55
No files matched your search
@@ -130,6 +130,11 @@ const computedSmErpUnitEntityList = computed(() => props.smErpUnitEntityList?.fi
|
||||
|
||||
// 包装单位下拉选择变化
|
||||
const handleUnitIdChange = (unitId: string, rowIndex: number) => {
|
||||
nextTick(() => {
|
||||
if (!isFieldUnique(auxiliaryCodeList.value, "unit")) {
|
||||
useMessage().error("包装单位重复")
|
||||
}
|
||||
})
|
||||
;(auxiliaryCodeList.value[rowIndex] as any).unit = computedSmErpUnitEntityList.value?.find((item: rowVU) => item.id == unitId)?.unit
|
||||
}
|
||||
|
||||
@@ -144,6 +149,19 @@ const removeSelectRowEvent = () => {
|
||||
}
|
||||
}
|
||||
|
||||
// 判断辅助条码是否重复
|
||||
const isFieldUnique = (arr: any[], field: string) => {
|
||||
const seen = new Set()
|
||||
for (const item of arr) {
|
||||
const value = item[field]
|
||||
if (seen.has(value)) {
|
||||
return false
|
||||
}
|
||||
seen.add(value)
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
// 校验可编辑表格 成功返回 true 失败返回 false
|
||||
// const editableTableValidate = async () => {
|
||||
// // 全量校验
|
||||
|
||||
Reference in new issue
Block a user