|
|
@ -217,6 +217,47 @@ |
|
|
width: 100%; |
|
|
width: 100%; |
|
|
border-collapse: collapse; |
|
|
border-collapse: collapse; |
|
|
font-size: 14px; |
|
|
font-size: 14px; |
|
|
|
|
|
table-layout: fixed; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
th:nth-child(1), td:nth-child(1) { |
|
|
|
|
|
max-width: 120px; |
|
|
|
|
|
width: 120px; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
th:nth-child(2), td:nth-child(2) { |
|
|
|
|
|
max-width: 100px; |
|
|
|
|
|
width: 100px; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
th:nth-child(3), td:nth-child(3) { |
|
|
|
|
|
max-width: 80px; |
|
|
|
|
|
width: 80px; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
th:nth-child(4), td:nth-child(4) { |
|
|
|
|
|
max-width: 130px; |
|
|
|
|
|
width: 130px; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
th:nth-child(5), td:nth-child(5) { |
|
|
|
|
|
max-width: 100px; |
|
|
|
|
|
width: 100px; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
th:nth-child(6), td:nth-child(6) { |
|
|
|
|
|
max-width: 100px; |
|
|
|
|
|
width: 100px; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
th:nth-child(7), td:nth-child(7) { |
|
|
|
|
|
max-width: 100px; |
|
|
|
|
|
width: 100px; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
th:nth-child(8), td:nth-child(8) { |
|
|
|
|
|
max-width: 120px; |
|
|
|
|
|
width: 120px; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
th { |
|
|
th { |
|
|
@ -232,6 +273,8 @@ |
|
|
padding: 12px; |
|
|
padding: 12px; |
|
|
border-bottom: 1px solid #f0f0f0; |
|
|
border-bottom: 1px solid #f0f0f0; |
|
|
color: #666; |
|
|
color: #666; |
|
|
|
|
|
word-wrap: break-word; |
|
|
|
|
|
word-break: break-all; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
tr:hover { |
|
|
tr:hover { |
|
|
@ -398,6 +441,9 @@ |
|
|
<div id="personal" class="tab-content active"> |
|
|
<div id="personal" class="tab-content active"> |
|
|
<div class="filter-bar"> |
|
|
<div class="filter-bar"> |
|
|
<button onclick="loadPersonalData()">刷新数据</button> |
|
|
<button onclick="loadPersonalData()">刷新数据</button> |
|
|
|
|
|
<button onclick="filterPersonalData('all')" style="background-color: #52c41a;">全部</button> |
|
|
|
|
|
<button onclick="filterPersonalData('followed')" style="background-color: #faad14;">已跟进</button> |
|
|
|
|
|
<button onclick="filterPersonalData('unfollowed')" style="background-color: #ff4d4f;">未跟进</button> |
|
|
<select id="personalPageSize" onchange="changePersonalPageSize()"> |
|
|
<select id="personalPageSize" onchange="changePersonalPageSize()"> |
|
|
<option value="10">10条/页</option> |
|
|
<option value="10">10条/页</option> |
|
|
<option value="50">50条/页</option> |
|
|
<option value="50">50条/页</option> |
|
|
@ -413,6 +459,7 @@ |
|
|
<th>创建时间</th> |
|
|
<th>创建时间</th> |
|
|
<th>跟进内容</th> |
|
|
<th>跟进内容</th> |
|
|
<th>响应时间</th> |
|
|
<th>响应时间</th> |
|
|
|
|
|
<th id="managerHeader">负责人</th> |
|
|
<th>操作</th> |
|
|
<th>操作</th> |
|
|
</tr> |
|
|
</tr> |
|
|
</thead> |
|
|
</thead> |
|
|
@ -443,6 +490,7 @@ |
|
|
<th>创建时间</th> |
|
|
<th>创建时间</th> |
|
|
<th>跟进内容</th> |
|
|
<th>跟进内容</th> |
|
|
<th>响应时间</th> |
|
|
<th>响应时间</th> |
|
|
|
|
|
<th id="publicManagerHeader">负责人</th> |
|
|
<th>操作</th> |
|
|
<th>操作</th> |
|
|
</tr> |
|
|
</tr> |
|
|
</thead> |
|
|
</thead> |
|
|
@ -463,6 +511,7 @@ |
|
|
var publicPage = 1; |
|
|
var publicPage = 1; |
|
|
var personalPageSize = 10; |
|
|
var personalPageSize = 10; |
|
|
var publicPageSize = 10; |
|
|
var publicPageSize = 10; |
|
|
|
|
|
var personalFilter = 'all'; // all, followed, unfollowed |
|
|
|
|
|
|
|
|
function init() { |
|
|
function init() { |
|
|
var savedUserInfo = localStorage.getItem('userInfo'); |
|
|
var savedUserInfo = localStorage.getItem('userInfo'); |
|
|
@ -557,7 +606,7 @@ |
|
|
role: usersManagements.role || '' |
|
|
role: usersManagements.role || '' |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
var url = 'http://localhost:8083/KH/api/users?' + objectToQueryString(params); |
|
|
var url = 'http://8.137.125.67:8083/KH/api/users?' + objectToQueryString(params); |
|
|
|
|
|
|
|
|
var xhr = new XMLHttpRequest(); |
|
|
var xhr = new XMLHttpRequest(); |
|
|
xhr.open('GET', url, true); |
|
|
xhr.open('GET', url, true); |
|
|
@ -571,6 +620,12 @@ |
|
|
xhr.send(); |
|
|
xhr.send(); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
function filterPersonalData(filter) { |
|
|
|
|
|
personalFilter = filter; |
|
|
|
|
|
personalPage = 1; // 重置为第一页 |
|
|
|
|
|
loadPersonalData(); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
function loadPublicData() { |
|
|
function loadPublicData() { |
|
|
var userRole = userInfo.loginInfo.projectName; |
|
|
var userRole = userInfo.loginInfo.projectName; |
|
|
var usersManagements = userInfo.usersManagements; |
|
|
var usersManagements = userInfo.usersManagements; |
|
|
@ -587,7 +642,7 @@ |
|
|
role: usersManagements.role || '' |
|
|
role: usersManagements.role || '' |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
var url = 'http://localhost:8083/KH/api/users/public?' + objectToQueryString(params); |
|
|
var url = 'http://8.137.125.67:8083/KH/api/users/public?' + objectToQueryString(params); |
|
|
|
|
|
|
|
|
var xhr = new XMLHttpRequest(); |
|
|
var xhr = new XMLHttpRequest(); |
|
|
xhr.open('GET', url, true); |
|
|
xhr.open('GET', url, true); |
|
|
@ -709,9 +764,9 @@ |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
function calculateResponseTime(createdAt, followupAt) { |
|
|
function calculateResponseTime(createdAt, followupAt) { |
|
|
if (!createdAt) return '-'; |
|
|
if (!createdAt || !followupAt) return '-'; |
|
|
var createTime = new Date(createdAt); |
|
|
var createTime = new Date(createdAt); |
|
|
var followupTime = followupAt ? new Date(followupAt) : new Date(); |
|
|
var followupTime = new Date(followupAt); |
|
|
var diffMs = followupTime - createTime; |
|
|
var diffMs = followupTime - createTime; |
|
|
var diffMins = Math.floor(diffMs / 60000); |
|
|
var diffMins = Math.floor(diffMs / 60000); |
|
|
var diffHours = Math.floor(diffMins / 60); |
|
|
var diffHours = Math.floor(diffMins / 60); |
|
|
@ -731,8 +786,18 @@ |
|
|
function displayPersonalData(data) { |
|
|
function displayPersonalData(data) { |
|
|
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 personalPagination = document.getElementById('personalPagination'); |
|
|
personalBody.innerHTML = ''; |
|
|
personalBody.innerHTML = ''; |
|
|
|
|
|
|
|
|
|
|
|
// 检查用户角色,只对管理员显示负责人列 |
|
|
|
|
|
var userRole = userInfo.loginInfo.projectName; |
|
|
|
|
|
if (userRole === '管理员') { |
|
|
|
|
|
managerHeader.style.display = 'table-cell'; |
|
|
|
|
|
} else { |
|
|
|
|
|
managerHeader.style.display = 'none'; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
console.log('后端返回的数据量:', data.users ? data.users.length : 0); |
|
|
console.log('后端返回的数据量:', data.users ? data.users.length : 0); |
|
|
console.log('总记录数:', data.total); |
|
|
console.log('总记录数:', data.total); |
|
|
console.log('当前页码:', data.page); |
|
|
console.log('当前页码:', data.page); |
|
|
@ -742,7 +807,19 @@ |
|
|
if (data.users && data.users.length > 0) { |
|
|
if (data.users && data.users.length > 0) { |
|
|
personalEmpty.style.display = 'none'; |
|
|
personalEmpty.style.display = 'none'; |
|
|
var filteredUsers = data.users.filter(function(user) { |
|
|
var filteredUsers = data.users.filter(function(user) { |
|
|
return user.type !== 'Colleague'; |
|
|
// 过滤掉同事类型 |
|
|
|
|
|
if (user.type === 'Colleague') { |
|
|
|
|
|
return false; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// 根据筛选条件过滤 |
|
|
|
|
|
if (personalFilter === 'followed') { |
|
|
|
|
|
return user.followup && user.followup !== ''; |
|
|
|
|
|
} else if (personalFilter === 'unfollowed') { |
|
|
|
|
|
return !user.followup || user.followup === ''; |
|
|
|
|
|
} |
|
|
|
|
|
// 'all' 或其他情况,不过滤 |
|
|
|
|
|
return true; |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
console.log('过滤后的数据量:', filteredUsers.length); |
|
|
console.log('过滤后的数据量:', filteredUsers.length); |
|
|
@ -751,6 +828,25 @@ |
|
|
for (var i = 0; i < filteredUsers.length; i++) { |
|
|
for (var i = 0; i < filteredUsers.length; i++) { |
|
|
var user = filteredUsers[i]; |
|
|
var user = filteredUsers[i]; |
|
|
var responseTime = calculateResponseTime(user.created_at, user.followup_at); |
|
|
var responseTime = calculateResponseTime(user.created_at, user.followup_at); |
|
|
|
|
|
var managerCell = ''; |
|
|
|
|
|
|
|
|
|
|
|
// 只对管理员显示负责人信息 |
|
|
|
|
|
if (userRole === '管理员') { |
|
|
|
|
|
managerCell = '<td>' + (user.managerName || user.followup || '-') + '</td>'; |
|
|
|
|
|
} else { |
|
|
|
|
|
managerCell = '<td style="display: none;"></td>'; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// 生成简道云按钮,根据sync_statuss字段决定状态 |
|
|
|
|
|
var jianDaoYunButton = ''; |
|
|
|
|
|
if (user.sync_statuss === 0 || user.sync_statuss === 1) { |
|
|
|
|
|
// 已写入简道云,显示灰色不可点击按钮 |
|
|
|
|
|
jianDaoYunButton = '<button style="padding: 4px 8px; background-color: #ccc; color: #666; border: none; border-radius: 4px; font-size: 12px; cursor: not-allowed;" disabled>已写入简道云</button>'; |
|
|
|
|
|
} else { |
|
|
|
|
|
// 未写入简道云,显示正常按钮 |
|
|
|
|
|
jianDaoYunButton = '<button onclick="openJianDaoYunModal(\'' + (user.userId || '') + '\', \'' + (user.nickName || '') + '\')" style="padding: 4px 8px; background-color: #52c41a; color: white; border: none; border-radius: 4px; font-size: 12px;">简道云</button>'; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
var row = '<tr>' + |
|
|
var row = '<tr>' + |
|
|
'<td>' + (user.nickName || '-') + '</td>' + |
|
|
'<td>' + (user.nickName || '-') + '</td>' + |
|
|
'<td>' + (user.phoneNumber || '-') + '</td>' + |
|
|
'<td>' + (user.phoneNumber || '-') + '</td>' + |
|
|
@ -758,23 +854,41 @@ |
|
|
'<td>' + formatDateTime(user.created_at) + '</td>' + |
|
|
'<td>' + formatDateTime(user.created_at) + '</td>' + |
|
|
'<td>' + (user.followup || '-') + '</td>' + |
|
|
'<td>' + (user.followup || '-') + '</td>' + |
|
|
'<td>' + responseTime + '</td>' + |
|
|
'<td>' + responseTime + '</td>' + |
|
|
'<td><button onclick="openFollowupModal(\'' + (user.userId || '') + '\', \'' + (user.nickName || '') + '\', \'' + (user.phoneNumber || '') + '\')" style="padding: 4px 8px; background-color: #1890ff; color: white; border: none; border-radius: 4px; font-size: 12px;">跟进</button> <button onclick="openReturnModal(\'' + (user.userId || '') + '\', \'' + (user.nickName || '') + '\', \'' + (user.phoneNumber || '') + '\', \'' + (user.type || '') + '\')" style="padding: 4px 8px; background-color: #faad14; color: white; border: none; border-radius: 4px; font-size: 12px;">归还</button> <button onclick="openJianDaoYunModal(\'' + (user.userId || '') + '\', \'' + (user.nickName || '') + '\')" style="padding: 4px 8px; background-color: #52c41a; color: white; border: none; border-radius: 4px; font-size: 12px;">简道云</button></td>' + |
|
|
managerCell + |
|
|
|
|
|
'<td><button onclick="openFollowupModal(\'' + (user.userId || '') + '\', \'' + (user.nickName || '') + '\', \'' + (user.phoneNumber || '') + '\')" style="padding: 4px 8px; background-color: #1890ff; color: white; border: none; border-radius: 4px; font-size: 12px;">跟进</button> <button onclick="openReturnModal(\'' + (user.userId || '') + '\', \'' + (user.nickName || '') + '\', \'' + (user.phoneNumber || '') + '\', \'' + (user.type || '') + '\')" style="padding: 4px 8px; background-color: #faad14; color: white; border: none; border-radius: 4px; font-size: 12px;">归还</button> ' + jianDaoYunButton + '</td>' + |
|
|
'</tr>'; |
|
|
'</tr>'; |
|
|
personalBody.innerHTML += row; |
|
|
personalBody.innerHTML += row; |
|
|
|
|
|
|
|
|
|
|
|
// 有数据时显示分页控件 |
|
|
|
|
|
personalPagination.style.display = 'flex'; |
|
|
} |
|
|
} |
|
|
} else { |
|
|
} else { |
|
|
personalEmpty.style.display = 'block'; |
|
|
personalEmpty.style.display = 'block'; |
|
|
|
|
|
// 没有数据时隐藏分页控件 |
|
|
|
|
|
personalPagination.style.display = 'none'; |
|
|
} |
|
|
} |
|
|
} else { |
|
|
} else { |
|
|
personalEmpty.style.display = 'block'; |
|
|
personalEmpty.style.display = 'block'; |
|
|
|
|
|
// 没有数据时隐藏分页控件 |
|
|
|
|
|
personalPagination.style.display = 'none'; |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
function displayPublicData(data) { |
|
|
function displayPublicData(data) { |
|
|
var publicBody = document.getElementById('publicBody'); |
|
|
var publicBody = document.getElementById('publicBody'); |
|
|
var publicEmpty = document.getElementById('publicEmpty'); |
|
|
var publicEmpty = document.getElementById('publicEmpty'); |
|
|
|
|
|
var publicManagerHeader = document.getElementById('publicManagerHeader'); |
|
|
|
|
|
var publicPagination = document.getElementById('publicPagination'); // New: Get pagination element |
|
|
publicBody.innerHTML = ''; |
|
|
publicBody.innerHTML = ''; |
|
|
|
|
|
|
|
|
|
|
|
// 检查用户角色,只对管理员显示负责人列 |
|
|
|
|
|
var userRole = userInfo.loginInfo.projectName; |
|
|
|
|
|
if (userRole === '管理员') { |
|
|
|
|
|
publicManagerHeader.style.display = 'table-cell'; |
|
|
|
|
|
} else { |
|
|
|
|
|
publicManagerHeader.style.display = 'none'; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
if (data.users && data.users.length > 0) { |
|
|
if (data.users && data.users.length > 0) { |
|
|
publicEmpty.style.display = 'none'; |
|
|
publicEmpty.style.display = 'none'; |
|
|
var filteredUsers = data.users.filter(function(user) { |
|
|
var filteredUsers = data.users.filter(function(user) { |
|
|
@ -785,6 +899,15 @@ |
|
|
for (var i = 0; i < filteredUsers.length; i++) { |
|
|
for (var i = 0; i < filteredUsers.length; i++) { |
|
|
var user = filteredUsers[i]; |
|
|
var user = filteredUsers[i]; |
|
|
var responseTime = calculateResponseTime(user.created_at, user.followup_at); |
|
|
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 row = '<tr>' + |
|
|
var row = '<tr>' + |
|
|
'<td>' + (user.nickName || '-') + '</td>' + |
|
|
'<td>' + (user.nickName || '-') + '</td>' + |
|
|
'<td>' + (user.phoneNumber || '-') + '</td>' + |
|
|
'<td>' + (user.phoneNumber || '-') + '</td>' + |
|
|
@ -792,15 +915,23 @@ |
|
|
'<td>' + formatDateTime(user.created_at) + '</td>' + |
|
|
'<td>' + formatDateTime(user.created_at) + '</td>' + |
|
|
'<td>' + (user.followup || '-') + '</td>' + |
|
|
'<td>' + (user.followup || '-') + '</td>' + |
|
|
'<td>' + responseTime + '</td>' + |
|
|
'<td>' + responseTime + '</td>' + |
|
|
|
|
|
managerCell + |
|
|
'<td><button onclick="claimCustomer(\'' + (user.userId || '') + '\', \'' + (user.nickName || '') + '\', \'' + (user.phoneNumber || '') + '\')" style="padding: 4px 8px; background-color: #52c41a; color: white; border: none; border-radius: 4px; font-size: 12px;">认领</button></td>' + |
|
|
'<td><button onclick="claimCustomer(\'' + (user.userId || '') + '\', \'' + (user.nickName || '') + '\', \'' + (user.phoneNumber || '') + '\')" style="padding: 4px 8px; background-color: #52c41a; color: white; border: none; border-radius: 4px; font-size: 12px;">认领</button></td>' + |
|
|
'</tr>'; |
|
|
'</tr>'; |
|
|
publicBody.innerHTML += row; |
|
|
publicBody.innerHTML += row; |
|
|
|
|
|
|
|
|
|
|
|
// 有数据时显示分页控件 |
|
|
|
|
|
publicPagination.style.display = 'flex'; |
|
|
} |
|
|
} |
|
|
} else { |
|
|
} else { |
|
|
publicEmpty.style.display = 'block'; |
|
|
publicEmpty.style.display = 'block'; |
|
|
|
|
|
// 没有数据时隐藏分页控件 |
|
|
|
|
|
publicPagination.style.display = 'none'; |
|
|
} |
|
|
} |
|
|
} else { |
|
|
} else { |
|
|
publicEmpty.style.display = 'block'; |
|
|
publicEmpty.style.display = 'block'; |
|
|
|
|
|
// 没有数据时隐藏分页控件 |
|
|
|
|
|
publicPagination.style.display = 'none'; |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@ -816,7 +947,7 @@ |
|
|
role: usersManagements.role || '' |
|
|
role: usersManagements.role || '' |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
var url = 'http://localhost:8083/KH/api/users/claim'; |
|
|
var url = 'http://8.137.125.67:8083/KH/api/users/claim'; |
|
|
|
|
|
|
|
|
var xhr = new XMLHttpRequest(); |
|
|
var xhr = new XMLHttpRequest(); |
|
|
xhr.open('POST', url, true); |
|
|
xhr.open('POST', url, true); |
|
|
@ -869,7 +1000,7 @@ |
|
|
role: usersManagements.role || '' |
|
|
role: usersManagements.role || '' |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
var url = 'http://localhost:8083/KH/api/users/followup'; |
|
|
var url = 'http://8.137.125.67:8083/KH/api/users/followup'; |
|
|
|
|
|
|
|
|
var xhr = new XMLHttpRequest(); |
|
|
var xhr = new XMLHttpRequest(); |
|
|
xhr.open('POST', url, true); |
|
|
xhr.open('POST', url, true); |
|
|
@ -922,7 +1053,7 @@ |
|
|
userId: userId |
|
|
userId: userId |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
var url = 'http://localhost:8083/KH/api/users/jianDaoYun'; |
|
|
var url = 'http://8.137.125.67:8083/KH/api/users/jianDaoYun'; |
|
|
|
|
|
|
|
|
var xhr = new XMLHttpRequest(); |
|
|
var xhr = new XMLHttpRequest(); |
|
|
xhr.open('POST', url, true); |
|
|
xhr.open('POST', url, true); |
|
|
@ -952,7 +1083,7 @@ |
|
|
type: type |
|
|
type: type |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
var url = 'http://localhost:8083/KH/api/users/return'; |
|
|
var url = 'http://8.137.125.67:8083/KH/api/users/return'; |
|
|
|
|
|
|
|
|
var xhr = new XMLHttpRequest(); |
|
|
var xhr = new XMLHttpRequest(); |
|
|
xhr.open('POST', url, true); |
|
|
xhr.open('POST', url, true); |
|
|
|