diff --git a/web/src/main/resources/static/index.html b/web/src/main/resources/static/index.html index 7b9c138..14a088e 100644 --- a/web/src/main/resources/static/index.html +++ b/web/src/main/resources/static/index.html @@ -1132,6 +1132,114 @@ }); } + function showManagerDropdown(event, cell, managerName) { + // 防止事件冒泡 + event.stopPropagation(); + + // 移除已存在的下拉菜单 + var existingDropdown = document.getElementById('managerDropdown'); + if (existingDropdown) { + existingDropdown.remove(); + } + + // 创建下拉菜单 + var dropdown = document.createElement('div'); + dropdown.id = 'managerDropdown'; + dropdown.style.cssText = ` + position: absolute; + background-color: white; + border: 1px solid #d9d9d9; + border-radius: 4px; + box-shadow: 0 4px 12px rgba(0,0,0,0.15); + z-index: 1001; + padding: 8px 0; + min-width: 150px; + max-height: 200px; + overflow-y: auto; + `; + + // 添加查看详情选项 + var detailOption = document.createElement('div'); + detailOption.textContent = '查看详情'; + detailOption.style.cssText = ` + padding: 8px 16px; + cursor: pointer; + font-size: 14px; + `; + detailOption.onmouseover = function() { + this.style.backgroundColor = '#f5f5f5'; + }; + detailOption.onmouseout = function() { + this.style.backgroundColor = 'white'; + }; + detailOption.onclick = function() { + // 这里可以添加查看负责人详情的逻辑 + showAlert('查看负责人:' + managerName + ' 的详情'); + dropdown.remove(); + }; + dropdown.appendChild(detailOption); + + // 添加筛选此负责人选项 + var filterOption = document.createElement('div'); + filterOption.textContent = '筛选此负责人'; + filterOption.style.cssText = ` + padding: 8px 16px; + cursor: pointer; + font-size: 14px; + `; + filterOption.onmouseover = function() { + this.style.backgroundColor = '#f5f5f5'; + }; + filterOption.onmouseout = function() { + this.style.backgroundColor = 'white'; + }; + filterOption.onclick = function() { + currentManagerFilter = managerName; + applyManagerFilter(); + dropdown.remove(); + }; + dropdown.appendChild(filterOption); + + // 添加清除筛选选项 + var clearOption = document.createElement('div'); + clearOption.textContent = '清除筛选'; + clearOption.style.cssText = ` + padding: 8px 16px; + cursor: pointer; + font-size: 14px; + `; + clearOption.onmouseover = function() { + this.style.backgroundColor = '#f5f5f5'; + }; + clearOption.onmouseout = function() { + this.style.backgroundColor = 'white'; + }; + clearOption.onclick = function() { + currentManagerFilter = null; + applyManagerFilter(); + dropdown.remove(); + }; + dropdown.appendChild(clearOption); + + // 获取单元格位置并显示菜单 + var rect = cell.getBoundingClientRect(); + var scrollTop = window.pageYOffset || document.documentElement.scrollTop; + var scrollLeft = window.pageXOffset || document.documentElement.scrollLeft; + + dropdown.style.left = (rect.left + scrollLeft) + 'px'; + dropdown.style.top = (rect.top + rect.height + scrollTop) + 'px'; + + // 添加到页面 + document.body.appendChild(dropdown); + + // 点击页面其他地方关闭菜单 + document.addEventListener('click', function closeDropdown(event) { + if (!dropdown.contains(event.target) && event.target !== cell) { + dropdown.remove(); + } + }); + } + function applyManagerFilter() { if (currentFilterTable === 'personal') { // 个人表格筛选