fix: модалка 'Закрыть этап' корректно переоткрывается после создания сделки

- initCreateDeal: заменено скрытие modalBg через jQuery на ac.closesStep = false
- hide_modal_events: убран ac.closesStep = false, добавлен body.removeClass('lock')
- addDealButton/addDealButtonNew success: убран ac.closesStep = false, добавлен body.removeClass('lock')
- удалён мёртвый dealModalClosed listener (isCloseStageOpen не существовала)
- обновлён билд deal SPA (убран dealModalClosed event)
This commit is contained in:
mac 2026-06-16 12:55:48 +03:00
parent 0f273bb9d4
commit 052cc1ab57
6 changed files with 3543 additions and 53 deletions

View File

@ -1,2 +1,2 @@
// Авто-сгенерировано: postbuild.js
import '/deal/assets/index-CuPFnrUz.js';
import '/deal/assets/index-D6utbWDV.js';

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -121,14 +121,8 @@ var ac = new Vue({
cottage: 'Коттедж',
}
},
watch: {
closesStep: function(newVal, oldVal) {
console.log('[CloseStage] closesStep ИЗМЕНЁН:', oldVal, '->', newVal, new Error().stack);
}
},
methods: {
closedStep: function(id, clientId) {
console.log('[CloseStage] closedStep вызван. closesStep:', ac.closesStep, 'step:', ac.step?.name, 'clientId:', ac.clientId, 'reqId:', ac.reqId);
ac.errorText = '';
ac.errorMes = false;
if(ac.no_close_step){
@ -270,7 +264,6 @@ var ac = new Vue({
selected_room_name: ac.selectedRoom.name
})
.then(function(response) {
console.log('[CloseStage] Этап закрыт (AJAX success). closesStep:', ac.closesStep, 'step:', ac.step?.name, 'response:', response.data);
if(response.data.adjacent_id > 0){
var req_id = response.data.req_id;
@ -291,7 +284,6 @@ var ac = new Vue({
get_count_clients();
}
$.post('/ajax/getStageBar.php', { client_id: ac.clientId, funnel_id: ac.step.funnel_id }, function(result) {
console.log('[CloseStage] getStageBar загружен. closesStep=false. step:', ac.step?.name);
$('#editClientStagebar').html(result);
ac.closesStep = false;
ac.is_looad = false;
@ -497,11 +489,6 @@ var ac = new Vue({
}
},
openStep: function(id, clientId) {
console.log('[CloseStage] openStep вызван. closesStep:', ac.closesStep, 'step:', ac.step?.name, 'id:', ac.step?.id);
var $modalBg = $('#app_step .full_modal-bg');
if ($modalBg.length && $modalBg.is(':hidden')) {
$modalBg.show();
}
this.open_step_load = true;
ac.pole_dop_close_step = [];
this.is_looad = false;
@ -1057,7 +1044,6 @@ var ac = new Vue({
},
//Закрытие окна "открыть этап"
formCloseStep: function() {
console.log('[CloseStage] formCloseStep (крестик). closesStep:', ac.closesStep);
if ($('#client-history__bg').css('display') == 'block') {
$('#client-history__bg').css('zIndex', '99998');
}
@ -1384,19 +1370,9 @@ var ac = new Vue({
}, 200)
},
initCreateDeal(reqId) {
console.log('reqId', reqId);
console.log('window', window);
if (window.createDeal) {
window.createDeal(reqId);
const modalBg = document.querySelector('#app_step .full_modal-bg');
if (modalBg) {
console.log('modalBg', modalBg)
modalBg.style.opacity = '0';
modalBg.style.transition = 'opacity 0.2s ease';
setTimeout(() => {
modalBg.style.display = 'none';
}, 200);
}
ac.closesStep = false;
} else {
console.error('createDeal function not found');
}

View File

@ -985,6 +985,8 @@ $(document).ready(function() {
$("#chat-modal__deal").hide(10);
$("body").removeClass("lock");
$("#chat-modal__bg__file").hide(10);
$("#chat-modal__file").hide(10);
@ -5900,6 +5902,7 @@ $('body').on('paste', '#custom_frequency, #installment_period', function (e) {
success: function() {
$("#chat-modal__bg__deal").hide(10);
$("#chat-modal__deal").hide(10);
$("body").removeClass("lock");
$('#dealComment').val('');
$('#dealSum').val('');
$('#dealDatetime').datepicker().data('datepicker').selectDate(new Date());
@ -8077,9 +8080,9 @@ $('body').on('paste', '#custom_frequency, #installment_period', function (e) {
"clients_ids": clients_ids,
},
success: function(data) {
console.log(data);
$("#chat-modal__bg__deal").hide(10);
$("#chat-modal__deal").hide(10);
$("body").removeClass("lock");
$('#dealComment').val('');
$('#dealSum').val('');
$('#dealDatetime').datepicker().data('datepicker').selectDate(new Date());

View File

@ -1,26 +1,4 @@
<div class="clear"></div>
<script>
// Listen for Vue Deal modal close event to reset Close Stage modal state
window.addEventListener('dealModalClosed', function () {
// Assuming the Close Stage modal is opened via a function `openCloseStageModal()`
// and its visibility is controlled by a global variable `isCloseStageOpen`.
// Adjust the logic according to the actual implementation.
if (typeof isCloseStageOpen !== 'undefined' && isCloseStageOpen) {
// Close the modal if it's still open
if (typeof closeCloseStageModal === 'function') {
closeCloseStageModal();
} else {
// Fallback: hide the modal element directly
const modalEl = document.getElementById('close-stage-modal');
if (modalEl) {
modalEl.style.display = 'none';
}
}
// Reset the flag
isCloseStageOpen = false;
}
});
</script>
</div> <!--main-block-->