import { eamServer } from '../../index' export interface IDevice { id: number name: string categoryId: string serialNo: string sn: string status: number description: string cost: string createTime: string updateTime: string creator: string updater: string testSheetId: number testSheetStatus: string testSheetDetail: string } export interface IDeviceOV { id?: number name: string categoryId: string templateId: string serialNo?: string sn: string description: string cost: string } export const operantDevice = (type: OperantAction, data: IDeviceOV) => { return eamServer({ url: `/device/${type}`, method: type === 'create' ? 'post' : 'put', data, }) } export const deleteDevice = (id: string) => eamServer({ url: `/device/delete`, method: 'delete', params: { id }, }) export const getDeviceInfo = (id: number) => eamServer({ url: `/device/get`, method: 'get', params: { id }, }) export const getDevicePage = (params: PageParam) => eamServer<{ list: IDevice[] total: number }>({ url: '/device/page', method: 'get', params }) // ============== 测试工单相关 ============== export const operantDeviceTestSheet = (type: OperantAction, params: any) => { if (type === 'create') { return eamServer({ url: '/test-sheet/create', method: 'post', params, }) } if (type === 'update') { return eamServer({ url: '/test-sheet/update', method: 'put', params, }) } }