// src/api/system/machinery.ts
import request from '@/config/axios'

export interface MachineryVO {
  machineryId?: number
  machineryName: string
  machineryCode: string
  machineryType: string
  parentId?: number
  remark?: string
  createTime?: Date
}

export interface PageParam {
  current: number
  size: number
  machineryName?: string
  machineryCode?: string
  machineryType?: string
}

// 查询设备工艺列表
export const listTechnology = async (params: PageParam) => {
  return await request.get({ url: '/iscs/machinery/getMachineryPage', params })
}

// 查询设备工艺详情
export const getTechnologyInfo = async (id: number) => {
  return await request.get({ url: '/iscs/machinery/selectMachineryById', params: { id: id } })
}

// 新增设备工艺
export const addTechnology = async (data: MachineryVO) => {
  return await request.post({ url: '/iscs/machinery/insertMachinery', data })
}

// 修改设备工艺
export const updateTechnology = async (data: MachineryVO) => {
  return await request.put({ url: '/iscs/machinery/updateMachinery', data })
}

// 删除设备工艺
export const delTechnology = async (ids: number) => {
  return await request.delete({
    url: '/iscs/machinery/deleteMachineryList?ids='+ids,

  })
}

// 保存设备工艺与隔离点的关系
export const saveMachineryPoints = async (data: any) => {
  return await request.post({ url: '/iscs/machinery/saveMachineryPoints', data })
}
// 导出设备工艺详情
export const exportMachineryExcel = async (params: PageParam) => {
  return await request.get({ url: '/iscs/machinery/exportMachineryExcel', params})
}
