import request from '@/utils/request'

// 查询实验室列表
export function listSubject(query) {
  return request({
    url: '/laboratory/subject/list',
    method: 'get',
    params: query
  })
}

// 查询实验室列表-带权限
export function authListSubject(query) {
  return request({
    url: '/laboratory/subject/manger/list',
    method: 'get',
    params: query
  })
}
// 查询实验室列表-带权限-新
export function authListSubjectTow(query) {
  return request({
    url: '/laboratory/subject/manger/pclist',
    method: 'get',
    params: query
  })
}

// 查询实验室详细
export function getSubject(id) {
  return request({
    url: '/laboratory/subject/' + id,
    method: 'get'
  })
}

// 变更实验管理员
export function setSubjectAdmin(data) {
  return request({
    url: '/laboratory/subject/'+data.userId+'/'+data.subId,
    method: 'put'
  })
}

// 新增实验室
export function addSubject(data) {
  return request({
    url: '/laboratory/subject',
    method: 'post',
    data: data
  })
}

// 修改实验室
export function updateSubject(data) {
  return request({
    url: '/laboratory/subject',
    method: 'put',
    data: data
  })
}
// 查询实验室-安全信息牌
export function getClassifyBySubId(data) {
  return request({
    url: '/laboratory/XxpClassify/getClassifyBySubId/',
    method: 'get',
    data: data
  })
}

// 修改实验室(包含新危险源)
export function updateSubjectEditJoinHazard(data) {
  return request({
    url: '/laboratory/subject/editJoinHazard',
    method: 'put',
    data: data
  })
}

// 删除实验室
export function delSubject(id) {
  return request({
    url: '/laboratory/subject/' + id,
    method: 'delete'
  })
}

//获取指定用户权限下的实验室列表/subject/manger/my/list
export function getSubjectList(id) {
  return request({
    url: '/laboratory/subject/count/'+id,
    method: 'get',
  })
}
//获取当前用户权限下的实验室列表/subject/manger/my/list
export function getMySubjectList(data) {
  return request({
    url: '/laboratory/subject/manger/my/list',
    method: 'get'
  })
}
//根据院系查询未绑定的实验室
export function getNoAdminSubjectList(data) {
  return request({
    url: '/laboratory/subject/list/noadmin',
    method: 'get',
    params: data
  })
}

//根据院系查询实验室
export function getNoAdminSubjectListNopage(data) {
  return request({
    url: '/laboratory/subject/list/nopage',
    method: 'get',
    params: data
  })
}

//删除实验室
export function removeSubject(id) {
  return request({
    url: '/laboratory/subject/'+id,
    method: 'delete'
  })
}
//根据ID查询摄像头列表
export function channels(data) {
  return request({
    url: '/algorithm/api/device/query/devices/channels',
    method: 'get',
    params: data
  })
}

//根据ID查询摄像头地址
export function startUrl(data) {
  return request({
    url: '/algorithm/api/play/startList',
    type:'video',
    method: 'get',
    params: data
  })
}







//播放文字接口
export function mangerVoice(data,id) {
  return request({
    url: '/laboratory/subject/manger/voice/'+id,
    method: 'post',
    params: data
  })
}

//是否禁用实验室
export function subjectType(id,type) {
  return request({
    url: '/laboratory/subject/'+id+'/'+type,
    method: 'Delete',
  })
}

//获取物联设备配置列表
export function listBySubjectId(data) {
  return request({
    url: '/laboratory/hardware/listBySubjectId',
    method: 'get',
    params: data
  })
}

//添加传感器
export function addSensor(data) {
  return request({
    url: '/laboratory/sensor/',
    method: 'post',
    data: data
  })
}
//编辑传感器
export function putSensor(data) {
  return request({
    url: '/laboratory/sensor/',
    method: 'put',
    data: data
  })
}
//删除传感器
export function delSensor(id) {
  return request({
    url: '/laboratory/sensor/'+id,
    method: 'Delete',
  })
}

//添加一体机
export function addHardware(data) {
  return request({
    url: '/laboratory/hardware/',
    method: 'post',
    data: data
  })
}
//编辑一体机
export function putHardware(data) {
  return request({
    url: '/laboratory/hardware/',
    method: 'put',
    data: data
  })
}
//删除一体机
export function delHardware(id) {
  return request({
    url: '/laboratory/hardware/'+id,
    method: 'Delete',
  })
}

// 查询实验室详情
export function subjectInfo(id,type) {
  return request({
    url: '/laboratory/subject/manger/query/'+id+'/'+type,
    method: 'get',
  })
}
// 查询实验室排风扇人工还是预案
export function subjectTriggerModes(id) {
  return request({
    url: '/laboratory/control/newMsg/'+id,
    method: 'get',
  })
}
//查询实验室门禁
export function getDetalis(query) {
  return request({
    url: '/algorithm/smartlock/lockinfo/detalis',
    method: 'get',
    params: query
  })
}
//根据人员ID查询人员列表
export function getSafeUserList(query) {
  return request({
    url: '/system/user/getSafeUserList',
    method: 'get',
    params: query
  })
}

// 修改实验室关联信息
export function editJoinHazard(data) {
  return request({
    url: '/laboratory/subject/editJoinHazard',
    method: 'put',
    data: data
  })
}

//门锁列表接口
export function subjectRelationList(query) {
  return request({
    url: '/algorithm/smartlock/subjectRelation/listSub',
    method: 'get',
    params: query
  })
}
//门锁选择列表数据
export function listLockRoom(query) {
  return request({
    url: '/algorithm/smartlock/subjectRelation/listLockRoom',
    method: 'get',
    params: query
  })
}

// 新增智能门禁
export function subjectRelation(data) {
  return request({
    url: '/algorithm/smartlock/subjectRelation/addSub',
    method: 'post',
    data: data
  })
}

// 删除智能门禁
export function delSubjectRelation(id) {
  return request({
    url: '/algorithm/smartlock/subjectRelation/removeSub/'+id,
    method: 'Delete',
  })
}
// 新增电子信息牌
export function subjectSignAdd(data) {
  return request({
    url: '/laboratory/XxpCardInfo/addInfo',
    method: 'post',
    data: data
  })
}
// 编辑电子信息牌
export function subjectSignEdit(data) {
  return request({
    url: '/laboratory/XxpCardInfo/edit',
    method: 'post',
    data: data
  })
}
// 删除电子信息牌
export function subjectSignDelete(id) {
  return request({
    url: '/laboratory/XxpCardInfo/del/'+id,
    method: 'post',
  })
}




//门禁授权列表
export function openDoorApplyList(query) {
  return request({
    url: '/algorithm/smartlock/openDoorApply/list',
    method: 'get',
    params: query
  })
}

//门禁授权申请列表
export function applyList(query) {
  return request({
    url: '/algorithm/smartlock/openDoorApply/applyList',
    method: 'get',
    params: query
  })
}

//门禁授权申请列表
export function postApproval(data) {
  return request({
    url: '/algorithm/smartlock/approval',
    method: 'post',
    data: data
  })
}

//提交门禁申请
export function openDoorApply(data) {
  return request({
    url: '/algorithm/smartlock/openDoorApply',
    method: 'post',
    data: data
  })
}

//申请门禁详情
export function getOpenDoorApply(id) {
  return request({
    url: '/algorithm/smartlock/openDoorApply/'+id,
    method: 'get',
  })
}

//获取实验室详情位置灯数据
export function subjectVo(id) {
  return request({
    url: '/laboratory/subject/vo/'+id,
    method: 'get',
  })
}
/* 一键灭火----------------- */
//智能灭火设备列表
export function firedeviceList(query) {
  return request({
    url: '/algorithm/firedevice/list',
    method: 'get',
    params: query
  })
}
//智能灭火设备-新增
export function firedeviceAdd(data) {
  return request({
    url: '/algorithm/firedevice',
    method: 'post',
    data: data
  })
}
//智能灭火设备-编辑
export function firedeviceEdit(data) {
  return request({
    url: '/algorithm/firedevice',
    method: 'put',
    data: data
  })
}
//智能灭火设备-删除
export function firedeviceDle(id) {
  return request({
    url: '/algorithm/firedevice/' + id,
    method: 'delete'
  })
}
/* 预案执行记录 */
//预案执行记录列表
export function riskExeRecordList(query) {
  return request({
    url: '/laboratory/plan/group/riskExeRecordList',
    method: 'get',
    params: query
  })
}
//预案执行记录-详情
export function riskPlanAbnormalDesc(query) {
  return request({
    url: '/laboratory/plan/desc/riskPlanAbnormalDesc?groupId='+query,
    method: 'get',
  })
}
//风险轨迹
export function abnormalLogOrderByList(query) {
  return request({
    url: '/laboratory/plan/log/abnormalLogOrderByList?groupId='+query,
    method: 'get',
  })
}
//消息推送记录
export function viewWarnMessage(query) {
  return request({
    url: '/laboratory/bigview/'+query+'/warn/getRiskLog',
    method: 'get',
  })
}

/* 智能门禁----------------- */

//查询门禁授权列表
export function getHaikangList(data) {
  return request({
    url: '/laboratory/haikang/user/subList?pageNum='+data.pageNum+'&pageSize='+data.pageSize,
    method: 'post',
    data: data,
  })
}
//查询实验室已授权列表
export function getHaikangUserList(data) {
  return request({
    url: '/laboratory/haikang/user/userList?pageNum='+data.pageNum+'&pageSize='+data.pageSize+'&startTime='+data.startTime+'&endTime='+data.endTime+'&searchValue='+data.searchValue+'&userType='+data.userType,
    method: 'post',
    data: data
  })
}
//查询门禁授权类型
export function getHaikangQueryTypes(data) {
  return request({
    url: '/laboratory/haikang/user/queryTypes',
    method: 'post',
    data: data
  })
}
//新增用户授权
export function AddImpowerHaikang(data) {
  return request({
    url: '/laboratory/haikang/user/add',
    method: 'post',
    data: data
  })
}
//编辑用户授权
export function editImpowerHaikang(data) {
  return request({
    url: '/laboratory/haikang/user/update',
    method: 'post',
    data: data
  })
}
//新增用户授权
export function retryImpowerHaikang(data) {
  return request({
    url: '/laboratory/haikang/user/retryAccredit',
    method: 'post',
    data: data
  })
}
// 删除用户授权
export function delUserHaikang(id) {
  return request({
    url: '/laboratory/haikang/user/' + id,
    method: 'delete'
  })
}
//门禁授权日志列表
export function entranceUserLogList(query) {
  return request({
    url: '/laboratory/haikang/userLog/list',
    method: 'get',
    params: query
  })
}
//门禁授权日志列表
export function queryHardByTypeList(query) {
  return request({
    url: '/laboratory/hardware/queryHardByType',
    method: 'get',
    params: query
  })
}
//电子信息牌------------------------------------------------------------------------------
//查询门禁授权类型
export function getSignTypeList(query) {
  return request({
    url: '/laboratory/XxpUserAuth/authTypelist',
    method: 'get',
    params: query
  })
}
//新增电子信息牌用户授权
export function getSignAuthAdd(data) {
  return request({
    url: '/laboratory/XxpUserAuth/addAuth',
    method: 'post',
    data: data
  })
}
//查询门禁授权列表
export function getSignAuthList(query) {
  return request({
    url: '/laboratory/XxpUserAuth/list',
    method: 'get',
    params: query
  })
}
//门禁授权删除
export function getSignAuthDelete(id) {
  return request({
    url: '/laboratory/XxpUserAuth/' + id,
    method: 'delete'
  })
}
