This commit is contained in:
zlwu committed 2026-06-06 19:44:18 +08:00
1 parent dacfdc9ff6
commit f9676f8759
906 files changed
+533306 -12946

No files matched your search

+79 -49
View File
@@ -34,46 +34,47 @@
</el-form>
<!-- 联系人列表 -->
<el-table
v-if="customerId"
v-loading="loading"
:data="contactList"
@current-change="handleCurrentChange"
:max-height="400"
border
highlight-current-row
>
<el-table-column type="index" label="序号" width="60" align="center" />
<el-table-column label="联系人姓名" prop="contactName" min-width="150" :show-overflow-tooltip="true">
<template #default="scope">
<div style="display: flex; align-items: center">
<span style="margin-right: 5px">{{ scope.row.contactName }}</span>
<el-tag v-if="scope.row.isPrimary === 1" type="success" size="small" style="margin-right: 5px">主要</el-tag>
<el-tag v-if="scope.row.isKey === 1" type="warning" size="small">决策人</el-tag>
</div>
</template>
</el-table-column>
<el-table-column label="性别" prop="gender" width="80" align="center">
<template #default="scope">
<DictTag dict-type="crm_contact_gender" :value="scope.row.gender" />
</template>
</el-table-column>
<el-table-column label="手机号码" prop="mobile" width="130" />
<el-table-column label="邮箱" prop="email" width="180" :show-overflow-tooltip="true" />
<el-table-column label="部门" prop="department" width="120" :show-overflow-tooltip="true" />
<el-table-column label="职位" prop="position" width="120" :show-overflow-tooltip="true" />
</el-table>
<div v-if="customerId" class="panel dialog-list-panel">
<div class="list-body list-wrap dialog-list-body-only">
<el-table
v-loading="loading"
:data="contactList"
class="list-table"
stripe
highlight-current-row
@current-change="handleCurrentChange"
:max-height="400"
>
<el-table-column type="index" label="序号" min-width="60" align="center" header-align="center" />
<el-table-column label="联系人姓名" prop="contactName" min-width="150" align="center" header-align="center" :show-overflow-tooltip="true">
<template #default="scope">
<div class="contact-name-cell">
<span>{{ scope.row.contactName }}</span>
<el-tag v-if="scope.row.isPrimary === 1" type="success" size="small">主要</el-tag>
<el-tag v-if="scope.row.isKey === 1" type="warning" size="small">决策人</el-tag>
</div>
</template>
</el-table-column>
<el-table-column label="性别" prop="gender" min-width="80" align="center" header-align="center">
<template #default="scope">
<DictTag dict-type="crm_contact_gender" :value="scope.row.gender" />
</template>
</el-table-column>
<el-table-column label="手机号码" prop="mobile" min-width="130" align="center" header-align="center" />
<el-table-column label="邮箱" prop="email" min-width="180" align="center" header-align="center" :show-overflow-tooltip="true" />
<el-table-column label="部门" prop="department" min-width="120" align="center" header-align="center" :show-overflow-tooltip="true" />
<el-table-column label="职位" prop="position" min-width="120" align="center" header-align="center" :show-overflow-tooltip="true" />
</el-table>
<!-- 分页 -->
<ListPagination
v-if="customerId"
v-show="total > 0"
:total="total"
v-model:page="queryParams.pageNum"
v-model:limit="queryParams.pageSize"
@pagination="getList"
class="mt-3"
/>
<ListPagination
v-show="total > 0"
:total="total"
v-model:page="queryParams.pageNum"
v-model:limit="queryParams.pageSize"
@pagination="getList"
/>
</div>
</div>
<!-- 当前选中联系人 -->
<template v-if="currentContact">
@@ -132,6 +133,7 @@ watch(
dialogVisible.value = val
if (val && props.customerId) {
await dictStore.loadAllDict()
resetQueryParams()
getList()
}
}
@@ -166,28 +168,34 @@ const total = ref(0)
const currentContact = ref<ContactVO | null>(null)
const queryFormRef = ref<ElFormInstance>()
const resetQueryParams = () => {
queryParams.value.pageNum = 1
queryParams.value.contactName = undefined
queryParams.value.mobile = undefined
queryParams.value.position = undefined
queryFormRef.value?.resetFields()
}
const getList = async () => {
if (!props.customerId) {
contactList.value = []
total.value = 0
return
}
loading.value = true
try {
queryParams.value.customerId = props.customerId
const keyword = [queryParams.value.contactName, queryParams.value.mobile, queryParams.value.position]
.filter(Boolean)
.join(' ')
.trim()
const res = await fetchContactList({
page: queryParams.value.pageNum,
pageSize: queryParams.value.pageSize,
customerId: String(props.customerId),
keyword: keyword || undefined
contactName: queryParams.value.contactName?.trim() || undefined,
mobile: queryParams.value.mobile?.trim() || undefined,
position: queryParams.value.position?.trim() || undefined
})
const data = (res as any)?.list ?? (res as any)?.rows ?? (res as any)?.data?.list ?? []
contactList.value = data
total.value = (res as any)?.total ?? (res as any)?.data?.total ?? data.length
contactList.value = res.list || res.rows || []
total.value = res.total ?? 0
} catch (error) {
console.error('获取联系人列表失败:', error)
} finally {
@@ -201,10 +209,24 @@ const handleQuery = () => {
}
const resetQuery = () => {
queryFormRef.value?.resetFields()
handleQuery()
resetQueryParams()
getList()
}
watchDebounced(
() => ({
contactName: queryParams.value.contactName,
mobile: queryParams.value.mobile,
position: queryParams.value.position
}),
() => {
if (!props.customerId) return
queryParams.value.pageNum = 1
getList()
},
{ debounce: 300, deep: true }
)
const handleCurrentChange = (row: ContactVO) => {
currentContact.value = row
}
@@ -243,4 +265,12 @@ const handleClose = () => {
.form-buttons-right {
margin-left: auto !important;
}
.contact-name-cell {
display: flex;
align-items: center;
justify-content: center;
flex-wrap: wrap;
gap: 5px;
}
</style>