feat: 为试用期列表添加刷新按钮并实现其数据刷新功能。

This commit is contained in:
zulifeng 2026-01-29 11:40:46 +08:00
parent b4f5813af7
commit df1be594ca
2 changed files with 39 additions and 0 deletions

View File

@ -391,6 +391,16 @@
</div> </div>
<div class="card trial-periods-container"> <div class="card trial-periods-container">
<!-- 客户列表标头 -->
<div class="card-header">
<h3 class="card-title">
<i class="fas fa-users"></i>
客户列表
</h3>
<button id="refreshTrialPeriodsBtn" class="icon-btn" title="刷新列表">
<i class="fas fa-sync-alt"></i>
</button>
</div>
<div class="card-body table-container"> <div class="card-body table-container">
<table> <table>
<thead> <thead>

View File

@ -80,6 +80,35 @@ function initTrialPeriodsPage() {
setupIntendedProductCheckboxes('trialIntendedProductOtherCheckbox', 'trialIntendedProductOther'); setupIntendedProductCheckboxes('trialIntendedProductOtherCheckbox', 'trialIntendedProductOther');
setupIntendedProductCheckboxes('editTrialIntendedProductOtherCheckbox', 'editTrialIntendedProductOther'); setupIntendedProductCheckboxes('editTrialIntendedProductOtherCheckbox', 'editTrialIntendedProductOther');
// 刷新按钮事件
const refreshTrialPeriodsBtn = document.getElementById('refreshTrialPeriodsBtn');
if (refreshTrialPeriodsBtn) {
refreshTrialPeriodsBtn.addEventListener('click', async function() {
// 添加旋转动画
refreshTrialPeriodsBtn.classList.add('refreshing');
const table = document.querySelector('.trial-periods-container table');
try {
await loadAllTrialPeriods();
// 成功反馈
refreshTrialPeriodsBtn.classList.remove('refreshing');
refreshTrialPeriodsBtn.classList.add('refresh-success');
// 添加表格刷新动画
if (table) {
table.classList.add('table-refreshing');
setTimeout(() => {
table.classList.remove('table-refreshing');
}, 500);
}
setTimeout(() => {
refreshTrialPeriodsBtn.classList.remove('refresh-success');
}, 1000);
} catch (error) {
refreshTrialPeriodsBtn.classList.remove('refreshing');
console.error('刷新失败:', error);
}
});
}
// Load customers map for displaying customer names // Load customers map for displaying customer names
loadCustomersMap(); loadCustomersMap();
} }