import request from '@/utils/request'

/*****************************化学品信息页面*****************************/
//获取化学品信息列表
export function hxpChemicalList(query) {
  return request({
    url: '/chemical/hxpChemical/list',
    method: 'get',
    params: query
  })
}

//获取化学品分类信息
export function classifyList(query) {
  return request({
    url: '/chemical/classify/list',
    method: 'get',
    params: query
  })
}

//新增化学品信息
export function addHxpChemical(data) {
  return request({
    url: '/chemical/hxpChemical',
    method: 'post',
    data: data
  })
}

//获取化学品信息详情接口
export function getHxpChemicalInfo(id) {
  return request({
    url: '/chemical//hxpChemical/'+id,
    method: 'get',
  })
}

//编辑化学品信息
export function putHxpChemical(data) {
  return request({
    url: '/chemical/hxpChemical',
    method: 'put',
    data: data
  })
}

//MSDS编辑
export function editChemicalByJoinHazard(data) {
  return request({
    url: '/chemical/hxpChemical/editChemicalByJoinHazard',
    method: 'put',
    data: data
  })
}

//删除化学品
export function delHxpChemicalInfo(id) {
  return request({
    url: '/chemical//hxpChemical/'+id,
    method: 'delete',
  })
}

//获取msds列表
export function getHazardBookJoinChemical(query) {
  return request({
    url: '/laboratory/hazard_book/hazardBookJoinChemical',
    method: 'get',
    params: query
  })
}
//根据化学品查询化学品存放列表
export function getHxpChemicalJoinCabinet(query) {
  return request({
    url: '/chemical/hxpChemicalJoinCabinet/list',
    method: 'get',
    params: query
  })
}
//删除化学品下化学品存放
export function delHxpChemicalJoinCabinet(id) {
  return request({
    url: '/chemical/hxpChemicalJoinCabinet/'+id,
    method: 'delete',
  })
}

//化学品存放页面-获取当前账号学院数据
export function filterDept(query) {
  return request({
    url: '/system/dept/filterDept',
    method: 'get',
    params: query
  })
}

//化学品存放页面-根据所属院系或多个院系获取实验室列表
export function getSubList(ids) {
  return request({
    url: '/laboratory/subject/multipleDetp/subList/'+ids,
    method: 'get',
  })
}

//化学品存放页面-根据实验室查询机柜
export function getCabinetBySubId(query) {
  return request({
    url: '/chemical/hxpCabinet/getCabinetBySubId',
    method: 'get',
    params: query
  })
}

//化学品存放页面-新增化学品存放
export function hxpChemicalJoinCabinet(data) {
  return request({
    url: '/chemical/hxpChemicalJoinCabinet',
    method: 'post',
    data: data
  })
}

//化学品存放页面-删除化学品存放
export function delByChemical(id) {
  return request({
    url: '/chemical/hxpChemicalJoinCabinet/delByChemical/'+id,
    method: 'delete',
  })
}


/*****************************机柜管理页面*****************************/
//获取机柜列表
export function hxpCabinetList(query) {
  return request({
    url: '/chemical/hxpCabinet/list',
    method: 'get',
    params: query
  })
}

//获取机柜列表(无权限)
export function getNoauthList(query) {
  return request({
    url: '/chemical/hxpCabinet/getNoauthList',
    method: 'get',
    params: query
  })
}

//获取实验室位置
export function getAddress(id) {
  return request({
    url: '/laboratory/layout/noauth/'+id,
    method: 'get',
  })
}

//新增机柜
export function hxpCabinet(data) {
  return request({
    url: '/chemical/hxpCabinet',
    method: 'post',
    data: data
  })
}

//编辑机柜
export function putHxpCabinet(data) {
  return request({
    url: '/chemical/hxpCabinet',
    method: 'put',
    data: data
  })
}

//删除机柜
export function delHxpCabinet(id) {
  return request({
    url: '/chemical/hxpCabinet/'+id,
    method: 'delete',
  })
}

//获取机柜详情
export function getHxpCabinetInfo(id) {
  return request({
    url: '/chemical/hxpCabinet/'+id,
    method: 'get',
  })
}

//机柜管理-化学品页面获取列表
export function getCabinetByChemical(query) {
  return request({
    url: '/chemical/hxpCabinet/getCabinetByChemical',
    method: 'get',
    params: query
  })
}

//根据机柜id查询柜锁
export function getHardwareByLockList(data) {
  return request({
    url: '/laboratory/hardware/getHardwareByLockList',
    method: 'post',
    data: data
  })
}


/*****************************化学品分类配置*****************************/
//获取化学品分类配置
export function getClassifyConfig(type) {
  return request({
    url: '/chemical/classifyConfig/'+type,
    method: 'get',
  })
}
//新增化学品分类配置
export function addClassifyConfig(data) {
  return request({
    url: '/chemical/classifyConfig',
    method: 'post',
    data: data
  })
}
//修改化学品分类配置
export function putClassifyConfig(data) {
  return request({
    url: '/chemical/classifyConfig',
    method: 'put',
    data: data
  })
}
/*****************************库存明细*****************************/

//获取库存明细列表接口
export function getListDetail(query) {
  return request({
    url: '/chemical/hxpStock/listDetail',
    method: 'get',
    params: query
  })
}

//获取入库列表接口
export function getListJoin(query) {
  return request({
    url: '/chemical/hxpStock/listJoin',
    method: 'get',
    params: query
  })
}

//获取入库列表接口
export function getListOut(query) {
  return request({
    url: '/chemical/hxpStock/listOut',
    method: 'get',
    params: query
  })
}

//获取使用记录列表接口
export function getHxpUserecordList(query) {
  return request({
    url: '/chemical/hxpUserecord/getHxpUserecordList',
    method: 'get',
    params: query
  })
}

//四合一智能终端/智能门禁/RFID识别器/只能报警器(列表接口)
export function hxpSmartTerminal(query) {
  return request({
    url: '/chemical/hxpSmartTerminal/list',
    method: 'get',
    params: query
  })
}

//四合一智能终端/智能门禁/RFID识别器/只能报警器(新增接口) terminalType （1是智能终端，2是智能门禁，3是RFID,4是智能报警）
export function addHxpSmartTerminal(data) {
  return request({
    url: '/chemical/hxpSmartTerminal',
    method: 'post',
    data: data
  })
}
//四合一智能终端/智能门禁/RFID识别器/只能报警器(修改接口) terminalType （1是智能终端，2是智能门禁，3是RFID,4是智能报警）
export function putHxpSmartTerminal(data) {
  return request({
    url: '/chemical/hxpSmartTerminal',
    method: 'put',
    data: data
  })
}
//四合一智能终端/智能门禁/RFID识别器/只能报警器(详情接口) terminalType （1是智能终端，2是智能门禁，3是RFID,4是智能报警）
export function getHxpSmartTerminal(id) {
  return request({
    url: '/chemical/hxpSmartTerminal/'+id,
    method: 'get',
  })
}
//四合一智能终端/智能门禁/RFID识别器/只能报警器(删除接口)
export function delHxpSmartTerminal(id) {
  return request({
    url: '/chemical/hxpSmartTerminal/'+id,
    method: 'delete',
  })
}

//报警记录列表
export function getHxpAlarmRecordList(query) {
  return request({
    url: '/chemical/hxpAlarmRecord/list',
    method: 'get',
    params: query
  })
}

//报警记录列表(无权限-实验室列表使用)
export function getHxpAlarmRecordNoAuthList(query) {
  return request({
    url: '/chemical/hxpAlarmRecord/noAuthlist',
    method: 'get',
    params: query
  })
}

//获取报警记录配置
export function getDeptDetail(id) {
  return request({
    url: '/chemical/hxpAlarmConfig/getDeptDetail/'+id,
    method: 'get',
  })
}

//提交报警记录配置
export function hxpAlarmConfig(data) {
  return request({
    url: '/chemical/hxpAlarmConfig/',
    method: 'post',
    data: data
  })
}

//智能报警器开启/关闭
export function updateStatus(query) {
  return request({
    url: '/chemical/hxpSmartTerminal/updateStatus/',
    method: 'get',
    params: query
  })
}

//报警器 报警时长/处理时长设置
export function alarmSettings(data) {
  return request({
    url: '/chemical/hxpSmartTerminal/alarmSettings/',
    method: 'post',
    data: data
  })
}


/*****************************首页*****************************/
//首页获取库存总量接口
export function stockTotal(query) {
  return request({
    url: '/chemical/hxpHomePage/stockTotal',
    method: 'get',
    params: query
  })
}

//首页获取-化学品数量
export function chemicalUsageCount(query) {
  return request({
    url: '/chemical/hxpHomePage/chemicalUsageCount',
    method: 'get',
    params: query
  })
}

//首页获取-化学品特别提示
export function chemicalUnusualCount(query) {
  return request({
    url: '/chemical/hxpHomePage/chemicalUnusualCount',
    method: 'get',
    params: query
  })
}

//获取首页报警通知
export function alarmRecordList(query) {
  return request({
    url: '/chemical/hxpHomePage/alarmRecordList',
    method: 'get',
    params: query
  })
}

//首页获取-化学品使用量排行top6
export function chemicalUsagesCount(query) {
  return request({
    url: '/chemical/hxpHomePage/chemicalUsagesCount',
    method: 'get',
    params: query
  })
}

//首页获取-化学品分类统计
export function chemicalClassifyMix(query) {
  return request({
    url: '/chemical/hxpHomePage/chemicalClassifyMix',
    method: 'get',
    params: query
  })
}

//首页获取-入库/出库统计
export function joinOutCount(query) {
  return request({
    url: '/chemical/hxpHomePage/joinOutCount',
    method: 'get',
    params: query
  })
}

/*****************************硬件相关接口(使用的是原来的老版本接口)*****************************/

// 查询硬件列表
export function listHardware(query) {
  return request({
    url: '/laboratory/hardware/list',
    method: 'get',
    params: query
  })
}

// 新增硬件
export function addHardware(data) {
  return request({
    url: '/laboratory/hardware',
    method: 'post',
    data: data
  })
}

// 修改硬件
export function updateHardware(data) {
  return request({
    url: '/laboratory/hardware',
    method: 'put',
    data: data
  })
}

// 删除硬件
export function delHardware(id) {
  return request({
    url: '/laboratory/hardware/' + id,
    method: 'delete'
  })
}

// 查询硬件
export function getHardwareDetail(query) {
  return request({
    url: '/laboratory/hardware/getHardwareDetail',
    method: 'get',
    params: query
  })
}

// 硬件开关控制
export function hardWareControl(data) {
  return request({
    url: '/laboratory/subject/manger/control/'+data.id+'/' + data.switchVal,
    method: 'post'
  })
}


/*****************************(3.1.1)*****************************/
//智能锁柜设置操作时长
export function setLock(data) {
  return request({
    url: '/laboratory/hardware/setLock',
    method: 'put',
    data: data
  })
}

//设备管理-智能锁-操作记录
export function lockLogList(query) {
  return request({
    url: '/chemical/locklog/list',
    method: 'get',
    params: query
  })
}

//智能锁-获取锁柜关联机柜列表
export function getCabinetLockList(query) {
  return request({
    url: '/laboratory/hardware/getCabinetLockList',
    method: 'get',
    params: query
  })
}

//智能锁-关联锁柜接口
export function setLockJoinCabinet(data) {
  return request({
    url: '/laboratory/hardware/setLockJoinCabinet',
    method: 'put',
    data: data
  })
}

//根据机柜获取智能锁列表
export function hardwareList(query) {
  return request({
    url: '/laboratory/hardware/list',
    method: 'get',
    params: query
  })
}

//获取实验室设备开关(无权限)
export function getEnablelist(query) {
  return request({
    url: '/laboratory/hardware/getEnablelist',
    method: 'get',
    params: query
  })
}

//报警记录处理
export function handle(data) {
  return request({
    url: '/chemical/hxpAlarmRecord/handleProcessing',
    method: 'put',
    data: data
  })
}

