/*
 * @Description:
 * @Author: leizhe
 * @Date: 2022-01-13 17:26:14
 * @LastEditTime: 2022-08-17 10:10:50
 * @LastEditors: leizhe
 */
import { get, post, PUBLISH_SERVICE } from '@/services/index';
// 工单流程列表查询
export const reloadFlows = param =>
  get(`${PUBLISH_SERVICE}/WorkOrderCenter/CM_Flow_ReloadFlows`, param);
// 流程信息查询
export const CMFlowGet = param => get(`${PUBLISH_SERVICE}/WorkOrderCenter/CM_Flow/${param.flowId}`);
// 流程信息查询
export const CMFlowPost = param =>
  post(`${PUBLISH_SERVICE}/WorkOrderCenter/CM_Flow/${param.flowId}`, param);
// 工单流程组内调序
export const flowReOrder = param =>
  post(`${PUBLISH_SERVICE}/WorkOrderCenter/CM_Flow_ReOrder?flowIDs=${param.flowIDs}`);
// 删除流程配置
export const removeFlowExtend = param =>
  post(`${PUBLISH_SERVICE}/WorkOrderCenter/CM_Flow_RemoveFlowExtend?flowId=${param.flowIDs}`);
// 流程节点列表查询
export const reloadFlowNodes = param =>
  get(`${PUBLISH_SERVICE}/WorkOrderCenter/CM_Event_ReloadFlowNodes?flowName=${param.flowName}`);
// 清除节点配置
export const removeFlowNodeExtend = param =>
  get(
    `${PUBLISH_SERVICE}/WorkOrderCenter/CM_Event_RemoveFlowNodeExtend?flowNodeExtendID=${
      param.flowNodeExtendID
    }`,
  );
// 流程节点详情
export const getFlowNode = param =>
  get(`${PUBLISH_SERVICE}/WorkOrderCenter/CM_Event_GetFlowNode?flowNodeId=${param.flowNodeId}`);
// 流程节点详情
export const loadRollbackNodes = param =>
  get(
    `${PUBLISH_SERVICE}/WorkOrderCenter/CM_Event_LoadRollbackNodes?flowNodeId=${param.flowNodeId}`,
  );
// 加载事件主表
export const loadEventTypeTable = query =>
  get(`${PUBLISH_SERVICE}/WorkOrderCenter/CM_Event_LoadTables`, query);

// 根据触发事件加载字段
export const loadEventFields = query =>
  post(`${PUBLISH_SERVICE}/WorkOrderCenter/CM_Feedback_LoadEventFields`, query);

// 加载反馈类型
export const loadFeedbackType = query =>
  get(`${PUBLISH_SERVICE}/WorkOrderCenter/CM_Feedback_LoadFeedbackType`, query);
// 加载反馈类型
export const editFlowNodeExtend = query =>
  post(`${PUBLISH_SERVICE}/WorkOrderCenter/CM_Event_EditFlowNodeExtend`, query);

// 加载流程辅助视图
export const reloadFlowNodeExtendPages = query =>
  get(`${PUBLISH_SERVICE}/WorkOrderCenter/CM_Flow_ReloadFlowNodeExtendPages`, query);
// 查询流程辅助视图配置信息
export const getFlowNodeExtendPage = query =>
  get(`${PUBLISH_SERVICE}/WorkOrderCenter/CM_Flow_GetFlowNodeExtendPage`, query);
// 添加或修改流程节点辅助视图配置
export const operateFlowNodeExtendPage = (query, flowNodeId) =>
  post(
    `${PUBLISH_SERVICE}/WorkOrderCenter/CM_Flow_OperateFlowNodeExtendPage?flowNodeId=${flowNodeId}`,
    query,
  );
// 删除流程节点辅助视图配置
export const removeFlowNodeExtendPage = query =>
  post(
    `${PUBLISH_SERVICE}/WorkOrderCenter/CM_Flow_RemoveFlowNodeExtendPage?flowNodeExtendId=${
      query.flowNodeExtendId
    }`,
    query,
  );

// 加载时限配置列表
export const reloadFlowTimers = query =>
  get(`${PUBLISH_SERVICE}/WorkOrderCenter/CM_Flow_ReloadFlowTimers`, query);
// 根据流程ID加载起止节点和终止节点
export const flowReloadFlowNodes = query =>
  get(`${PUBLISH_SERVICE}/WorkOrderCenter/CM_Flow_ReloadFlowNodes`, query);
// 根据下拉框选择的流程节点关联的表名加载指派字段
export const reloadTimeLimitadFlowNodes = query =>
  get(`${PUBLISH_SERVICE}/WorkOrderCenter/CM_Flow_ReloadTimeLimit`, query);
// 添加或修改时限配置
export const operateFlowTimer = query =>
  post(`${PUBLISH_SERVICE}/WorkOrderCenter/CM_Flow_OperateFlowTimer`, query);
// 添加或修改时限配置
export const removeFlowTimer = query =>
  post(
    `${PUBLISH_SERVICE}/WorkOrderCenter/CM_Flow_RemoveFlowTimer?flowTimerID=${query.flowTimerID}`,
    query,
  );
