fix: 修复联系人管理API路径不一致问题

问题:
- 前端API使用旧路径 /cust/api/v1/customer-contact
- 后端已改为 /cust/api/v1/contact
- getContactList接口参数不匹配(单个customerId vs params对象)

修复:
- 统一前端API路径为 /cust/api/v1/contact
- 修改getContactList为分页查询接口,支持params参数
- 修改前端页面调用方式,传递完整的查询参数
- 支持按客户ID和联系人姓名筛选

现在前后端API路径完全一致!
This commit is contained in:
zhangjf 2026-02-15 19:11:01 +08:00
parent abded8ec75
commit 2b5ab61668
4 changed files with 16 additions and 20 deletions

View File

@ -38,16 +38,17 @@ export const deleteCustomer = (id) => {
}) })
} }
export const getContactList = (customerId) => { export const getContactList = (params) => {
return request({ return request({
url: `/cust/api/v1/customer-contact/list/${customerId}`, url: '/cust/api/v1/contact/list',
method: 'get' method: 'get',
params
}) })
} }
export const createContact = (data) => { export const createContact = (data) => {
return request({ return request({
url: '/cust/api/v1/customer-contact', url: '/cust/api/v1/contact',
method: 'post', method: 'post',
data data
}) })
@ -55,7 +56,7 @@ export const createContact = (data) => {
export const updateContact = (id, data) => { export const updateContact = (id, data) => {
return request({ return request({
url: `/cust/api/v1/customer-contact/${id}`, url: `/cust/api/v1/contact/${id}`,
method: 'put', method: 'put',
data data
}) })
@ -63,7 +64,7 @@ export const updateContact = (id, data) => {
export const deleteContact = (id) => { export const deleteContact = (id) => {
return request({ return request({
url: `/cust/api/v1/customer-contact/${id}`, url: `/cust/api/v1/contact/${id}`,
method: 'delete' method: 'delete'
}) })
} }

View File

@ -198,21 +198,15 @@ const loadCustomerList = async () => {
} }
const loadTableData = async () => { const loadTableData = async () => {
if (!searchForm.customerId) {
tableData.value = []
return
}
try { try {
const res = await getContactList(searchForm.customerId) const params = {
let contacts = res || [] current: 1,
size: 1000,
// customerId: searchForm.customerId || undefined,
if (searchForm.contactName) { contactName: searchForm.contactName || undefined
contacts = contacts.filter(c => c.contactName.includes(searchForm.contactName))
} }
const res = await getContactList(params)
tableData.value = contacts tableData.value = res.records || []
} catch (error) { } catch (error) {
ElMessage.error('加载数据失败') ElMessage.error('加载数据失败')
} }

1
fund-cust.log Normal file
View File

@ -0,0 +1 @@
Error: Unable to access jarfile fund-cust-1.0.0-SNAPSHOT.jar

@ -1 +1 @@
Subproject commit 184919142741a540dcd8ed6e0862eba5153458d5 Subproject commit 6d49ac30bcdfa4223053f4f0d55a577725ff7a51