diff --git a/frontend/src/views/desktop/CustomerManage.vue b/frontend/src/views/desktop/CustomerManage.vue index b163b02..d64c171 100644 --- a/frontend/src/views/desktop/CustomerManage.vue +++ b/frontend/src/views/desktop/CustomerManage.vue @@ -25,6 +25,54 @@ const indivPlans = ref([]) const indivMini = ref([]) const indivKeyVisits = ref([]) const indivLoading = ref(false) + +// Individual record edit +const indivEditVisible = ref(false) +const indivEditType = ref('') +const indivEditForm = ref({}) +const indivEditSaving = ref(false) + +function openIndivEdit(type: string, row: any) { + indivEditType.value = type + indivEditForm.value = { ...row } + indivEditVisible.value = true +} + +async function handleIndivEditSave() { + indivEditSaving.value = true + try { + const type = indivEditType.value + const f = indivEditForm.value + if (type === 'visit') { + await api.put(`/visits/${f.id}`, { communication_content: f.communication_content, visitor_name: f.visitor_name }) + } else if (type === 'plan') { + await api.put(`/work-plans/${f.id}`, { plan_content: f.plan_content, status: f.status }) + } else if (type === 'mini') { + await api.put(`/mini-business/${f.id}`, { product_type: f.product_type, amount: f.amount, follow_up_detail: f.follow_up_detail, status: f.status }) + } else if (type === 'key') { + await api.put(`/key-visits/${f.id}`, { description: f.description }) + } + ElMessage.success('已更新') + indivEditVisible.value = false + loadIndividualData() + } catch (e: any) { ElMessage.error('保存失败') } + finally { indivEditSaving.value = false } +} + +async function handleIndivEditDelete() { + try { + await ElMessageBox.confirm('确定删除?', '确认', { type: 'warning' }) + const type = indivEditType.value + const id = indivEditForm.value.id + if (type === 'visit') await api.delete(`/visits/${id}`) + else if (type === 'plan') await api.delete(`/work-plans/${id}`) + else if (type === 'mini') await api.delete(`/mini-business/${id}`) + else if (type === 'key') await api.delete(`/key-visits/${id}`) + ElMessage.success('已删除') + indivEditVisible.value = false + loadIndividualData() + } catch (e: any) { if (e !== 'cancel') ElMessage.error('删除失败') } +} const currentPage = ref(1) const pageSize = ref(25) const total = ref(0) @@ -384,6 +432,7 @@ async function handleImport() { +
暂无拜访记录
@@ -393,6 +442,7 @@ async function handleImport() { +
暂无工作计划
@@ -403,6 +453,7 @@ async function handleImport() { +
暂无商机记录
@@ -412,6 +463,7 @@ async function handleImport() { +
暂不要客记录
@@ -628,6 +680,34 @@ async function handleImport() { + + + + + + + + + + +