import request from "@/utils/request";
import { AxiosPromise } from "axios";
import {Fault, FaultHandle} from "@/api/fault/types";


/**
 * 获取关联图片
 *
 * @param fault
 */
export function getFault(data: Fault): AxiosPromise<Fault> {
  return request({
    url: "/api/v1/process/escalationImg/list",
    method: "post",
    data: data,
  });
}

/**
 * 获取报故详情
 *
 * @param id
 * @param data
 */
export function getFaultDetails(id: Number): AxiosPromise<any> {
  return request({
    url: "/api/v1/process/escalationFault/get/" + id,
    method: "get",
  });
}
/**
 * 处理结果
 *
 * @param id
 * @param data
 */
export function handleEscalationFault(data: FaultHandle): AxiosPromise<any> {
  return request({
    url: "/api/v1/process/escalationFault/handle",
    method: "post",
    data: data,
  });
}

  /**
   * 处理结果
   *
   * @param id
   * @param data
   */
  export function getSeqNoList(data:Fault): AxiosPromise<any> {
    return request({
      url: "/api/v1/process/escalationItem/list",
      method: "post",
      data: data,
    });
  }

    /**
     * 处理结果
     *
     * @param id
     * @param data
     */
    export function getProcessInfoList(data:Object) {
      return request({
        url: "/api/v1/process/info/list" ,
        method: "post",
        data:data,
      });
}

/**
 * 返工处理
 *
 *
 * @param data
 */
export function rework(data:Object) {
  return request({
    url: "/api/v1/process/info/rework",
    method: "post",
    data:data,
  });
}

/**
 * 线长审核
 *
 * @param id
 * @param data
 */
export function updateFault(data:Object) {
  return request({
    url: "/api/v1/process/escalationFault/update",
    method: "post",
    data:data,
  });
}

/**
 * 获取不合格品审理单二维码
 *
 * @param id
 * @param data
 */
export function getFaultScanCode(id: Number): AxiosPromise<any> {
  return request({
    url: "/api/v1/process/escalationFault/scan/" + id,
    method: "get",
  });
}