fix_train

This commit is contained in:
hangyu.tao 2026-01-15 15:18:20 +08:00
parent da118f41f9
commit 569ca8479f

View File

@ -72,8 +72,11 @@ async function loadCustomersForDropdown() {
console.log('Customers data:', data); console.log('Customers data:', data);
const customers = data.customers || []; const customers = data.customers || [];
console.log('Number of customers:', customers.length); // Use the complete customer map for ID->Name lookups
customersMap = {}; customersMap = data.customerMap || {};
console.log('Number of unique customers:', customers.length);
console.log('Number of customer ID mappings:', Object.keys(customersMap).length);
const select = document.getElementById('trialCustomerSelect'); const select = document.getElementById('trialCustomerSelect');
if (!select) { if (!select) {
@ -84,15 +87,15 @@ async function loadCustomersForDropdown() {
// Keep the first option (请选择客户) // Keep the first option (请选择客户)
select.innerHTML = '<option value="">请选择客户</option>'; select.innerHTML = '<option value="">请选择客户</option>';
// Use the deduplicated list for dropdown options
customers.forEach(customer => { customers.forEach(customer => {
customersMap[customer.id] = customer.customerName;
const option = document.createElement('option'); const option = document.createElement('option');
option.value = customer.id; option.value = customer.id;
option.textContent = customer.customerName; option.textContent = customer.customerName;
select.appendChild(option); select.appendChild(option);
}); });
console.log('Customers loaded successfully. Total:', customers.length); console.log('Customers loaded successfully. Dropdown options:', customers.length);
} catch (error) { } catch (error) {
console.error('Error loading customers:', error); console.error('Error loading customers:', error);
} }