增加在线沟通筛选

master
songxiangjie 2025-12-16 17:01:22 +08:00
parent 02cea41fb6
commit 07e2920c08
1 changed files with 54 additions and 10 deletions

View File

@ -825,7 +825,7 @@
<option value="">选择时间类型</option> <option value="">选择时间类型</option>
<option value="1">创建时间</option> <option value="1">创建时间</option>
<option value="2">到期时间</option> <option value="2">到期时间</option>
<option value="4">保险时间</option> <option value="3">保险时间</option>
</select> </select>
</div> </div>
@ -885,7 +885,7 @@
<!-- 归属客服下拉框 --> <!-- 归属客服下拉框 -->
<div style="display: flex; flex-direction: column; min-width: 220px; flex-shrink: 0;"> <div style="display: flex; flex-direction: column; min-width: 220px; flex-shrink: 0;">
<select style="padding: 7px 9px; border: 1px solid var(--border-color); border-radius: 3px; font-size: 0.85rem; height: 32px; margin-bottom: 6px;" v-model="searchParams.belongKefu"> <select style="padding: 7px 9px; border: 1px solid var(--border-color); border-radius: 3px; font-size: 0.85rem; height: 32px; margin-bottom: 6px;" v-model="searchParams.belongKefu" @change="handleKefuChange">
<option value="">全部客服</option> <option value="">全部客服</option>
<option v-for="item in staffOptions.customers" :key="item.id" :value="item.id"> <option v-for="item in staffOptions.customers" :key="item.id" :value="item.id">
{{ item.name }} {{ item.name }}
@ -1412,7 +1412,7 @@
createApp({ createApp({
setup() { setup() {
// 基础URL配置 // 基础URL配置
const BASE_URL = 'https://backend.jjsos.cn/'; const BASE_URL = 'http://backend.jjdev.cn/';
const searchParams = reactive({ const searchParams = reactive({
province: '', province: '',
@ -1458,6 +1458,7 @@
// 司机搜索结果 // 司机搜索结果
const driverSearchResults = ref([]); const driverSearchResults = ref([]);
let driverSearchTimer = null; let driverSearchTimer = null;
const allOnlineDrivers = ref([]);
const kpiList = ref([ const kpiList = ref([
{ value: '-', label: '司机数', isDriver: true }, { value: '-', label: '司机数', isDriver: true },
@ -1621,7 +1622,7 @@
const fetchFollowUpCount = async (driverTotal) => { const fetchFollowUpCount = async (driverTotal) => {
try { try {
const res = await axios.get('http://sos.chat.cn/src/getChatDriverCount.php'); const res = await axios.get('https://test-chat.jjsos.cn/src/getChatDriverCount.php');
let count = null; let count = null;
if (Array.isArray(res.data) && res.data.length > 0 && res.data[0].driver_count !== undefined) { if (Array.isArray(res.data) && res.data.length > 0 && res.data[0].driver_count !== undefined) {
count = Number(res.data[0].driver_count); count = Number(res.data[0].driver_count);
@ -1641,26 +1642,64 @@
} }
}; };
// 获取在线沟通数据
const fetchOnlineChatData = async () => { const fetchOnlineChatData = async () => {
try { try {
const res = await axios.get('https://sos-chat.jjsos.cn/src/getUnChatCount.php'); const res = await axios.get('https://test-chat.jjsos.cn/src/getUnChatCount.php');
if (res.data) { if (res.data) {
const onlineTask = taskList.value.find(task => task.type === 'online'); const onlineTask = taskList.value.find(task => task.type === 'online');
if (onlineTask) { if (onlineTask) {
// 更新在线沟通的案件数 allOnlineDrivers.value = Array.isArray(res.data.drivers) ? res.data.drivers : [];
onlineTask.count = res.data.total_drivers || 0; onlineTask.listData = allOnlineDrivers.value.slice();
// 更新在线沟通的列表数据 onlineTask.count = res.data.total_drivers || allOnlineDrivers.value.length || 0;
onlineTask.listData = res.data.drivers || [];
} }
console.log('在线沟通数据:', res.data.total_drivers, '条'); console.log('在线沟通数据:', res.data.total_drivers, '条');
if (searchParams.belongKefu) {
await filterOnlineDriversByKefu(searchParams.belongKefu);
}
} }
} catch (error) { } catch (error) {
console.error('Error fetching online chat data:', error); console.error('Error fetching online chat data:', error);
} }
}; };
const filterOnlineDriversByKefu = async (csId) => {
const onlineTask = taskList.value.find(task => task.type === 'online');
if (!onlineTask) return;
if (!csId) {
onlineTask.listData = allOnlineDrivers.value.slice();
onlineTask.count = onlineTask.listData.length;
if (activeTaskType.value === 'online') {
handleTaskClick(onlineTask);
}
return;
}
try {
const res = await axios.get(BASE_URL + 'third-api/get-cs-driver', {
params: { cs_id: csId }
});
if (res.data && res.data.code === 200 && Array.isArray(res.data.data)) {
const allowedIds = new Set(res.data.data.map(String));
const filtered = allOnlineDrivers.value.filter(d => {
const id = d.driver_id || d.driverId || d.uid || d.id;
return allowedIds.has(String(id));
});
onlineTask.listData = filtered;
onlineTask.count = filtered.length;
} else {
onlineTask.listData = [];
onlineTask.count = 0;
}
if (activeTaskType.value === 'online') {
handleTaskClick(onlineTask);
}
} catch (error) {
console.error('Error filtering online drivers by cs:', error);
}
};
// 方法定义 // 方法定义
const fetchInitialData = async () => { const fetchInitialData = async () => {
try { try {
@ -2156,6 +2195,10 @@
window.open(url, '_blank'); window.open(url, '_blank');
}; };
const handleKefuChange = () => {
filterOnlineDriversByKefu(searchParams.belongKefu);
};
// 格式化复议情况 // 格式化复议情况
const formatReviewStatus = (type, typeId) => { const formatReviewStatus = (type, typeId) => {
if (type == 1) { if (type == 1) {
@ -2519,6 +2562,7 @@
handleTableScroll, handleTableScroll,
formatReviewStatus, formatReviewStatus,
openAppealDetail, openAppealDetail,
handleKefuChange,
handleTaskClick, handleTaskClick,
openChatWindow, openChatWindow,
exportData, exportData,