陪练和客户页面的产品化
This commit is contained in:
@@ -1632,33 +1632,36 @@
|
||||
// 加载服务记录列表
|
||||
async loadServiceList(params = {}) {
|
||||
try {
|
||||
// 构建查询参数对象(后端使用 @RequestParam,参数需要作为 URL 查询参数传递)
|
||||
const queryParams = {
|
||||
current: this.serviceListPage.current,
|
||||
size: this.serviceListPage.size
|
||||
};
|
||||
|
||||
// 添加查询参数:所属销售姓名和客户姓名
|
||||
if (params.salesName) {
|
||||
queryParams.salesName = params.salesName;
|
||||
const trimmedSalesName = params.salesName?.trim();
|
||||
const trimmedCustomerName = params.customerName?.trim();
|
||||
if (trimmedSalesName) {
|
||||
queryParams.salesName = trimmedSalesName;
|
||||
}
|
||||
if (params.customerName) {
|
||||
queryParams.customerName = params.customerName;
|
||||
if (trimmedCustomerName) {
|
||||
queryParams.customerName = trimmedCustomerName;
|
||||
}
|
||||
|
||||
// 构建请求体(过滤空值),后端改为 POST
|
||||
const requestData = Object.keys(queryParams)
|
||||
// 将参数转换为 URL 查询字符串(因为后端使用 @RequestParam)
|
||||
const queryString = Object.keys(queryParams)
|
||||
.filter(key => queryParams[key] !== null && queryParams[key] !== undefined && queryParams[key] !== '')
|
||||
.reduce((acc, key) => {
|
||||
acc[key] = queryParams[key];
|
||||
return acc;
|
||||
}, {});
|
||||
.map(key => `${encodeURIComponent(key)}=${encodeURIComponent(queryParams[key])}`)
|
||||
.join('&');
|
||||
|
||||
const url = getApiUrl('/api/audioManagement/list');
|
||||
// 后端使用 @RequestParam,参数需要作为 URL 查询参数传递
|
||||
const baseUrl = getApiUrl('/api/audioManagement/list');
|
||||
const url = queryString ? `${baseUrl}?${queryString}` : baseUrl;
|
||||
|
||||
const res = await uni.request({
|
||||
url: url,
|
||||
url,
|
||||
method: 'POST',
|
||||
data: requestData,
|
||||
data: {}, // POST 请求体为空,参数都在 URL 查询字符串中
|
||||
header: {
|
||||
'Content-Type': 'application/json'
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user