import request from "@/utils/request";
import JSONbig from "json-bigint";

// 创建MES 岗位任免单明细
export function createEmployeeAppointRemovePostDetail(data) {
  return request({
    url: "/system/employee-appoint-remove-post-detail/create",
    method: "post",
    data: data,
    // 处理精度丢失问题
    transformResponse: [
      function (data) {
        const JSONbigToString = JSONbig({ storeAsString: true });
        // 将Long类型数据转换为字符串
        return JSONbigToString.parse(data);
      },
    ],
  });
}

// 更新MES 岗位任免单明细
export function updateEmployeeAppointRemovePostDetail(data) {
  return request({
    url: "/system/employee-appoint-remove-post-detail/update",
    method: "put",
    data: data,
    // 处理精度丢失问题
    transformResponse: [
      function (data) {
        const JSONbigToString = JSONbig({ storeAsString: true });
        // 将Long类型数据转换为字符串
        return JSONbigToString.parse(data);
      },
    ],
  });
}

// 删除MES 岗位任免单明细
export function deleteEmployeeAppointRemovePostMaster(id) {
  return request({
    url: "/system/employee-appoint-remove-post-master/delete?id=" + id,
    method: "delete",
    // 处理精度丢失问题
    transformResponse: [
      function (data) {
        const JSONbigToString = JSONbig({ storeAsString: true });
        // 将Long类型数据转换为字符串
        return JSONbigToString.parse(data);
      },
    ],
  });
}

// 获得MES 岗位任免单明细
export function getEmployeeAppointRemovePostDetail(id) {
  return request({
    url: "/system/employee-appoint-remove-post-detail/get?id=" + id,
    method: "get",
    // 处理精度丢失问题
    transformResponse: [
      function (data) {
        const JSONbigToString = JSONbig({ storeAsString: true });
        // 将Long类型数据转换为字符串
        return JSONbigToString.parse(data);
      },
    ],
  });
}

// 获得MES 岗位任免单明细分页
export function getEmployeeAppointRemovePostMasterPage(query) {
  return request({
    url: "/system/employee-appoint-remove-post-master/page",
    method: "get",
    params: query,
    // 处理精度丢失问题
    transformResponse: [
      function (data) {
        const JSONbigToString = JSONbig({ storeAsString: true });
        // 将Long类型数据转换为字符串
        return JSONbigToString.parse(data);
      },
    ],
  });
}

// 导出MES 岗位任免单明细 Excel
export function exportEmployeeAppointRemovePostDetailExcel(query) {
  return request({
    url: "/system/employee-appoint-remove-post-detail/export-excel",
    method: "get",
    params: query,
    responseType: "blob",
  });
}

// 更新MES岗位任岗
export function updateEmployeePostMaster(data) {
  return request({
    url: "/system/employee-appoint-remove-post-master/update",
    method: "put",
    data,
    // 处理精度丢失问题
    transformResponse: [
      function (data) {
        const JSONbigToString = JSONbig({ storeAsString: true });
        // 将Long类型数据转换为字符串
        return JSONbigToString.parse(data);
      },
    ],
  });
}

// 更新MES岗位任岗
export function approvalEmployeePostMaster(data) {
  return request({
    url: "/system/employee-appoint-remove-post-master/approve",
    method: "put",
    data,
    // 处理精度丢失问题
    transformResponse: [
      function (data) {
        const JSONbigToString = JSONbig({ storeAsString: true });
        // 将Long类型数据转换为字符串
        return JSONbigToString.parse(data);
      },
    ],
  });
}

// 获得MES 岗位任免单主
export function getEmployeeAppointRemovePostMaster(id) {
  return request({
    url: "/system/employee-appoint-remove-post-master/get?id=" + id,
    method: "get",
    // 处理精度丢失问题
    transformResponse: [
      function (data) {
        const JSONbigToString = JSONbig({ storeAsString: true });
        // 将Long类型数据转换为字符串
        return JSONbigToString.parse(data);
      },
    ],
  });
}
