import http from "@/api/http.js"

/**
 * 获取分类
 * @returns 
 */
export const classifyList =  params =>{
	return http.get('/datamanage/excel_classify/list',params)
}

/**
 * 新增分类
 * @param {*} params  "ExcelClassifyName": "分类1-2"
 * @returns 
 */
export const classifyAdd =  params =>{
	return http.post('/datamanage/excel_classify/add',params)
}

/**
 * 编辑分类
 * @param {*} params  ExcelClassifyName ExcelClassifyId
 * @returns 
 */
export const classifyEdit =  params =>{
	return http.post('/datamanage/excel_classify/edit',params)
}

/**
 * 删除分类检测
 * @param {*} params ExcelClassifyId ExcelInfoId
 * @returns 
 */
export const classifyDelCheck = params =>{
	return  http.post('/datamanage/excel_classify/delete/check',params)
}

/**
 * 删除分类
 * @param {*} params ExcelClassifyId ExcelInfoId
 * @returns 
 */
export const classifyDel = params =>{
	return  http.post('/datamanage/excel_classify/delete',params)
}

/**
 * 移动分类
 * @param {*} params ClassifyId "PrevClassifyId":1, "NextClassifyId":2,
 * @returns 
 */
export const classifyMove = params =>{
	return  http.post('/datamanage/excel_classify/move',params)
}

/**
 * 移动表格
 * @param {*} params ExcelClassifyId ExcelInfoId PrevExcelInfoId NextExcelInfoId
 * @returns 
 */
export const sheetMove = params => {
	return http.post('/datamanage/excel_info/move',params)
}

/**
 * 表格列表
 * @param {*} params  CurrentIndex  PageSize  ExcelClassifyId 
 */
export const sheetList = params => {
  return http.get('/datamanage/excel_info/list',params)
}

/**
 * 表格分类
 * @param {*} params 
 * @returns 
 */
export const excelClassifyOne = params => {
	return http.get('/datamanage/excel_classify/items',params)
}

/**
 * 新增表格
 * @param {*} params ExcelName ExcelClassifyId Content
 * //自定义表格ExcelImage ExcelType TableData
 * @returns 
 */
export const sheetAdd = params => {
	return http.post('/datamanage/excel_info/add',params)
}

/**
 * 保存表格 
 * @param {*} params  ExcelInfoId ExcelName ExcelClassifyId Content
 * @returns 
 */
export const sheetEdit = params => {
	return http.post('/datamanage/excel_info/edit',params)
}

/**
 * 获取表格详情
 * @param {*} params ExcelInfoId 
 * @returns 
 */
export const sheetDetail = params => {
	return http.get('/datamanage/excel_info/detail',params)
}

/**
 * 保存草稿
 * @param {*} params ExcelInfoId ExcelName ExcelClassifyId Content
 * @returns 
 */
export const sheetDrafSave = params => {
	return http.post('/datamanage/excel_info/draft/add',params)
}

/**
 * 
 * @param {*} params Image
 * @returns 
 */
export const uploadImg = params => {
	return http.post('/resource/upload_image_base64',params)
}
/**
 * 获取表格数据
 */
 export const getSheetData = params=>{
  return http.get('/datamanage/excel_info/table_data',params)
}

/* =====自定义表格====== */

/**
 * 选择指标插入的数据 第一个指标
 * @param {*} params 
 * EdbInfoId Num
 * @returns 
 */
export const getEdbInsertDataA = params => {
	return http.get('/datamanage/excel_info/table/first_edb_data_list',params)
}

/**
 * 选择指标根据日期插入数据  第N个指标
 * @param {*} params 
 * EdbInfoId DateList
 * @returns 
 */
export const getEdbInsertDataOther = params => {
	return http.post('/datamanage/excel_info/table/other_edb_data_list',params)
}

/**
 * 根据公式计算结果
 * @param {*} params 
 * "CalculateFormula": "=A+B/C",
		"TagMap":{
			"A":100,
			"B":200,
			"C":0,
		}
 * @returns 
 */
export const calculateCustomCellData = params => {
	return http.post('/datamanage/excel_info/table/calculate',params)
}

/**
 * 获取未来日期的数据
 * @param {*} params 
 * "EdbInfoIdList": [102227],
	"DateType":2,
	"StartDate":"2023-07-28",
	"EndDate":"2023-11-28",
 * @returns 
 */
export const getCustomFutureData = params => {
	return http.post('/datamanage/excel_info/table/future_date_list',params)
}

/**
 * 获取过去N期数据
 * @param {*} params 
 * EdbInfoIdList [] EndDate Num
 * @returns 
 */
export const getCustomPastData = params => {
	return http.post('/datamanage/excel_info/table/history_date_list',params)
}

/**
 * 编辑页详情 ExcelInfoId
 * @param {*} params 
 * @returns 
 */
export const getCustomSheetDetail = params => {
	return http.get('/datamanage/excel_info/table/detail',params)
}

/**
 * 刷新表格 ExcelInfoId
 * @param {*} params 
 * @returns 
 */
export const refreshCustomSheet = params => {
	return http.get('/datamanage/excel_info/table/refresh',params)
}

/**
 * 下载excel
 * @param {*} params ExcelInfoId authorization
 * @returns 
 */
export const downExcelFile = params => {
	return http.get('/datamanage/excel_info/table/download',params)
}

/**
 * 另存为
 * @param {*} params 
 * ExcelInfoId ExcelName ExcelClassifyId
 * @returns 
 */
export const copyExcel = params => {
	return http.post('/datamanage/excel_info/copy',params)
}

/* ======混合表格======= */
/**
 * 指标搜索 
 * @param {*} params KeyWord CurrentIndex PageSize
 * @returns 
 */
export const searchTarget  = params => {
	return http.get('/datamanage/edb_info/filter_by_es/all',params)
}

/**
 * 插值
 * @param {*} params EdbInfoId Date
 * @returns 
 */
export const insertData = params => {
	return http.get('/datamanage/edb_info/date_data',params)
}