import axios from './http';

/**  登录相关   **/
// 登录
export function Login(data) {
  return axios({
    url: '/admin/my/loginMultilevel',
    method: 'post',
    data: data
  })
}
// 根据用户id 拿到默认的 颜色 和 导航栏
export function findOne(data) {
  return axios({
    url: '/admin/accountMultilevel/findOne',
    method: 'get',
    params: data
  })
}

// 根据id 修改 默认样式 导航
export function findUpdate(data) {
  return axios({
    url: '/admin/accountMultilevel/update',
    method: 'post',
    data: data
  })
}

/**  系统管理api  **/
// 获取菜单用户列表
export function getUserMenu(data) {
  return axios({
    url: '/admin/auth/getMyMenu',
    method: 'post',
    params: data
  })
}

// 拿到菜单用户列表
export function getUserMenuAndButon(data) {
  return axios({
    url: '/admin/auth/getMyMenuAndButton',
    method: 'post',
    params: data,
  })
}

// 拿到按钮权限
export function getMyButton(data) {
  return axios({
    url: '/admin/auth/getMyButton',
    method: 'get',
    params: data
  })
}

// 获取纯菜单(不带按钮)
export function getMenuList() {
  return axios({
    url: '/admin/menu/list1',
    method: 'post',
  })
}

// 获取菜单列表
export function getMenu() {
  return axios({
    url: '/admin/menu/list',
    method: 'post'
  })
}

// 菜单添加
export function addMenu(data) {
  return axios({
    url: '/admin/menu/add',
    method: 'post',
    data: data
  })
}

// 菜单编辑
export function editMenu(data) {
  return axios({
    url: '/admin/menu/edit',
    method: 'post',
    data: data
  })
}

// 菜单删除
export function delMenu(data) {
  return axios({
    url: '/admin/menu/remove',
    method: 'post',
    params: data
  })
}

// 权限列表
export function getAuth(data) {
  return axios({
    url: '/admin/group/list',
    method: 'post',
    data: data
  })
}

// 权限列表删除
export function delAuth(data) {
  return axios({
    url: '/admin/group/remove',
    method: 'post',
    params: data
  })
}

// 新增权限组
export function addAuth(data) {
  return axios({
    url: '/admin/group/add',
    method: 'post',
    data: data
  })
}

// 编辑权限组
export function editAuth(data) {
  return axios({
    url: '/admin/group/edit',
    method: 'post',
    data: data
  })
}

// 权限分配列表(上次保存的菜单)
export function getMenuByGroup(data) {
  return axios({
    url: '/admin/auth/getMenuByGroup',
    method: 'get',
    params: data
  })
}

// 权限分配保存
export function saveGroupMenu(data) {
  return axios({
    url: '/admin/auth/saveGroupMenu',
    method: 'post',
    data: data
  })
}

// 用户分配(上次保存的用户id)
export function getAcountByGroup(data) {
  return axios({
    url: '/admin/auth/getAcountByGroup',
    method: 'get',
    params: data
  })
}

// 用户分配保存
export function saveAccountGroup(data) {
  return axios({
    url: '/admin/auth/saveAccountGroup',
    method: 'post',
    data: data
  })
}

// 获取用户列表
export function getUserList(data) {
  return axios({
    // url: '/admin/accountMultilevel/list',
    url: '/admin/accountMultilevel/listSubordinate',
    method: 'post',
    data: data
  })
}

// 用户添加
export function addUser(data) {
  return axios({
    url: '/admin/accountMultilevel/add',
    method: 'post',
    data: data
  })
}

// 用户编辑
export function editUser(data) {
  return axios({
    url: '/admin/accountMultilevel/update',
    method: 'post',
    data: data
  })
}

// 是否启用账号
export function isUser(data) {
  return axios({
    url: '/admin/accountMultilevel/setAccountStatus',
    method: 'get',
    params: data
  })
}

// 用户删除
export function delUser(data) {
  return axios({
    url: '/admin/accountMultilevel/remove',
    method: 'get',
    params: data
  })
}

// 牧场列表
export function getFarm(data) {
  return axios({
    url: '/admin/farm/getFarm',
    method: 'get',
    params: data
  })
}

// 牧场添加
export function addFarm(data) {
  return axios({
    url: 'admin/farm/add',
    method: 'post',
    data: data
  })
}

// 牧场编辑
export function editFarm(data) {
  return axios({
    url: 'admin/farm/edit',
    method: 'post',
    data: data
  })
}

// 牧场删除

export function delFarm(data) {
  return axios({
    url: 'admin/farm/remove',
    method: 'get',
    params: data
  })
}

// 选择牧场
export function getFarmId(data) {
  return axios({
    url: 'admin/accountMultilevel/getLastFarmId',
    method: 'get',
    params: data,
  })
}

/**
 *
 * 视频监控部分
 * **/

// 监控区域列表
export function areaList(data) {
  return axios({
    url: '/video/cameraArea/list',
    method: 'post',
    data: data
  })
}

// 监控区域删除
export function delArea(data) {
  return axios({
    url: '/video/cameraArea/remove',
    method: 'get',
    params: data
  })
}

// 监控区域添加
export function addArea(data) {
  return axios({
    url: '/video/cameraArea/add',
    method: 'post',
    data: data
  })
}

// 监控区域编辑
export function editArea(data) {
  return axios({
    url: '/video/cameraArea/update',
    method: 'post',
    data: data
  })
}

// 摄像头品牌列表
export function brandList(data) {
  return axios({
    url: '/video/cameraBrand/list',
    method: 'post',
    data: data
  })
}

// 品牌添加
export function addBarand(data) {
  return axios({
    url: '/video/cameraBrand/add',
    method: 'post',
    data: data
  })
}

// 品牌删除
export function delBarand(data) {
  return axios({
    url: '/video/cameraBrand/remove',
    method: 'get',
    params: data
  })
}

// 品牌编辑
export function editBarand(data) {
  return axios({
    url: '/video/cameraBrand/update',
    method: 'post',
    data: data
  })
}

// 监控管理列表
export function videoList(data) {
  return axios({
    url: '/video/camera/list',
    method: 'post',
    data: data
  })
}
// 监控是否启用
export function videoSwitch(data) {
  return axios({
    url: '/video/camera/updateStatus',
    method: 'get',
    params: data
  })
}
// 监控删除
export function delVideo(data) {
  return axios({
    url: '/video/camera/remove',
    method: 'get',
    params: data
  })
}
// 监控添加
export function addVideo(data) {
  return axios({
    url: '/video/camera/add',
    method: 'post',
    data: data
  })
}
// 监控编辑
export function editVideo(data) {
  return axios({
    url: '/video/camera/update',
    method: 'post',
    data: data
  })
}

// 根据id获取摄像头
export function getVideo(data) {
  return axios({
    url: '/video/camera/getCameraDetails',
    method: 'post',
    data: data
  })
}

/** 生产数据 */
/* 生产数据 - ERP */
// 存栏结构 - 存栏变动折线图
export function getInventoryLines(data) {
  return axios({
    url: '/produce/prodStock/listStorage',
    method: 'get',
    params: data
  })
}

// 存栏情况 + 生产情况
export function getInventoryAndProduct(data) {
  return axios({
    url: '/produce/prodStock/listERP',
    method: 'get',
    params: data
  })
}

/** 经营分析 */

// 经营分析 - 成本分析
export function getCosts(data) {
  return axios({
    url: '/produce/prodCost/listProdCost',
    method: 'get',
    params: data
  })
}

// 经营分析 - 销售改变
export function getSalesChange(data) {
  return axios({
    url: '/produce/prodSalesDetail/getSalesWeek',
    method: 'get',
    params: data
  })
}
// 经营分析 - 销售情况图
export function getSalesChart(data) {
  return axios({
    url: '/produce/prodSalesDetail/getSalesDetail',
    method: 'get',
    params: data
  })
}

/** 应收 */
export function getYingShou(data) {
  return axios({
    url: '/produce/prodPayable/listReceivable',
    method: 'get',
    params: data
  })
}

/** 应付 */
export function getYingFu(data) {
  return axios({
    url: '/produce/prodPayableRank/listPayable',
    method: 'get',
    params: data
  })
}

/** 人员管理 - 人脸门禁 - Token */
export function getFaceToken(data) {
  return axios({
    url: '/video/token/getToken',
    method: 'get',
    params: data
  })
}
/** 人员管理 - 人脸门禁 - 查询 */
export function getFaceGuard(data) {
  return axios({
    url: '/video/person/get_person_record',
    method: 'post',
    data: data
  })
}

/** 每栋温湿度 **/
export function getEnv(data) {
  return axios({
    url: '/env/room/getAllRoomEnvironment',
    method: 'get',
    params: data
  })
}

/* 栋舍 */
export function getSchool(data) {
  return axios({
    url: '/env/floor/list',
    method: 'get',
    params: data
  })
}

/* 楼层 */
export function getByFloor(data) {
  return axios({
    url: '/env/box/listByFloor',
    method: 'get',
    params: data
  })
}

/** 单元 **/
export function getUid(data) {
  return axios({
    url: '/env/room/listBy',
    method: 'get',
    params: data
  })
}

/* 环境查询 */
export function getByRoom(data) {
  return axios({
    url: '/env/room/listByRoom',
    method: 'post',
    data: data
  })
}

/** 饮用水详情 **/
export function getAllDayWater(data) {
  return axios({
    url: '/env/monthWater/getAllDayWater',
    method: 'get',
    params: data
  })
}

/** 饮用水全部 **/
export function getListAllWater(data) {
  return axios({
    url: '/env/dayWater/listAllWater',
    method: 'post',
    data: data
  })
}

/** 栋舍饮用水 **/
export function getListWater(data) {
  return axios({
    url: '/env/dayWater/listWater',
    method: 'post',
    data: data
  })
}

/** 总用料量 **/
export function getAllFodder(data) {
  return axios({
    url: '/env/sysFodder/getAllFodder',
    method: 'post',
    data: data
  })
}

/** 单个查询用料量 **/

export function getFodder(data) {
  return axios({
    url: '/env/sysFodder/getFodder',
    method: 'post',
    data: data
  })
}

/**  erp牧场列表  **/
export function getErpFarm(data) {
  return axios({
    url: 'admin/prodFarmName/listFarmName',
    method: 'post',
    data: data
  })
}
/**  erp牧场同步  **/
export function getErpHold(data) {
  return axios({
    url: 'admin/prodFarmName/updatName',
    method: 'get',
    params: data
  })
}
/** erp牧场删除 **/
export function delErpFarm(data) {
  return axios({
    url: 'admin/prodFarmName/remove',
    method: 'get',
    params: data
  })
}

/** erp牧场修改 **/
export function editEarpFarm(data) {
  return axios({
    url: 'admin/prodFarmName/edit',
    method: 'post',
    data: data
  })
}

/** 首页报警之类 **/
export function getListClientHome(data) {
  return axios({
    url: 'produce/prodSales/listClientHome',
    method: 'get',
    params: data
  })
}

/** 环保  **/
export function getEnvList(data) {
  return axios({
    url: 'env/environ/getLastEnviron',
    method: 'get',
    params: data
  })
}

/** 7天环保数据 **/
export function getSevenEnv(data) {
  return axios({
    url: 'env/environ/getLastSevenDayEnviron',
    method: 'get',
    params: data
  })
}

/** 时间提醒 **/
export function getEventList(data) {
  return axios({
    url: 'video/client/event/ListAllEvent',
    method: 'post',
    data: data
  })
}

/**  牧场1.0添加 **/
export function addXFarm(data) {
  return axios({
    url: 'admin/my/xadd',
    method: 'post',
    data: data
  })
}

/** 牧场1.0list **/
export function getXFarmList(data) {
  return axios({
    url: 'admin/my/xlist',
    method: 'get',
    params: data
  })
}

/** 牧场1.0修改 **/
export function editXFarm(data) {
  return axios({
    url: 'admin/my/xupdate',
    method: 'post',
    data: data
  })
}

/** 牧场1.0删除 **/
export function delXFarm(data) {
  return axios({
    url: 'admin/my/xremove',
    method: 'get',
    params: data
  })
}

/** 得到video列表 **/
export function getVideoAll(data) {
  return axios({
    url: 'video/cameraArea/lsitAndCamera',
    method: 'get',
    params: data
  })
}

/** 添加大屏video **/
export function baseVideoAdd(data) {
  return axios({
    url: '/video/baseSpecificVideo/add',
    method: 'post',
    data: data
  })
}

/**  大屏全部**/
export function baseVideoList(data) {
  return axios({
    url: '/video/baseSpecificVideo/list',
    method: 'get',
    params: data
  })
}

/**  大屏删除 **/
export function baseVideoDel(data) {
  return axios({
    url: '/video/baseSpecificVideo/remove',
    method: 'get',
    params: data
  })
}


/** 大屏编辑 **/
export function baseVideoEdit(data) {
  return axios({
    url: '/video/baseSpecificVideo/update',
    method: 'post',
    data: data
  })
}

