deal/src/App.vue

82 lines
2.0 KiB
Vue
Raw Normal View History

2025-11-30 18:10:54 +01:00
<template>
<div>
<h1>Сделка</h1>
2026-06-08 12:01:04 +02:00
<div><a href="#" @click.prevent="createDeal(1481170)">Создать новую сделку</a></div>
<div><a href="#" @click.prevent="editDeal(1481170, 46)">Открыть тестовую сделку</a></div>
2025-11-30 18:10:54 +01:00
</div>
<DynamicDialog />
</template>
<script setup>
import { ref, onMounted } from 'vue'
2026-05-19 16:20:23 +02:00
import DealModal from './components/deal/DealModal.vue'
2025-11-30 18:10:54 +01:00
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)
2026-06-18 14:03:52 +02:00
$('#client-history__bg').hide(10);
$('#client_history').hide(10);
$('body').removeClass('lock');
2025-12-12 21:56:50 +01:00
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>