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

// 初始化机床项目
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
    }
  })
}
// 工艺定额人员查询
export function initPerson() {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '1',
      name: '人事档案管理_人员_部门与人员_查询数据_根据部门编号',
      param: '考核部门编号=20'
    }
  })
}
// 查询
export function search(pageCurrent, pageSize, check1, val1, check2, val2, check3, val3, check4, val4, check5, val5, val6, val7, role, personnel) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '1',
      name: '车间生产管理工艺_零件工序_查询数据_已编制工序的全部零件及工序_按机床分组图号人员查',
      param: `机床流水号_check=${check1}&机床流水号=${val1}&组件流水号_check=${check2}&组件流水号=${val2}&零件图号_check=${check3}&零件图号=${val3}&人员编号_check=${check4}&人员编号=${val4}&编制时间_check=${check5}&编制开始时间=${val5}&编制结束时间=${val6}&排序=${val7}&角色编号=${role}&营销经理流水号=${personnel}&PageCurrent=${pageCurrent}&PageSize=${pageSize}&PageCount=1111=int=output&ItemCount=1111=int=output`
    }
  })
}
// 查询已编制数量
export function searchCount(check1, val1, check2, val2, check3, val3, check4, val4, check5, val5, val6, role, personnel) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '1',
      name: '车间生产管理工艺_零件工序_查询数据_已编制工序的全部零件及工序_按机床分组图号人员查_已编制数量',
      param: `机床流水号_check=${check1}&机床流水号=${val1}&组件流水号_check=${check2}&组件流水号=${val2}&零件图号_check=${check3}&零件图号=${val3}&人员编号_check=${check4}&人员编号=${val4}&编制时间_check=${check5}&编制开始时间=${val5}&编制结束时间=${val6}&角色编号=${role}&营销经理流水号=${personnel}`
    }
  })
}
// 显示表1
export function searchtable1(num) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '1',
      name: '车间生产管理工艺_零件工序_查询数据_根据工艺计划流水号_工艺定额查询_系数',
      param: '工艺计划流水号=' + num
    }
  })
}
export function searchtable2(num) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '1',
      name: '车间生产管理工艺_零件加工路线单_查询数据_系数',
      param: '工艺计划流水号=' + num
    }
  })
}
// 在制零件工艺修改
export function returnEdit(num) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '2',
      name: '车间生产管理工艺_在制零件工艺调整_修改工艺_循环',
      param: `工艺计划流水号组=${num}`
    }
  })
}
export function tiaozheng(num1, num2) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '2',
      name: '工艺制定_工艺定额查询_工序人员修改',
      param: '人员编号=' + num1 + '&工艺计划流水号组=' + num2
    }
  })
}
