import request from '@/utils/request'

//电子围栏


// 查询电子围栏列表
export function listFence(data) {
  return request({
    url: '/saas/fence/fenceselectList',
    method: 'post',
    data
  })
}

// 查询电子围栏选择列表
export function fenceArray(data) {
  return request({
    url: '/saas/fence/fenceArray',
    method: 'post',
    data
  })
}

//添加
export function addfence(data) {
  return request({
    url: '/saas/fence/add',
    method: 'post',
    data
  })
}
//修改
export function updfence(data) {
  return request({
    url: `/saas/fence/upd/${data.id}`,
    method: 'post',
    data
  })
}

//删除
export function delElectronById(id) {
  return request({
    url: '/saas/fence/' + id,
    method: 'DELETE'
  })
}

//根据id设置围栏
export function setFenceWay(data) {
  return request({
    url: '/saas/fence/setFenceWay',
    method: 'post',
    data
  })
}


//开启围栏
export function openFence(id) {
  return request({
    url: '/saas/fence/open/'+id,
    method: 'post',
    data
  })
}
//回显
export function findElectronicByid(id) {
  return request({
    url: '/saas/fence/findElectronicByid/'+id,
    method: 'post',
  })
}

//关闭围栏
export function closeFence(id) {
  return request({
    url: '/saas/fence/close/'+id,
    method: 'post',
    data
  })
}


//围栏组



// 查询围栏组列表
export function selectGroupList(data) {
  return request({
    url: '/saas/group/selectGroupList',
    method: 'post',
    data
  })
}

//添加
export function addGroup(data) {
  return request({
    url: '/saas/group/addGroup',
    method: 'post',
    data
  })
}
//修改
export function updGroup(data) {
  return request({
    url: `/saas/group/updGroup/${data.id}`,
    method: 'post',
    data
  })
}
//添加
export function findGroupByid(id) {
  return request({
    url: '/saas/group/findGroupByid/'+id,
    method: 'post',
  })
}



//企业信息




//分页查询企业信息
export function enterpriseList(data) {
  return request({
    url: '/saas/enterprise/selectEnterprise',
    method: 'post',
    data
  })
}


//新增企业信息
export function insert(data) {
  return request({
    url: '/saas/enterprise/insert',
    method: 'post',
    data: data
  })
}


//根据编号查询企业信息
export function searchById(enterpriseId) {
  return request({
    url: '/saas/enterprise/searchById',
    method: 'get',
    params: {enterpriseId}
  })
}



//修改企业信息
export function updateEnterEnterprise(data) {
  return request({
    url: '/saas/enterprise/updateEnterEnterprise',
    method: 'post',
    data: data
  })
}



//删除企业信息
export function deleteByIds(data) {
  return request({
    url: '/saas/enterprise/deleteByIds',
    method: 'post',
    data: data
  })
}




//车辆管理




// 查询车辆基础信息列表
export function listCar(query) {
  return request({
    url: '/saas/sysCar/selectSysCarVoList',
    method: 'post',
    data: query
  })
}

// 查询车辆基础信息详细
export function getCar(id) {
  return request({
    url: '/saas/sysCar/selectSysCarVoById/' + id,
    method: 'get'
  })
}

// 新增车辆基础信息
export function addCar(data) {
  return request({
    url: '/saas/sysCar/addSysCar',
    method: 'post',
    data: data
  })
}

// 修改车辆基础信息
export function updateCar(data) {
  return request({
    url: '/saas/sysCar',
    method: 'put',
    data: data
  })
}

// 删除车辆基础信息
export function delCar(id) {
  return request({
    url: '/saas/sysCar/deleteSysCarById/' + id,
    method: 'delete'
  })
}



// 查询车辆类型列表
export function selectCarTypeList() {
  return request({
    url: '/saas/carType/selectCarTypeList',
    method: 'get'
  })
}

export function getLogCar() {
  return request({
    url: '/saas/sysCarLog/selectList',
    method: 'get'
  })
}
//对应车辆VIN码查询对应故障 预警 电子围栏
export function findFaultData(carVin) {
  return request({
    url: '/saas/sysCar/findFenceCarVin/'+carVin,
    method: 'post'
  })
}




//报文



// 查询报文模版列表
export function messageTemplateTypeList() {
  return request({
    url: '/saas/messageTemplateType/messageTemplateTypeList',
    method: 'post'
  })
}
// 添加报文
export function addMessageTemplate(data) {
  return request({
    url: '/saas/messageTemplateType/addMessageType',
    method: 'post',
    data
  })
}
// 数据类型列表
export function findDataTypeList() {
  return request({
    url: '/saas/dataType/dataTypeList',
    method: 'post'
  })
}
// 报文模版
export function templateList() {
  return request({
    url: '/saas/template/templateList',
    method: 'post'
  })
}
//基础类型
export function findvehicleFoundationData(templatedId,code) {
  return request({
    url: '/saas/messageTemplateType/findvehicleFoundationData?templatedId='+templatedId+"&code="+code,
    method: 'post'
  })
}
//数据类型
export function findvehicleData(templatedId,code) {
  return request({
    url: '/saas/messageTemplateType/findvehicleData?templatedId='+templatedId+"&code="+code,
    method: 'post'
  })
}
//设备状态
// export function finddeviceStatusData(templatedId,code) {
//   return request({
//     url: '/saas/sysCar/findFenceByCarVin?templatedId='+templatedId+"&code="+code,
//     method: 'post'
//   })
// }

//设备状态
export function findVehicleFaultData(param) {
  return request({
    url: '/saas/messageTemplateType/finddeviceStatusData?carVin='+param,
    method: 'post'
  })
}

//添加报文模版
export function addTemplate(data) {
  return request({
    url: '/saas/template/addTemplate',
    method: 'post',
    data
  })
}



//警告策略




export function selectWarnStrategyList(data) {
  return request({
    url: '/saas/strategy/selectWarnStrategyList',
    method: 'post',
    data: data
  })
}

//报文模板列表
// export function templateList(data) {
//   return request({
//     url: '/saas/template/templateList',
//     method: 'post',
//     data
//   })
// }


//根据报文ID查报文字段
export function selectByTemplateId(templateId) {
  return request({
    url: '/saas/templateNeed/selectByTemplateId/'+templateId,
    method: 'get'
  })
}

//策略新增
export function addWarnStrategy(data) {
  return request({
    url: '/saas/strategy/addWarnStrategy',
    method: 'post',
    data: data
  })
}

//策略修改
export function updWarnStrategy(data) {
  return request({
    url: '/saas/strategy/updWarnStrategy',
    method: 'post',
    data: data
  })
}


//策略回显
export function selectListByCarType(carTypeId) {
  return request({
    url: '/saas/strategy/selectListByCarType/'+carTypeId,
    method: 'get'
  })
}



//删除策略
export function deleteStrategy(id) {
  return request({
    url: '/saas/strategy/deleteWarnStrategy/'+id,
    method: 'delete'
  })
}



//根据车辆类型查策略
export function selectById(id) {
  return request({
    url: '/saas/strategy/selectById/'+id,
    method: 'get'
  })
}


//查询所有规则

export function selectWarnRuleRespList() {
  return request({
    url: '/saas/rule/selectWarnRuleRespList',
    method: 'get'
  })
}

//根据策略ID查规则
export function selectListByStrategyId(strategyId) {
  return request({
    url: '/saas/rule/selectListByStrategyId/'+strategyId,
    method: 'get'
  })
}



//规则新增
export function addWarnRule(data) {
  return request({
    url: '/saas/rule/addWarnRule',
    method: 'post',
    data: data
  })
}
//规则删除
export function updWarnRule(data) {
  return request({
    url: '/saas/rule/updWarnRule',
    method: 'post',
    data: data
  })
}

//规则回显
export function selectRuleById(id) {
  return request({
    url: '/saas/rule/selectById/'+id,
    method: 'get'
  })
}




//故障




// 查询车辆故障管理列表
export function listBreakdown(query) {
  return request({
    url: '/saas/breakdown/list',
    method: 'get',
    params: query
  })
}

// 查询车辆故障管理详细
export function getBreakdown(id) {
  return request({
    url: '/saas/breakdown/' + id,
    method: 'get'
  })
}

// 新增车辆故障管理
export function addBreakdown(data) {
  return request({
    url: '/saas/breakdown',
    method: 'post',
    data: data
  })
}

// 修改车辆故障管理
export function updateBreakdown(data) {
  return request({
    url: '/saas/breakdown',
    method: 'put',
    data: data
  })
}

// 删除车辆故障管理
export function delBreakdown(id) {
  return request({
    url: '/saas/breakdown/' + id,
    method: 'delete'
  })
}
//启用警告
export function enableWarningsById(id) {
  return request({
    url: '/saas/breakdown/enableWarningsById/' + id,
    method: 'put'
  })
}
//禁用警告
export function disableWarningsById(id) {
  return request({
    url: '/saas/breakdown/disableWarningsById/' + id,
    method: 'put'
  })
}


//查询
export function listMessage(){
  return request({
    url:'/saas/message/list',
    method:'get',

  })
}

export function listStatusOne(){
  return request({
    url:'/saas/message/listStatusOne',
    method:'get',
  })
}

export function listStatusTwo(){
  return request({
    url:'/saas/message/listStatusTwo',
    method:'get',
  })
}

//状态修改
export function updateStatusById(id){
  return request({
    url:'/saas/message/updateStatusById/'+id,
    method:'put',
  })
}


//查询
export function listLog(data){
  return request({
    url:'/saas/log/list',
    method:'post',
    data
  })
}

export function listStatusIgnore(data){
  return request({
    url:'/saas/log/listStatusIgnore',
    method:'post',
    data
  })
}

export function listStatusSolve(data){
  return request({
    url:'/saas/log/listStatusSolve',
    method:'post',
    data
  })
}

export function listStatusProcess(data){
  return request({
    url:'/saas/log/listStatusProcess',
    method:'post',
    data
  })
}

// 将状态改为忽略
// export  function  updateStatusById(id){
//   return request({
//     url:'/breakdown/log/updateStatusById/'+id,
//     method:'put'
//   })
// }


