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

// 初始化项目
export function initProject(role, personnel) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '1',
      name: 'PDM_项目名称_综合查询',
      param: '角色编号=' + role + '&人员编号=' + personnel
    }
  })
}
// 机床查询
export function searchMachine(num) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '1',
      name: 'PDM_机床名称_查询数据',
      param: '项目流水号_check=1&项目流水号=' + num
    }
  })
}
// 分组查询
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
    }
  })
}
// 初始化项目金额统计表
export function searchProjectTotal(check1, num1, check2, num2, check3, num3) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '1',
      name: '采购管理_项目采购总价_查询数据',
      param: `项目流水号_check=${check1}&项目流水号=${num1}&机床流水号_check=${check2}&机床流水号=${num2}&组件流水号_check=${check3}&组件流水号=${num3}`
    }
  })
}
