odf_new/odf-uniapp/services/trunk.js
zpc 837ff4d4cc
Some checks are pending
continuous-integration/drone/push Build is running
feat(odf-uniapp): Add mileage correction editing and export enhancements
- Add inline editing UI for mileage correction field in fault detail page
- Implement save/cancel buttons for mileage correction updates
- Add updateMileageCorrection API endpoint and service method
- Update App.vue global styles with page background color
- Enhance pages.json with backgroundColorTop and backgroundColorBottom
- Add MileageCorrectionDto for request validation
- Implement batch fault times retrieval for export functionality
- Add fault frequency time concatenation in export data
- Improve export data structure with complete fault history information
2026-03-31 15:51:07 +08:00

53 lines
1.6 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.

import { get, post, BASE_URL } from './api'
import store from '@/store'
export const getCableList = (deptId) =>
get('/business/OdfCables/list', { deptId })
export const getFaultList = (cableId, pageNum, pageSize) =>
get('/business/OdfCableFaults/list', { cableId, pageNum, pageSize })
export const getFaultDetail = (id) =>
get(`/business/OdfCableFaults/${id}`)
/**
* 新增故障multipart/form-data含图片上传
* @param {FormData|object} formData - 包含故障信息和图片的 FormData
* @returns {Promise}
*/
export function addFault(formData) {
return new Promise((resolve, reject) => {
const header = {
'Authorization': `Bearer ${store.token}`,
'Userid': store.userId,
'Username': store.userName
}
uni.uploadFile({
url: BASE_URL + '/business/OdfCableFaults/add',
files: formData.files || [],
formData: formData.data || {},
header,
success(res) {
try {
const result = JSON.parse(res.data)
resolve({ code: result.code, msg: result.msg, data: result.data })
} catch (e) {
reject({ code: -1, msg: '解析响应失败' })
}
},
fail(err) {
reject({ code: -1, msg: err.errMsg || '网络异常' })
}
})
})
}
export const incrementFaultCount = (id) =>
post(`/business/OdfCableFaults/incrementFaultCount/${id}`)
export const updateMileageCorrection = (id, mileageCorrection) =>
post(`/business/OdfCableFaults/updateMileageCorrection/${id}`, { mileageCorrection })
export const searchCablesAndFaults = (deptId, keyword) =>
get('/business/OdfCables/search', { deptId, keyword })