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() {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '1',
      name: 'PDM_项目名称_查询数据'
    }
  })
}

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, orderName, order, orderassignmentTypeValue_check, assignmentTypeValue, check_time, outTime1, outTime2, pageSize, pageCurrent) {
  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}&规格_check=${Model_check}&规格=${ModelValue}&排序名称=${orderName}&排序顺序=${order}&分配类型_check=${orderassignmentTypeValue_check}&分配类型=${assignmentTypeValue}&分配时间_check=${check_time}&分配开始时间=${outTime1}&分配结束时间=${outTime2}`,
      Pagination: pageCurrent + '&' + pageSize
    }
  })
}
export function basicPartsData1(machine_check, machine, group_check, group, Model_check, ModelValue, orderName, order, orderassignmentTypeValue_check, assignmentTypeValue, check_time, outTime1, outTime2) {
  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}&规格_check=${Model_check}&规格=${ModelValue}&排序名称=${orderName}&排序顺序=${order}&分配类型_check=${orderassignmentTypeValue_check}&分配类型=${assignmentTypeValue}&分配时间_check=${check_time}&导入开始时间=${outTime1}&导入结束时间=${outTime2}`
    }
  })
}
// 根据机床和组查询规格型号  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, pageSize, pageCurrent) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '1',
      name: '零件分配查询_标准件和外购件_查询',
      // param: `组件流水号=${num}`,
      param: `机床流水号_check=${machine_check}&机床流水号=${machine}&组件流水号_check=${group_check}&组件流水号=${group}&规格_check=${Model_check}&规格=${ModelValue}`,
      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}`
    }
  })
}
