import request from '@/utils/request'
import state from '@/store'
import router from '@/router'
// 初始化机床项目
export function initProject() {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '1',
      name: 'PDM_项目名称_查询数据'
    }
  })
}
// 组件查询
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 searchgroupName(num) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '1',
      name: 'PDM_组件名称_查询数据_查询名称',
      param: '组件流水号=' + num
    }
  })
}
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 searchTable1(machineNumberValue, check2) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '1',
      name: '车间装配管理_机床信息_查询数据',
      param: '机床流水号_check=' + check2 + '&机床流水号=' + machineNumberValue
    }
  })
}
// 组件查询
export function searchTable2(machineNumberValue, type) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '1',
      name: '电气管理_工作计划_查询数据',
      param: '机床流水号=' + machineNumberValue + '&计划类型=' + type
    }
  })
}
export function deletedata(num) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '2',
      name: '电气管理_工作计划_删除数据',
      param: '计划流水号=' + num
    }
  })
}
export function editData(num, group, groupName, Name, time) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '2',
      name: '车间管理_工作计划_编辑数据',
      param: '计划流水号=' + num + '&组件流水号=' + group + '&组号=' + groupName + '&任务名称=' + Name + '&计划工时=' + time
    }
  })
}
export function addData(num, type) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '2',
      name: '车间管理_工作计划_增加数据',
      param: '机床流水号=' + num + '&计划类型=' + type
    }
  })
}
// 获取装配人员
export function searchPeople() {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '1',
      name: '人事档案管理_人员_部门与人员_查询数据_根据部门编号_装配',
      param: '考核部门编号=16'
    }
  })
}
// 获取分配后装配人员
export function searchName(num) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '1',
      name: '电气管理_装配计划_装配工_查询数据',
      param: '计划流水号=' + num
    }
  })
}
export function submitPeople(num, people) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '2',
      name: '电气装配管理_分配任务_循环执行',
      param: '计划流水号=' + num + '&人员编号组=' + people
    }
  })
}
