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 searchMachine(num) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '1',
      name: '车间装配管理_机床_查询数据',
      param: '项目流水号=' + num
    }
  })
}
// 关键节点查询
export function searchTable(num, pageCurrent, pageSize) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '1',
      name: '车间装配管理_安装调试_关键节点_查询数据',
      param: '机床流水号=' + num,
      Pagination: pageCurrent + '&' + pageSize
    }
  })
}
// 工作记录查询
export function searchTable1(num, pageCurrent, pageSize) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '1',
      name: '车间装配管理_安装调试_工作记录_查询数据',
      param: '机床流水号=' + num,
      Pagination: pageCurrent + '&' + pageSize
    }
  })
}
// 增加关键节点
export function addData(machineNumberValue, KeyNode, completion, Remarks) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '2',
      name: '车间装配管理_安装调试_关键节点_增加数据',
      param: '机床流水号=' + machineNumberValue + '&关键节点=' + KeyNode + '&完成情况=' + completion + '&备注=' + Remarks
    }
  })
}
// 编辑关键节点
export function editData(KeyNodeNum, KeyNode, completion, Remarks) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '2',
      name: '车间装配管理_安装调试_关键节点_编辑数据',
      param: '关键节点流水号=' + KeyNodeNum + '&关键节点=' + KeyNode + '&完成情况=' + completion + '&备注=' + Remarks
    }
  })
}
// 删除关键节点
export function deleteData(KeyNodeNum) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '2',
      name: '车间装配管理_安装调试_关键节点_删除数据',
      param: '关键节点流水号=' + KeyNodeNum
    }
  })
}
// 增加工作记录
export function addData1(machineNumberValue, WorkRecord, WorkDay) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '2',
      name: '车间装配管理_安装调试_工作记录_增加数据',
      param: '机床流水号=' + machineNumberValue + '&工作情况=' + WorkRecord + '&工作日期=' + WorkDay
    }
  })
}
// 编辑工作记录
export function editData1(WorkRecordNum, WorkRecord, WorkDay) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '2',
      name: '车间装配管理_安装调试_工作记录_编辑数据',
      param: '工作记录流水号=' + WorkRecordNum + '&工作情况=' + WorkRecord + '&工作日期=' + WorkDay
    }
  })
}
// 删除工作记录
export function deleteData1(WorkRecordNum) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '2',
      name: '车间装配管理_安装调试_工作记录_删除数据',
      param: '工作记录流水号=' + WorkRecordNum
    }
  })
}
