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

export function getMachine() {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '1',
      name: '机床信息_查询数据'
    }
  })
}
export function gettable(num, num1) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '1',
      name: '机床组件_分配情况_查询',
      param: '机床流水号=' + num + '&是否分配=' + num1
    }
  })
}

export function getPerson() {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '1',
      name: '人事档案管理_人员与角色_查询数据_技术员'
    }
  })
}

export function allocatetask(num, num1, num2) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '2',
      name: '机床组件_分配任务',
      param: '组件流水号组=' + num + '&设计员=' + num1 + '&分配人=' + num2
    }
  })
}
export function executereturn(num) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '2',
      name: '机床组件_撤回分配',
      param: '组件流水号组=' + num
    }
  })
}
export function getMachineTime(num) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '1',
      name: '机床信息_查询数据_获取审图时间',
      param: '机床流水号=' + num
    }
  })
}
export function updateMachineTime(num, time1, time2) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '2',
      name: '机床信息_查询数据_修改审图时间',
      param: '机床流水号=' + num + '&审图实际开始时间=' + time1 + '&审图实际完成时间=' + time2
    }
  })
}
