fix: 客户列表查询失败问题修复

**问题根因:**
1. PageResult返回字段list与前端期望records不一致
2. CustomerVO字段名与前端期望不一致

**修改内容:**
- fund-common: PageResult字段list改为records
- fund-cust: CustomerVO字段id改为customerId
- fund-mobile: 客户列表页面字段对齐
- fund-admin: 客户管理页面字段对齐
This commit is contained in:
zhangjf 2026-02-23 13:26:07 +08:00
parent 011a6bfb3f
commit 9b545b3f00
5 changed files with 60 additions and 85 deletions

View File

@ -31,24 +31,18 @@
<el-table :data="tableData" v-loading="loading" border stripe>
<el-table-column prop="customerId" label="客户ID" width="80" />
<el-table-column prop="customerCode" label="客户编码" width="120" />
<el-table-column prop="customerName" label="客户名称" min-width="150" />
<el-table-column prop="customerType" label="客户类型" width="100">
<template #default="{ row }">
<el-tag v-if="row.customerType === 'ENTERPRISE'" type="primary">企业</el-tag>
<el-tag v-else type="success">个人</el-tag>
</template>
</el-table-column>
<el-table-column prop="contactPerson" label="联系人" width="120" />
<el-table-column prop="contactPhone" label="联系电话" width="140" />
<el-table-column prop="contact" label="联系人" width="120" />
<el-table-column prop="phone" label="联系电话" width="140" />
<el-table-column prop="email" label="邮箱" min-width="180" show-overflow-tooltip />
<el-table-column prop="address" label="地址" min-width="200" show-overflow-tooltip />
<el-table-column prop="status" label="状态" width="80">
<template #default="{ row }">
<el-tag v-if="row.status === 'NORMAL'" type="success">正常</el-tag>
<el-tag v-if="row.status === 1" type="success">启用</el-tag>
<el-tag v-else type="danger">禁用</el-tag>
</template>
</el-table-column>
<el-table-column prop="createTime" label="创建时间" width="160" />
<el-table-column label="操作" width="280" fixed="right">
<template #default="{ row }">
<el-button link type="primary" :icon="View" @click="handleView(row)">详情</el-button>
@ -81,29 +75,26 @@
<el-form :model="form" :rules="rules" ref="formRef" label-width="100px">
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="客户名称" prop="customerName">
<el-input v-model="form.customerName" placeholder="请输入客户名称" />
<el-form-item label="客户编码" prop="customerCode">
<el-input v-model="form.customerCode" placeholder="请输入客户编码" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="客户类型" prop="customerType">
<el-select v-model="form.customerType" placeholder="请选择" style="width: 100%">
<el-option label="企业" value="ENTERPRISE" />
<el-option label="个人" value="INDIVIDUAL" />
</el-select>
<el-form-item label="客户名称" prop="customerName">
<el-input v-model="form.customerName" placeholder="请输入客户名称" />
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="联系人" prop="contactPerson">
<el-input v-model="form.contactPerson" placeholder="请输入联系人" />
<el-form-item label="联系人" prop="contact">
<el-input v-model="form.contact" placeholder="请输入联系人" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="联系电话" prop="contactPhone">
<el-input v-model="form.contactPhone" placeholder="请输入联系电话" />
<el-form-item label="联系电话" prop="phone">
<el-input v-model="form.phone" placeholder="请输入联系电话" />
</el-form-item>
</el-col>
</el-row>
@ -117,8 +108,8 @@
<el-col :span="12">
<el-form-item label="状态" prop="status">
<el-radio-group v-model="form.status">
<el-radio value="NORMAL">正常</el-radio>
<el-radio value="DISABLED">禁用</el-radio>
<el-radio :value="1">启用</el-radio>
<el-radio :value="0">禁用</el-radio>
</el-radio-group>
</el-form-item>
</el-col>
@ -128,8 +119,8 @@
<el-input v-model="form.address" placeholder="请输入地址" />
</el-form-item>
<el-form-item label="备注" prop="remarks">
<el-input v-model="form.remarks" type="textarea" :rows="3" placeholder="请输入备注" />
<el-form-item label="备注" prop="remark">
<el-input v-model="form.remark" type="textarea" :rows="3" placeholder="请输入备注" />
</el-form-item>
</el-form>
@ -143,21 +134,17 @@
<el-dialog title="客户详情" v-model="detailVisible" width="700px">
<el-descriptions :column="2" border>
<el-descriptions-item label="客户ID">{{ detailData.customerId }}</el-descriptions-item>
<el-descriptions-item label="客户编码">{{ detailData.customerCode }}</el-descriptions-item>
<el-descriptions-item label="客户名称">{{ detailData.customerName }}</el-descriptions-item>
<el-descriptions-item label="客户类型">
<el-tag v-if="detailData.customerType === 'ENTERPRISE'" type="primary">企业</el-tag>
<el-tag v-else type="success">个人</el-tag>
</el-descriptions-item>
<el-descriptions-item label="状态">
<el-tag v-if="detailData.status === 'NORMAL'" type="success">正常</el-tag>
<el-tag v-if="detailData.status === 1" type="success">启用</el-tag>
<el-tag v-else type="danger">禁用</el-tag>
</el-descriptions-item>
<el-descriptions-item label="联系人">{{ detailData.contactPerson }}</el-descriptions-item>
<el-descriptions-item label="联系电话">{{ detailData.contactPhone }}</el-descriptions-item>
<el-descriptions-item label="联系人">{{ detailData.contact }}</el-descriptions-item>
<el-descriptions-item label="联系电话">{{ detailData.phone }}</el-descriptions-item>
<el-descriptions-item label="邮箱" :span="2">{{ detailData.email }}</el-descriptions-item>
<el-descriptions-item label="地址" :span="2">{{ detailData.address }}</el-descriptions-item>
<el-descriptions-item label="备注" :span="2">{{ detailData.remarks || '-' }}</el-descriptions-item>
<el-descriptions-item label="创建时间" :span="2">{{ detailData.createTime }}</el-descriptions-item>
<el-descriptions-item label="备注" :span="2">{{ detailData.remark || '-' }}</el-descriptions-item>
</el-descriptions>
</el-dialog>
</div>
@ -191,21 +178,21 @@ const formRef = ref<FormInstance>()
const form = reactive({
customerId: null as number | null,
customerCode: '',
customerName: '',
customerType: 'ENTERPRISE',
contactPerson: '',
contactPhone: '',
contact: '',
phone: '',
email: '',
address: '',
status: 'NORMAL',
remarks: ''
status: 1,
remark: ''
})
const rules = reactive<FormRules>({
customerCode: [{ required: true, message: '请输入客户编码', trigger: 'blur' }],
customerName: [{ required: true, message: '请输入客户名称', trigger: 'blur' }],
customerType: [{ required: true, message: '请选择客户类型', trigger: 'change' }],
contactPerson: [{ required: true, message: '请输入联系人', trigger: 'blur' }],
contactPhone: [
contact: [{ required: true, message: '请输入联系人', trigger: 'blur' }],
phone: [
{ required: true, message: '请输入联系电话', trigger: 'blur' },
{ pattern: /^1[3-9]\d{9}$/, message: '请输入正确的手机号', trigger: 'blur' }
],
@ -306,14 +293,14 @@ const handleSubmit = async () => {
const resetForm = () => {
form.customerId = null
form.customerCode = ''
form.customerName = ''
form.customerType = 'ENTERPRISE'
form.contactPerson = ''
form.contactPhone = ''
form.contact = ''
form.phone = ''
form.email = ''
form.address = ''
form.status = 'NORMAL'
form.remarks = ''
form.status = 1
form.remark = ''
formRef.value?.clearValidate()
}

View File

@ -12,7 +12,7 @@ import java.util.List;
* <li>pageNum当前页码 1 开始</li>
* <li>pageSize每页条数</li>
* <li>total总记录数</li>
* <li>list当前页数据列表</li>
* <li>records当前页数据列表</li>
* </ul>
*
* @param <T> 列表元素类型
@ -31,17 +31,17 @@ public class PageResult<T> implements Serializable {
private long total;
/** 当前页数据 */
private List<T> list;
private List<T> records;
public PageResult() {
this.list = Collections.emptyList();
this.records = Collections.emptyList();
}
public PageResult(long pageNum, long pageSize, long total, List<T> list) {
public PageResult(long pageNum, long pageSize, long total, List<T> records) {
this.pageNum = pageNum;
this.pageSize = pageSize;
this.total = total;
this.list = list != null ? list : Collections.emptyList();
this.records = records != null ? records : Collections.emptyList();
}
public long getPageNum() {
@ -68,11 +68,11 @@ public class PageResult<T> implements Serializable {
this.total = total;
}
public List<T> getList() {
return list;
public List<T> getRecords() {
return records;
}
public void setList(List<T> list) {
this.list = list;
public void setRecords(List<T> records) {
this.records = records;
}
}

View File

@ -122,7 +122,7 @@ public class CustomerServiceImpl implements CustomerService {
private CustomerVO convertToVO(Customer customer) {
CustomerVO vo = new CustomerVO();
vo.setId(customer.getId());
vo.setCustomerId(customer.getId());
vo.setCustomerCode(customer.getCustomerCode());
vo.setCustomerName(customer.getCustomerName());
vo.setContact(customer.getContact());

View File

@ -5,7 +5,7 @@ package com.fundplatform.cust.vo;
*/
public class CustomerVO {
private Long id;
private Long customerId;
private String customerCode;
private String customerName;
private String contact;
@ -15,12 +15,12 @@ public class CustomerVO {
private Integer status;
private String remark;
public Long getId() {
return id;
public Long getCustomerId() {
return customerId;
}
public void setId(Long id) {
this.id = id;
public void setCustomerId(Long customerId) {
this.customerId = customerId;
}
public String getCustomerCode() {

View File

@ -20,19 +20,19 @@
<div class="customer-avatar">{{ item.customerName?.charAt(0) || 'C' }}</div>
<div class="customer-info">
<div class="customer-name">{{ item.customerName }}</div>
<div class="customer-short">{{ item.customerShort || '-' }}</div>
<div class="customer-code">{{ item.customerCode || '-' }}</div>
</div>
<van-tag :type="getLevelType(item.level)">{{ getLevelText(item.level) }}</van-tag>
<van-tag :type="getStatusType(item.status)">{{ getStatusText(item.status) }}</van-tag>
</div>
<div class="customer-detail">
<div class="detail-item" v-if="item.contact">
<van-icon name="user-o" />
<span>{{ item.contact }}</span>
</div>
<div class="detail-item" v-if="item.phone">
<van-icon name="phone-o" />
<span>{{ item.phone }}</span>
</div>
<div class="detail-item" v-if="item.industry">
<van-icon name="cluster-o" />
<span>{{ item.industry }}</span>
</div>
</div>
</div>
</van-list>
@ -52,24 +52,12 @@ const list = ref<any[]>([])
const pageNum = ref(1)
const pageSize = 10
const getLevelType = (level: string): 'primary' | 'success' | 'warning' | 'danger' | 'default' => {
const map: Record<string, 'primary' | 'success' | 'warning' | 'danger' | 'default'> = {
'A': 'primary',
'B': 'success',
'C': 'warning',
'D': 'danger'
}
return map[level] || 'default'
const getStatusType = (status: number): 'primary' | 'success' | 'warning' | 'danger' | 'default' => {
return status === 1 ? 'success' : 'default'
}
const getLevelText = (level: string) => {
const map: Record<string, string> = {
'A': 'A类',
'B': 'B类',
'C': 'C类',
'D': 'D类'
}
return map[level] || '普通'
const getStatusText = (status: number) => {
return status === 1 ? '启用' : '禁用'
}
const loadData = async () => {
@ -162,7 +150,7 @@ const handleSearch = () => {
color: #333;
}
.customer-short {
.customer-code {
font-size: 13px;
color: #999;
margin-top: 2px;