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

export default{
    /**
   * 获取分类
   * @returns 
   */
  classifyList:  params =>{
    return http.get('/correlation/chart_classify/list',params)
  },

  /**
   * 新增分类
   * @param {*} params  "ChartClassifyName": "分类1-2"
   * @returns 
   */
  classifyAdd:  params =>{
    return http.post('/correlation/chart_classify/add',params)
  },

  /**
   * 编辑分类
   * @param {*} params  ChartClassifyName ChartClassifyId
   * @returns 
   */
  classifyEdit: params =>{
    return http.post('/correlation/chart_classify/edit',params)
  },

  /**
   * 删除分类检测
   * @param {*} params ChartClassifyId
   * @returns 
   */
  classifyDelCheck: params =>{
    return  http.post('/correlation/chart_classify/delete/check',params)
  },

  /**
   * 删除分类
   * @param {*} params ChartClassifyId
   * @returns 
   */
  classifyDel: params =>{
    return  http.post('/correlation/chart_classify/delete',params)
  },

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

  /**
   * 移动图表
   * @param {*} params 
   * @returns 
   */
  chartMove: params => {
    return http.post('/correlation/chart_info/move',params)
  },

  /**
   * 图表分类option
   * @param {*} params 
   * @returns 
   */
   classifyOne: params => {
      return http.get('/correlation/chart_classify/items',params)
    },

  /**
   * 相关性图表列表
   * @param {*} params CurrentIndex PageSize ChartClassifyId Keyword IsShowMe
   * @returns 
   */
   getChartList: params => {
    return http.get('/correlation/chart_info/list',params)
  },

  /**
   * 相关性图表详情
   * @param {ChartInfoId} params 
   * @returns 
   */
   chartDetail: params => {
    return http.get('/correlation/chart_info/detail',params)
  },


  /**
   * 预览相关性图
   */
  previewRelevanceChart:params=>{
    return http.post('/correlation/chart_info/preview',params)
  },

  /**
   * 保存相关性图
   */
  saveRelevanceChart:params=>{
    return http.post('/correlation/chart_info/add',params)
  },

  /**
   * 编辑
   * @param {*} params 
   * @returns 
   */
   editRelevanceChart:params=>{
    return http.post('/correlation/chart_info/edit',params)
  },

  /**
   * 刷新图表 
   * @param {*} params ChartInfoId
   * @returns 
   */
   refreshChart: params => {
    return http.get('/correlation/chart_info/refresh',params)
  },

  /**
   * 另存为
   * @param {*} params ChartInfoId  ChartClassifyId  ChartName
   * @returns 
   */
   saveOtherChart: params => {
    return http.post('/correlation/chart_info/copy',params)
  },

  /**
   * 编辑英文信息
   * @param {*} params  ChartInfoId ChartNameEn UnitEn
   * @returns 
   */
   editChartEn: params => {
    return http.post('/correlation/chart_info/en/edit',params)
  },

  /**
   * 搜索图表
   * @param {*} params Keyword IsShowMe
   * @returns 
   */
   searchChart: params => {
    return http.get('/correlation/chart_info/search_by_es',params)
  },

  /* =============================================== */
  /* 改动版 */

  /**
   * 关联性图表配置
   * @param {*} params 
   * {
    "MultipleGraphConfigId": 1,
    "EdbInfoIdA": 102651,
    "EdbInfoIdB": 102646,
    "Curve": {
      "DateType": 1,
      "StartDate": "2021-01-01",
      "EndDate": "2023-01-01",
      "LeftMin": 0,
      "LeftMax": 100,
      "RightMin": -10,
      "RightMax": 300,
      "IsOrder": false,
      "EdbInfoType": true,
      "LeadValue": 1,
      "LeadUnit": "周"
    },
    "Correlation": {
      "LeadValue": 6,
      "LeadUnit": "周",
      "CalculateValue": 10,
      "CalculateUnit": "周度"
    },
    "RollingCorrelation": [
      {
        "LeadValue": 6,
        "LeadUnit": "周",
        "CalculateValue": 10,
        "CalculateUnit": "周度"
      }
    ]
  }
   * @returns 
   */
  chartOptionsSet: params => {
    return http.post('/datamanage/multiple_graph/config/save',params)
  },

  /**
   * 预览数据
   * @param {*} params 同配置参数
   * @returns 
   */
  previewChartBatch: params => {
    return http.post('/datamanage/multiple_graph/preview',params)
  },

  /**
   * 保存图表
   * @param {*} params 
   * "MultipleGraphConfigId": 1, //配置ID，为0时，代表新增，大于0：代表编辑
    "Source": 1, //来源,1:曲线图，2：相关性图；3：滚动相关性图1；4：滚动相关性图2；
    "ChartName": "多图配置的曲线图", //图表名称
    "ClassifyId": 243, //分类id
    "EdbInfoIdA": 102563, //指标A的id
    "EdbInfoIdB": 102561, //指标B的id
    IsSaveAs
   * @returns 
   */
  saveChart: params => {
    return http.post('/datamanage/multiple_graph/chart/save',params)
  },

  /***
   * 指标保存 另存
   * "MultipleGraphConfigId": 1, //配置ID，为0时，代表新增，大于0：代表编辑
    "Source": 3, //来源,1:曲线图，2：相关性图；3：滚动相关性图1；4：滚动相关性图2；
    "EdbName": "多图配置的相关性指标",
    "Frequency": "日度",
    "Unit": "吨",
    "ClassifyId": 373, //分类id
    "EdbInfoIdA": 102563, //指标A的id
    "EdbInfoIdB": 102561, //指标B的id
    "IsSaveAs": false, //是否另存为，默认false
   */
  saveEdb: params => {
    return http.post('/datamanage/multiple_graph/edb/save',params)
  },

  /**
   * 获取配置详情
   * @param {*UniqueCode} params 
   * @returns 
   */
  getOptionByCode: params => {
    return http.get('/datamanage/multiple_graph/config/detail',params)
  },
   
  /**
   * 预览曲线图
   * @param {*} params 同配置参数
   * @returns 
   */
  previewSplineChart: params => {
    return http.post('/datamanage/multiple_graph/preview_cure',params)
  },

}

/* 拟合方程曲线 */
export const fittingEquationInterface = {
  /**
   * 分类列表
   * @param {*} params 
   * @returns 
   */
  classifyList: params => {
    return http.get('/line_equation/chart_classify/list',params)
  },

  /**
   * 分类添加
   * @param {*} params ChartClassifyName
   * @returns 
   */
  classifyAdd: params => {
    return http.post('/line_equation/chart_classify/add',params)
  },

  /**
   * 分类编辑
   * @param {*} params ChartClassifyName ChartClassifyId
   * @returns 
   */
  classifyEdit: params => {
    return http.post('/line_equation/chart_classify/edit',params)
  },

  /**
   * 删除监测
   * @param {*} params ChartClassifyId
   * @returns 
   */
  classifyDelCheck: params => {
    return http.post('/line_equation/chart_classify/delete/check',params)
  },

  /**
   * 删除
   * @param {*} params ChartClassifyId
   * @returns 
   */
  classifyDel: params => {
    return http.post('/line_equation/chart_classify/delete',params)
  },

  /**
   * 分类移动
   * @param {*} params 
   * "ClassifyId": 269,
    "PrevClassifyId": 0,
    "NextClassifyId": 227,
   * @returns 
   */
  classifyMove: params => {
    return http.post('/line_equation/chart_classify/move',params)
  },

  /**
   * 纯分类
   * @param {*} params 
   * @returns 
   */
  classifyOne: params => {
    return http.get('/line_equation/chart_classify/items',params)
  },

  /**预览
   * "DateType": 2,
    "StartDate": "2022-01-31",
    "EndDate": "2023-02-14",
    "XEdbInfoIdList":[102563,102565],
    "YEdbInfoIdList":[102566,102568],
   * @param {*} params 
   * @returns 
   */
  previewData: params => {
    return http.post('/line_equation/chart_info/preview',params)
  },

  /**
   * 新增/编辑图表
   * @param {*} params 
   * {
      "MultipleGraphConfigId":241,
      "BatchAddChart":[
        {
          "Source":5,//5：斜率图；6：截距图；7：相关性图
          "ChartClassifyId":270,
          "ChartName":"斜率图3",
        },{
          "Source":6,//5：斜率图；6：截距图；7：相关性图
          "ChartClassifyId":270,
          "ChartName":"截距图3",
        },{
          "Source":7,//5：斜率图；6：截距图；7：相关性图
          "ChartClassifyId":270,
          "ChartName":"相关性图3",
        }
      ],
      "ExtraConfig": {
        "DateType": 2,
        "StartDate": "2022-01-01",
        "EndDate": "2023-04-14",
        "XEdbInfoIdList": [],
        "YEdbInfoIdList": [],
      }
    }
   * @returns 
   */
  chartEdit: params => {
    return http.post('/line_equation/chart_info/save',params)
  },
  
  /**
   * 获取图表配置  UniqueCode
   * @param {*} params 
   * @returns 
   */
  getConfigSetting: params => {
    return http.get('/line_equation/multiple_graph/config/detail',params)
  },

  /**
   * 图表拖动
   * @param {*} params 
   * "ChartInfoId": 844,
    "PrevChartInfoId": 0,
    "NextChartInfoId": 839,
    "ChartClassifyId": 270
   * @returns 
   */
  chartMove: params => {
    return http.post('/line_equation/chart_info/move',params)
  },

  /**
   * 获取图表列表
   * @param {*} params 
   * CurrentIndex PageSize ChartClassifyId Keyword IsShowMe
   * @returns 
   */
  getChartList: params => {
    return http.get('/line_equation/chart_info/list',params)
  },

  /**
   * 编辑页图表详情
   * @param {*} params  ChartInfoId
   * @returns 
   */
  chartDetail: params => {
    return http.get('/line_equation/chart_info/detail',params)
  },

  /**
   * 图表另存为
   * @param {*} params 
   * 	"ChartInfoId": 843,
    "ChartClassifyId": 270,
    "ChartName": "截距图3（复制出来的）"
   * @returns 
   */
  saveOtherChart: params => {
    return http.post('/line_equation/chart_info/copy',params)
  },

  enInfoEdit: params => {
    return http.post('')
  },

  /**
   * 图表搜索
   * @param {*} params Keyword IsShowMe CurrentIndex
   * @returns 
   */
  searchChart: params => {
    return http.get('/line_equation/chart_info/search_by_es',params)
  },

  /**
   * 刷新图表 
   * @param {*} params ChartInfoId
   * @returns 
   */
  refreshChart: params => {
    return http.get('/line_equation/chart_info/refresh',params)
  },

  /**
   * 设置英文
   * @param {*} params  ChartInfoId ChartNameEn
   * @returns 
   */
  editChartEn: params => {
    return http.post('/line_equation/chart_info/en/edit',params)
  }
}

/* 统计特征曲线 */
export const statisticFeatureInterface = {
  /**
   * 分类列表
   * @param {*} params 
   * @returns 
   */
  classifyList: params => {
    return http.get('/line_feature/chart_classify/list',params)
  },

  /**
   * 分类添加
   * @param {*} params ChartClassifyName
   * @returns 
   */
  classifyAdd: params => {
    return http.post('/line_feature/chart_classify/add',params)
  },

  /**
   * 分类编辑
   * @param {*} params ChartClassifyName ChartClassifyId
   * @returns 
   */
  classifyEdit: params => {
    return http.post('/line_feature/chart_classify/edit',params)
  },

  /**
   * 删除监测
   * @param {*} params ChartClassifyId
   * @returns 
   */
  classifyDelCheck: params => {
    return http.post('/line_feature/chart_classify/delete/check',params)
  },

  /**
   * 删除
   * @param {*} params ChartClassifyId
   * @returns 
   */
  classifyDel: params => {
    return http.post('/line_feature/chart_classify/delete',params)
  },

  /**
   * 分类移动
   * @param {*} params 
   * "ClassifyId": 269,
    "PrevClassifyId": 0,
    "NextClassifyId": 227,
   * @returns 
   */
  classifyMove: params => {
    return http.post('/line_feature/chart_classify/move',params)
  },

  /**
   * 纯分类
   * @param {*} params 
   * @returns 
   */
  classifyOne: params => {
    return http.get('/line_feature/chart_classify/items',params)
  },

  /**
   * 图表拖动
   * @param {*} params 
   * "ChartInfoId": 844,
    "PrevChartInfoId": 0,
    "NextChartInfoId": 839,
    "ChartClassifyId": 270
   * @returns 
   */
    chartMove: params => {
      return http.post('/line_feature/chart_info/move',params)
    },
  
    /**
     * 获取图表列表
     * @param {*} params 
     * CurrentIndex PageSize ChartClassifyId Keyword IsShowMe
     * @returns 
     */
    getChartList: params => {
      return http.get('/line_feature/chart_info/list',params)
    },
  
    /**
     * 图表详情
     * @param {*} params  ChartInfoId
     * @returns 
     */
    chartDetail: params => {
      return http.get('/line_feature/chart_info/detail',params)
    },

  /**预览
   * {
    "EdbInfoId": 102563,
    "Curve": {
      "DateType": 6,
      "StartDate": "2023-11-01",
      "EndDate": "2023-05-01",
      "LeftMin": 0,
      "LeftMax": 100,
    },
    "StandardDeviation": {
      "CalculateValue": 30
    },
    "Percentile": {
      "CalculateValue": 30,
      "CalculateUnit":"天"
    },
    "FrequencyDistribution":{
      "DateType": 6,
      "StartDate": "2023-11-01",
      "EndDate": "2023-05-01",
      "FrequencyValue": 10,
    }
  }
   * @param {*} params 
   * @returns 
   */
  previewChartBatch: params => {
    return http.post('/line_feature/preview',params)
  },
  /**
   * 保存配置
   * @param {*} params 参数同预览
   * @returns 
   */
  chartOptionsSet: params => {
    return http.post('/line_feature/config/save',params)
  },
  
  /**
   * 获取图表配置  UniqueCode
   * @param {*} params 
   * @returns 
   */
  getOptionByCode: params => {
    return http.get('/line_feature/config/detail',params)
  },

  /**
   * 图表另存为
   * @param {*} params 
   * 	"ChartInfoId": 843,
    "ChartClassifyId": 270,
    "ChartName": "截距图3（复制出来的）"
   * @returns 
   */
  saveOtherChart: params => {
    return http.post('/line_feature/chart_info/copy',params)
  },

  /**
   * 图表搜索
   * @param {*} params Keyword IsShowMe CurrentIndex
   * @returns 
   */
  searchChart: params => {
    return http.get('/line_feature/chart_info/search_by_es',params)
  },

  /**
   * 刷新图表 
   * @param {*} params ChartInfoId
   * @returns 
   */
  refreshChart: params => {
    return http.get('/line_feature/chart_info/refresh',params)
  },

  /**
   * 设置英文
   * @param {*} params  ChartInfoId ChartNameEn
   * @returns 
   */
  editChartEn: params => {
    return http.post('/line_feature/chart_info/en/edit',params)
  },

    /**
   * 保存图表
   * @param {*} params 
   * "MultipleGraphConfigId": 1, //配置ID，为0时，代表新增，大于0：代表编辑
    "Source": 1, //来源,1:曲线图，8：标准差；9：百分位图；10：频率分布图；
    "ChartName": "多图配置的曲线图", //图表名称
    "ClassifyId": 243, //分类id
    "EdbInfoIdA": 102563, //指标A的id
    "EdbInfoIdB": 102561, //指标B的id
    IsSaveAs
   * @returns 
   */
    saveChart: params => {
      return http.post('/line_feature/chart/save',params)
    },
  
    /***
     * 指标保存 另存
     * "MultipleGraphConfigId": 1, //配置ID，为0时，代表新增，大于0：代表编辑
      "Source": 3, //来源,1:曲线图，8：标准差；9：百分位图；10：频率分布图；
      "EdbName": "多图配置的相关性指标",
      "Frequency": "日度",
      "Unit": "吨",
      "ClassifyId": 373, //分类id
      "EdbInfoIdA": 102563, //指标A的id
      "EdbInfoIdB": 102561, //指标B的id
      "IsSaveAs": false, //是否另存为，默认false
     */
    saveEdb: params => {
      return http.post('/line_feature/edb/save',params)
    },

    /**
     * 只获取曲线图数据
     * @param {*} params 
     * @returns 
     */
    previewSpline: params => {
      return http.post('/line_feature/preview_cure',params)
    }
}