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

// 查询表1
export function searchTable1(pageCurrent, pageSize, check1, start, end, check2, num1, check3, name1, check4, name2) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '1',
      name: '车间采购管理_请款表_查询数据',
      param: '时间段_check=' + check1 + '&开始时间=' + start + '&结束时间=' + end + '&合同号_check=' + check2 + '&采购合同编号=' + num1 + '&采购员_check=' + check3 + '&采购员流水号=' + name1 + '&供应商_check=' + check4 + '&供应商名称=' + name2,
      Pagination: pageCurrent + '&' + pageSize
    }
  })
}
// 请款
export function requestFund(num1, money, time, id) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '2',
      name: '采购管理_请款表_增加数据',
      param: `采购合同流水号=${num1}&请款金额=${money}&请款人=${id}&请款时间=${time}`
    }
  })
}
// 查询请款付款情况
export function searchCondition(num1) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '1',
      name: '采购管理_请款表_查询数据_已付款',
      param: '采购合同流水号=' + num1
    }
  })
}
// 取消请款
export function cancelRequestFund(num1) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '2',
      name: '采购管理_请款表_删除数据',
      param: '采购科请款流水号=' + num1
    }
  })
}
// 查询请款表
export function searchRequestTable(check, start, end) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '1',
      name: '车间采购管理_请款表_查询数据_请款Excel',
      param: '请款时间段_check=' + check + '&开始时间=' + start + '&结束时间=' + end
    }
  })
}
// 初始化采购员
export function initBuyer() {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '1',
      name: '人事档案管理_人员_部门与人员_查询数据_根据部门编号',
      param: '考核部门编号=5'
    }
  })
}
