- usePurchases: user_id 필터링으로 타 사용자 데이터 접근 차단 - usePurchases: bulkCreatePurchases() 일괄 저장 메서드 추가 - PurchaseModal: submit 시 중복 닫힘 방지 (부모에서 제어) - purchases/index: 엑셀 업로드 버튼 및 모달 연동 - purchases/index: 중고 판매 등록(태그 아이콘) 버튼 및 모달 연동 - purchases/index: 판매 상태 뱃지를 장비명 옆에 표시 - PurchaseExcelUpload: xlsx 파일 파싱 후 일괄 저장 컴포넌트 추가 - SellFromPurchaseModal: 구매 장비에서 중고 판매 등록 모달 추가 - xlsx 패키지 추가
33 lines
819 B
Vue
33 lines
819 B
Vue
<script setup lang="ts">
|
|
import type { Purchase, PurchaseInsert } from '~/types/purchase'
|
|
|
|
const props = defineProps<{
|
|
open: boolean
|
|
initial?: Purchase
|
|
}>()
|
|
|
|
const emit = defineEmits<{
|
|
'update:open': [value: boolean]
|
|
submit: [data: PurchaseInsert]
|
|
}>()
|
|
|
|
const title = computed(() => props.initial ? '장비 수정' : '장비 추가')
|
|
|
|
function handleSubmit(data: PurchaseInsert) {
|
|
// 부모의 비동기 핸들러가 완료된 후 모달을 닫으므로 여기서 닫지 않음
|
|
emit('submit', data)
|
|
}
|
|
</script>
|
|
|
|
<template>
|
|
<UModal :open="open" :title="title" @update:open="emit('update:open', $event)">
|
|
<template #body>
|
|
<PurchasesPurchaseForm
|
|
:initial="initial"
|
|
@submit="handleSubmit"
|
|
@cancel="emit('update:open', false)"
|
|
/>
|
|
</template>
|
|
</UModal>
|
|
</template>
|