import http from '@/utils/http'
import { AppDispatch } from '..'
/**
 * 流程设置-获取列表
 */
export const D2_APIgetlist = (): any => {
  return async (dispatch: AppDispatch) => {
    const res = await http.get('cms/flow/getList')
    if (res.code === 0) {
      dispatch({ type: 'D2/getList', payload: res.data })
    }
  }
}

/**
 * 流程设置- 获取详情
 */
export const D2_APIgetInfo = (id: number) => {
  return http.get(`cms/flow/detail/${id}`)
}

/**
 * 流程设置- 编辑
 */
export const D2_APIsave = (data: any) => {
  return http.post('cms/flow/edit', data)
}

/**
 * 流程设置- 环节-获取详情
 */
export const D2_APIgetProInfo = (id: number) => {
  return http.get(`cms/flow/process/${id}`)
}

/**
 * 流程设置- 环节-删除
 */
export const D2_APIgetProDel = (id: number) => {
  return http.get(`cms/flow/process/remove/${id}`)
}

/**
 * 流程设置- 环节 - 列表
 */
export const D2_APIgetProGetUser = (id: number) => {
  return http.get(`cms/flow/process/getUser/${id}`)
}

/**
 * 流程设置- 环节-新增/编辑
 */
export const D2_APIgetProSave = (data: any) => {
  return http.post('cms/flow/process/save', data)
}
