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

// export function projectSelect() {
//   return request({
//     url: '',
//     method: 'post',
//     data: {
//       type: '1',
//       name: 'PDM_项目名称_查询数据_按时间排序'
//     }
//   })
// }

export function machineSelect(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 groupSelect(machineValue) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '1',
      name: 'PDM_零件明细表_组件流水号_查询数据_根据机床',
      param: `机床流水号=${machineValue}`
    }
  })
}

export function basicPartsData(machine_check, machine, group_check, group, Model_check, ModelValue, person_check, personValue, time_check, inTime0, inTime1, pageSize, pageCurrent) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '1',
      name: 'PDM_零件明细表_基本件_查询数据_综合gj',
      param: `机床流水号_check=${machine_check}&机床流水号=${machine}&组件流水号_check=${group_check}&组件流水号=${group}&规格_check=${Model_check}&规格=${ModelValue}&导入人_check=${person_check}&导入人=${personValue}&导入日期_check=${time_check}&开始时间=${inTime0}&结束时间=${inTime1}`,
      Pagination: pageCurrent + '&' + pageSize
    }
  })
}
// 根据机床和组查询规格型号  LLJ 新增
export function searchModel(machine_check, machine, group_check, group) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '1',
      name: '三表查询_根据机床组号查询规格型号',
      param: `机床流水号_check=${machine_check}&机床流水号=${machine}&组件流水号_check=${group_check}&组件流水号=${group}`
    }
  })
}
export function purchasePartsData(machine_check, machine, group_check, group, Model_check, ModelValue, person_check, personValue, time_check, inTime0, inTime1, pageSize, pageCurrent) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '1',
      name: 'PDM_零件明细表_标准件和外购件_查询数据',
      // param: `组件流水号=${num}`,
      param: `机床流水号_check=${machine_check}&机床流水号=${machine}&组件流水号_check=${group_check}&组件流水号=${group}&规格_check=${Model_check}&规格=${ModelValue}&导入人_check=${person_check}&导入人=${personValue}&导入日期_check=${time_check}&开始时间=${inTime0}&结束时间=${inTime1}`,
      pagination: pageCurrent + '&' + pageSize
    }
  })
}
export function deleteBasicParts(basicNum) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '2',
      name: 'PDM_零件明细表_基本件_删除数据',
      param: `基本件流水号=${basicNum}`
    }
  })
}
export function deletePurchaseData(num) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '2',
      name: 'PDM_零件明细表_标准件和外购件_删除数据',
      param: '标准件和外购件流水号=' + num + '=int'
    }
  })
}
export function getFileData(MachineDrawValue) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '1',
      name: 'PDM_机床总图_查询数据',
      param: `机床流水号=${MachineDrawValue}`
    }
  })
}
export function getperson() {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '1',
      name: '三表导入_人员查询'
    }
  })
}
