import request from '@/utils/request'
import state from '@/store'
import router from '@/router'

export function insertInto(num2, num3, num4, num5, num6, num7, num8, num9) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '2',
      name: '车间采购管理_发票结算申请单_增加数据',
      param: `发票号=${num2}&发票金额=${num3}&供应商流水号=${num4}&已付款项=${num5}&尚欠金额=${num6}&税额=${num7}&是否费用类=${num8}&备注=${num9}`
    }
  })
}

// 查询供应商
export function searchSupplier() {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '1',
      name: '采购管理_供应商_查询数据_根据条件'
    }
  })
}
// 根据条件查发票结算申请单
export function searchTable1(...group) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '1',
      name: '车间采购管理_发票结算申请单_查询数据_到票申请',
      param: `发票号_check=${group[0]}&发票号=${group[1]}`,
      Pagination: group[2] + '&' + group[3]
    }
  })
}
// 编辑发票结算申请单
export function submitEdit(...group) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '1',
      name: '车间采购管理_发票结算申请单_修改数据',
      param: `发票号=${group[0]}&发票金额=${group[1]}&已付款项=${group[2]}&尚欠金额=${group[3]}&税额=${group[4]}&是否费用类=${group[5]}&备注=${group[6]}&发票结算申请单流水号=${group[7]}`
    }
  })
}
// 删除发票结算申请单
export function submitDelete(...group) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '2',
      name: '车间采购管理_发票结算申请单_删除数据',
      param: `发票结算申请单流水号=${group[0]}`
    }
  })
}
// 提交申请 发票结算申请单
export function submitApply(...group) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '2',
      name: '车间采购管理_发票结算申请单_提交申请',
      param: `发票结算申请单流水号=${group[0]}&申请人=${group[1]}`
    }
  })
}
// 发票结算申请单明细列表
export function searchTable2(num) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '1',
      name: '车间采购管理_发票结算申请单明细_查询数据',
      param: `发票结算申请单流水号=${num}`
    }
  })
}
// 根据供应商查询采购合同
export function searchPurchase(data) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '1',
      name: '车间采购管理_采购合同_查询数据',
      param: '供应商流水号_check=1&供应商流水号=' + data
    }
  })
}
// 根据供应商查询离线合同
export function searchOffline(data) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '1',
      name: '车间采购管理_离线合同_查询数据',
      param: '供应商流水号_check=1&供应商流水号=' + data
    }
  })
}
// 查询采购合同明细
export function searchPurchaseDetail(data) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '1',
      // name: '车间采购管理_采购合同明细_查询数据NEW',
      name: '车间采购管理_采购合同明细_追加入库单_查询数据',
      param: '采购合同流水号=' + data
    }
  })
}
// 查询采购合同明细
export function searchPurchaseDetail1(data) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '1',
      name: '车间采购管理_采购合同明细_成组采购_查询数据',
      param: '采购合同流水号=' + data
    }
  })
}
// 查询离线合同明细
export function searchOfflineDetail(data) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '1',
      name: '车间采购管理_离线合同明细_查询数据',
      param: '离线合同流水号=' + data
    }
  })
}
// 发票结算申请单明细增加-1采购/2离线
export function addTable2(data, group1, group2, type) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '2',
      name: '车间采购管理_发票结算申请单明细_增加数据',
      param: '发票结算申请单流水号=' + data + '&合同明细流水号组=' + group1 + '&到票数量组=' + group2 + '&合同类型=' + type
    }
  })
}
// 发票结算申请单明细删除
export function deleteTable2(data) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '2',
      name: '车间采购管理_发票结算申请单明细_删除数据',
      param: '发票结算申请单明细流水号=' + data
    }
  })
}
