import { AppDispatch } from '@/store'
import http from '@/utils/http'
/**
 * 流程设置 - 获取分页列表
 */
export const I4_APIgetList = (data: any): any => {
  return async (dispatch: AppDispatch) => {
    const res = await http.post('cms/flow/pageList', { ...data, pageSize: 99999, pageNum: 1 })
    if (res.code === 0) {
      dispatch({ type: 'I4/getList', payload: res.data.records })
    }
  }
}

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

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

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

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

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

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

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