From e1ec17aa97b317d81a566d76a41a083ea041d6a5 Mon Sep 17 00:00:00 2001 From: Yesol Choi Date: Fri, 30 May 2025 00:03:11 +0900 Subject: [PATCH] =?UTF-8?q?fix=20:=20VUser=20=EC=99=80=20=ED=95=A8?= =?UTF-8?q?=EA=BB=98=20=EC=97=B0=EB=8F=99=EB=90=98=EB=8A=94=20=EA=B2=B0?= =?UTF-8?q?=EC=9E=AC=EC=84=A0=20table=20=EC=88=98=EC=A0=95=20=EC=99=84?= =?UTF-8?q?=EB=A3=8C,=20=EC=B0=B8=EC=A1=B0=EA=B0=92=20=EA=B0=99=EC=95=84?= =?UTF-8?q?=EC=84=9C=20=EB=B0=98=EC=9D=91=ED=98=95=20=EC=9D=B4=EC=8A=88=20?= =?UTF-8?q?=EC=9E=88=EC=96=B4=20deep:true=20=EC=84=A4=EC=A0=95=ED=95=98?= =?UTF-8?q?=EC=97=AC=20=ED=95=B4=EA=B2=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/app/priceUpdate.vue | 27 +++++++++++++++++++-------- 1 file changed, 19 insertions(+), 8 deletions(-) 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) => {
- +