import request from '@/utils/request'

export async function getTaskAssignRuleList(query) {
  const res = await request({
    url: '/bpm/task-assign-rule/list',
    method: 'get',
    params: query
  })
  if (res.data.code == 0) {
    return res.data.data;
  }
  return Promise.reject(new Error(res.data.message));
}

export async function createTaskAssignRule(data) {
  const res = await request({
    url: '/bpm/task-assign-rule/create',
    method: 'post',
    data: data
  })
  if (res.data.code == 0) {
    return res.data.data;
  }
  return Promise.reject(new Error(res.data.message));
}

export async function updateTaskAssignRule(data) {
  const res = await request({
    url: '/bpm/task-assign-rule/update',
    method: 'put',
    data: data
  })
  if (res.data.code == 0) {
    return res.data.data;
  }
  return Promise.reject(new Error(res.data.message));
}
