import request from '@/config/axios'

// 物资类型查询参数
export interface TypeQuery {
  current: number
  size: number
  typeName?: string
  typeCode?: string
  status?: number
}

// 物资类型表单对象
export interface TypeVO {
  materialsTypeId?: number
  typeName: string
  typeCode: string
  typeIcon?: string
  typePicture?: string
  status: number
  remark?: string
  createTime?: Date
}

// 查询物资类型列表
export const listType = async (params: TypeQuery) => {
  return await request.get({ url: '/iscs/materials-type/getMaterialsTypePage', params })
}

// 查询物资类型详情
export const getTypeInfo = async (id: number) => {
  return await request.get({
    url: '/iscs/materials-type/selectMaterialsTypeById',
    params: { id: id }
  })
}

// 新增物资类型
export const addType = async (data: TypeVO) => {
  return await request.post({ url: '/iscs/materials-type/insertMaterialsType', data })
}

// 修改物资类型
export const updateType = async (data: TypeVO) => {
  return await request.put({ url: '/iscs/materials-type/updateMaterialsType', data })
}

// 删除物资类型
export const deleteType = async (ids: number) => {
  return await request.delete({
    url: '/iscs/materials-type/deleteMaterialsTypeList?ids='+ids,

  })
}
