deal/src/App.vue

78 lines
1.9 KiB
Vue
Raw Normal View History

2025-11-30 18:10:54 +01:00
<template>
<div>
<h1>Сделка</h1>
2025-12-12 21:56:50 +01:00
<div><a href="#" @click.prevent="createDeal(17539)">Создать новую сделку</a></div>
<div><a href="#" @click.prevent="editDeal(17539, 46)">Открыть тестовую сделку</a></div>
2025-11-30 18:10:54 +01:00
</div>
<DynamicDialog />
</template>
<script setup>
import { ref, onMounted } from 'vue'
import DealModal from './components/deals/DealModal.vue'
import DynamicDialog from 'primevue/dynamicdialog'
import {useDialog} from "primevue/usedialog";
const isOpen = ref(false)
const dealId = ref(null)
const newDealReqId = ref(null)
const dialog = useDialog()
const createDeal = (newDealReqId) => {
console.log('[createDeal] Открываем DealModal через DynamicDialog', newDealReqId)
dialog.open(DealModal, {
props: {
header: 'Создание сделки',
style: { width: '80vw' },
modal: true
},
data: {
newDealReqId: newDealReqId
},
onClose: (opt) => {
console.log('[DynamicDialog] Закрыто с данными:', opt?.data)
}
})
}
2025-12-12 21:56:50 +01:00
const editDeal = (newDealReqId, dealId) => {
console.log('[editDeal] Открываем DealModal через DynamicDialog', dealId)
dialog.open(DealModal, {
props: {
header: 'Редактирование сделки',
style: { width: '80vw' },
modal: true
},
data: {
newDealReqId: newDealReqId,
deal_id: dealId
},
onClose: (opt) => {
console.log('[DynamicDialog] Закрыто с данными:', opt?.data)
}
})
2025-11-30 18:10:54 +01:00
}
2025-12-12 21:56:50 +01:00
// const editDeal = (id) => {
// isOpen.value = true
// dealId.value = id
// newDealReqId.value = null
// }
2025-11-30 18:10:54 +01:00
const backToStep = () => {
isOpen.value = false
}
onMounted(() => {
window.createDeal = createDeal
window.createDealReady = true
window.editDeal = editDeal
window.backToStep = backToStep
console.log('✅ window.createDeal доступна')
})
</script>