批量更新功能
This commit is contained in:
1 parent
6f106e43af
commit
a26c98b92b
79 files changed
+4529
-724
No files matched your search
@@ -81,6 +81,10 @@
|
||||
<el-table-column label="客户名称" min-width="200" show-overflow-tooltip>
|
||||
<template #default="{ row }">
|
||||
<span class="name-link" @click="openDetail(row)">{{ row.customer_name }}</span>
|
||||
<!-- 同一家单位可能既是客户又是供应商(已建供应商档案) -->
|
||||
<el-tag v-if="row.also_supplier" size="small" type="warning" effect="plain" style="margin-left: 6px">
|
||||
也是供应商
|
||||
</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="类型" width="110" align="center">
|
||||
@@ -111,10 +115,11 @@
|
||||
<el-table-column label="更新时间" width="160" align="center">
|
||||
<template #default="{ row }">{{ formatDateTime(row.update_time) }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" width="280" align="center" fixed="right">
|
||||
<el-table-column label="操作" width="350" align="center" fixed="right">
|
||||
<template #default="{ row }">
|
||||
<el-button link type="primary" size="small" @click="openEdit(row)">编辑</el-button>
|
||||
<el-button link type="primary" size="small" @click="openContact(row)">联系人</el-button>
|
||||
<el-button link type="success" size="small" @click="handleConvertSupplier(row)">转为供应商</el-button>
|
||||
<el-button link type="warning" size="small" @click="openMovePool([row])">移入公海</el-button>
|
||||
<el-button link type="danger" size="small" @click="handleDelete(row)">删除</el-button>
|
||||
</template>
|
||||
@@ -151,6 +156,10 @@
|
||||
size="700px"
|
||||
>
|
||||
<div v-if="detailData" class="detail-content">
|
||||
<div class="detail-actions">
|
||||
<el-button type="success" size="small" @click="handleConvertSupplier(detailData)">转为供应商</el-button>
|
||||
<span class="detail-actions-tip">同一家单位可能既是客户又是供应商,转化后原客户记录保留</span>
|
||||
</div>
|
||||
<el-descriptions title="基本信息" :column="2" border size="small">
|
||||
<el-descriptions-item label="客户名称" :span="2">
|
||||
{{ detailData.customer_name }}
|
||||
@@ -254,12 +263,14 @@
|
||||
</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="mobile" label="手机号" width="130" />
|
||||
<el-table-column prop="department" label="部门" width="120" show-overflow-tooltip />
|
||||
<el-table-column prop="position" label="职位" width="130" show-overflow-tooltip />
|
||||
<el-table-column label="手机号" width="170" show-overflow-tooltip>
|
||||
<template #default="{ row }">{{ formatMobiles(row.mobiles) || row.mobile || "-" }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="email" label="邮箱" min-width="180" show-overflow-tooltip />
|
||||
<el-table-column prop="wechat" label="微信" width="120" show-overflow-tooltip />
|
||||
<el-table-column prop="qq" label="QQ" width="110" show-overflow-tooltip />
|
||||
<el-table-column prop="department" label="部门" width="120" show-overflow-tooltip />
|
||||
<el-table-column prop="position" label="职位" width="130" show-overflow-tooltip />
|
||||
<el-table-column label="操作" width="120" align="center" fixed="right">
|
||||
<template #default="{ row }">
|
||||
<el-button link type="primary" size="small" @click="openContactEdit(row)">编辑</el-button>
|
||||
@@ -323,6 +334,7 @@ import {
|
||||
getCrmCustomerList,
|
||||
deleteCrmCustomer,
|
||||
moveToPool,
|
||||
convertCustomerToSupplier,
|
||||
} from "@/api/crm";
|
||||
import { listContacts, deleteContact } from "@/api/contact";
|
||||
import CustomerEdit from "./components/edit.vue";
|
||||
@@ -341,6 +353,7 @@ import {
|
||||
statusTag,
|
||||
formatDate,
|
||||
formatDateTime,
|
||||
formatMobiles,
|
||||
} from "../dict";
|
||||
|
||||
const loading = ref(false);
|
||||
@@ -465,6 +478,35 @@ async function handleDelete(row) {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 客户转供应商:把客户的企业资料与联系人复制一套到供应商库。
|
||||
* 同一家单位可能既是客户又是供应商,原客户记录保留;供应商库已有同名企业时只补同步联系人,不重复建档。
|
||||
*/
|
||||
async function handleConvertSupplier(row) {
|
||||
try {
|
||||
await ElMessageBox.confirm(
|
||||
`将客户「${row.customer_name}」的企业资料与联系人复制一套到供应商库?原客户记录会保留,可在供应商管理中继续完善。`,
|
||||
"转为供应商",
|
||||
{ type: "warning", confirmButtonText: "确认转化" }
|
||||
);
|
||||
} catch (e) {
|
||||
return; // 取消
|
||||
}
|
||||
try {
|
||||
const res = await convertCustomerToSupplier(row.id);
|
||||
const data = res?.data || {};
|
||||
const c = data.contacts || {};
|
||||
ElMessage.success(
|
||||
data.existed
|
||||
? `供应商库已有同名企业,已同步联系人(新增 ${c.inserted || 0}、补充 ${c.merged || 0}),未重复建档`
|
||||
: `已转为供应商,并同步联系人(新增 ${c.inserted || 0})`
|
||||
);
|
||||
fetchList();
|
||||
} catch (e) {
|
||||
ElMessage.error(e.message || "转化失败");
|
||||
}
|
||||
}
|
||||
|
||||
/* ------------------------------ 联系人 ------------------------------ */
|
||||
async function openContact(row) {
|
||||
currentRow.value = { ...row };
|
||||
@@ -621,6 +663,18 @@ async function submitMovePool() {
|
||||
.detail-content {
|
||||
padding: 4px 8px;
|
||||
|
||||
.detail-actions {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 10px;
|
||||
margin-bottom: 16px;
|
||||
}
|
||||
|
||||
.detail-actions-tip {
|
||||
font-size: 12px;
|
||||
color: var(--el-text-color-secondary);
|
||||
}
|
||||
|
||||
:deep(.el-descriptions__label) {
|
||||
width: 130px;
|
||||
min-width: 130px;
|
||||
|
||||
Reference in new issue
Block a user