import request from '@/config/axios'

export interface UnitVO {
  unitId?: number
  parentId?: number
  unitName: string
  unitType: string
  orderNum: number
  status: number
  remark?: string
  createTime?: Date
}

export interface PageParam {
  current: number
  size: number
  unitName?: string
  unitId?: string
  status?: number
}

// 查询单位列表
export const listUnit = async (params: PageParam) => {
  return await request.get({ url: '/iscs/unit/getUnitPage', params })
}


// 查询单位详情
export const getUnitInfo = async (id: number) => {
  return await request.get({ url: '/iscs/unit/selectUnitById', params: { id: id } })
}

// 新增单位
export const addUnit = async (data: UnitVO) => {
  return await request.post({ url: '/iscs/unit/insertUnit', data })
}

// 修改单位
export const updateUnit = async (data: UnitVO) => {
  return await request.put({ url: '/iscs/unit/updateUnit', data })
}

// 删除单位
export const delUnit = async (id: number) => {
  return await request.delete({ url: '/iscs/unit/deleteUnitList?ids=' + id })
}

// 导出单位
export const exportUnit = async (params: PageParam) => {
  return await request.download({ url: '/iscs/unit/exportUnitExcel', params })
}
