新建监控功能
This commit is contained in:
31
frontend/src/api/tools/mmsmapping/index.ts
Normal file
31
frontend/src/api/tools/mmsmapping/index.ts
Normal file
@@ -0,0 +1,31 @@
|
||||
import http from '@/api'
|
||||
import type { MmsMapping } from './interface'
|
||||
|
||||
const buildIcdFormData = (icdFile: File) => {
|
||||
const formData = new FormData()
|
||||
|
||||
formData.append('icdFile', icdFile)
|
||||
|
||||
return formData
|
||||
}
|
||||
|
||||
export const getIcdApi = (params: MmsMapping.GetIcdParams) => {
|
||||
const formData = buildIcdFormData(params.icdFile)
|
||||
|
||||
// 关键业务节点:解析 ICD 按钮改走独立 get-icd 接口,只上传当前选择的 ICD 文件。
|
||||
return http.post<MmsMapping.MappingTaskResponse>('/api/mms-mapping/get-icd', formData, {
|
||||
headers: { 'Content-Type': 'multipart/form-data' }
|
||||
})
|
||||
}
|
||||
|
||||
export const getIcdMmsJsonApi = (params: MmsMapping.GetIcdMmsJsonParams) => {
|
||||
const formData = buildIcdFormData(params.icdFile)
|
||||
|
||||
// 接口文档要求 request 以 application/json 分段提交,避免后端按普通字符串丢失 JSON 结构。
|
||||
formData.append('request', new Blob([JSON.stringify(params.request)], { type: 'application/json' }))
|
||||
|
||||
// 关键业务节点:生成映射仍走 get-icd-mms-json,提交时保持 icdFile + request 的 multipart 结构。
|
||||
return http.post<MmsMapping.MappingTaskResponse>('/api/mms-mapping/get-icd-mms-json', formData, {
|
||||
headers: { 'Content-Type': 'multipart/form-data' }
|
||||
})
|
||||
}
|
||||
68
frontend/src/api/tools/mmsmapping/interface/index.ts
Normal file
68
frontend/src/api/tools/mmsmapping/interface/index.ts
Normal file
@@ -0,0 +1,68 @@
|
||||
export namespace MmsMapping {
|
||||
export interface GetIcdParams {
|
||||
icdFile: File
|
||||
}
|
||||
|
||||
export interface IndexSelectionBinding {
|
||||
reportName: string
|
||||
dataSetName: string
|
||||
label: string
|
||||
lnInst: string
|
||||
}
|
||||
|
||||
export interface IndexSelectionGroup {
|
||||
groupKey: string
|
||||
groupDesc?: string
|
||||
bindings: IndexSelectionBinding[]
|
||||
}
|
||||
|
||||
export interface GetIcdMmsJsonRequestPayload {
|
||||
version: string
|
||||
author: string
|
||||
saveToDisk: boolean
|
||||
prettyJson: boolean
|
||||
outputDir: string
|
||||
indexSelection: IndexSelectionGroup[]
|
||||
}
|
||||
|
||||
export interface GetIcdMmsJsonParams {
|
||||
icdFile: File
|
||||
request: GetIcdMmsJsonRequestPayload
|
||||
}
|
||||
|
||||
export interface IcdDocument {
|
||||
[key: string]: unknown
|
||||
}
|
||||
|
||||
export interface IndexCandidateReport {
|
||||
reportName?: string
|
||||
dataSetName?: string
|
||||
reportDesc?: string
|
||||
availableLnInstValues?: string[]
|
||||
}
|
||||
|
||||
export interface IndexCandidateGroup {
|
||||
groupKey?: string
|
||||
groupDesc?: string
|
||||
reportCount?: number
|
||||
templateLabels?: string[]
|
||||
reports?: IndexCandidateReport[]
|
||||
}
|
||||
|
||||
export type MappingTaskStatus = 'SUCCESS' | 'NEED_INDEX_SELECTION' | 'FAILED' | (string & {})
|
||||
|
||||
export interface MappingTaskResponse {
|
||||
status?: MappingTaskStatus
|
||||
message?: string
|
||||
icdDocument?: IcdDocument
|
||||
mappingJson?: string
|
||||
savedPath?: string
|
||||
indexCandidates?: IndexCandidateGroup[]
|
||||
problems?: string[]
|
||||
}
|
||||
|
||||
export interface BaseRequestForm {
|
||||
version: string
|
||||
author: string
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user