diff --git a/frontend/src/views/desktop/KeyVisits.vue b/frontend/src/views/desktop/KeyVisits.vue index 2f28885..3bfb9a4 100644 --- a/frontend/src/views/desktop/KeyVisits.vue +++ b/frontend/src/views/desktop/KeyVisits.vue @@ -45,6 +45,19 @@ const filteredItems = computed(() => { return list }) +// ── Three-level sort: urgency → planned_date → manager pinyin ── +const urgencyWeight: Record = { '紧急': 0, '重要': 1, '普通': 2 } + +const sortedItems = computed(() => { + return [...filteredItems.value].sort((a: any, b: any) => { + const ua = urgencyWeight[a.urgency_level] ?? 3 + const ub = urgencyWeight[b.urgency_level] ?? 3 + if (ua !== ub) return ua - ub + if (a.planned_date !== b.planned_date) return (a.planned_date || '').localeCompare(b.planned_date || '') + return (a.manager_name || '').localeCompare(b.manager_name || '', 'zh-CN') + }) +}) + function resetFilters() { filterManager.value = '' filterStatus.value = '' @@ -103,6 +116,9 @@ function openCreate() { function openEdit(item: any) { dialogMode.value = 'edit' form.value = { ...item } + if (item.customer_id && item.customer_name && !customers.value.find((c: any) => c.id === item.customer_id)) { + customers.value.unshift({ id: item.customer_id, name: item.customer_name }) + } plannedVisitors.value = item.planned_visitor ? item.planned_visitor.split('、') : [] dialogVisible.value = true } @@ -200,7 +216,7 @@ async function quickStatusChange(row: any, newStatus: string) { - +