/**
 * 分包项目申请接口
 */
import request from '../../index'
import type { IListQuery } from '@/views/business/subpackage/subpackage-interface'

// 列表查询
export function getListPage(data: IListQuery) {
  return request({
    url: `/business/outsourceProject/apply/approval/listPage?offset=${data.offset}&limit=${data.limit}`,
    method: 'post',
    data,
  })
}

// 详情
export function detail(data: { id: string; sampleNo?: string; sampleName?: string }) {
  return request({
    url: '/business/outsourceProject/apply/detail',
    method: 'post',
    data,
  })
}

// 审批删除
export function approvalDel(data: object) {
  return request({
    url: '/business/outsourceProject/apply/approval/operate/delete',
    method: 'post',
    data,
  })
}

// 删除
export function deleteListItem(data: { id: string }) {
  return request({
    url: '/business/outsourceProject/apply/delete',
    method: 'post',
    data,
  })
}

// 编辑(草稿箱、已取消的编辑)
export function updateApply(data: object) {
  return request({
    url: '/business/outsourceProject/apply/draftUpdate',
    method: 'post',
    data,
  })
}

// 未通过-驳回的编辑
export function failUpdateApply(data: object) {
  return request({
    url: '/business/outsourceProject/apply/failUpdate',
    method: 'post',
    data,
  })
}

// 新建
export function addApply(data: object) {
  return request({
    url: '/business/outsourceProject/apply/save',
    method: 'post',
    data,
  })
}

// 提交
export function submit(data: { formId: any; id: string; processId?: string }) {
  return request({
    url: '/business/outsourceProject/apply/submit',
    method: 'post',
    data,
  })
}

// 分包页面 样品列表
export function listPageBySubpackage(data: object) {
  return request({
    url: '/customer/sample/listPageBySubpackage',
    method: 'post',
    data,
  })
}

// 分包页面 申请审批通过列表
export function OutsourceProjectPassList(data: { offset: number; limit: number }) {
  return request({
    url: `/business/outsourceProject/apply/listPage?offset=${data.offset}&limit=${data.limit}`,
    method: 'post',
    data,
  })
}
