import request from '@/utils/request'

// 查询流程管理2.0列表
export function listFlow(query) {
  return request({
    url: '/hnyz/flow/list',
    method: 'get',
    params: query
  })
}

// 查询流程管理2.0详细
export function getFlow(flowId) {
  return request({
    url: '/hnyz/flow/' + flowId,
    method: 'get'
  })
}

// 新增流程管理2.0
export function addFlow(data) {
  return request({
    url: '/hnyz/flow',
    method: 'post',
    data: data
  })
}

// 修改流程管理2.0
export function updateFlow(data) {
  return request({
    url: '/hnyz/flow',
    method: 'put',
    data: data
  })
}

// 删除流程管理2.0
export function delFlow(flowId) {
  return request({
    url: '/hnyz/flow/' + flowId,
    method: 'delete'
  })
}

//获取流程列表（下拉框）
export function getFlowList({ equipmentId, flowType }) {
  return request({
    url: '/hnyz/flow/getFlowList',
    method: 'get',
    params: {
      equipmentId: equipmentId,
      flowType: flowType
    }
  })
}

//修改启用状态
export function changeStatus(flowId, status) {
  return request({
    url: '/hnyz/flow/changeStatus',
    method: 'put',
    data: {
      flowId: flowId,
      status: status
    }
  })
}