feat: 实现任务管理功能并优化界面显示
- 添加任务列表获取和状态更新API调用 - 修改任务列表组件显示格式和状态标签 - 优化日期格式化处理逻辑 - 调整任务列表样式和交互效果 - 注释掉部分不需要的API调用
This commit is contained in:
@@ -158,8 +158,7 @@ import DataDetail from "./components/DataDetail.vue";
|
||||
import CampManagement from "./components/CampManagement.vue";
|
||||
import DetailedDataTable from "./components/DetailedDataTable.vue";
|
||||
import { getOverallCompanyPerformance,getCompanyDepositConversionRate,getCompanyTotalCallCount,getCompanyNewCustomer,getCompanyConversionRate,getCompanyRealTimeProgress
|
||||
,getCompanyConversionRateVsLast,getSalesMonthlyPerformance,getCustomerTypeDistribution,getUrgentNeedToAddress,getLevelTree,getDetailedDataTable,assignTasks
|
||||
} from "@/api/top";
|
||||
,getCompanyConversionRateVsLast,getSalesMonthlyPerformance,getCustomerTypeDistribution,getUrgentNeedToAddress,getLevelTree,getDetailedDataTable,assignTasks } from "@/api/top";
|
||||
|
||||
const rankingPeriod = ref("month");
|
||||
const rankingData = ref([
|
||||
@@ -187,6 +186,101 @@ const newTask = reactive({
|
||||
deadline: "",
|
||||
description: "",
|
||||
});
|
||||
// 获取任务列表
|
||||
const getTaskList = async () => {
|
||||
try {
|
||||
const res = await axios.post('http://192.168.15.56:8890/api/v1/level_five/overview/view_tasks', {}, {
|
||||
headers: {
|
||||
'Authorization': 'Bearer ' + localStorage.getItem('token')
|
||||
}
|
||||
})
|
||||
console.log(888888,res)
|
||||
if (res.data.code === 200) {
|
||||
const apiTasks = res.data.data.tasks || res.data.data
|
||||
// 将API数据格式转换为TaskList组件期望的格式
|
||||
tasks.value = apiTasks.map(task => ({
|
||||
id: task.task_id,
|
||||
title: task.task_title,
|
||||
assignee: task.assignee || '未分配',
|
||||
deadline: task.expiration_date,
|
||||
status: task.state === '待处理' ? 'pending' : task.state === '正在处理' ? 'in-progress' : 'completed',
|
||||
description: task.task_content,
|
||||
created_at: task.created_at
|
||||
}))
|
||||
console.log(777777,tasks.value)
|
||||
/**
|
||||
* tasks
|
||||
:
|
||||
[,…]
|
||||
0
|
||||
:
|
||||
{task_id: "1755748690560728_22d55cc618784537973481228a15956a", task_title: "55", task_content: "222",…}
|
||||
created_at
|
||||
:
|
||||
"2025-08-21 11:58:10"
|
||||
expiration_date
|
||||
:
|
||||
"20250808"
|
||||
state
|
||||
:
|
||||
"待处理"
|
||||
task_content
|
||||
:
|
||||
"222"
|
||||
task_id
|
||||
:
|
||||
"1755748690560728_22d55cc618784537973481228a15956a"
|
||||
task_title
|
||||
:
|
||||
"55"
|
||||
1
|
||||
:
|
||||
{task_id: "1755745331126891_650206e5b6d345699de3e3e406a2600e", task_title: "测试任务",…}
|
||||
created_at
|
||||
:
|
||||
"2025-08-21 11:02:11"
|
||||
expiration_date
|
||||
:
|
||||
"121221"
|
||||
state
|
||||
:
|
||||
"待处理"
|
||||
task_content
|
||||
:
|
||||
"测试任务"
|
||||
task_id
|
||||
:
|
||||
"1755745331126891_650206e5b6d345699de3e3e406a2600e"
|
||||
task_title
|
||||
:
|
||||
"测试任务"
|
||||
2
|
||||
:
|
||||
{task_id: "1755745330094989_528dd87dc13a4a5bb33c9c272fb1a482", task_title: "测试任务",…}
|
||||
created_at
|
||||
:
|
||||
"2025-08-21 11:02:10"
|
||||
expiration_date
|
||||
:
|
||||
"121221"
|
||||
state
|
||||
:
|
||||
"已完成"
|
||||
task_content
|
||||
:
|
||||
"测试任务"
|
||||
task_id
|
||||
:
|
||||
"1755745330094989_528dd87dc13a4a5bb33c9c272fb1a482"
|
||||
task_title
|
||||
:
|
||||
"测试任务"
|
||||
*/
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('获取任务列表失败:', error)
|
||||
}
|
||||
}
|
||||
// 下拉框人员
|
||||
const assigneeOptions = ref([]);
|
||||
async function name() {
|
||||
@@ -203,34 +297,6 @@ async function name() {
|
||||
} catch (error) {
|
||||
console.error('获取下属人员列表失败:', error);
|
||||
}
|
||||
/**
|
||||
* "data": [
|
||||
{
|
||||
"name": "程琦",
|
||||
"wechat_id": "1688856301330784"
|
||||
},
|
||||
{
|
||||
"name": "潘加俊",
|
||||
"wechat_id": "1688855836721980"
|
||||
},
|
||||
{
|
||||
"name": "伍晶晶",
|
||||
"wechat_id": "1688854476805987"
|
||||
},
|
||||
{
|
||||
"name": "张三丰",
|
||||
"wechat_id": "1212345648513"
|
||||
},
|
||||
{
|
||||
"name": "朱一航",
|
||||
"wechat_id": "1212345648513"
|
||||
},
|
||||
{
|
||||
"name": "王卓琳",
|
||||
"wechat_id": "1212345648513"
|
||||
}
|
||||
]
|
||||
*/
|
||||
}
|
||||
// 计算属性
|
||||
const filteredTableData = computed(() => {
|
||||
@@ -329,7 +395,17 @@ const formatTime = (timestamp) => {
|
||||
};
|
||||
|
||||
const formatDate = (dateString) => {
|
||||
return new Date(dateString).toLocaleDateString("zh-CN");
|
||||
if (!dateString) return '';
|
||||
// 处理 "2025-08-21 11:58:10" 格式的时间字符串
|
||||
try {
|
||||
const date = new Date(dateString.replace(' ', 'T'));
|
||||
if (isNaN(date.getTime())) {
|
||||
return dateString; // 如果解析失败,返回原字符串
|
||||
}
|
||||
return date.toLocaleDateString("zh-CN");
|
||||
} catch (error) {
|
||||
return dateString;
|
||||
}
|
||||
};
|
||||
|
||||
const formatDuration = (minutes) => {
|
||||
@@ -643,6 +719,7 @@ onMounted(async() => {
|
||||
// 页面初始化逻辑
|
||||
await getRealTimeProgress()
|
||||
await getTotalDeals()
|
||||
await getTaskList()
|
||||
await getConversionComparison('month')
|
||||
await getCompanySalesRank('red')
|
||||
await getCustomerTypeRatio('child_education')
|
||||
|
||||
Reference in New Issue
Block a user