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

// 初始化合同
export function searchdata(check1, partDrawing, check2, daterange0, daterange1, check3, machine, check4, group, role, personnel, partName, order, pageCurrent, pageSize) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '1',
      name: '车间管理_车间采购_采购件查询',
      param: `零件图号_check=${check1}&零件图号=${partDrawing}&时间段_check=${check2}&开始时间=${daterange0}&结束时间=${daterange1}&机床_check=${check3}&机床=${machine}&组号_check=${check4}&组号=${group}&角色编号=${role}&人员编号=${personnel}&排序名称=${partName}&排序方式=${order}`,
      Pagination: pageCurrent + '&' + pageSize
    }
  })
}
// 总价
export function searchPrice(check1, partDrawing, check2, daterange0, daterange1, check3, machine, check4, group, role, personnel) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '1',
      name: '车间管理_车间采购_采购件查询_获取总价',
      param: `零件图号_check=${check1}&零件图号=${partDrawing}&时间段_check=${check2}&开始时间=${daterange0}&结束时间=${daterange1}&机床_check=${check3}&机床=${machine}&组号_check=${check4}&组号=${group}&角色编号=${role}&人员编号=${personnel}`
    }
  })
}
// 初始化机床项目
export function initMachineProject(role, personnel) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '1',
      name: '机床_查询_营销筛选',
      param: '角色编号=' + role + '&人员编号=' + personnel
    }
  })
}
// 组件查询
export function searchgroup(num) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '1',
      name: 'PDM_组件名称_查询数据',
      param: '机床流水号=' + num
    }
  })
}
