deal/src/App.vue

92 lines
2.3 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()
2026-07-03 10:49:23 +02:00
const refreshRequisitions = () => {
if (window.requisitions && typeof window.requisitions.getList === 'function') {
window.requisitions.getList()
}
}
2025-11-30 18:10:54 +01:00
const createDeal = (newDealReqId) => {
console.log('[createDeal] Открываем DealModal через DynamicDialog', newDealReqId)
dialog.open(DealModal, {
props: {
header: 'Создание сделки',
2026-06-18 15:34:18 +02:00
style: { width: '85vw' },
2025-11-30 18:10:54 +01:00
modal: true
},
data: {
newDealReqId: newDealReqId
},
onClose: (opt) => {
console.log('[DynamicDialog] Закрыто с данными:', opt?.data)
2026-07-03 10:49:23 +02:00
refreshRequisitions()
2025-11-30 18:10:54 +01:00
}
})
}
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);
2026-06-30 12:18:43 +02:00
$('#object-history__bg').hide(10);
$('#object-history').hide(10);
2026-06-18 14:03:52 +02:00
$('body').removeClass('lock');
2025-12-12 21:56:50 +01:00
dialog.open(DealModal, {
props: {
header: 'Редактирование сделки',
2026-06-18 15:34:18 +02:00
style: { width: '85vw' },
2025-12-12 21:56:50 +01:00
modal: true
},
data: {
newDealReqId: newDealReqId,
deal_id: dealId
},
onClose: (opt) => {
console.log('[DynamicDialog] Закрыто с данными:', opt?.data)
2026-07-03 10:49:23 +02:00
refreshRequisitions()
2025-12-12 21:56:50 +01:00
}
})
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>