import request from '@/utils/request'

// 初始化设备名称
export function getEquipment(id, equipmentNum) {
  return request({
    url: '',
    method: 'post',
    data: {
      type: '1',
      name: '设备管理_设备名称与班次关系_查询数据',
      param: `查询代码=${id}=int&设备流水号=${equipmentNum}`
    }
  })
}

export function getDepartment() {
  return request({
    url: '',
    method: 'post',
    data: {
      type: '1',
      name: '设备管理_部门查询'
    }
  })
}

export function getTablePeople(number) {
  return request({
    url: '',
    method: 'post',
    data: {
      type: '1',
      name: '人事档案管理_人员_部门与人员_查询数据_根据部门编号',
      param: `考核部门编号=${number}`
    }
  })
}

export function getTableData(equipmentCheck, equipmentNameValue, operatorCheck, operatorNumber, pageCurrent, pageSize) {
  return request({
    url: '',
    method: 'post',
    data: {
      type: '1',
      name: '设备管理_设备名称_人员关系_查询数据',
      param: `设备流水号_check=${equipmentCheck}&设备流水号=${equipmentNameValue}&操作者编号_check=${operatorCheck}&操作者编号=${operatorNumber}`,
      pagination: pageCurrent + '&' + pageSize
    }
  })
}

export function deleteTable(number) {
  return request({
    url: '',
    method: 'post',
    data: {
      type: '2',
      name: '设备管理_设备名称_人员关系_删除数据',
      param: '设备人员关系流水号=' + number + '=int'
    }
  })
}

export function getStaff() {
  return request({
    url: '',
    method: 'post',
    data: {
      type: '1',
      name: '设备管理_基础表_班次表_查询班次'
    }
  })
}

export function addTable(equipmentNumber, equipment, shift, operator, operatorNumber) {
  return request({
    url: '',
    method: 'post',
    data: {
      type: '2',
      name: '设备管理_设备名称_人员关系_增加数据',
      param: '设备流水号=' + equipmentNumber + '=int&设备名称=' + equipment + '=string&班次代码=' + shift + '=int&操作者=' + operator + '=string&操作者编号=' + operatorNumber + '=int'
    }
  })
}

export function editTable(equipment, equipmentNumber, shift, operator, operatorNumber, Number) {
  return request({
    url: '',
    method: 'post',
    data: {
      type: '2',
      name: '设备管理_设备名称_人员关系_修改数据',
      param: '设备流水号=' + equipmentNumber + '=int&设备名称=' + equipment + '=string&班次代码=' + shift + '=int&操作者=' + operator + '=string&操作者编号=' + operatorNumber + '=int&设备人员关系流水号=' + Number + '=int'
    }
  })
}
