import request from "@/utils/request";

// 返回一工段为
export function processTreeList(operationType: string) {
  return request({
    url: "/api/v1/op/baseOperation/treeList",
    method: "post",
    data: {
      operationType: operationType,
    },
  });
}

// 新增自定义工艺工序组件路径
export function saveCompoents(data: object) {
  return request({
    url: "/api/v1/op/compent/saveOrUpdate",
    method: "post",
    data: data,
  });
}
export function addBatch(data: object) {
  return request({
    url: "/api/v1/op/operationItem/addBatch",
    method: "post",
    data: data,
  });
}
// 新增工序采集辅料
export function addFuliao(data: object) {
  return request({
    url: "/api/v1/operationAccessoryItem/addBatch",
    method: "post",
    data: data,
  });
}

//批量新增esop
export function addEsopBatch(data: object) {
  return request({
    url: "/api/v1/op/esop/addBatch",
    method: "post",
    data: data,
  });
}

//批量新增检验项
export function addCheckBatch(data: object) {
  return request({
    url: "/api/v1/op/operationCheck/addBatch",
    method: "post",
    data: data,
  });
}
// 获取工艺工序组件路径信息
export function getCompoentsList(opId: string) {
  return request({
    url: `/api/v1/op/compent/get/${opId}`,
    method: "get",
  });
}

// 批量更新工序记录项信息
export function sortGXJLList(data: object) {
  return request({
    url: `/api/v1/op/operationRecord/batch-update`,
    method: "post",
    data: data,
  });
}

export function getBomVersion(data: object) {
  return request({
    url: `/api/v1/base/bomVersion/list`,
    method: "post",
    data: data,
  });
}

export function getRouteMaxVersion(routeId: string) {
  return request({
    url: `/api/v1/op/route/getRouteMaxVersion/${routeId}`,
    method: "get",
  });
}
export function checkSyncList(id: string) {
  return request({
    url: "/api/v1/op/routeOperation/checkSyncList/" + id,
    method: "get",
  });
}

export function syncOperation(data: Object) {
  return request({
    url: "/api/v1/op/routeOperation/syncOperation",
    method: "post",
    data: data,
  });
}

export function treeDataList(data: object) {
  return request({
    url: `/api/v1/operation/item/group/list`,
    method: "post",
    data: data,
  });
}


export function treeDataSave(data: object) {
  return request({
    url: `/api/v1/operation/item/group/add`,
    method: "post",
    data: data,
  });
}

export function treeDataDel(data: object) {
  return request({
    url: `/api/v1/operation/item/group/del`,
    method: "post",
    data: data,
  });
}

export function treeDataUpdate(data: object) {
  return request({
    url: `/api/v1/operation/item/group/update`,
    method: "post",
    data: data,
  });
}

export function treeDataAddBatch(data: object) {
  return request({
    url: `/api/v1/op/operationItem/updateBatch`,
    method: "post",
    data: data,
  });
}

export function removeGroup(data: object) {
  return request({
    url: `/api/v1/op/operationItem/removeGroup`,
    method: "post",
    data: data,
  });
}

export function  removeAccessoryGroup(data: object){
  return request({
    url: `/api/v1/operationAccessoryItem/removeGroup`,
    method: "post",
    data: data,
  });
}

export function treeAccessoryAddBatch(data: object) {
  return request({
    url: `/api/v1/operationAccessoryItem/updateBatch`,
    method: "post",
    data: data,
  });
}
