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

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

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

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

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

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

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

/**
 * 移动指标
 * @param {*} params ClassifyId EdbInfoId PrevEdbInfoId NextEdbInfoId
 * @returns 
 */
export const ebdMove = params => {
	return http.post('/datamanage/predict_edb_info/move',params)
}

/**
 * 预测指标图表列表
 * @param {*} params Keyword AdminId CurrentIndex  PageSize  ClassifyId 
 */
export const edbList = params => {
  return http.get('/datamanage/predict_edb_info/chart/list',params)
}

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

/**
 * 新增指标
 * @param {*} params ClassifyId SourceEdbInfoId EdbName RuleList
 * EdbInfoIdArr: { EdbInfoId FromTag }
 * @returns 
 */
export const edbAdd = params => {
	return http.post('/datamanage/predict_edb_info/add',params)
}

/**
 * 修改指标 
 * @param {*} params EdbInfoId ClassifyId  EdbName RuleList
 * @returns 
 */
export const edbEdit = params => {
	return http.post('/datamanage/predict_edb_info/edit',params)
}

/**
 * 获取指标详情
 * @param {*} params EdbInfoId 
 * @returns 
 */
export const edbDetail = params => {
	return http.get('/datamanage/predict_edb_info/detail',params)
}

/**
 * 获取指标数据列表 EdbInfoId CurrentIndex PageSize
 * @param {*} params 
 * @returns 
 */
export const edbDataInfo = params => {
  return http.get('/datamanage/predict_edb_info/list',params)
}

/**
 * 获取指标图表数据 EdbInfoId  DateType=10&StartDate=&EndDate
 * @param {*} params 
 */
export const edbChartInfo = params => {
  return http.get('/datamanage/predict_edb_info/data',params)
}

/**
 * 搜索指标
 * @param {*} params  Keyword
 * @returns 
 */
export const edbSearch = params => {
	return http.get('/datamanage/predict_edb_info/filter_by_es',params)
}

/**
 * 设置缩略图 
 * @param {*} params EdbInfoId  ImageUrl
 * @returns 
 */
export const setImg = params => {
	return http.post('/datamanage/predict_edb_info/image/set',params)
}

/**
 * 指标刷新
 * @param {*} params EdbInfoId
 * @returns 
 * 
 */
export const edbRefresh = params => {
	return http.get('/datamanage/predict_edb_info/refresh/all',params)
}
/**
 * 指标部分刷新
 * @param {*} params EdbInfoId
 * @returns 
 * 
 */
 export const edbPartRefresh = params => {
	return http.get('/datamanage/predict_edb_info/refresh',params)
}

/**
 * 新增预测指标时预览图表详情数据
 * @param SourceEdbInfoId 来源指标id
 * @param PredictEndDate 预测截止日期
 * @param RuleType 预测规则，1：最新，2：固定值
 * @param FixedValue 固定值的数据
 * @param DateType 日期类型:1:00年至今,2:10年至今,3:15年至今，4：年初至今，5:自定义时间,6:自定义起始时间至今，7：18年至今,8:19年至今,9:20年至今,10:全部
 * @param StartDate 自定义开始日期
 * @param EndDate 自定义结束日期
 * @param Calendar 公历/农历
 * @param ChartType 生成样式:1:曲线图,2:季节性图
 * @param SeasonStartDate 季节性图开始日期
 * @param SeasonEndDate 季节性图结束日期
 */
export const edbChartDataForAdd=params=>{
	return http.post('/datamanage/predict_edb_info/chart/data/list',params)
}
/**
 * 指标运算
 * @param {*} params 
 * "CalculateFormula": "A+5",
	"ClassifyId": 315,
	"EdbName": "乙二醇期货价格(预测)+5",
	"Frequency": "日度",
	"Unit": "无",
	"EdbInfoIdArr": [
		{
			"EdbInfoId": 101812,
			"FromTag": "A"
		}
	]
 * @returns 
 */
export const calculateEdbSave = params => {
	return http.post('/datamanage/predict_edb_info/calculate/save',params)
}

/**
 * 计算指标
 * @param {*} params 
 * EdbInfoId":0,
	"Source": 33,
	"EdbName": "乙二醇期货价格(预测)同差",
	"Unit": "无",
	"ClassifyId": 315,
	"Frequency": "日度",
	"FromEdbInfoId": 101812
 * @returns 
 */
export const operateEdbSave = params => {
	return http.post('/datamanage/predict_edb_info/calculate/batch/save',params)
}

/**
 * 规则9动态环差 获取展示数据
 * @param {*} params 
	"RuleType": 9,
	"EndDate": "2022-11-30",
	"Value": "A-B",
	"EdbInfoIdArr": [{
			"EdbInfoId": 101935,
			"FromTag": "A"
		}]
 * @returns 
 */
export const getRuleNineData = params => {
	return http.post('/datamanage/predict_edb_info/rule/calculate_by_nine',params)
}

/**
 * 批量计算
 * @param {*} params 
 * CalculateId
 * CalculateInfo {
 * 	"ClassifyId": 341,
		"EdbName": "PVC出口占比同比2",
		"Formula": "1",
		"Frequency": "月度",
		"FromEdbInfoId": 101712,
		"MoveFrequency": "天",
		"MoveType": 1,
		"Source": 6,
		"Unit": "无"
	* }
	* @returns 
	*/
export const batchCalculateTargetAdd = params => {
	return http.post('/datamanage/predict_edb_info/calculate/batch/save/batch',params)
}

/**
 * 保存上下限
 * @param {*} params "EdbInfoId": 102607,
    "MaxValue": 2000,
    "MinValue": -200
 * @returns 
 */
export const saveChartInfo = params => {
	return http.post('/datamanage/predict_edb_info/modify',params)
}