live and export fix

This commit is contained in:
Ivan
2024-01-09 13:18:42 +03:00
parent fb53bddd37
commit e602828d5d
3 changed files with 65 additions and 57 deletions

View File

@ -127,6 +127,7 @@
<img>
<input type="number" id="channels-{{this.serial}}" value="{{this.channels}}" hidden>
<input type="radio" name="camera-serial" id="radio-{{this.serial}}" class="radio-input" value="{{this.serial}}" hidden>
<input type="text" id="ourreg-{{this.serial}}" value="{{this.ourreg}}" hidden>
<label for="radio-{{this.serial}}" class="radio-label active-{{this.status}}">
{{#if this.number}}
{{this.number}}
@ -873,38 +874,43 @@ endVideoTimeInput.addEventListener("blur", sendPostRequest);
alert('Пожалуйста, выберите камеру из списка.');
return;
}
if (!HasData) {
alert('Пожалуйста, выберите другой временной период.');
return;
}
if (videoTimeInput.value > endVideoTimeInput.value) {
alert('Конечное время не может быть больше начального.');
return;
}
document.getElementById("exportLoading").style.display = 'flex';
const startTimeInput = document.getElementById('video-time');
const endTimeInput = document.getElementById('video-end-time');
const selectedDateInput = document.getElementById('selectedDate');
const startTime = formatTime(startTimeInput.value);
const endTime = formatTime(endTimeInput.value);
const selectedDate = formatDate(selectedDateInput.value);
const reqDate = document.getElementById("selectedDate").value;
const reqTime = document.getElementById("video-time").value;
const reqSerial = document.querySelector('input[name="camera-serial"]:checked').value;
const finalResponse = await fetch(`/getData?serial=${reqSerial}&selectedDate=${formatDate(reqDate)}&selectedTime=${formatTime(reqTime)}&selectedChannel=${channel}`);
const resData = await finalResponse.json();
const serial = selectedDevice.value;
const url = `http://localhost:8081/export?url=https%3A%2F%2F{{VIRTUAL_HOST}}%2Fhttp%2Fdownload.flv%3Fserial%3D${serial}%26channel%3D${channel}%26queryTime%3D${selectedDate}%26startTime%3D${startTime}%26endTime%3D${endTime}%26recordID%3D${resData.dataId}`;
document.getElementById("exportLoading").style.display = 'none';
window.open(url, '_blank');
if ($(`#ourreg-${serial}`).val() == "true") {
} else {
if (!HasData) {
alert('Пожалуйста, выберите другой временной период.');
return;
}
}
document.getElementById("exportLoading").style.display = 'flex';
const startTimeInput = document.getElementById('video-time');
const endTimeInput = document.getElementById('video-end-time');
const selectedDateInput = document.getElementById('selectedDate');
const startTime = formatTime(startTimeInput.value);
const endTime = formatTime(endTimeInput.value);
const selectedDate = formatDate(selectedDateInput.value);
const reqDate = document.getElementById("selectedDate").value;
const reqTime = document.getElementById("video-time").value;
const reqSerial = document.querySelector('input[name="camera-serial"]:checked').value;
const finalResponse = await fetch(`/getData?serial=${reqSerial}&selectedDate=${formatDate(reqDate)}&selectedTime=${formatTime(reqTime)}&selectedChannel=${channel}`);
const resData = await finalResponse.json();
const url = `http://localhost:8081/export?url=https%3A%2F%2F{{VIRTUAL_HOST}}%2Fhttp%2Fdownload.flv%3Fserial%3D${serial}%26channel%3D${channel}%26queryTime%3D${selectedDate}%26startTime%3D${startTime}%26endTime%3D${endTime}%26recordID%3D${resData.dataId}`;
document.getElementById("exportLoading").style.display = 'none';
window.open(url, '_blank');
}
</script>