|
|
@ -956,15 +956,7 @@ |
|
|
<button onclick="resetPublicPhoneSearch()" style="margin-left: 8px; padding: 4px 12px; background-color: #666; color: white; border: none; border-radius: 4px; font-size: 14px;">重置</button> |
|
|
<button onclick="resetPublicPhoneSearch()" style="margin-left: 8px; padding: 4px 12px; background-color: #666; color: white; border: none; border-radius: 4px; font-size: 14px;">重置</button> |
|
|
</div> |
|
|
</div> |
|
|
<div class="filter-bar" style="margin-top: 8px;"> |
|
|
<div class="filter-bar" style="margin-top: 8px;"> |
|
|
<span style="font-size: 14px;">负责人:</span> |
|
|
<span style="font-size: 14px;">类型:</span> |
|
|
<select id="publicManagerFilter" onchange="filterPublicByManager()" style="padding: 4px 8px; border: 1px solid #d9d9d9; border-radius: 4px; font-size: 14px;"> |
|
|
|
|
|
<option value="">全部</option> |
|
|
|
|
|
<option value="李文涛">李文涛</option> |
|
|
|
|
|
<option value="代斯磊">代斯磊</option> |
|
|
|
|
|
<option value="杨率">杨率</option> |
|
|
|
|
|
<option value="李毅">李毅</option> |
|
|
|
|
|
</select> |
|
|
|
|
|
<span style="margin-left: 20px; font-size: 14px;">类型:</span> |
|
|
|
|
|
<select id="publicTypeFilter" onchange="filterPublicByType()" style="padding: 4px 8px; border: 1px solid #d9d9d9; border-radius: 4px; font-size: 14px;"> |
|
|
<select id="publicTypeFilter" onchange="filterPublicByType()" style="padding: 4px 8px; border: 1px solid #d9d9d9; border-radius: 4px; font-size: 14px;"> |
|
|
<option value="">全部类型</option> |
|
|
<option value="">全部类型</option> |
|
|
<option value="wholesale">批发贸易类</option> |
|
|
<option value="wholesale">批发贸易类</option> |
|
|
@ -1054,12 +1046,21 @@ |
|
|
var productsTotalPages = 0; |
|
|
var productsTotalPages = 0; |
|
|
var isLoadingAllData = false; |
|
|
var isLoadingAllData = false; |
|
|
var isLoadingProducts = false; |
|
|
var isLoadingProducts = false; |
|
|
var currentManagerFilter = null; |
|
|
|
|
|
var currentFilterTable = 'personal'; |
|
|
var currentFilterTable = 'personal'; |
|
|
var currentPhoneSearch = null; |
|
|
|
|
|
var currentStartDate = null; |
|
|
// 个人数据筛选变量 |
|
|
var currentEndDate = null; |
|
|
var personalManagerFilter = null; |
|
|
var currentTypeFilter = null; |
|
|
var personalPhoneSearch = null; |
|
|
|
|
|
var personalStartDate = null; |
|
|
|
|
|
var personalEndDate = null; |
|
|
|
|
|
var personalTypeFilter = null; |
|
|
|
|
|
|
|
|
|
|
|
// 公海池数据筛选变量 |
|
|
|
|
|
var publicManagerFilter = null; |
|
|
|
|
|
var publicPhoneSearch = null; |
|
|
|
|
|
var publicStartDate = null; |
|
|
|
|
|
var publicEndDate = null; |
|
|
|
|
|
var publicTypeFilter = null; |
|
|
|
|
|
|
|
|
// 数据缓存对象 |
|
|
// 数据缓存对象 |
|
|
var dataCache = { |
|
|
var dataCache = { |
|
|
@ -1642,34 +1643,34 @@ |
|
|
// 为个人数据筛选函数添加防抖 |
|
|
// 为个人数据筛选函数添加防抖 |
|
|
var debouncedFilterPersonalByManager = debounce(function() { |
|
|
var debouncedFilterPersonalByManager = debounce(function() { |
|
|
var managerName = document.getElementById('personalManagerFilter').value; |
|
|
var managerName = document.getElementById('personalManagerFilter').value; |
|
|
currentManagerFilter = managerName || null; |
|
|
personalManagerFilter = managerName || null; |
|
|
personalPage = 1; |
|
|
personalPage = 1; |
|
|
loadPersonalDataWithPagination(); |
|
|
loadAllPersonalData(); |
|
|
updateFilterTags('personal'); |
|
|
updateFilterTags('personal'); |
|
|
}, 300); |
|
|
}, 300); |
|
|
|
|
|
|
|
|
var debouncedFilterPersonalByType = debounce(function() { |
|
|
var debouncedFilterPersonalByType = debounce(function() { |
|
|
var type = document.getElementById('personalTypeFilter').value; |
|
|
var type = document.getElementById('personalTypeFilter').value; |
|
|
currentTypeFilter = type || null; |
|
|
personalTypeFilter = type || null; |
|
|
personalPage = 1; |
|
|
personalPage = 1; |
|
|
loadPersonalDataWithPagination(); |
|
|
loadAllPersonalData(); |
|
|
updateFilterTags('personal'); |
|
|
updateFilterTags('personal'); |
|
|
}, 300); |
|
|
}, 300); |
|
|
|
|
|
|
|
|
var debouncedFilterPersonalByDate = debounce(function() { |
|
|
var debouncedFilterPersonalByDate = debounce(function() { |
|
|
var startDate = document.getElementById('personalStartDate').value; |
|
|
var startDate = document.getElementById('personalStartDate').value; |
|
|
var endDate = document.getElementById('personalEndDate').value; |
|
|
var endDate = document.getElementById('personalEndDate').value; |
|
|
currentStartDate = startDate || null; |
|
|
personalStartDate = startDate || null; |
|
|
currentEndDate = endDate || null; |
|
|
personalEndDate = endDate || null; |
|
|
personalPage = 1; |
|
|
personalPage = 1; |
|
|
loadPersonalDataWithPagination(); |
|
|
loadAllPersonalData(); |
|
|
updateFilterTags('personal'); |
|
|
updateFilterTags('personal'); |
|
|
}, 300); |
|
|
}, 300); |
|
|
|
|
|
|
|
|
// 为公海池数据筛选函数添加防抖 |
|
|
// 为公海池数据筛选函数添加防抖 |
|
|
var debouncedFilterPublicByManager = debounce(function() { |
|
|
var debouncedFilterPublicByManager = debounce(function() { |
|
|
var managerName = document.getElementById('publicManagerFilter').value; |
|
|
var managerName = document.getElementById('publicManagerFilter').value; |
|
|
currentManagerFilter = managerName || null; |
|
|
publicManagerFilter = managerName || null; |
|
|
publicPage = 1; |
|
|
publicPage = 1; |
|
|
loadPublicData(); |
|
|
loadPublicData(); |
|
|
updateFilterTags('public'); |
|
|
updateFilterTags('public'); |
|
|
@ -1677,7 +1678,7 @@ |
|
|
|
|
|
|
|
|
var debouncedFilterPublicByType = debounce(function() { |
|
|
var debouncedFilterPublicByType = debounce(function() { |
|
|
var type = document.getElementById('publicTypeFilter').value; |
|
|
var type = document.getElementById('publicTypeFilter').value; |
|
|
currentTypeFilter = type || null; |
|
|
publicTypeFilter = type || null; |
|
|
publicPage = 1; |
|
|
publicPage = 1; |
|
|
loadPublicData(); |
|
|
loadPublicData(); |
|
|
updateFilterTags('public'); |
|
|
updateFilterTags('public'); |
|
|
@ -1686,8 +1687,8 @@ |
|
|
var debouncedFilterPublicByDate = debounce(function() { |
|
|
var debouncedFilterPublicByDate = debounce(function() { |
|
|
var startDate = document.getElementById('publicStartDate').value; |
|
|
var startDate = document.getElementById('publicStartDate').value; |
|
|
var endDate = document.getElementById('publicEndDate').value; |
|
|
var endDate = document.getElementById('publicEndDate').value; |
|
|
currentStartDate = startDate || null; |
|
|
publicStartDate = startDate || null; |
|
|
currentEndDate = endDate || null; |
|
|
publicEndDate = endDate || null; |
|
|
publicPage = 1; |
|
|
publicPage = 1; |
|
|
loadPublicData(); |
|
|
loadPublicData(); |
|
|
updateFilterTags('public'); |
|
|
updateFilterTags('public'); |
|
|
@ -2075,8 +2076,8 @@ |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
function loadPersonalData() { |
|
|
function loadPersonalData() { |
|
|
// 使用真正的后端分页加载 |
|
|
// 加载全部数据后在前端筛选 |
|
|
loadPersonalDataWithPagination(); |
|
|
loadAllPersonalData(); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
function loadAllPersonalData() { |
|
|
function loadAllPersonalData() { |
|
|
@ -2119,7 +2120,7 @@ |
|
|
xhr.send(); |
|
|
xhr.send(); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
function displayFilteredPersonalData(total, totalPages) { |
|
|
function displayFilteredPersonalData() { |
|
|
var personalBody = document.getElementById('personalBody'); |
|
|
var personalBody = document.getElementById('personalBody'); |
|
|
var personalEmpty = document.getElementById('personalEmpty'); |
|
|
var personalEmpty = document.getElementById('personalEmpty'); |
|
|
var managerHeader = document.getElementById('managerHeader'); |
|
|
var managerHeader = document.getElementById('managerHeader'); |
|
|
@ -2167,33 +2168,33 @@ |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
// 按负责人筛选 |
|
|
// 按负责人筛选 |
|
|
if (currentManagerFilter) { |
|
|
if (personalManagerFilter) { |
|
|
console.log('筛选负责人:', currentManagerFilter, '用户负责人:', user.managerName); |
|
|
console.log('筛选负责人:', personalManagerFilter, '用户负责人:', user.managerName); |
|
|
if (user.managerName !== currentManagerFilter) { |
|
|
if (user.managerName !== personalManagerFilter) { |
|
|
return false; |
|
|
return false; |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
// 按手机号搜索 |
|
|
// 按手机号搜索 |
|
|
if (currentPhoneSearch) { |
|
|
if (personalPhoneSearch) { |
|
|
if (!user.phoneNumber || !user.phoneNumber.includes(currentPhoneSearch)) { |
|
|
if (!user.phoneNumber || !user.phoneNumber.includes(personalPhoneSearch)) { |
|
|
return false; |
|
|
return false; |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
// 按创建时间范围筛选 |
|
|
// 按创建时间范围筛选 |
|
|
if (currentStartDate || currentEndDate) { |
|
|
if (personalStartDate || personalEndDate) { |
|
|
var userCreatedAt = new Date(user.created_at); |
|
|
var userCreatedAt = new Date(user.created_at); |
|
|
|
|
|
|
|
|
if (currentStartDate) { |
|
|
if (personalStartDate) { |
|
|
var startDate = new Date(currentStartDate); |
|
|
var startDate = new Date(personalStartDate); |
|
|
if (userCreatedAt < startDate) { |
|
|
if (userCreatedAt < startDate) { |
|
|
return false; |
|
|
return false; |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
if (currentEndDate) { |
|
|
if (personalEndDate) { |
|
|
var endDate = new Date(currentEndDate); |
|
|
var endDate = new Date(personalEndDate); |
|
|
// 设置结束日期为当天的23:59:59 |
|
|
// 设置结束日期为当天的23:59:59 |
|
|
endDate.setHours(23, 59, 59, 999); |
|
|
endDate.setHours(23, 59, 59, 999); |
|
|
if (userCreatedAt > endDate) { |
|
|
if (userCreatedAt > endDate) { |
|
|
@ -2203,16 +2204,16 @@ |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
// 按类型筛选 |
|
|
// 按类型筛选 |
|
|
if (currentTypeFilter) { |
|
|
if (personalTypeFilter) { |
|
|
var userType = user.type || ''; |
|
|
var userType = user.type || ''; |
|
|
console.log('筛选类型:', currentTypeFilter, '用户类型:', userType); |
|
|
console.log('筛选类型:', personalTypeFilter, '用户类型:', userType); |
|
|
|
|
|
|
|
|
// 特殊处理seller和buyer类型,直接比较英文 |
|
|
// 特殊处理seller和buyer类型,直接比较英文 |
|
|
if (currentTypeFilter === 'seller') { |
|
|
if (personalTypeFilter === 'seller') { |
|
|
if (userType !== 'seller' && userType !== '供应商') { |
|
|
if (userType !== 'seller' && userType !== '供应商') { |
|
|
return false; |
|
|
return false; |
|
|
} |
|
|
} |
|
|
} else if (currentTypeFilter === 'buyer') { |
|
|
} else if (personalTypeFilter === 'buyer') { |
|
|
if (userType !== 'buyer' && userType !== '大贸易客户') { |
|
|
if (userType !== 'buyer' && userType !== '大贸易客户') { |
|
|
return false; |
|
|
return false; |
|
|
} |
|
|
} |
|
|
@ -2225,7 +2226,7 @@ |
|
|
'defective_egg': '次品蛋专项类', |
|
|
'defective_egg': '次品蛋专项类', |
|
|
'other': '其他类型' |
|
|
'other': '其他类型' |
|
|
}; |
|
|
}; |
|
|
var filterValue = typeMap[currentTypeFilter] || currentTypeFilter; |
|
|
var filterValue = typeMap[personalTypeFilter] || personalTypeFilter; |
|
|
if (userType !== filterValue) { |
|
|
if (userType !== filterValue) { |
|
|
return false; |
|
|
return false; |
|
|
} |
|
|
} |
|
|
@ -2236,6 +2237,10 @@ |
|
|
return true; |
|
|
return true; |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
// 计算总页数 |
|
|
|
|
|
var total = filteredUsers.length; |
|
|
|
|
|
var totalPages = Math.ceil(total / personalPageSize); |
|
|
|
|
|
|
|
|
// 更新统计信息 |
|
|
// 更新统计信息 |
|
|
if (personalTotalCount) { |
|
|
if (personalTotalCount) { |
|
|
personalTotalCount.textContent = total; |
|
|
personalTotalCount.textContent = total; |
|
|
@ -2246,8 +2251,10 @@ |
|
|
if (filteredUsers.length > 0) { |
|
|
if (filteredUsers.length > 0) { |
|
|
personalEmpty.style.display = 'none'; |
|
|
personalEmpty.style.display = 'none'; |
|
|
|
|
|
|
|
|
// 使用筛选后的数据 |
|
|
// 计算当前页显示的数据范围 |
|
|
var displayUsers = filteredUsers; |
|
|
var startIndex = (personalPage - 1) * personalPageSize; |
|
|
|
|
|
var endIndex = startIndex + personalPageSize; |
|
|
|
|
|
var displayUsers = filteredUsers.slice(startIndex, endIndex); |
|
|
|
|
|
|
|
|
for (var i = 0; i < displayUsers.length; i++) { |
|
|
for (var i = 0; i < displayUsers.length; i++) { |
|
|
var user = displayUsers[i]; |
|
|
var user = displayUsers[i]; |
|
|
@ -2331,13 +2338,8 @@ |
|
|
personalFilter = filter; |
|
|
personalFilter = filter; |
|
|
personalPage = 1; // 重置为第一页 |
|
|
personalPage = 1; // 重置为第一页 |
|
|
|
|
|
|
|
|
// 对于已跟进和未跟进,总是加载所有数据后进行筛选 |
|
|
// 总是加载全部数据后进行筛选 |
|
|
if (filter === 'followed' || filter === 'unfollowed') { |
|
|
loadAllPersonalData(); |
|
|
loadPersonalDataWithPagination(); |
|
|
|
|
|
} else { |
|
|
|
|
|
// 对于全部,使用正常的分页加载 |
|
|
|
|
|
loadPersonalData(); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
function toggleManagerFilter(tableType) { |
|
|
function toggleManagerFilter(tableType) { |
|
|
@ -2407,7 +2409,11 @@ |
|
|
this.style.backgroundColor = 'white'; |
|
|
this.style.backgroundColor = 'white'; |
|
|
}; |
|
|
}; |
|
|
clearOption.onclick = function() { |
|
|
clearOption.onclick = function() { |
|
|
currentManagerFilter = null; |
|
|
if (currentFilterTable === 'personal') { |
|
|
|
|
|
personalManagerFilter = null; |
|
|
|
|
|
} else { |
|
|
|
|
|
publicManagerFilter = null; |
|
|
|
|
|
} |
|
|
applyManagerFilter(); |
|
|
applyManagerFilter(); |
|
|
menu.remove(); |
|
|
menu.remove(); |
|
|
}; |
|
|
}; |
|
|
@ -2438,7 +2444,11 @@ |
|
|
this.style.backgroundColor = 'white'; |
|
|
this.style.backgroundColor = 'white'; |
|
|
}; |
|
|
}; |
|
|
option.onclick = function() { |
|
|
option.onclick = function() { |
|
|
currentManagerFilter = manager; |
|
|
if (currentFilterTable === 'personal') { |
|
|
|
|
|
personalManagerFilter = manager; |
|
|
|
|
|
} else { |
|
|
|
|
|
publicManagerFilter = manager; |
|
|
|
|
|
} |
|
|
applyManagerFilter(); |
|
|
applyManagerFilter(); |
|
|
menu.remove(); |
|
|
menu.remove(); |
|
|
}; |
|
|
}; |
|
|
@ -2528,7 +2538,9 @@ |
|
|
this.style.backgroundColor = 'white'; |
|
|
this.style.backgroundColor = 'white'; |
|
|
}; |
|
|
}; |
|
|
filterOption.onclick = function() { |
|
|
filterOption.onclick = function() { |
|
|
currentManagerFilter = managerName; |
|
|
// 默认筛选到个人数据表格 |
|
|
|
|
|
currentFilterTable = 'personal'; |
|
|
|
|
|
personalManagerFilter = managerName; |
|
|
applyManagerFilter(); |
|
|
applyManagerFilter(); |
|
|
dropdown.remove(); |
|
|
dropdown.remove(); |
|
|
}; |
|
|
}; |
|
|
@ -2549,7 +2561,9 @@ |
|
|
this.style.backgroundColor = 'white'; |
|
|
this.style.backgroundColor = 'white'; |
|
|
}; |
|
|
}; |
|
|
clearOption.onclick = function() { |
|
|
clearOption.onclick = function() { |
|
|
currentManagerFilter = null; |
|
|
// 清除两个表格的筛选 |
|
|
|
|
|
personalManagerFilter = null; |
|
|
|
|
|
publicManagerFilter = null; |
|
|
applyManagerFilter(); |
|
|
applyManagerFilter(); |
|
|
dropdown.remove(); |
|
|
dropdown.remove(); |
|
|
}; |
|
|
}; |
|
|
@ -2589,8 +2603,8 @@ |
|
|
if (currentFilterTable === 'personal') { |
|
|
if (currentFilterTable === 'personal') { |
|
|
// 个人表格筛选 |
|
|
// 个人表格筛选 |
|
|
personalPage = 1; |
|
|
personalPage = 1; |
|
|
// 使用后端分页加载数据 |
|
|
// 加载全部数据后进行筛选 |
|
|
loadPersonalDataWithPagination(); |
|
|
loadAllPersonalData(); |
|
|
|
|
|
|
|
|
// 更新个人表格筛选标签 |
|
|
// 更新个人表格筛选标签 |
|
|
updateFilterTags('personal'); |
|
|
updateFilterTags('personal'); |
|
|
@ -2612,8 +2626,15 @@ |
|
|
var tagsContainer = document.getElementById(tableType + 'FilterTags'); |
|
|
var tagsContainer = document.getElementById(tableType + 'FilterTags'); |
|
|
tagsContainer.innerHTML = ''; |
|
|
tagsContainer.innerHTML = ''; |
|
|
|
|
|
|
|
|
// 显示负责人筛选标签 |
|
|
// 根据表格类型获取相应的筛选变量 |
|
|
if (currentManagerFilter) { |
|
|
var managerFilter = tableType === 'personal' ? personalManagerFilter : publicManagerFilter; |
|
|
|
|
|
var phoneSearch = tableType === 'personal' ? personalPhoneSearch : publicPhoneSearch; |
|
|
|
|
|
var typeFilter = tableType === 'personal' ? personalTypeFilter : publicTypeFilter; |
|
|
|
|
|
var startDate = tableType === 'personal' ? personalStartDate : publicStartDate; |
|
|
|
|
|
var endDate = tableType === 'personal' ? personalEndDate : publicEndDate; |
|
|
|
|
|
|
|
|
|
|
|
// 只对个人数据显示负责人筛选标签,公海池数据不需要 |
|
|
|
|
|
if (tableType === 'personal' && managerFilter) { |
|
|
var tag = document.createElement('span'); |
|
|
var tag = document.createElement('span'); |
|
|
tag.style.cssText = ` |
|
|
tag.style.cssText = ` |
|
|
display: inline-block; |
|
|
display: inline-block; |
|
|
@ -2627,7 +2648,7 @@ |
|
|
position: relative; |
|
|
position: relative; |
|
|
`; |
|
|
`; |
|
|
|
|
|
|
|
|
var tagText = document.createTextNode('负责人: ' + currentManagerFilter); |
|
|
var tagText = document.createTextNode('负责人: ' + managerFilter); |
|
|
tag.appendChild(tagText); |
|
|
tag.appendChild(tagText); |
|
|
|
|
|
|
|
|
var closeButton = document.createElement('span'); |
|
|
var closeButton = document.createElement('span'); |
|
|
@ -2638,8 +2659,11 @@ |
|
|
font-weight: bold; |
|
|
font-weight: bold; |
|
|
`; |
|
|
`; |
|
|
closeButton.onclick = function() { |
|
|
closeButton.onclick = function() { |
|
|
currentManagerFilter = null; |
|
|
personalManagerFilter = null; |
|
|
applyManagerFilter(); |
|
|
document.getElementById('personalManagerFilter').value = ''; |
|
|
|
|
|
personalPage = 1; |
|
|
|
|
|
loadAllPersonalData(); |
|
|
|
|
|
updateFilterTags('personal'); |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
tag.appendChild(closeButton); |
|
|
tag.appendChild(closeButton); |
|
|
@ -2647,7 +2671,7 @@ |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
// 显示手机号搜索标签 |
|
|
// 显示手机号搜索标签 |
|
|
if (currentPhoneSearch) { |
|
|
if (phoneSearch) { |
|
|
var tag = document.createElement('span'); |
|
|
var tag = document.createElement('span'); |
|
|
tag.style.cssText = ` |
|
|
tag.style.cssText = ` |
|
|
display: inline-block; |
|
|
display: inline-block; |
|
|
@ -2661,7 +2685,7 @@ |
|
|
position: relative; |
|
|
position: relative; |
|
|
`; |
|
|
`; |
|
|
|
|
|
|
|
|
var tagText = document.createTextNode('手机号: ' + currentPhoneSearch); |
|
|
var tagText = document.createTextNode('手机号: ' + phoneSearch); |
|
|
tag.appendChild(tagText); |
|
|
tag.appendChild(tagText); |
|
|
|
|
|
|
|
|
var closeButton = document.createElement('span'); |
|
|
var closeButton = document.createElement('span'); |
|
|
@ -2672,15 +2696,15 @@ |
|
|
font-weight: bold; |
|
|
font-weight: bold; |
|
|
`; |
|
|
`; |
|
|
closeButton.onclick = function() { |
|
|
closeButton.onclick = function() { |
|
|
currentPhoneSearch = null; |
|
|
if (tableType === 'personal') { |
|
|
|
|
|
personalPhoneSearch = null; |
|
|
|
|
|
} else { |
|
|
|
|
|
publicPhoneSearch = null; |
|
|
|
|
|
} |
|
|
document.getElementById(tableType + 'PhoneSearch').value = ''; |
|
|
document.getElementById(tableType + 'PhoneSearch').value = ''; |
|
|
if (tableType === 'personal') { |
|
|
if (tableType === 'personal') { |
|
|
personalPage = 1; |
|
|
personalPage = 1; |
|
|
if (personalFilter === 'followed' || personalFilter === 'unfollowed') { |
|
|
loadAllPersonalData(); |
|
|
displayFilteredPersonalData(); |
|
|
|
|
|
} else { |
|
|
|
|
|
loadPersonalDataWithPagination(); |
|
|
|
|
|
} |
|
|
|
|
|
} else { |
|
|
} else { |
|
|
publicPage = 1; |
|
|
publicPage = 1; |
|
|
loadPublicData(); |
|
|
loadPublicData(); |
|
|
@ -2693,7 +2717,7 @@ |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
// 显示类型筛选标签 |
|
|
// 显示类型筛选标签 |
|
|
if (currentTypeFilter) { |
|
|
if (typeFilter) { |
|
|
var tag = document.createElement('span'); |
|
|
var tag = document.createElement('span'); |
|
|
tag.style.cssText = ` |
|
|
tag.style.cssText = ` |
|
|
display: inline-block; |
|
|
display: inline-block; |
|
|
@ -2709,13 +2733,13 @@ |
|
|
|
|
|
|
|
|
// 映射类型值到显示文本 |
|
|
// 映射类型值到显示文本 |
|
|
var typeText = ''; |
|
|
var typeText = ''; |
|
|
switch(currentTypeFilter) { |
|
|
switch(typeFilter) { |
|
|
case 'wholesale': typeText = '批发贸易类'; break; |
|
|
case 'wholesale': typeText = '批发贸易类'; break; |
|
|
case 'e-commerce': typeText = '电商平台类'; break; |
|
|
case 'e-commerce': typeText = '电商平台类'; break; |
|
|
case 'delivery_retail': typeText = '配送零售类'; break; |
|
|
case 'delivery_retail': typeText = '配送零售类'; break; |
|
|
case 'defective_egg': typeText = '次品蛋专项类'; break; |
|
|
case 'defective_egg': typeText = '次品蛋专项类'; break; |
|
|
case 'other': typeText = '其他类型'; break; |
|
|
case 'other': typeText = '其他类型'; break; |
|
|
default: typeText = currentTypeFilter; |
|
|
default: typeText = typeFilter; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
var tagText = document.createTextNode('类型: ' + typeText); |
|
|
var tagText = document.createTextNode('类型: ' + typeText); |
|
|
@ -2729,15 +2753,15 @@ |
|
|
font-weight: bold; |
|
|
font-weight: bold; |
|
|
`; |
|
|
`; |
|
|
closeButton.onclick = function() { |
|
|
closeButton.onclick = function() { |
|
|
currentTypeFilter = null; |
|
|
if (tableType === 'personal') { |
|
|
|
|
|
personalTypeFilter = null; |
|
|
|
|
|
} else { |
|
|
|
|
|
publicTypeFilter = null; |
|
|
|
|
|
} |
|
|
document.getElementById(tableType + 'TypeFilter').value = ''; |
|
|
document.getElementById(tableType + 'TypeFilter').value = ''; |
|
|
if (tableType === 'personal') { |
|
|
if (tableType === 'personal') { |
|
|
personalPage = 1; |
|
|
personalPage = 1; |
|
|
if (personalFilter === 'followed' || personalFilter === 'unfollowed') { |
|
|
loadAllPersonalData(); |
|
|
displayFilteredPersonalData(); |
|
|
|
|
|
} else { |
|
|
|
|
|
loadPersonalDataWithPagination(); |
|
|
|
|
|
} |
|
|
|
|
|
} else { |
|
|
} else { |
|
|
publicPage = 1; |
|
|
publicPage = 1; |
|
|
loadPublicData(); |
|
|
loadPublicData(); |
|
|
@ -2750,7 +2774,7 @@ |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
// 显示日期范围筛选标签 |
|
|
// 显示日期范围筛选标签 |
|
|
if (currentStartDate || currentEndDate) { |
|
|
if (startDate || endDate) { |
|
|
var tag = document.createElement('span'); |
|
|
var tag = document.createElement('span'); |
|
|
tag.style.cssText = ` |
|
|
tag.style.cssText = ` |
|
|
display: inline-block; |
|
|
display: inline-block; |
|
|
@ -2765,12 +2789,12 @@ |
|
|
`; |
|
|
`; |
|
|
|
|
|
|
|
|
var dateText = ''; |
|
|
var dateText = ''; |
|
|
if (currentStartDate && currentEndDate) { |
|
|
if (startDate && endDate) { |
|
|
dateText = '创建时间: ' + currentStartDate + ' 至 ' + currentEndDate; |
|
|
dateText = '创建时间: ' + startDate + ' 至 ' + endDate; |
|
|
} else if (currentStartDate) { |
|
|
} else if (startDate) { |
|
|
dateText = '创建时间: 从 ' + currentStartDate; |
|
|
dateText = '创建时间: 从 ' + startDate; |
|
|
} else { |
|
|
} else { |
|
|
dateText = '创建时间: 至 ' + currentEndDate; |
|
|
dateText = '创建时间: 至 ' + endDate; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
var tagText = document.createTextNode(dateText); |
|
|
var tagText = document.createTextNode(dateText); |
|
|
@ -2784,17 +2808,18 @@ |
|
|
font-weight: bold; |
|
|
font-weight: bold; |
|
|
`; |
|
|
`; |
|
|
closeButton.onclick = function() { |
|
|
closeButton.onclick = function() { |
|
|
currentStartDate = null; |
|
|
if (tableType === 'personal') { |
|
|
currentEndDate = null; |
|
|
personalStartDate = null; |
|
|
|
|
|
personalEndDate = null; |
|
|
|
|
|
} else { |
|
|
|
|
|
publicStartDate = null; |
|
|
|
|
|
publicEndDate = null; |
|
|
|
|
|
} |
|
|
document.getElementById(tableType + 'StartDate').value = ''; |
|
|
document.getElementById(tableType + 'StartDate').value = ''; |
|
|
document.getElementById(tableType + 'EndDate').value = ''; |
|
|
document.getElementById(tableType + 'EndDate').value = ''; |
|
|
if (tableType === 'personal') { |
|
|
if (tableType === 'personal') { |
|
|
personalPage = 1; |
|
|
personalPage = 1; |
|
|
if (personalFilter === 'followed' || personalFilter === 'unfollowed') { |
|
|
loadAllPersonalData(); |
|
|
displayFilteredPersonalData(); |
|
|
|
|
|
} else { |
|
|
|
|
|
loadPersonalDataWithPagination(); |
|
|
|
|
|
} |
|
|
|
|
|
} else { |
|
|
} else { |
|
|
publicPage = 1; |
|
|
publicPage = 1; |
|
|
loadPublicData(); |
|
|
loadPublicData(); |
|
|
@ -2810,11 +2835,11 @@ |
|
|
// 搜索个人数据手机号 |
|
|
// 搜索个人数据手机号 |
|
|
function searchPersonalByPhone() { |
|
|
function searchPersonalByPhone() { |
|
|
var searchValue = document.getElementById('personalPhoneSearch').value.trim(); |
|
|
var searchValue = document.getElementById('personalPhoneSearch').value.trim(); |
|
|
currentPhoneSearch = searchValue || null; |
|
|
personalPhoneSearch = searchValue || null; |
|
|
personalPage = 1; // 重置为第一页 |
|
|
personalPage = 1; // 重置为第一页 |
|
|
|
|
|
|
|
|
// 使用后端分页加载数据 |
|
|
// 加载全部数据后进行筛选 |
|
|
loadPersonalDataWithPagination(); |
|
|
loadAllPersonalData(); |
|
|
|
|
|
|
|
|
// 更新筛选标签 |
|
|
// 更新筛选标签 |
|
|
updateFilterTags('personal'); |
|
|
updateFilterTags('personal'); |
|
|
@ -2823,7 +2848,7 @@ |
|
|
// 搜索公海池数据手机号 |
|
|
// 搜索公海池数据手机号 |
|
|
function searchPublicByPhone() { |
|
|
function searchPublicByPhone() { |
|
|
var searchValue = document.getElementById('publicPhoneSearch').value.trim(); |
|
|
var searchValue = document.getElementById('publicPhoneSearch').value.trim(); |
|
|
currentPhoneSearch = searchValue || null; |
|
|
publicPhoneSearch = searchValue || null; |
|
|
publicPage = 1; // 重置为第一页 |
|
|
publicPage = 1; // 重置为第一页 |
|
|
loadPublicData(); // 重新加载公海池数据 |
|
|
loadPublicData(); // 重新加载公海池数据 |
|
|
|
|
|
|
|
|
@ -2834,11 +2859,11 @@ |
|
|
// 重置个人数据手机号搜索 |
|
|
// 重置个人数据手机号搜索 |
|
|
function resetPersonalPhoneSearch() { |
|
|
function resetPersonalPhoneSearch() { |
|
|
document.getElementById('personalPhoneSearch').value = ''; |
|
|
document.getElementById('personalPhoneSearch').value = ''; |
|
|
currentPhoneSearch = null; |
|
|
personalPhoneSearch = null; |
|
|
personalPage = 1; // 重置为第一页 |
|
|
personalPage = 1; // 重置为第一页 |
|
|
|
|
|
|
|
|
// 使用后端分页加载数据 |
|
|
// 加载全部数据后进行筛选 |
|
|
loadPersonalDataWithPagination(); |
|
|
loadAllPersonalData(); |
|
|
|
|
|
|
|
|
// 更新筛选标签 |
|
|
// 更新筛选标签 |
|
|
updateFilterTags('personal'); |
|
|
updateFilterTags('personal'); |
|
|
@ -2847,7 +2872,7 @@ |
|
|
// 重置公海池数据手机号搜索 |
|
|
// 重置公海池数据手机号搜索 |
|
|
function resetPublicPhoneSearch() { |
|
|
function resetPublicPhoneSearch() { |
|
|
document.getElementById('publicPhoneSearch').value = ''; |
|
|
document.getElementById('publicPhoneSearch').value = ''; |
|
|
currentPhoneSearch = null; |
|
|
publicPhoneSearch = null; |
|
|
publicPage = 1; // 重置为第一页 |
|
|
publicPage = 1; // 重置为第一页 |
|
|
loadPublicData(); // 重新加载公海池数据 |
|
|
loadPublicData(); // 重新加载公海池数据 |
|
|
|
|
|
|
|
|
@ -2864,12 +2889,12 @@ |
|
|
function resetPersonalDateFilter() { |
|
|
function resetPersonalDateFilter() { |
|
|
document.getElementById('personalStartDate').value = ''; |
|
|
document.getElementById('personalStartDate').value = ''; |
|
|
document.getElementById('personalEndDate').value = ''; |
|
|
document.getElementById('personalEndDate').value = ''; |
|
|
currentStartDate = null; |
|
|
personalStartDate = null; |
|
|
currentEndDate = null; |
|
|
personalEndDate = null; |
|
|
personalPage = 1; // 重置为第一页 |
|
|
personalPage = 1; // 重置为第一页 |
|
|
|
|
|
|
|
|
// 使用后端分页加载数据 |
|
|
// 加载全部数据后进行筛选 |
|
|
loadPersonalDataWithPagination(); |
|
|
loadAllPersonalData(); |
|
|
|
|
|
|
|
|
// 更新筛选标签 |
|
|
// 更新筛选标签 |
|
|
updateFilterTags('personal'); |
|
|
updateFilterTags('personal'); |
|
|
@ -2937,8 +2962,8 @@ |
|
|
function resetPublicDateFilter() { |
|
|
function resetPublicDateFilter() { |
|
|
document.getElementById('publicStartDate').value = ''; |
|
|
document.getElementById('publicStartDate').value = ''; |
|
|
document.getElementById('publicEndDate').value = ''; |
|
|
document.getElementById('publicEndDate').value = ''; |
|
|
currentStartDate = null; |
|
|
publicStartDate = null; |
|
|
currentEndDate = null; |
|
|
publicEndDate = null; |
|
|
publicPage = 1; // 重置为第一页 |
|
|
publicPage = 1; // 重置为第一页 |
|
|
loadPublicData(); // 重新加载公海池数据 |
|
|
loadPublicData(); // 重新加载公海池数据 |
|
|
|
|
|
|
|
|
@ -2951,10 +2976,8 @@ |
|
|
debouncedFilterPersonalByManager(); |
|
|
debouncedFilterPersonalByManager(); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
// 筛选公海池数据负责人 |
|
|
|
|
|
function filterPublicByManager() { |
|
|
|
|
|
debouncedFilterPublicByManager(); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// 筛选个人数据类型 |
|
|
// 筛选个人数据类型 |
|
|
function filterPersonalByType() { |
|
|
function filterPersonalByType() { |
|
|
@ -2975,8 +2998,8 @@ |
|
|
|
|
|
|
|
|
// 构建查询参数,获取所有数据 |
|
|
// 构建查询参数,获取所有数据 |
|
|
var params = { |
|
|
var params = { |
|
|
page: publicPage, |
|
|
page: 1, |
|
|
size: publicPageSize, |
|
|
size: 1000, // 假设最多1000条数据 |
|
|
userRole: userRole, |
|
|
userRole: userRole, |
|
|
userName: usersManagements.userName || '', |
|
|
userName: usersManagements.userName || '', |
|
|
managercompany: usersManagements.managercompany || '', |
|
|
managercompany: usersManagements.managercompany || '', |
|
|
@ -2998,12 +3021,7 @@ |
|
|
if (data.users) { |
|
|
if (data.users) { |
|
|
allPublicData = data.users; |
|
|
allPublicData = data.users; |
|
|
} |
|
|
} |
|
|
displayPublicData(data); |
|
|
displayFilteredPublicData(); |
|
|
// 确保传递正确的参数给分页函数 |
|
|
|
|
|
var page = data.page || 1; |
|
|
|
|
|
var pages = data.pages || 1; |
|
|
|
|
|
var total = data.total || 0; |
|
|
|
|
|
renderPublicPagination(page, pages, total); |
|
|
|
|
|
} else if (xhr.readyState == 4) { |
|
|
} else if (xhr.readyState == 4) { |
|
|
// 隐藏骨架屏 |
|
|
// 隐藏骨架屏 |
|
|
loadingManager.hideTableSkeleton('publicBody'); |
|
|
loadingManager.hideTableSkeleton('publicBody'); |
|
|
@ -3013,6 +3031,138 @@ |
|
|
xhr.send(); |
|
|
xhr.send(); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
function displayFilteredPublicData() { |
|
|
|
|
|
var publicBody = document.getElementById('publicBody'); |
|
|
|
|
|
var publicEmpty = document.getElementById('publicEmpty'); |
|
|
|
|
|
var publicPagination = document.getElementById('publicPagination'); |
|
|
|
|
|
var selectAllPublic = document.getElementById('selectAllPublic'); |
|
|
|
|
|
publicBody.innerHTML = ''; |
|
|
|
|
|
|
|
|
|
|
|
// 检查用户角色,只对管理员显示复选框列 |
|
|
|
|
|
var userRole = userInfo.loginInfo.projectName; |
|
|
|
|
|
var isAdmin = userRole === '管理员'; |
|
|
|
|
|
|
|
|
|
|
|
// 过滤数据 |
|
|
|
|
|
var filteredUsers = allPublicData.filter(function(user) { |
|
|
|
|
|
// 过滤掉同事类型 |
|
|
|
|
|
if (user.type === 'Colleague') { |
|
|
|
|
|
return false; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// 按手机号搜索 |
|
|
|
|
|
if (publicPhoneSearch) { |
|
|
|
|
|
if (!user.phoneNumber || !user.phoneNumber.includes(publicPhoneSearch)) { |
|
|
|
|
|
return false; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// 按创建时间范围筛选 |
|
|
|
|
|
if (publicStartDate || publicEndDate) { |
|
|
|
|
|
var userCreatedAt = new Date(user.created_at); |
|
|
|
|
|
|
|
|
|
|
|
if (publicStartDate) { |
|
|
|
|
|
var startDate = new Date(publicStartDate); |
|
|
|
|
|
if (userCreatedAt < startDate) { |
|
|
|
|
|
return false; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (publicEndDate) { |
|
|
|
|
|
var endDate = new Date(publicEndDate); |
|
|
|
|
|
// 设置结束日期为当天的23:59:59 |
|
|
|
|
|
endDate.setHours(23, 59, 59, 999); |
|
|
|
|
|
if (userCreatedAt > endDate) { |
|
|
|
|
|
return false; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// 按类型筛选 |
|
|
|
|
|
if (publicTypeFilter) { |
|
|
|
|
|
var userType = user.type || ''; |
|
|
|
|
|
|
|
|
|
|
|
// 特殊处理seller和buyer类型,直接比较英文 |
|
|
|
|
|
if (publicTypeFilter === 'seller') { |
|
|
|
|
|
if (userType !== 'seller' && userType !== '供应商') { |
|
|
|
|
|
return false; |
|
|
|
|
|
} |
|
|
|
|
|
} else if (publicTypeFilter === 'buyer') { |
|
|
|
|
|
if (userType !== 'buyer' && userType !== '大贸易客户') { |
|
|
|
|
|
return false; |
|
|
|
|
|
} |
|
|
|
|
|
} else { |
|
|
|
|
|
// 其他类型的映射 |
|
|
|
|
|
var typeMap = { |
|
|
|
|
|
'wholesale': '批发贸易类', |
|
|
|
|
|
'e-commerce': '电商平台类', |
|
|
|
|
|
'delivery_retail': '配送零售类', |
|
|
|
|
|
'defective_egg': '次品蛋专项类', |
|
|
|
|
|
'other': '其他类型' |
|
|
|
|
|
}; |
|
|
|
|
|
var filterValue = typeMap[publicTypeFilter] || publicTypeFilter; |
|
|
|
|
|
if (userType !== filterValue) { |
|
|
|
|
|
return false; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// 其他情况,不过滤 |
|
|
|
|
|
return true; |
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
// 计算总页数 |
|
|
|
|
|
var total = filteredUsers.length; |
|
|
|
|
|
var totalPages = Math.ceil(total / publicPageSize); |
|
|
|
|
|
|
|
|
|
|
|
if (filteredUsers.length > 0) { |
|
|
|
|
|
publicEmpty.style.display = 'none'; |
|
|
|
|
|
|
|
|
|
|
|
// 计算当前页显示的数据范围 |
|
|
|
|
|
var startIndex = (publicPage - 1) * publicPageSize; |
|
|
|
|
|
var endIndex = startIndex + publicPageSize; |
|
|
|
|
|
var displayUsers = filteredUsers.slice(startIndex, endIndex); |
|
|
|
|
|
|
|
|
|
|
|
for (var i = 0; i < displayUsers.length; i++) { |
|
|
|
|
|
var user = displayUsers[i]; |
|
|
|
|
|
var responseTime = calculateResponseTime(user.created_at, user.followup_at); |
|
|
|
|
|
var managerCell = ''; |
|
|
|
|
|
|
|
|
|
|
|
// 只对管理员显示负责人信息 |
|
|
|
|
|
if (userRole === '管理员') { |
|
|
|
|
|
managerCell = '<td>' + (user.managerName || '-') + '</td>'; |
|
|
|
|
|
} else { |
|
|
|
|
|
managerCell = '<td style="display: none;"></td>'; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// 只有管理员显示复选框 |
|
|
|
|
|
var checkboxCell = isAdmin ? '<td><input type="checkbox" class="userCheckbox" data-userid="' + (user.userId || '') + '"></td>' : '<td style="width: 40px;"></td>'; |
|
|
|
|
|
|
|
|
|
|
|
var row = '<tr style="cursor: default;">' + |
|
|
|
|
|
checkboxCell + |
|
|
|
|
|
'<td>' + (user.nickName || '-') + '</td>' + |
|
|
|
|
|
'<td>' + (user.phoneNumber || '-') + '</td>' + |
|
|
|
|
|
'<td>' + mapUserType(user.type) + '</td>' + |
|
|
|
|
|
'<td>' + formatDateTime(user.created_at) + '</td>' + |
|
|
|
|
|
'<td>' + (user.followup || '-') + '</td>' + |
|
|
|
|
|
'<td>' + responseTime + '</td>' + |
|
|
|
|
|
managerCell + |
|
|
|
|
|
'<td><button onclick="openFollowupModal(\'' + (user.userId || '') + '\', \'' + (user.nickName || '') + '\', \'' + (user.phoneNumber || '') + '\'); event.stopPropagation();" style="padding: 4px 8px; background-color: #1890ff; color: white; border: none; border-radius: 4px; font-size: 12px; margin-right: 4px;">跟进</button> <button onclick="openDetailModal(\'' + (user.userId || '') + '\'); event.stopPropagation();" style="padding: 4px 8px; background-color: #13c2c2; color: white; border: none; border-radius: 4px; font-size: 12px; margin-right: 4px;">详情</button> <button onclick="openReturnModal(\'' + (user.userId || '') + '\', \'' + (user.nickName || '') + '\', \'' + (user.phoneNumber || '') + '\', \'' + (user.type || '') + '\'); event.stopPropagation();" style="padding: 4px 8px; background-color: #faad14; color: white; border: none; border-radius: 4px; font-size: 12px; margin-right: 4px;">归还</button></td>' + |
|
|
|
|
|
'</tr>'; |
|
|
|
|
|
publicBody.innerHTML += row; |
|
|
|
|
|
|
|
|
|
|
|
// 有数据时显示分页控件 |
|
|
|
|
|
publicPagination.style.display = 'flex'; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// 渲染分页控件 |
|
|
|
|
|
renderPublicPagination(publicPage, totalPages, total); |
|
|
|
|
|
} else { |
|
|
|
|
|
publicEmpty.style.display = 'block'; |
|
|
|
|
|
// 没有数据时隐藏分页控件 |
|
|
|
|
|
publicPagination.style.display = 'none'; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
function objectToQueryString(obj) { |
|
|
function objectToQueryString(obj) { |
|
|
return Object.keys(obj) |
|
|
return Object.keys(obj) |
|
|
.map(key => key + '=' + encodeURIComponent(obj[key])) |
|
|
.map(key => key + '=' + encodeURIComponent(obj[key])) |
|
|
@ -5257,8 +5407,8 @@ |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
// 按负责人筛选 |
|
|
// 按负责人筛选 |
|
|
if (currentManagerFilter) { |
|
|
if (personalManagerFilter) { |
|
|
return user.managerName === currentManagerFilter; |
|
|
return user.managerName === personalManagerFilter; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
// 其他情况,不过滤 |
|
|
// 其他情况,不过滤 |
|
|
@ -5381,33 +5531,33 @@ |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
// 按负责人筛选 |
|
|
// 按负责人筛选 |
|
|
if (currentManagerFilter) { |
|
|
if (publicManagerFilter) { |
|
|
console.log('公海池筛选负责人:', currentManagerFilter, '用户负责人:', user.managerName); |
|
|
console.log('公海池筛选负责人:', publicManagerFilter, '用户负责人:', user.managerName); |
|
|
if (user.managerName !== currentManagerFilter) { |
|
|
if (user.managerName !== publicManagerFilter) { |
|
|
return false; |
|
|
return false; |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
// 按手机号搜索 |
|
|
// 按手机号搜索 |
|
|
if (currentPhoneSearch) { |
|
|
if (publicPhoneSearch) { |
|
|
if (!user.phoneNumber || !user.phoneNumber.includes(currentPhoneSearch)) { |
|
|
if (!user.phoneNumber || !user.phoneNumber.includes(publicPhoneSearch)) { |
|
|
return false; |
|
|
return false; |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
// 按创建时间范围筛选 |
|
|
// 按创建时间范围筛选 |
|
|
if (currentStartDate || currentEndDate) { |
|
|
if (publicStartDate || publicEndDate) { |
|
|
var userCreatedAt = new Date(user.created_at); |
|
|
var userCreatedAt = new Date(user.created_at); |
|
|
|
|
|
|
|
|
if (currentStartDate) { |
|
|
if (publicStartDate) { |
|
|
var startDate = new Date(currentStartDate); |
|
|
var startDate = new Date(publicStartDate); |
|
|
if (userCreatedAt < startDate) { |
|
|
if (userCreatedAt < startDate) { |
|
|
return false; |
|
|
return false; |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
if (currentEndDate) { |
|
|
if (publicEndDate) { |
|
|
var endDate = new Date(currentEndDate); |
|
|
var endDate = new Date(publicEndDate); |
|
|
// 设置结束日期为当天的23:59:59 |
|
|
// 设置结束日期为当天的23:59:59 |
|
|
endDate.setHours(23, 59, 59, 999); |
|
|
endDate.setHours(23, 59, 59, 999); |
|
|
if (userCreatedAt > endDate) { |
|
|
if (userCreatedAt > endDate) { |
|
|
@ -5417,16 +5567,16 @@ |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
// 按类型筛选 |
|
|
// 按类型筛选 |
|
|
if (currentTypeFilter) { |
|
|
if (publicTypeFilter) { |
|
|
var userType = user.type || ''; |
|
|
var userType = user.type || ''; |
|
|
console.log('公海池筛选类型:', currentTypeFilter, '用户类型:', userType); |
|
|
console.log('公海池筛选类型:', publicTypeFilter, '用户类型:', userType); |
|
|
|
|
|
|
|
|
// 特殊处理seller和buyer类型,直接比较英文 |
|
|
// 特殊处理seller和buyer类型,直接比较英文 |
|
|
if (currentTypeFilter === 'seller') { |
|
|
if (publicTypeFilter === 'seller') { |
|
|
if (userType !== 'seller' && userType !== '供应商') { |
|
|
if (userType !== 'seller' && userType !== '供应商') { |
|
|
return false; |
|
|
return false; |
|
|
} |
|
|
} |
|
|
} else if (currentTypeFilter === 'buyer') { |
|
|
} else if (publicTypeFilter === 'buyer') { |
|
|
if (userType !== 'buyer' && userType !== '大贸易客户') { |
|
|
if (userType !== 'buyer' && userType !== '大贸易客户') { |
|
|
return false; |
|
|
return false; |
|
|
} |
|
|
} |
|
|
@ -5439,7 +5589,7 @@ |
|
|
'defective_egg': '次品蛋专项类', |
|
|
'defective_egg': '次品蛋专项类', |
|
|
'other': '其他类型' |
|
|
'other': '其他类型' |
|
|
}; |
|
|
}; |
|
|
var filterValue = typeMap[currentTypeFilter] || currentTypeFilter; |
|
|
var filterValue = typeMap[publicTypeFilter] || publicTypeFilter; |
|
|
if (userType !== filterValue) { |
|
|
if (userType !== filterValue) { |
|
|
return false; |
|
|
return false; |
|
|
} |
|
|
} |
|
|
@ -6132,7 +6282,7 @@ |
|
|
prevBtn.onclick = function() { |
|
|
prevBtn.onclick = function() { |
|
|
if (current > 1) { |
|
|
if (current > 1) { |
|
|
publicPage = current - 1; |
|
|
publicPage = current - 1; |
|
|
loadPublicData(); |
|
|
displayFilteredPublicData(); |
|
|
} |
|
|
} |
|
|
}; |
|
|
}; |
|
|
pagination.appendChild(prevBtn); |
|
|
pagination.appendChild(prevBtn); |
|
|
@ -6185,7 +6335,7 @@ |
|
|
nextBtn.onclick = function() { |
|
|
nextBtn.onclick = function() { |
|
|
if (current < total) { |
|
|
if (current < total) { |
|
|
publicPage = current + 1; |
|
|
publicPage = current + 1; |
|
|
loadPublicData(); |
|
|
displayFilteredPublicData(); |
|
|
} |
|
|
} |
|
|
}; |
|
|
}; |
|
|
pagination.appendChild(nextBtn); |
|
|
pagination.appendChild(nextBtn); |
|
|
@ -6406,7 +6556,7 @@ |
|
|
firstBtn.onclick = function() { |
|
|
firstBtn.onclick = function() { |
|
|
if (current > 1) { |
|
|
if (current > 1) { |
|
|
publicPage = 1; |
|
|
publicPage = 1; |
|
|
loadPublicData(); |
|
|
displayFilteredPublicData(); |
|
|
} |
|
|
} |
|
|
}; |
|
|
}; |
|
|
pagination.appendChild(firstBtn); |
|
|
pagination.appendChild(firstBtn); |
|
|
@ -6448,7 +6598,7 @@ |
|
|
lastBtn.onclick = function() { |
|
|
lastBtn.onclick = function() { |
|
|
if (current < total) { |
|
|
if (current < total) { |
|
|
publicPage = total; |
|
|
publicPage = total; |
|
|
loadPublicData(); |
|
|
displayFilteredPublicData(); |
|
|
} |
|
|
} |
|
|
}; |
|
|
}; |
|
|
pagination.appendChild(lastBtn); |
|
|
pagination.appendChild(lastBtn); |
|
|
@ -6478,7 +6628,7 @@ |
|
|
pageSizeSelect.onchange = function() { |
|
|
pageSizeSelect.onchange = function() { |
|
|
publicPageSize = parseInt(this.value); |
|
|
publicPageSize = parseInt(this.value); |
|
|
publicPage = 1; |
|
|
publicPage = 1; |
|
|
loadPublicData(); |
|
|
displayFilteredPublicData(); |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
pageSizeContainer.appendChild(pageSizeText); |
|
|
pageSizeContainer.appendChild(pageSizeText); |
|
|
@ -6506,7 +6656,7 @@ |
|
|
var jumpPage = parseInt(jumpInput.value); |
|
|
var jumpPage = parseInt(jumpInput.value); |
|
|
if (jumpPage >= 1 && jumpPage <= total) { |
|
|
if (jumpPage >= 1 && jumpPage <= total) { |
|
|
publicPage = jumpPage; |
|
|
publicPage = jumpPage; |
|
|
loadPublicData(); |
|
|
displayFilteredPublicData(); |
|
|
} |
|
|
} |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
@ -7436,11 +7586,11 @@ |
|
|
organization: usersManagements.organization || '', |
|
|
organization: usersManagements.organization || '', |
|
|
role: usersManagements.role || '', |
|
|
role: usersManagements.role || '', |
|
|
filter: personalFilter, |
|
|
filter: personalFilter, |
|
|
managerName: currentManagerFilter || '', |
|
|
managerName: personalManagerFilter || '', |
|
|
phoneNumber: currentPhoneSearch || '', |
|
|
phoneNumber: personalPhoneSearch || '', |
|
|
startDate: currentStartDate || '', |
|
|
startDate: personalStartDate || '', |
|
|
endDate: currentEndDate || '', |
|
|
endDate: personalEndDate || '', |
|
|
type: currentTypeFilter || '' |
|
|
type: personalTypeFilter || '' |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
var url = '/KH/api/users?' + objectToQueryString(params); |
|
|
var url = '/KH/api/users?' + objectToQueryString(params); |
|
|
|