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:
parent
011a6bfb3f
commit
9b545b3f00
@ -31,24 +31,18 @@
|
|||||||
|
|
||||||
<el-table :data="tableData" v-loading="loading" border stripe>
|
<el-table :data="tableData" v-loading="loading" border stripe>
|
||||||
<el-table-column prop="customerId" label="客户ID" width="80" />
|
<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="customerName" label="客户名称" min-width="150" />
|
||||||
<el-table-column prop="customerType" label="客户类型" width="100">
|
<el-table-column prop="contact" label="联系人" width="120" />
|
||||||
<template #default="{ row }">
|
<el-table-column prop="phone" label="联系电话" width="140" />
|
||||||
<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="email" label="邮箱" min-width="180" show-overflow-tooltip />
|
<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="address" label="地址" min-width="200" show-overflow-tooltip />
|
||||||
<el-table-column prop="status" label="状态" width="80">
|
<el-table-column prop="status" label="状态" width="80">
|
||||||
<template #default="{ row }">
|
<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>
|
<el-tag v-else type="danger">禁用</el-tag>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column prop="createTime" label="创建时间" width="160" />
|
|
||||||
<el-table-column label="操作" width="280" fixed="right">
|
<el-table-column label="操作" width="280" fixed="right">
|
||||||
<template #default="{ row }">
|
<template #default="{ row }">
|
||||||
<el-button link type="primary" :icon="View" @click="handleView(row)">详情</el-button>
|
<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-form :model="form" :rules="rules" ref="formRef" label-width="100px">
|
||||||
<el-row :gutter="20">
|
<el-row :gutter="20">
|
||||||
<el-col :span="12">
|
<el-col :span="12">
|
||||||
<el-form-item label="客户名称" prop="customerName">
|
<el-form-item label="客户编码" prop="customerCode">
|
||||||
<el-input v-model="form.customerName" placeholder="请输入客户名称" />
|
<el-input v-model="form.customerCode" placeholder="请输入客户编码" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="12">
|
<el-col :span="12">
|
||||||
<el-form-item label="客户类型" prop="customerType">
|
<el-form-item label="客户名称" prop="customerName">
|
||||||
<el-select v-model="form.customerType" placeholder="请选择" style="width: 100%">
|
<el-input v-model="form.customerName" placeholder="请输入客户名称" />
|
||||||
<el-option label="企业" value="ENTERPRISE" />
|
|
||||||
<el-option label="个人" value="INDIVIDUAL" />
|
|
||||||
</el-select>
|
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
</el-row>
|
</el-row>
|
||||||
|
|
||||||
<el-row :gutter="20">
|
<el-row :gutter="20">
|
||||||
<el-col :span="12">
|
<el-col :span="12">
|
||||||
<el-form-item label="联系人" prop="contactPerson">
|
<el-form-item label="联系人" prop="contact">
|
||||||
<el-input v-model="form.contactPerson" placeholder="请输入联系人" />
|
<el-input v-model="form.contact" placeholder="请输入联系人" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="12">
|
<el-col :span="12">
|
||||||
<el-form-item label="联系电话" prop="contactPhone">
|
<el-form-item label="联系电话" prop="phone">
|
||||||
<el-input v-model="form.contactPhone" placeholder="请输入联系电话" />
|
<el-input v-model="form.phone" placeholder="请输入联系电话" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
</el-row>
|
</el-row>
|
||||||
@ -117,8 +108,8 @@
|
|||||||
<el-col :span="12">
|
<el-col :span="12">
|
||||||
<el-form-item label="状态" prop="status">
|
<el-form-item label="状态" prop="status">
|
||||||
<el-radio-group v-model="form.status">
|
<el-radio-group v-model="form.status">
|
||||||
<el-radio value="NORMAL">正常</el-radio>
|
<el-radio :value="1">启用</el-radio>
|
||||||
<el-radio value="DISABLED">禁用</el-radio>
|
<el-radio :value="0">禁用</el-radio>
|
||||||
</el-radio-group>
|
</el-radio-group>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
@ -128,8 +119,8 @@
|
|||||||
<el-input v-model="form.address" placeholder="请输入地址" />
|
<el-input v-model="form.address" placeholder="请输入地址" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
||||||
<el-form-item label="备注" prop="remarks">
|
<el-form-item label="备注" prop="remark">
|
||||||
<el-input v-model="form.remarks" type="textarea" :rows="3" placeholder="请输入备注" />
|
<el-input v-model="form.remark" type="textarea" :rows="3" placeholder="请输入备注" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-form>
|
</el-form>
|
||||||
|
|
||||||
@ -143,21 +134,17 @@
|
|||||||
<el-dialog title="客户详情" v-model="detailVisible" width="700px">
|
<el-dialog title="客户详情" v-model="detailVisible" width="700px">
|
||||||
<el-descriptions :column="2" border>
|
<el-descriptions :column="2" border>
|
||||||
<el-descriptions-item label="客户ID">{{ detailData.customerId }}</el-descriptions-item>
|
<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="客户名称">{{ 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-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-tag v-else type="danger">禁用</el-tag>
|
||||||
</el-descriptions-item>
|
</el-descriptions-item>
|
||||||
<el-descriptions-item label="联系人">{{ detailData.contactPerson }}</el-descriptions-item>
|
<el-descriptions-item label="联系人">{{ detailData.contact }}</el-descriptions-item>
|
||||||
<el-descriptions-item label="联系电话">{{ detailData.contactPhone }}</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.email }}</el-descriptions-item>
|
||||||
<el-descriptions-item label="地址" :span="2">{{ detailData.address }}</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.remark || '-' }}</el-descriptions-item>
|
||||||
<el-descriptions-item label="创建时间" :span="2">{{ detailData.createTime }}</el-descriptions-item>
|
|
||||||
</el-descriptions>
|
</el-descriptions>
|
||||||
</el-dialog>
|
</el-dialog>
|
||||||
</div>
|
</div>
|
||||||
@ -191,21 +178,21 @@ const formRef = ref<FormInstance>()
|
|||||||
|
|
||||||
const form = reactive({
|
const form = reactive({
|
||||||
customerId: null as number | null,
|
customerId: null as number | null,
|
||||||
|
customerCode: '',
|
||||||
customerName: '',
|
customerName: '',
|
||||||
customerType: 'ENTERPRISE',
|
contact: '',
|
||||||
contactPerson: '',
|
phone: '',
|
||||||
contactPhone: '',
|
|
||||||
email: '',
|
email: '',
|
||||||
address: '',
|
address: '',
|
||||||
status: 'NORMAL',
|
status: 1,
|
||||||
remarks: ''
|
remark: ''
|
||||||
})
|
})
|
||||||
|
|
||||||
const rules = reactive<FormRules>({
|
const rules = reactive<FormRules>({
|
||||||
|
customerCode: [{ required: true, message: '请输入客户编码', trigger: 'blur' }],
|
||||||
customerName: [{ required: true, message: '请输入客户名称', trigger: 'blur' }],
|
customerName: [{ required: true, message: '请输入客户名称', trigger: 'blur' }],
|
||||||
customerType: [{ required: true, message: '请选择客户类型', trigger: 'change' }],
|
contact: [{ required: true, message: '请输入联系人', trigger: 'blur' }],
|
||||||
contactPerson: [{ required: true, message: '请输入联系人', trigger: 'blur' }],
|
phone: [
|
||||||
contactPhone: [
|
|
||||||
{ required: true, message: '请输入联系电话', trigger: 'blur' },
|
{ required: true, message: '请输入联系电话', trigger: 'blur' },
|
||||||
{ pattern: /^1[3-9]\d{9}$/, message: '请输入正确的手机号', trigger: 'blur' }
|
{ pattern: /^1[3-9]\d{9}$/, message: '请输入正确的手机号', trigger: 'blur' }
|
||||||
],
|
],
|
||||||
@ -306,14 +293,14 @@ const handleSubmit = async () => {
|
|||||||
|
|
||||||
const resetForm = () => {
|
const resetForm = () => {
|
||||||
form.customerId = null
|
form.customerId = null
|
||||||
|
form.customerCode = ''
|
||||||
form.customerName = ''
|
form.customerName = ''
|
||||||
form.customerType = 'ENTERPRISE'
|
form.contact = ''
|
||||||
form.contactPerson = ''
|
form.phone = ''
|
||||||
form.contactPhone = ''
|
|
||||||
form.email = ''
|
form.email = ''
|
||||||
form.address = ''
|
form.address = ''
|
||||||
form.status = 'NORMAL'
|
form.status = 1
|
||||||
form.remarks = ''
|
form.remark = ''
|
||||||
formRef.value?.clearValidate()
|
formRef.value?.clearValidate()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -12,7 +12,7 @@ import java.util.List;
|
|||||||
* <li>pageNum:当前页码(从 1 开始);</li>
|
* <li>pageNum:当前页码(从 1 开始);</li>
|
||||||
* <li>pageSize:每页条数;</li>
|
* <li>pageSize:每页条数;</li>
|
||||||
* <li>total:总记录数;</li>
|
* <li>total:总记录数;</li>
|
||||||
* <li>list:当前页数据列表。</li>
|
* <li>records:当前页数据列表。</li>
|
||||||
* </ul>
|
* </ul>
|
||||||
*
|
*
|
||||||
* @param <T> 列表元素类型
|
* @param <T> 列表元素类型
|
||||||
@ -31,17 +31,17 @@ public class PageResult<T> implements Serializable {
|
|||||||
private long total;
|
private long total;
|
||||||
|
|
||||||
/** 当前页数据 */
|
/** 当前页数据 */
|
||||||
private List<T> list;
|
private List<T> records;
|
||||||
|
|
||||||
public PageResult() {
|
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.pageNum = pageNum;
|
||||||
this.pageSize = pageSize;
|
this.pageSize = pageSize;
|
||||||
this.total = total;
|
this.total = total;
|
||||||
this.list = list != null ? list : Collections.emptyList();
|
this.records = records != null ? records : Collections.emptyList();
|
||||||
}
|
}
|
||||||
|
|
||||||
public long getPageNum() {
|
public long getPageNum() {
|
||||||
@ -68,11 +68,11 @@ public class PageResult<T> implements Serializable {
|
|||||||
this.total = total;
|
this.total = total;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<T> getList() {
|
public List<T> getRecords() {
|
||||||
return list;
|
return records;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setList(List<T> list) {
|
public void setRecords(List<T> records) {
|
||||||
this.list = list;
|
this.records = records;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -122,7 +122,7 @@ public class CustomerServiceImpl implements CustomerService {
|
|||||||
|
|
||||||
private CustomerVO convertToVO(Customer customer) {
|
private CustomerVO convertToVO(Customer customer) {
|
||||||
CustomerVO vo = new CustomerVO();
|
CustomerVO vo = new CustomerVO();
|
||||||
vo.setId(customer.getId());
|
vo.setCustomerId(customer.getId());
|
||||||
vo.setCustomerCode(customer.getCustomerCode());
|
vo.setCustomerCode(customer.getCustomerCode());
|
||||||
vo.setCustomerName(customer.getCustomerName());
|
vo.setCustomerName(customer.getCustomerName());
|
||||||
vo.setContact(customer.getContact());
|
vo.setContact(customer.getContact());
|
||||||
|
|||||||
@ -5,7 +5,7 @@ package com.fundplatform.cust.vo;
|
|||||||
*/
|
*/
|
||||||
public class CustomerVO {
|
public class CustomerVO {
|
||||||
|
|
||||||
private Long id;
|
private Long customerId;
|
||||||
private String customerCode;
|
private String customerCode;
|
||||||
private String customerName;
|
private String customerName;
|
||||||
private String contact;
|
private String contact;
|
||||||
@ -15,12 +15,12 @@ public class CustomerVO {
|
|||||||
private Integer status;
|
private Integer status;
|
||||||
private String remark;
|
private String remark;
|
||||||
|
|
||||||
public Long getId() {
|
public Long getCustomerId() {
|
||||||
return id;
|
return customerId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setId(Long id) {
|
public void setCustomerId(Long customerId) {
|
||||||
this.id = id;
|
this.customerId = customerId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getCustomerCode() {
|
public String getCustomerCode() {
|
||||||
|
|||||||
@ -20,19 +20,19 @@
|
|||||||
<div class="customer-avatar">{{ item.customerName?.charAt(0) || 'C' }}</div>
|
<div class="customer-avatar">{{ item.customerName?.charAt(0) || 'C' }}</div>
|
||||||
<div class="customer-info">
|
<div class="customer-info">
|
||||||
<div class="customer-name">{{ item.customerName }}</div>
|
<div class="customer-name">{{ item.customerName }}</div>
|
||||||
<div class="customer-short">{{ item.customerShort || '-' }}</div>
|
<div class="customer-code">{{ item.customerCode || '-' }}</div>
|
||||||
</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>
|
||||||
<div class="customer-detail">
|
<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">
|
<div class="detail-item" v-if="item.phone">
|
||||||
<van-icon name="phone-o" />
|
<van-icon name="phone-o" />
|
||||||
<span>{{ item.phone }}</span>
|
<span>{{ item.phone }}</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="detail-item" v-if="item.industry">
|
|
||||||
<van-icon name="cluster-o" />
|
|
||||||
<span>{{ item.industry }}</span>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</van-list>
|
</van-list>
|
||||||
@ -52,24 +52,12 @@ const list = ref<any[]>([])
|
|||||||
const pageNum = ref(1)
|
const pageNum = ref(1)
|
||||||
const pageSize = 10
|
const pageSize = 10
|
||||||
|
|
||||||
const getLevelType = (level: string): 'primary' | 'success' | 'warning' | 'danger' | 'default' => {
|
const getStatusType = (status: number): 'primary' | 'success' | 'warning' | 'danger' | 'default' => {
|
||||||
const map: Record<string, 'primary' | 'success' | 'warning' | 'danger' | 'default'> = {
|
return status === 1 ? 'success' : 'default'
|
||||||
'A': 'primary',
|
|
||||||
'B': 'success',
|
|
||||||
'C': 'warning',
|
|
||||||
'D': 'danger'
|
|
||||||
}
|
|
||||||
return map[level] || 'default'
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const getLevelText = (level: string) => {
|
const getStatusText = (status: number) => {
|
||||||
const map: Record<string, string> = {
|
return status === 1 ? '启用' : '禁用'
|
||||||
'A': 'A类',
|
|
||||||
'B': 'B类',
|
|
||||||
'C': 'C类',
|
|
||||||
'D': 'D类'
|
|
||||||
}
|
|
||||||
return map[level] || '普通'
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const loadData = async () => {
|
const loadData = async () => {
|
||||||
@ -162,7 +150,7 @@ const handleSearch = () => {
|
|||||||
color: #333;
|
color: #333;
|
||||||
}
|
}
|
||||||
|
|
||||||
.customer-short {
|
.customer-code {
|
||||||
font-size: 13px;
|
font-size: 13px;
|
||||||
color: #999;
|
color: #999;
|
||||||
margin-top: 2px;
|
margin-top: 2px;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user