import request from "@/utils/request";

// 查询值班列表
export function listDuty(query) {
  return request({
    url: "/duty/duty/selectList",
    method: "get",
    params: query,
  });
}

// 查询值班详细
export function getDuty(id) {
  return request({
    url: "/duty/duty/" + id,
    method: "get",
  });
}

// 新增值班
export function addDuty(data) {
  return request({
    url: "/duty/duty",
    method: "post",
    data: data,
  });
}

// 修改值班
export function updateDuty(data) {
  return request({
    url: "/duty/duty",
    method: "put",
    data: data,
  });
}

// 删除值班
export function delDuty(id) {
  return request({
    url: "/duty/duty/" + id,
    method: "delete",
  });
}

//生成值班
export function dutyButton(data) {
  let f = new FormData();
  Object.keys(data).forEach((key) => {
    f.append(key, data[key]);
  });
  return request({
    url: "/duty/duty/dutyButton",
    method: "post",
    data: f,
  });
}
//值班人员
export function userList() {
  return request({
    url: "system/user/list",
    method: "get",
  });
}
//值班新增人员
export function saveDuties(data) {
  return request({
    url: "/duty/duty/editDuty",
    method: "put",
    data: data,
  });
}

// 查询值班详细
export function getDutyAdjust() {
  return request({
    url: "/duty/adjust/list",
    method: "get",
  });
}

//编辑调班
export function editAdjust(data) {
  return request({
    url: "/duty/adjust/editAdjust",
    method: "put",
    data: data,
  });
}
