document.addEventListener('DOMContentLoaded', function() { // 初始化工具提示 const tooltipTriggerList = [].slice.call(document.querySelectorAll('[data-bs-toggle="tooltip"]')); tooltipTriggerList.map(function (tooltipTriggerEl) { return new bootstrap.Tooltip(tooltipTriggerEl); }); // 自动计算结束日期 const startDateInput = document.getElementById('start_date'); const endDateInput = document.getElementById('end_date'); if (startDateInput && endDateInput) { startDateInput.addEventListener('change', function() { if (!endDateInput.value && startDateInput.value) { const startDate = new Date(startDateInput.value); const endDate = new Date(startDate); endDate.setFullYear(endDate.getFullYear() + 1); endDateInput.valueAsDate = endDate; } }); } });