import request from '@/utils/request'

// ===== 评分维度 =====
export function listDimension(params) {
  return request({ url: '/score/dimension/list', method: 'get', params })
}
export function allDimension() {
  return request({ url: '/score/dimension/all', method: 'get' })
}
export function getDimension(id) {
  return request({ url: `/score/dimension/${id}`, method: 'get' })
}
export function addDimension(data) {
  return request({ url: '/score/dimension', method: 'post', data })
}
export function updateDimension(data) {
  return request({ url: '/score/dimension', method: 'put', data })
}
export function delDimension(ids) {
  return request({ url: `/score/dimension/${ids}`, method: 'delete' })
}
export function exportDimension(params) {
  return request({ url: '/score/dimension/export', method: 'post', params, responseType: 'blob' })
}

// ===== 评分指标 =====
export function listIndicator(params) {
  return request({ url: '/score/indicator/list', method: 'get', params })
}
export function treeIndicator(dimensionId) {
  return request({ url: '/score/indicator/tree', method: 'get', params: { dimensionId } })
}
export function getIndicator(id) {
  return request({ url: `/score/indicator/${id}`, method: 'get' })
}
export function addIndicator(data) {
  return request({ url: '/score/indicator', method: 'post', data })
}
export function updateIndicator(data) {
  return request({ url: '/score/indicator', method: 'put', data })
}
export function delIndicator(ids) {
  return request({ url: `/score/indicator/${ids}`, method: 'delete' })
}
export function exportIndicator(params) {
  return request({ url: '/score/indicator/export', method: 'post', params, responseType: 'blob' })
}

// ===== 配分事项 =====
export function listScoreEvent(params) {
  return request({ url: '/score/event/list', method: 'get', params })
}
export function getScoreEvent(id) {
  return request({ url: `/score/event/${id}`, method: 'get' })
}
export function addScoreEvent(data) {
  return request({ url: '/score/event', method: 'post', data })
}
export function updateScoreEvent(data) {
  return request({ url: '/score/event', method: 'put', data })
}
export function delScoreEvent(ids) {
  return request({ url: `/score/event/${ids}`, method: 'delete' })
}
export function exportScoreEvent(params) {
  return request({ url: '/score/event/export', method: 'post', params, responseType: 'blob' })
}
export function importScoreEvent(file) {
  const fd = new FormData()
  fd.append('file', file)
  return request({ url: '/score/event/import', method: 'post', data: fd })
}

// ===== 雷达图大屏 =====
export function radarTeamList() {
  return request({ url: '/score/radar/teamList', method: 'get' })
}
export function radarMemberScores(teamName) {
  return request({ url: '/score/radar/memberScores', method: 'get', params: { teamName } })
}

// ===== 台账同步 =====
export function syncLedgerAll() {
  return request({ url: '/ledger/sync/all', method: 'post' })
}
export function syncLedgerByType(type) {
  return request({ url: `/ledger/sync/${type}`, method: 'post' })
}

// ===== 员工画像 =====
export function searchPortraitUsers(keyword) {
  return request({ url: '/score/portrait/searchUsers', method: 'get', params: { keyword } })
}
export function getEmployeePortrait(params) {
  return request({ url: '/score/portrait/employee', method: 'get', params })
}

// ===== 推送配置 =====
export function listPushConfig(params) {
  return request({ url: '/score/pushConfig/list', method: 'get', params })
}
export function getPushConfig(id) {
  return request({ url: `/score/pushConfig/${id}`, method: 'get' })
}
export function addPushConfig(data) {
  return request({ url: '/score/pushConfig', method: 'post', data })
}
export function updatePushConfig(data) {
  return request({ url: '/score/pushConfig', method: 'put', data })
}
export function delPushConfig(ids) {
  return request({ url: `/score/pushConfig/${ids}`, method: 'delete' })
}
