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

// 项目
export function getProject(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 getToolNum(check, num) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '1',
      name: 'PDM_机床名称_查询数据',
      param: '项目流水号_check=' + check + '=int&项目流水号=' + 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 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 getCustomerName() {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '1',
      name: '客户关系管理系统_初始化查询_客户名称'
    }
  })
}
// 查询表1
export function searchtable(num1, num2, num3, num4, num5, num6, num7, num8, num9, num10, num11, num12, role, personnel, pageCurrent, pageSize) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '1',
      name: '项目计划管理_项目总计划_查询数据',
      param: `项目流水号_check=` + num1 + '&项目流水号=' + num2 + '&机床流水号_check=' + num3 + '&机床流水号=' + num4 + '&客户名称_check=' + num5 + '&客户名称=' + num6 + '&签订日期_check=' + num7 + '&签订日期开始时间=' + num8 + '&签订日期结束时间=' + num9 + '&交货期_check=' + num10 + '&交货期开始时间=' + num11 + '&交货期结束时间=' + num12 + '&角色编号=' + role + '&人员编号=' + personnel,
      Pagination: pageCurrent + '&' + pageSize
    }
  })
}
// 编辑表1
export function editTable(num1, num2, num3, num5, num13, num14, num15, num6, num7, num8, num9, num10, num11, num12) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '2',
      name: '项目计划管理_项目总计划_编辑数据',
      param: `项目流水号=` + num1 + '&机床流水号=' + num2 + '&项目编号=' + num3 + '&设计者=' + num5 + '&审图计划开始时间=' + num13 + '&审图计划完成时间=' + num14 + '&审图实际完成时间=' + num15 + '&机床设计完成时间=' + num6 + '&采购完成时间=' + num7 + '&备料完成时间=' + num8 + '&机床生产完成时间=' + num9 + '&机床装配完成时间=' + num10 + '&完成顺序=' + num11 + '&更新=' + num12
    }
  })
}
// 查询时间
export function searchTime(num) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '1',
      name: '项目计划管理_项目计划查询_查询项目时间节点_查询数据',
      param: `机床流水号=` + num
    }
  })
}
// 查询表2
export function searchTable2(num1) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '1',
      name: '项目计划管理_项目计划查询_查询项目详细_查询数据',
      param: `机床流水号=` + num1
    }
  })
}
// 编辑表2
export function editTable2(num1, num2, num3, num4, num5, num6, num7, num8, num9, num10) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '2',
      name: '项目计划管理_项目详细计划_编辑数据',
      param: `组件计划流水号=` + num1 + '&组件流水号=' + num2 + '&任务名称=' + num3 + '&负责人=' + num4 + '&接收任务时间=' + num5 + '&任务开始时间=' + num6 + '&计划完成时间=' + num7 + '&货期=' + num8 + '&实际完成时间=' + num9 + '&备注=' + num10
    }
  })
}
// 删除表2
export function Delete(num1) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '2',
      name: '项目计划管理_项目详细计划_删除数据',
      param: `组件计划流水号=` + num1
    }
  })
}
// 新增表2
export function addTable(num1, num2) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '2',
      name: '项目计划管理_项目详细计划_增加数据',
      param: `机床流水号=` + num1 + '&计划类型=' + num2
    }
  })
}
// 查询表4
export function searchtable4(num1) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '1',
      name: '项目计划管理_项目计划查询_修改记录_查询数据',
      param: `组件计划流水号=` + num1
    }
  })
}
