refactor(steady-checksquare): 更新稳态校验功能的数据结构和接口规范
- 移除 lineId 字段,统一使用 lineIds 数组字段 - 更新创建任务请求体构建逻辑,不再包含 lineId 属性 - 修改任务详情和检测项明细的接口契约验证 - 更新稳态校验 API 文档说明,移除对 lineId 的支持 - 重构稳态校验表单项验证规则 - 移除磁盘监控作业详情抽屉组件 - 移除磁盘监控作业表格组件 - 更新路由配置以支持新的系统监控路径 - 添加测试报告相关字典代码常量 - 更新 ICD 路径表单和结果面板功能
This commit is contained in:
77
frontend/src/api/aireport/testDevice/index.ts
Normal file
77
frontend/src/api/aireport/testDevice/index.ts
Normal file
@@ -0,0 +1,77 @@
|
||||
import http from '@/api'
|
||||
import type { TestDevice } from './interface'
|
||||
|
||||
const TEST_DEVICE_BASE_URL = '/api/test-device'
|
||||
|
||||
const buildTestDeviceFormData = (request: TestDevice.TestDeviceSaveRequest, reportFile?: File | null) => {
|
||||
const formData = new FormData()
|
||||
|
||||
// 关键业务节点:检测设备新增/编辑接口按 request JSON 分段读取业务字段,报告文件单独传 reportFile。
|
||||
formData.append('request', new Blob([JSON.stringify(request)], { type: 'application/json' }))
|
||||
|
||||
if (reportFile) {
|
||||
formData.append('reportFile', reportFile)
|
||||
}
|
||||
|
||||
return formData
|
||||
}
|
||||
|
||||
const buildTestDeviceImportFormData = (file: File, reportZip: File) => {
|
||||
const formData = new FormData()
|
||||
|
||||
formData.append('file', file)
|
||||
formData.append('reportZip', reportZip)
|
||||
|
||||
return formData
|
||||
}
|
||||
|
||||
export const listTestDevicesApi = (params: TestDevice.TestDeviceListParams) => {
|
||||
return http.post(`${TEST_DEVICE_BASE_URL}/list`, params)
|
||||
}
|
||||
|
||||
export const createTestDeviceApi = (request: TestDevice.TestDeviceSaveRequest, reportFile: File) => {
|
||||
return http.post<boolean>(`${TEST_DEVICE_BASE_URL}/add`, buildTestDeviceFormData(request, reportFile), {
|
||||
headers: { 'Content-Type': 'multipart/form-data' }
|
||||
})
|
||||
}
|
||||
|
||||
export const updateTestDeviceApi = (request: TestDevice.TestDeviceSaveRequest, reportFile?: File | null) => {
|
||||
return http.post<boolean>(`${TEST_DEVICE_BASE_URL}/update`, buildTestDeviceFormData(request, reportFile), {
|
||||
headers: { 'Content-Type': 'multipart/form-data' }
|
||||
})
|
||||
}
|
||||
|
||||
export const deleteTestDevicesApi = (ids: string[]) => {
|
||||
return http.post<boolean>(`${TEST_DEVICE_BASE_URL}/delete`, ids)
|
||||
}
|
||||
|
||||
export const getTestDeviceDetailApi = (id: string) => {
|
||||
return http.get<TestDevice.TestDeviceRecord>(`${TEST_DEVICE_BASE_URL}/${id}`)
|
||||
}
|
||||
|
||||
export const downloadTestDeviceImportTemplateApi = () => {
|
||||
return http.get(`${TEST_DEVICE_BASE_URL}/template`, undefined, { responseType: 'blob' })
|
||||
}
|
||||
|
||||
export const importTestDevicesApi = (file: File, reportZip: File) => {
|
||||
return http.post<TestDevice.TestDeviceImportResult>(
|
||||
`${TEST_DEVICE_BASE_URL}/import`,
|
||||
buildTestDeviceImportFormData(file, reportZip),
|
||||
{
|
||||
headers: { 'Content-Type': 'multipart/form-data' }
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
export const exportTestDevicesApi = (params: TestDevice.TestDeviceListParams) => {
|
||||
return http.get(`${TEST_DEVICE_BASE_URL}/export`, params, { responseType: 'blob' })
|
||||
}
|
||||
|
||||
export const previewTestDeviceReportApi = (id: string) => {
|
||||
// 关键业务节点:test-device 当前仅提供 /{id}/report,预览与下载统一复用同一报告流,避免前端误调不存在的 preview 接口。
|
||||
return http.get(`${TEST_DEVICE_BASE_URL}/${id}/report`, undefined, { responseType: 'blob' })
|
||||
}
|
||||
|
||||
export const downloadTestDeviceReportApi = (id: string) => {
|
||||
return http.get(`${TEST_DEVICE_BASE_URL}/${id}/report`, undefined, { responseType: 'blob' })
|
||||
}
|
||||
Reference in New Issue
Block a user