fix : VUser 와 함께 연동되는 결재선 table 수정 완료, 참조값 같아서 반응형 이슈 있어 deep:true 설정하여 해결

This commit is contained in:
Yesol Choi
2025-05-30 00:03:11 +09:00
parent 8eb1efd05a
commit e1ec17aa97

View File

@@ -14,7 +14,6 @@ onBeforeMount(async ()=>{
const showTable = ref(false) const showTable = ref(false)
const detailActionsOpen = ref(false) const detailActionsOpen = ref(false)
const apprLine = ref([])
const generalParams = reactive({ const generalParams = reactive({
title: "", title: "",
@@ -131,12 +130,23 @@ const validation = () => {
return true return true
} }
const selectUser = ref() const selectUser = ref<Person[]>([])
watch(selectUser,(newPersons)=>{ const apprLine = ref<Person[]>([])
if (Array.isArray(newPersons)) {
apprLine.value = [...apprLine.value, ...newPersons] 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 () => { const updatePriceOne = async () => {
let res = null let res = null
@@ -222,6 +232,7 @@ const onPriceDelete = (index: number) => {
if(apprLine.value.length-1 !== params.felxColumn.length if(apprLine.value.length-1 !== params.felxColumn.length
|| (params.felxColumn.length == 8 && 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) apprLine.value.splice(index, 1)
} }
} }
@@ -587,7 +598,7 @@ const moveDown = (index: number) => {
</table> </table>
</div> </div>
<div class="column is-12"> <div class="column is-12">
<VUser v-model="selectUser"/> <VUserTemp v-model="selectUser"/>
</div> </div>
<div class="column is-12"> <div class="column is-12">
<VField class="pr-2"> <VField class="pr-2">