diff --git a/src/pages/app/priceUpdate.vue b/src/pages/app/priceUpdate.vue index 4b2844b..884036b 100644 --- a/src/pages/app/priceUpdate.vue +++ b/src/pages/app/priceUpdate.vue @@ -14,7 +14,6 @@ onBeforeMount(async ()=>{ const showTable = ref(false) const detailActionsOpen = ref(false) -const apprLine = ref([]) const generalParams = reactive({ title: "", @@ -131,12 +130,23 @@ const validation = () => { return true } -const selectUser = ref() -watch(selectUser,(newPersons)=>{ - if (Array.isArray(newPersons)) { - apprLine.value = [...apprLine.value, ...newPersons] - } -}) +const selectUser = ref([]) +const apprLine = ref([]) + +const isDuplicate = (person: Person) => + apprLine.value.some((p) => p.sabun === person.sabun) + +watch( + selectUser, + (newPersons) => { + if (Array.isArray(newPersons) && newPersons.length > 0) { + const filtered = newPersons.filter((p) => !isDuplicate(p)) + apprLine.value = [...apprLine.value, ...filtered] + selectUser.value = [] + } + }, + { deep: true } +) const updatePriceOne = async () => { let res = null @@ -222,6 +232,7 @@ const onPriceDelete = (index: number) => { if(apprLine.value.length-1 !== params.felxColumn.length || (params.felxColumn.length == 8 && apprLine.value.length-1 == params.felxColumn.length)) { + console.log("index",index) apprLine.value.splice(index, 1) } } @@ -587,7 +598,7 @@ const moveDown = (index: number) => {
- +