Some checks are pending
continuous-integration/drone/push Build is running
- 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
53 lines
1.6 KiB
JavaScript
53 lines
1.6 KiB
JavaScript
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 })
|