import request from '@/utils/request'

// 创建业务模型定义
export function createModelDef(data) {
  return request({
    url: '/bpm/model-def/create',
    method: 'post',
    data: data
  })
}

// 更新业务模型定义
export function updateModelDef(data) {
  return request({
    url: '/bpm/model-def/update',
    method: 'put',
    data: data
  })
}

// 删除业务模型定义
export function deleteModelDef(id) {
  return request({
    url: '/bpm/model-def/delete?id=' + id,
    method: 'delete'
  })
}

// 获得业务模型定义
export function getModelDef(id) {
  return request({
    url: '/bpm/model-def/get?id=' + id,
    method: 'get'
  })
}

// 获取流程图
export function getBeginEnd(query) {
  return request({
    url: '/bpm/model/getBeginEnd',
    method: 'get',
    params: query
  })
}

// 获得业务模型定义分页
export function getModelDefPage(query) {
  return request({
    url: '/bpm/model-def/page',
    method: 'get',
    params: query
  })
}

// 获得表单id分页
export function getAllFormPage(query) {
  return request({
    url: '/bpm/form/page',
    method: 'get',
    params: query
  })
}

// 根据表单获取字段
// export function getDetailTablePage(query) {
//   return request({
//     url: '/infra/codegen/detail',
//     method: 'get',
//     params: query
//   })
// }

// 根据表单获取字段
export function getDetailTablePage(query) {
  return request({
    url: '/bpm/form/getTableColumn',
    method: 'get',
    params: query
  })
}

// 字典数据获取
export function getDictDate(query) {
  return request({
    url: '/bpm/model-def/dictData',
    method: 'get',
    params: query
  })
}

// 查询EL 
export function getELMaster(query) {
  return request({
    url: '/bpm/el-master/getEL',
    method: 'get',
    params: query
  })
}

// 保存EL 
export function saveElMaster(data) {
  return request({
    url: '/bpm/el-master/save',
    method: 'put',
    data
  })
}

// 导出业务模型定义 Excel
export function exportModelDefExcel(query) {
  return request({
    url: '/bpm/model-def/export-excel',
    method: 'get',
    params: query,
    responseType: 'blob'
  })
}
