Files
autoAiWorkSys/app/api/apply_records.js
张成 e17d5610f5 1
2025-12-22 16:26:59 +08:00

77 lines
1.9 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
/**
* 投递记录 API 服务
* 封装投递记录相关的API调用
*/
import apiClient from '../utils/api.js';
class ApplyRecordsAPI {
/**
* 获取投递记录列表
* @param {Object} params - 查询参数
* @param {Object} params.seachOption - 搜索条件
* @param {Object} params.pageOption - 分页选项
* @returns {Promise}
*/
async getList(params = {}) {
try {
const result = await apiClient.post('/apply/list', params);
return result;
} catch (error) {
console.error('获取投递记录列表失败:', error);
throw error;
}
}
/**
* 获取投递统计
* @param {String} snCode - 设备SN码可选
* @returns {Promise}
*/
async getStatistics(snCode = null) {
try {
const params = snCode ? { sn_code: snCode } : {};
const result = await apiClient.get('/apply/statistics', params);
return result;
} catch (error) {
console.error('获取投递统计失败:', error);
throw error;
}
}
/**
* 获取近7天投递趋势数据
* @param {String} snCode - 设备SN码可选
* @returns {Promise}
*/
async getTrendData(snCode = null) {
try {
const params = snCode ? { sn_code: snCode } : {};
const result = await apiClient.get('/apply/trend', params);
return result;
} catch (error) {
console.error('获取投递趋势数据失败:', error);
throw error;
}
}
/**
* 获取投递记录详情
* @param {String|Number} recordId - 投递记录ID可以是 id 或 applyId
* @returns {Promise}
*/
async getDetail(recordId) {
try {
// 使用 id 参数名(数据库主键字段)
const result = await apiClient.get('/apply/detail', { id: recordId });
return result;
} catch (error) {
console.error('获取投递记录详情失败:', error);
throw error;
}
}
}
export default new ApplyRecordsAPI();