import request from '@/router/axios'


// 字典表接口
export function userDict(query) {
  return request({
    url: '/admin/user/dict',
    method: 'get',
    params: query
  })
}
// 组织权限获取数组
export function fetchRoleTree(orgType) {
  return request({
    url: '/admin/sysorgmenu/tree/' + orgType,
    method: 'get'
  })
}
//添加组织用户权限
export function permissionUpd(orgType, menuIds) {
  return request({
    url: 'admin/sysorgmenu',
    method: 'post',
    data: {
      orgType:orgType ,
      menuIds: menuIds
    }
  })
}
export function fetchList(query) {
  return request({
    url: '/admin/user/page',
    method: 'get',
    params: query
  })
}

export function addObj(obj) {
  return request({
    url: '/admin/user',
    method: 'post',
    data: obj
  })
}

export function delObj(id) {
  return request({
    url: '/admin/user/' + id,
    method: 'delete'
  })
}

export function putObj(obj) {
  return request({
    url: '/admin/user',
    method: 'put',
    data: obj
  })
}

// 页面加载时获取登录人tab
export function getTab(query) {
  return request({
    url: '/admin/user/getLoginBackend',
    method: 'get',
    params: query
  })
}

// 获取部门树
export function userDeptTree(query) {
  return request({
    url: '/admin/user/deptTree',
    method: 'get',
    params: query
  })
}
// 获取公司角色列表
export function getRoleByOrgCode(query) {
  return request({
    url: '/admin/role/getRoleByOrgCode',
    method: 'get',
    params: query
  })
}

// 用户管理
// 获取当前人的所有楼盘
export function queryHouseByUsername(query) {
  return request({
    url: '/autoSR/zkhouse/queryHouseByUsername',
    method: 'get',
    params: query
  })
}
//获取当前用户信息
export function getUserMsg(query) {
  return request({
    url: '/admin/user/getUser',
    method: 'get',
    params: query
  })
}
// 组织用户禁用先用
export function updateLockFlag(obj) {
  return request({
    url: '/admin/user/updateLockFlag',
    method: 'post',
    data: obj
  })
}
// 区域回显
export function userAreaFind(query) {
  return request({
    url: '/admin/user/areaFind',
    method: 'get',
    params: query
  })
}
// 用户批量删除
export function userDelByIds(query) {
  return request({
    url: '/admin/user/delByIds',
    method: 'delete',
    params: query
  })
}
// 获取公司列表
export function deptGetOrgList(query) {
  return request({
    url: '/admin/dept/deptGetOrgList',
    method: 'get',
    params: query
  })
}
// 获取公司下的角色
export function roleList(query) {
  return request({
    url: '/admin/role/list',
    method: 'get',
    params: query
  })
}
// 获取身份列表
export function getAllUserRoleType(query) {
  return request({
    url: 'admin/user/getAllUserRoleType',
    method: 'get',
    params: query
  })
}
// 添加角色
export function addUserMsg(data) {
  return request({
    url: '/admin/user',
    method: 'post',
    data
  })
}
// 修改角色
export function editUserMsg(data) {
  return request({
    url: '/admin/user',
    method: 'put',
    data
  })
}
// 密码重置
export function resetPassword(data) {
  return request({
    url: '/admin/user/resetPassword',
    method: 'post',
    data
  })
}
// 客户手机号显隐
export function updateShowPhoneStatus(data) {
  return request({
    url: '/admin/user/updateShowPhoneStatus',
    method: 'post',
    data
  })
}

// 角色管理

export function roleDelIds(query) {
  return request({
    url: '/admin/role/delIds',
    method: 'delete',
    params: query
  })
}

// 部门管理

//部门添加
export function deptAddOrg(data) {
  return request({
    url: '/admin/dept/addOrg',
    method: 'post',
    data
  })
}
//部门编辑
export function deptUpdateOrgTree(data) {
  return request({
    url: '/admin/dept/updateOrgTree',
    method: 'post',
    data
  })
}

//部门删除
export function deptDelOrg(data) {
  return request({
    url: '/admin/dept/delOrg',
    method: 'post',
    data
  })
}

// 获取代理商列表
export function zkagentPage(query) {
  return request({
    url: '/autoSR/zkagent/page',
    method: 'get',
    params: {orgType:localStorage.getItem('orgType'),...query}
  })
}
// 获取公司列表
export function zkorg(query) {
  return request({
    url: '/autoSR/zkorg/page',
    method: 'get',
    params: query
  })
}


// 获取注册用户列表
export function registerUserList(query) {
  return request({
    url: '/admin/user/registerUserList',
    method: 'get',
    params: query
  })
}

// 获取组织用户列表
export function orgUserList(query) {
  return request({
    url: '/admin/user/orgUserList',
    method: 'get',
    params: query
  })
}
// 验证电话号码是否存在
export function verPhone(username) {
  return request({
    url: 'admin/user/findByUsername/'+username,
    method: 'get',
  })
}
//获取用户代理商
export function findMyAgent(query) {
  return request({
    url: '/autoSR/zkagent/findMyAgent',
    method: 'get',
    params:query
  })
}
//获取用户公司
export function findMyOrg(query) {
  return request({
    url: '/autoSR/zkorg/findMyOrg',
    method: 'get',
    params:query
  })
}
// 获取当前公司代理商的角色
export function findRoleByOrgCode(data) {
  return request({
    url: '/admin/role/findRoleByCondition',
    method:'post',
    data
  })
}
// 添加用户
export function addUser(data) {
  return request({
    url: '/admin/user',
    method:'post',
    data
  })
}
// 获取用户
export function houseListWhenAddUser(query) {
  return request({
    url: '/autoSR/zkhouse/houseListWhenAddUser',
    method:'get',
    params:query
  })
}
export function findHouseByUser(query) {
  return request({
    url: '/autoSR/zkhouse/findHouseByUser',
    method:'get',
    params:{
      agentId:localStorage.getItem('agentId'),
      orgCode:localStorage.getItem('orgCode'),
      ...query
    }
  })
}
// 楼盘绑定
export function saveHouse(data) {
  return request({
    url: '/admin/user/saveHouse',
    method:'post',
    data
  })
}
// 根据公司获取区域
export function areamanagerList(query) {
  return request({
    url: '/autoSR/areamanager/list',
    method:'get',
    params:query
  })
}
// 获取当前登录人的区域
export function findArea(query) {
  return request({
    url: 'autoSR/cushouseuserrelationmid/findArea ',
    method:'get',
    params:query
  })
}
// 通过地区串获取省市
export function getParentAndKidList(query) {
  return request({
    url: '/autoSR/zksysarea/getParentAndKidList',
    method:'get',
    params:query
  })
}
// 获取省市地区
export function getValueByCondition(query) {
  return request({
    url: '/autoSR/zksysarea/getValueByCondition',
    method:'get',
    params:query
  })
}
//添加区域
export function areaAdd(data) {
  return request({
    url: '/admin/user/areaAdd',
    method:'post',
    data
  })
}


// 角色管理
// 获取角色
export function rolePage(query) {
  return request({
    url: '/admin/role/findByPage',
    method:'get',
    params:query
  })
}


// 楼盘管理，获取公司列表
export function getCompanyList(query) {
  return request({
    url: '/autoSR/zkorg/findMyOrg',
    method:'get',
    params:query
  })
}
// 获取楼盘管理列表
export function zkhousePage(query) {
  return request({
    url: '/autoSR/zkhouse/page',
    method:'get',
    params:query
  })
}

// 获取省市
export function getAreaList(query) {
  return request({
    url: '/autoSR/zksysarea/list',
    method:'get',
    params:query
  })
}
// 获取当前人的区域的楼盘
export function findHouseByArea(query) {
  return request({
    url: 'autoSR/cushouseuserrelationmid/findHouseByArea',
    method:'get',
    params:query
  })
}
// 获取运营人员
export function getAllOperationsStaff(query) {
  return request({
    url: '/admin/user/getAllOperationsStaff',
    method:'get',
    params:query
  })
}
// 获取运营人员
export function getAllOperationsStaffByAgent(query) {
  return request({
    url: '/admin/user/getAllOperationsStaffByAgent',
    method:'get',
    params:query
  })
}
// 添加楼盘
export function addZkhouse(data) {
  return request({
    url: '/autoSR/zkhouse',
    method:'post',
    data
  })
}
export function editZkhouse(data) {
  return request({
    url: '/autoSR/zkhouse',
    method:'put',
    data
  })
}
// 更换账号
export function updateManagerPhone(data) {
  return request({
    url: '/autoSR/zkhouse/updateManagerPhone',
    method:'post',
    data
  })
}



// 接待记录
export function findbypage(query) {
  return request({
    url: '/autoSR/customer/findbypage',
    method:'get',
    params:query
  })
}
// 接待记录客户意向
export function findKeywords(query) {
  return request({
    url: 'autoSR/matchKeywords/findKeywords',
    method:'get',
    params:query
  })
}

// 置业顾问
export function findUserListByHouseId(query) {
  return request({
    url: 'autoSR/cushouseuserrelationmid/findUserListByHouseId',
    method:'get',
    params:query
  })
}

// 常错词列表
export function correctFindbypage(query) {
  return request({
    url: '/autoSR/zk/correct/findByPage',
    method:'get',
    params:query
  })
}
// 新增常错词
export function correctAdd(query) {
  return request({
    url: '/autoSR/zk/correct/add',
    method:'post',
    params:query
  })
}
// 新增常错词
export function correctUpdate(query) {
  return request({
    url: '/autoSR/zk/correct/update',
    method:'post',
    params:query
  })
}

//
// 客户管理客户裂变
export function customerManagement(query) {
  return request({
    url: '/autoSR/customer/customerManagement',
    method:'get',
    params:query
  })
}

// 销售阶段列表
export function lifeTrackDefineList(query) {
  return request({
    url: '/autoSR/lifeTrackDefine/list',
    method:'get',
    params:query
  })
}
// 修改
export function lifeTrackDefineUpdate(data) {
  return request({
    url: '/autoSR/lifeTrackDefine/update',
    method:'post',
    data
  })
}
// 添加
export function lifeTrackDefineAdd(data) {
  return request({
    url: '/autoSR/lifeTrackDefine/add',
    method:'post',
    data
  })
}


// 设备列表
export function equipmentManagement(query) {
  return request({
    url: 'autoSR/zk/equipment/equipmentManagement',
    method:'get',
    params:query
  })
}

export function findByUserName(data) {
  return request({
    url: 'admin/user/findByUserName',
    method:'post',
    data:{
      orgType:localStorage.getItem('orgType')/1,
      ...data
    }
  })
}
// 设备列表获取批次列表
export function zkequipmentbatchList(query) {
  return request({
    url: 'autoSR/zkequipmentbatch/list',
    method:'get',
    params:query
  })
}

// 添加设备
export function equipmentAdd(data) {
  return request({
    url: 'autoSR/zk/equipment/add',
    method:'post',
    data
  })
}
// 验收设备
export function equipmentAcceptance(data) {
  return request({
    url: 'autoSR/zk/equipment/acceptance',
    method:'post',
    data
  })
}
// 归还设备
export function equipmentUnbind(data) {
  return request({
    url: 'autoSR/zk/equipment/unbind',
    method:'post',
    data
  })
}
// 恢复正常
export function backToNormal(data) {
  return request({
    url: 'autoSR/zk/equipment/backToNormal',
    method:'post',
    data
  })
}
//转写方式修改
export function updateTranslationMethod(data) {
  return request({
    url: 'autoSR/zk/equipment/updateTranslationMethod',
    method:'post',
    data
  })
}
// 绑定
export function equipmentbind(data) {
  return request({
    url: 'autoSR/zk/equipment/bind',
    method:'post',
    data
  })
}

// 获取设备状态检测
export function equipmentZxOn(data) {
  return request({
    url: 'autoSR/zk/equipment/zxOn',
    method:'post',
    data
  })
}
// 设备删除
export function equipmentZxOnDelete(query) {
  return request({
    url: 'autoSR/zk/equipment/delete',
    method:'get',
    params:query
  })
}
// 设备状态监控列表
export function equipmentZxOnFindByPage(query) {
  return request({
    url: 'autoSR/zk/equipment/findByPage',
    method:'get',
    params:query
  })
}

//楼盘获取顾问列表
export function getUserByHouseId(query) {
  return request({
    url: '/admin/user/getUserByHouseId',
    method:'get',
    params:query
  })
}
//设备领用
export function equipmentReceiving(data) {
  return request({
    url: 'autoSR/zk/equipment/receiving',
    method:'post',
    data
  })
}
//设备指示灯
export function batchOperateIndicator(data) {
  return request({
    url: 'autoSR/zk/equipment/batchOperateIndicator',
    method:'post',
    data
  })
}
//状态检测绑定
export function zkequipmentBind(data) {
  return request({
    url: 'autoSR/zk/equipment/bind',
    method:'post',
    data
  })
}
//状态检测绑定
export function zkequipmentUnbind(data) {
  return request({
    url: 'autoSR/zk/equipment/unbind',
    method:'post',
    data
  })
}
//状态检测批量归还
export function zkequipmentEquipmentBack(data) {
  return request({
    url: 'autoSR/zk/equipment/equipmentBack',
    method:'post',
    data
  })
}
//批量绑定批次号
export function zkequipmentBindBatchId(data) {
  return request({
    url: 'autoSR/zk/equipment/bindBatchId',
    method:'post',
    data
  })
}
// WiFi管理
export function wifiFindById(query) {
  return request({
    url: '/autoSR/equipment/wifi/findById',
    method:'get',
    params:query
  })
}
//录音开启关闭
export function audioStatusControl(data) {
  return request({
    url: 'autoSR/zk/equipment/audioStatusControl',
    method:'post',
    data
  })
}
//Wifi修改
export function wifiUpdate(data) {
  return request({
    url: '/autoSR/equipment/wifi/update',
    method:'post',
    data
  })
}
//Wifi添加
export function wifiInsert(data) {
  return request({
    url: '/autoSR/equipment/wifi/insert',
    method:'post',
    data
  })
}
// 获取领用记录列表
export function equipReceiveFindByPage(query) {
  return request({
    url: '/autoSR/equipReceive/findByPage',
    method:'get',
    params:query
  })
}
// 楼盘对比列表
export function houseStatistics(query) {
  return request({
    url: 'autoSR/zkhouse/houseStatistics',
    method:'get',
    params:query
  })
}
// 运营人员列表获取
export function zkoperationrecordFindByOrg(query) {
  return request({
    url: '/autoSR/zkoperationrecord/findByOrg',
    method:'get',
    params:query
  })
}

// 运营人员添加
export function zkoperationrecord(data) {
  return request({
    url: '/autoSR/zkoperationrecord',
    method:'post',
    data
  })
}
// 公司运营人员添加
export function zkoperationrecordSaveCompany(data) {
  return request({
    url: '/autoSR/zkoperationrecord/saveCompany',
    method:'post',
    data
  })
}
// 楼盘运营人员添加
export function zkoperationrecordSaveHouse(data) {
  return request({
    url: '/autoSR/zkoperationrecord/saveHouse',
    method:'post',
    data
  })
}

// 部门列表
export function deptFindByPage(query) {
  return request({
    url: 'admin/dept/findByPage',
    method:'get',
    params:query
  })
}
// 部门添加
export function deptAdd(data) {
  return request({
    url: 'admin/dept/add',
    method:'post',
    data
  })
}
// 部门删除
export function deptDel(data) {
  return request({
    url: 'admin/dept/del',
    method:'post',
    data
  })
}
// 部门编辑
export function deptUpdate(data) {
  return request({
    url: 'admin/dept/update',
    method:'post',
    data
  })
}
// 根据楼盘获取部门
export function deptFindList(query) {
  return request({
    url: 'admin/dept/findList',
    method:'get',
    params:query
  })
}
// 获取代理商回显
export function findAgentByOrgCode(query) {
  return request({
    url: 'autoSR/zkagentcompanybind/findAgentByOrgCode',
    method:'get',
    params:query
  })
}
// 公司绑定代理商
export function bindAgent(data) {
  return request({
    url: 'autoSR/zkagentcompanybind/bindAgent',
    method:'post',
    data
  })
}
// 楼盘绑定代理商
export function saveAgent(data) {
  return request({
    url: 'autoSR/zkhouse/saveAgent',
    method:'post',
    data
  })
}

// 验证登陆人信息
export function userVerify(data) {
  return request({
    url: 'admin/user/verify',
    method:'post',
    data
  })
}
// 注册用户修改
export function editRoleAndDept(data) {
  return request({
    url: '/admin/user/editRoleAndDept',
    method:'put',
    data
  })
}
// 获取数据总览统计数据
export function dataOverViewWithSystem(data) {
  return request({
    url: 'autoSR/cusStageStatistics/dataOverViewWithSystem',
    method:'post',
    data
  })
}
// 获取数据总览统计数据
export function dataOverviewWithSystemWithDay(data) {
  return request({
    url: 'autoSR/cusStageStatistics/dataOverviewWithSystemWithDay',
    method:'post',
    data
  })
}
// 整体看板
export function dataOverviewWithSystemWithLook(data) {
  return request({
    url: 'autoSR/cusStageStatistics/dataOverviewWithSystemWithLook',
    method:'post',
    data
  })
}
// 获取楼盘数据一
export function houseDataAll(data) {
  return request({
    url: 'autoSR/cusStageStatistics/houseDataAll',
    method:'post',
    data
  })
}
// 获取楼盘数据一
export function houseTrends(data) {
  return request({
    url: 'autoSR/cusStageStatistics/houseTrends',
    method:'post',
    data
  })
}
// 趋势分析tab
export function receptionOverviewOfSystem(data) {
  return request({
    url: 'autoSR/cusStageStatistics/receptionOverviewOfSystem',
    method:'post',
    data
  })
}

// 趋势分析折线图
export function receptionDataOfSystem(data) {
  return request({
    url: 'autoSR/cusStageStatistics/receptionDataOfSystem',
    method:'post',
    data
  })
}
// 楼盘统计公司
export function companyStatistics(query) {
  return request({
    url: 'autoSR/cusStageStatistics/companyStatistics',
    method:'get',
    params:query
  })
}
// 楼盘统计代理商
export function agentStatistics(query) {
  return request({
    url: 'autoSR/cusStageStatistics/agentStatistics',
    method:'get',
    params:query
  })
}
// 楼盘统计代理商
export function houseStatistics1(query) {
  return request({
    url: 'autoSR/cusStageStatistics/houseStatistics',
    method:'get',
    params:query
  })
}
//顾问能力列表
export function prohibitedStatistics(query) {
  return request({
    url: '/autoSR/cusStageStatistics/prohibitedStatistics',
    method:'get',
    params:query
  })
}
export function accountRank(query) {
  return request({
    url: '/autoSR/cusStageStatistics/accountRank',
    method:'get',
    params:query
  })
}

export function accountRankTOP10(query) {
  return request({
    url: '/autoSR/cusStageStatistics/accountRankTOP10',
    method:'get',
    params:query
  })
}
// 置业顾问列表
export function receptionStatisticsAllAccount(query) {
  return request({
    url: '/autoSR/cusStageStatistics/receptionStatisticsAllAccount',
    method:'get',
    params:query
  })
}
export function receptionStatistics(query) {
  return request({
    url: '/autoSR/cusStageStatistics/receptionStatistics',
    method:'get',
    params:query
  })
}
// 小程序菜单管理
export function apiTree(query) {
  return request({
    url: 'admin/menu/apiTree',
    method:'get',
    params:query
  })
}
// 后台首页获取第一个数据
export function waitingForOperation(data) {
  return request({
    url: 'autoSR/cusStageStatistics/waitingForOperation',
    method:'post',
    data
  })
}
// 设备绑定
export function scheduling(query) {
  return request({
    url: 'autoSR/zkAgentPoolCalendar/scheduling',
    method:'get',
    params:query
  })
}
// 设备批量绑定
export function schedulings(query) {
  return request({
    url: 'autoSR/zkAgentPoolCalendar/schedulings',
    method:'get',
    params:query
  })
}
// 获取绑定的排版
export function findByAgentId(query) {
  return request({
    url: 'autoSR/zkAgentPoolCalendar/findByAgentId',
    method:'get',
    params:query
  })
}
//销讲词模板
export function templategetMarketingTree(query) {
  return request({
    url: '/autoSR/marketing/getMarketingTree',
    method:'get',
    params:query
  })
}
//导出文件
export function exportFile(data) {
  return request({
    url: '/autoSR/equipReceive/findByPage',
    method:'post',
    data
  })
}
//表格一
export function realTimeStatisticsOfTime(query) {
  return request({
    url: '/autoSR/cusStageStatistics/realTimeStatisticsOfTime',
    method:'get',
    params:query
  })
}
//表格二
export function dataOverviewWithSystemWithLookWithTable(query) {
  return request({
    url: '/autoSR/cusStageStatistics/dataOverviewWithSystemWithLookWithTable',
    method:'get',
    params:query
  })
}
export function buyEquipmentQuantity(query) {
  return request({
    url: '/autoSR/cusStageStatistics/buyEquipmentQuantity',
    method:'get',
    params:query
  })
}
// 下载录音文件
export function filedownload(query) {
  return request({
    url: '/autoSR/zk/file/filedownload',
    method:'get',
    params:query
  })
}
// 洞察详情导出
// export function dcCarReceptionRecord(query) {
//   return request({
//     url: '/autoSR/matchKeywords/dcCarReceptionRecord',
//     method:'get',
//     params:query
//   })
// }
