import request from '@/utils/request';
import store from '@/store';
import Vue from 'vue';

/**
 * 列表
 */
export async function getList(params) {
  const res = await request.post('/aps/workorder/page', params);
  if (res.data.code == 0) {
    return res.data.data;
  }
  return Promise.reject(new Error(res.data.message));
}

// 下达
export async function releaseWorkOrder({ id, teamId }) {
  const res = await request.get(
    `/aps/workorder/releaseWorkOrder/${id}/${teamId}`
  );
  if (res.data.code == 0) {
    return res.data.data;
  }
  return Promise.reject(new Error(res.data.message));
}



// 列表
export async function getteampage(data) {
  const res = await request.get(`/main/team/page`, {
      params: data
  });
  console.log(res.data.code == 0)
  if (res.data.code == 0) {
      return res.data.data;
  }
  return Promise.reject(new Error(res.data.message));
}
// 修改优先级
export async function updatePriority(data) {
  const res = await request.post(`/aps/workorder/updatePriority`,  data);
  if (res.data.code == 0) {
    return res.data.data;
  }
  return Promise.reject(new Error(res.data.message));
}





// 动态表头
export async function fieldModel(params) {
  const res = await request.get(
    `/main/fieldmodel/list`, { params }
  );
  if (res.data.code == 0) {
    return res.data.data;
  }
  return Promise.reject(new Error(res.data.message));
}