haoxuan
2023-11-07 f7ad95439053af6e89e04a2b669e16b6408ece25
src/api/index.ts
@@ -3,11 +3,19 @@
import type { PLCResponse } from './plc'
import type { Devices } from './device'
import type { CraftModel } from './craftModel'
import type { Problem } from './problem'
export interface BaseResponse<T = any> {
  code: number
  data: T
  msg: string
}
export interface ListResponse<T = any> {
  code: number
  data: T
  msg: string
  total: number
}
export interface TaskListParams {
@@ -107,11 +115,25 @@
  })
}
export interface SetCurrentDeviceParams {
  currentDeviceID: string
}
/**
 * 获取当前面板绑定的设备列表
 */
export function apiSetCurrentDevice(data: SetCurrentDeviceParams) {
  return request<BaseResponse<Devices>>({
    url: `/v1/device/setCurrentDeviceId`,
    method: 'post',
    data
  })
}
export interface CraftModelListParams {
  procedureId: number
  page: number
  pageSize: number
  number: string
}
/**
@@ -119,7 +141,7 @@
 * @param params
 */
export function apiGetCraftModelList(params: CraftModelListParams) {
  return request<BaseResponse<CraftModel[]>>({
  return request<ListResponse<CraftModel[]>>({
    url: '/v1/processModel/list',
    method: 'get',
    params
@@ -141,3 +163,13 @@
    data: params
  })
}
/**
 * 获取问题诊断问题列表
 */
export function apiGetProblemList() {
  return request<BaseResponse<Problem[]>>({
    url: '/v1/system/problemList',
    method: 'get'
  })
}