diff --git a/web/src/main/resources/static/index.html b/web/src/main/resources/static/index.html index 743b4e9..6d26db1 100644 --- a/web/src/main/resources/static/index.html +++ b/web/src/main/resources/static/index.html @@ -159,7 +159,7 @@ display: flex; gap: 10px; align-items: center; - white-space: nowrap; + flex-wrap: wrap; } .filter-bar span { @@ -464,6 +464,13 @@ white-space: nowrap; } + /* 允许创建时间列换行 */ + .table-container th:nth-child(5), + .table-container td:nth-child(5) { + white-space: normal; + min-width: 120px; + } + /* 筛选容器样式,添加横向滚动 */ .filter-container { width: 100%; @@ -495,7 +502,7 @@ .filter-container .filter-bar { width: auto; min-width: 100%; - flex-wrap: nowrap; + flex-wrap: wrap; padding: 10px 0; } @@ -597,9 +604,18 @@ - 负责人: + + 类型: + 创建时间: @@ -607,12 +623,14 @@ - 总数: 0 - +
+ 总数: 0 + +
@@ -653,7 +671,16 @@ 负责人: + 类型: + 创建时间: @@ -661,11 +688,13 @@ - +
+ +
@@ -715,6 +744,7 @@ var currentPhoneSearch = null; var currentStartDate = null; var currentEndDate = null; + var currentTypeFilter = null; function init() { var savedUserInfo = localStorage.getItem('userInfo'); @@ -931,6 +961,13 @@ } } + // 按类型筛选 + if (currentTypeFilter) { + if (user.type !== currentTypeFilter) { + return false; + } + } + // 其他情况,不过滤 return true; }); @@ -1367,6 +1404,63 @@ tagsContainer.appendChild(tag); } + // 显示类型筛选标签 + if (currentTypeFilter) { + var tag = document.createElement('span'); + tag.style.cssText = ` + display: inline-block; + padding: 4px 12px; + background-color: #e6f7ff; + color: #1890ff; + border: 1px solid #91d5ff; + border-radius: 10px; + font-size: 12px; + margin-right: 8px; + position: relative; + `; + + // 映射类型值到显示文本 + var typeText = ''; + switch(currentTypeFilter) { + case 'wholesale': typeText = '批发贸易类'; break; + case 'e-commerce': typeText = '电商平台类'; break; + case 'delivery_retail': typeText = '配送零售类'; break; + case 'defective_egg': typeText = '次品蛋专项类'; break; + case 'other': typeText = '其他类型'; break; + default: typeText = currentTypeFilter; + } + + var tagText = document.createTextNode('类型: ' + typeText); + tag.appendChild(tagText); + + var closeButton = document.createElement('span'); + closeButton.textContent = ' ×'; + closeButton.style.cssText = ` + margin-left: 8px; + cursor: pointer; + font-weight: bold; + `; + closeButton.onclick = function() { + currentTypeFilter = null; + document.getElementById(tableType + 'TypeFilter').value = ''; + if (tableType === 'personal') { + personalPage = 1; + if (personalFilter === 'followed' || personalFilter === 'unfollowed') { + displayFilteredPersonalData(); + } else { + loadAllPersonalData(); + } + } else { + publicPage = 1; + loadPublicData(); + } + updateFilterTags(tableType); + }; + + tag.appendChild(closeButton); + tagsContainer.appendChild(tag); + } + // 显示日期范围筛选标签 if (currentStartDate || currentEndDate) { var tag = document.createElement('span'); @@ -1553,6 +1647,30 @@ updateFilterTags('public'); } + // 筛选个人数据类型 + function filterPersonalByType() { + var type = document.getElementById('personalTypeFilter').value; + currentTypeFilter = type || null; + personalPage = 1; // 重置为第一页 + + // 总是加载所有数据以便筛选 + loadAllPersonalData(); + + // 更新筛选标签 + updateFilterTags('personal'); + } + + // 筛选公海池数据类型 + function filterPublicByType() { + var type = document.getElementById('publicTypeFilter').value; + currentTypeFilter = type || null; + publicPage = 1; // 重置为第一页 + loadPublicData(); // 重新加载公海池数据 + + // 更新筛选标签 + updateFilterTags('public'); + } + function loadPublicData() { var userRole = userInfo.loginInfo.projectName; var usersManagements = userInfo.usersManagements; @@ -1587,6 +1705,11 @@ params.endDate = currentEndDate; } + // 添加类型筛选参数 + if (currentTypeFilter) { + params.type = currentTypeFilter; + } + var url = '/KH/api/users/public?' + objectToQueryString(params); var xhr = new XMLHttpRequest();