import http from '@/http'

// 项目指标模板
const listUrl = {
  1: '/api/v1/indicator-config/project/index/template/list',
  2: '/api/v1/performance-appraisal/audit/submit-list',
  3: '/api/v1/indicator-config/project/index/template/draft/list'
}
export const list = (state, params) => http.get(listUrl[state], { params }) // 项目指标配置模板列表
export const save = data => http.post(`/api/v1/indicator-config/project/index/template/save`, data) // 项目指标配置模板新建
export const draftSave = data => http.post(`/api/v1/indicator-config/project/index/template/draft`, data) // 项目指标配置模板暂存
export const draftDetail = id => http.get(`/api/v1/indicator-config/project/index/template/draft/detail/${id}`) // 项目指标配置模板草稿详情
export const detail = id => http.get(`/api/v1/indicator-config/project/index/template/detail/${id}`) // 项目指标配置模板详情
export const enable = (templateId, state) => http.put(`/api/v1/indicator-config/project/index/${templateId}/active/${state}`) // 项目指标配置模板启用、禁用
export const del = id => http.post(`/api/v1/indicator-config/project/index/template/delete/${id}`) // 项目指标配置模板删除
export const copy = id => http.post(`/api/v1/indicator-config/project/index/template/copy/${id}`) // 项目指标配置模板复制

// 项目指标库
export const indexList = params => http.get('/api/v1/indicator-config/project/index/list', { params }) // 项目指标库列表
export const indexSave = data => http.post(`/api/v1/indicator-config/project/index/save`, data) // 项目指标新建
export const indexDetail = id => http.post(`/api/v1/indicator-config/project/index/detail/${id}`) // 项目指标详情
export const indexDel = id => http.post(`/api/v1/indicator-config/project/index/delete/${id}`) // 项目指标删除

// 应用指标
export const appIndexList = params => http.get('/api/v1/indicator-config/app/index/list', { params }) // 应用指标库列表
export const appIndexDel = id => http.post(`/api/v1/indicator-config/app/index/delete/${id}`) // 应用指标删除
export const appIndexDetail = id => http.post(`/api/v1/indicator-config/app/index/detail/${id}`) // 应用指标详情
export const appEnable = (appId, state) => http.put(`/api/v1/indicator-config/app/index/${appId}/active/${state}`) // 项目指标配置模板启用、禁用
export const appIndexSave = data => http.post(`/api/v1/indicator-config/app/index/save`, data) // 应用指标新建

// 项目标签管理
export const tagList = params => http.get('/api/v1/project-indicator-tag/list', { params }) // 标签列表
export const tagSave = data => http.post(`/api/v1/project-indicator-tag/save`, data) // 标签保存
export const tagDel = id => http.post(`/api/v1/project-indicator-tag/delete/${id}`) // 标签删除

export const tagFuzzyMatch = params => http.get(`/api/v1/project-indicator-tag/fuzzy-match`, { params }) // 指标模糊匹配

// 模板类型
export const templateTypePage = params => http.get('/api/v1/performance-appraisal/template-type/page', { params }) // 列表
export const templateTypeList = params => http.get('/api/v1/performance-appraisal/template-type/list', { params }) // 不分页列表
export const templateTypeDetail = id => http.get(`/api/v1/performance-appraisal/template-type/detail/${id}`) // 模板类型详情
export const templateTypeSave = data => http.post(`/api/v1/performance-appraisal/template-type/save`, data) // 保存
export const templateTypeDel = id => http.post(`/api/v1/performance-appraisal/template-type/remove/${id}`) // 标签删除

