import request from '@/utils/request'

// 查询查获物品明细列表
export function listItems(query) {
  return request({
    url: '/item/items/list',
    method: 'get',
    params: query
  })
}

// 查询查获物品明细详细
export function getItems(id) {
  return request({
    url: '/item/items/' + id,
    method: 'get'
  })
}

// 新增查获物品明细
export function addItems(data) {
  return request({
    url: '/item/items',
    method: 'post',
    data: data
  })
}

// 修改查获物品明细
export function updateItems(data) {
  return request({
    url: '/item/items',
    method: 'put',
    data: data
  })
}

// 删除查获物品明细
export function delItems(id) {
  return request({
    url: '/item/items/' + id,
    method: 'delete'
  })
}

//查获总数量+移交公安数量+故意隐匿数量
export function getTotalSome (params = {}) {
  return request({
    url: '/item/largeScreen/getAppTotalSome',
    method: 'get',
    params
  })
}

//获取当天所有用户统计数据
export function getDailyAllUsersRanking(params = {}) {
  return request({
    url: '/exam/daily/statistics/dashboard/all-users-ranking',
    method: 'get',
    params
  })
}

//巡检执行
export function getExecutionStatusTotal(params) {
  return request({
    url: '/check/largeScreen/inspectionExecute',
    method: 'get',
    params: params
  })
}

// 获取通道统计
export function getChannelStatistics(status) {
  return request({
    url: '/attendance/postRecord/count?regionalStatus='+status,
    method: 'post',
  })
}

// 答题个人排行
export function userRanking() {
  return request({
    url: '/exam/daily/statistics/dashboard/user-ranking?timeRange=today&topN=10&sortBy=completionRate',
    method: 'get',
  })
}
// 获取通道统计
export function deptRanking() {
  return request({
    url: '/exam/daily/statistics/dashboard/dept-ranking?timeRange=today&topN=10&sortBy=completionRate',
    method: 'get',
  })
}


// 获取总体问题分布
export function problemDistribution(params = {}) {
  return request({
    url: '/check/largeScreen/problemDistribution',
    method: 'get',
    params
  })
}

// 获取问题分布对比
export function problemComparison(params = {}) {
  return request({
    url: '/check/largeScreen/problemComparison',
    method: 'get',
    params
  })
}

// 获取计划安排总览
export function planOverview(params={}) {
  return request({
    url: '/check/largeScreen/planOverview',
    method: 'get',
    params
  })
}
// 获取日常任务检查指标累计分布
export function planDistribution(params={}) {
  return request({
    url: '/check/largeScreen/planDistribution',
    method: 'get',
    params
  })
}
// 获取任务明细统计
export function planStatistics(params={}) {
  return request({
    url: '/check/largeScreen/planStatistics',
    method: 'get',
    params
  })
}

// 查获总览
export function getAppTotalSome(params = {}) {
  return request({
    url: '/item/largeScreen/getAppTotalSome',
    method: 'get',
    params
  })
}
// 违禁品类别
export function category(params = {}) {
  return request({
    url: '/item/largeScreen/category',
    method: 'get',
    params: {
      levelType: 1,
      ...params,
    }
  })
}
// 违禁品查获部位
export function appPosition(params = {}) {
  return request({
    url: '/item/largeScreen/appPosition',
    method: 'get',
    params: {
      levelType: 1,
      ...params,
    }
  })
}
// 查获岗位
export function largeScreenPost(params = {}) {
  return request({
    url: '/item/largeScreen/post',
    method: 'get',
    params
  })
}
// 查获时间分布
export function appTimeSpan(params = {}) {
  return request({
    url: '/item/largeScreen/appTimeSpan',
    method: 'get',
    params
  })
}

// 问题整改统计
export function correction(params = {}) {
  return request({
    url: '/check/largeScreen/correction',
    method: 'get',
    params
  })
}
// 问题整改分布
export function correctionDistribution(params = {}) {
  return request({
    url: '/check/largeScreen/correctionDistribution',
    method: 'get',
    params
  })
}

//工作画像--查获审批时长统计(柱状图)
export function getDurationChart (params) {
  return request({
    url: '/item/user-ranking/seizure-approval/duration',
    method: 'get',
    params: params
  });
}


//获取站级别抽问抽答完成率
export function getStationLevelRate (params = {}) {
  return request({
    url: '/exam/daily/site-profile/daily-completion-rate',
    method: 'get',
    params: params
  });
}
//获取部门抽问抽答完成率
export function getDepartmentLevelRate (params = {}) {
  return request({
    url: '/exam/daily/dept-profile/daily-completion-rate',
    method: 'get',
    params: params
  });
}
//工作画像--查获趋势图，获取有效查获趋势数据（默认近90天）
export function getSeizureTrendChart (params = {}) {
  return request({
    url: '/item/user-ranking/seizure-trend',
    method: 'get',
    params: params
  });
}

//工作画像--通道开放趋势图(折线图)
export function getChannelOpenTrendChart (params = {}) {
  return request({
    url: '/attendance/stats/channel/open/trend',
    method: 'get',
    params: params
  });
}

export function getDeptList() {
  return request({
    url: '/system/user/deptTree',
    method: 'get'
  })
}

//能力画像-协同配合
export function getCollaborationProfile(params) {
  return request({
    url: '/system/user/cooperation',
    method: 'get',
    params: params
  })
}
//能力画像-明细
export function getDetailProfile(params) {
  return request({
    url: '/system/user/detail',
    method: 'get',
    params: params
  })
}

// 查获取指定模块的指标值
export function getModuleMetrics(params) {
  return request({
    url: '/user/basic/portrait/module/info',
    method: 'get',
    params: params
  })
}
//总体概览接口
export function getOverview(params) {
  return request({
    url: '/system/user/population',
    method: 'get',
    params: params
  })
}

//计算站级考勤工作统计
export function getAttendanceStatistics (params) {
  return request({
    url: `/attendance/stats/station`,
    method: 'get',
    params: params  
  })
}
//计算站级查获统计
export function getSiteStatistics(params) {
  return request({
    url: `/item/user-ranking/station`,
    method: 'get',
    params: params
  })
}
//能力画像-学习成长
export function getGrowthPortrait(params) {
  return request({
    url: '/system/growth/portrait',
    method: 'get',
    params: params
  })
}

//获取指定用户画像
export function getUserProfile(params) {
  return request({
    url: '/exam/daily/user-profile',
    method: 'get',
    params: params
  })
}

//获取班组和科室画像
export function getDeptProfile(params) {
  return request({
    url: '/exam/daily/dept-profile',
    method: 'get',
    params: params
  })
}
//获取站级画像
export function getSiteProfile(params) {
  return request({
    url: '/exam/daily/site-profile',
    method: 'get',
    params: params
  })
}

//巡检画像
export function getPortrait(params) {
  return request({
    url: '/check/largeScreen/portrait',
    method: 'get',
    params: params
  })
}

//获取所有部门和班组下人员
export function getDeptUserTree(params) {
  return request({
    url: '/system/user/deptUserTree',
    method: 'get',
    params: params
  })
}
//获取用户在指定层级的详细排名信息
export function getRankInfo(params) {
  return request({
    url: '/item/user-ranking/ranking-detail',
    method: 'get',
    params: params
  })
}
//根据用户ID查询用户信息
export function getUserInfoById(userId) {
  return request({
    url: `/system/user/${userId}`,
    method: 'get',
  })
}