fix: 桌面端编辑时客户名称显示UUID的问题
WorkPlans/MiniBusiness/KeyVisits/ManagerWorkspace 四个页面的 openEdit 均直接 spread item 到 form,未确保客户在 el-select 选项列表中。修复:编辑前检查并补充客户到 customers 列表。 Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -45,6 +45,19 @@ const filteredItems = computed(() => {
|
||||
return list
|
||||
})
|
||||
|
||||
// ── Three-level sort: urgency → planned_date → manager pinyin ──
|
||||
const urgencyWeight: Record<string, number> = { '紧急': 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) {
|
||||
</div>
|
||||
|
||||
<el-card>
|
||||
<el-table :data="filteredItems" stripe size="small" v-if="filteredItems.length" v-column-resize>
|
||||
<el-table :data="sortedItems" stripe size="small" v-if="sortedItems.length" v-column-resize>
|
||||
<el-table-column type="index" label="序号" width="50" />
|
||||
<el-table-column prop="customer_name" label="客户" width="160">
|
||||
<template #default="{ row }">
|
||||
|
||||
@@ -104,6 +104,9 @@ function openCreate(type: string) {
|
||||
function openEdit(type: string, item: any) {
|
||||
dialogMode.value = 'edit'; dialogType.value = type
|
||||
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 })
|
||||
}
|
||||
dialogTimeRange.value = null
|
||||
if ((type === 'visit' || type === 'note') && item.time_range && item.time_range.includes('-')) {
|
||||
const parts = item.time_range.split('-')
|
||||
|
||||
@@ -93,6 +93,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 })
|
||||
}
|
||||
dialogVisible.value = true
|
||||
}
|
||||
|
||||
|
||||
@@ -94,6 +94,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 })
|
||||
}
|
||||
dialogVisible.value = true
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user