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

export function initType() {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '1',
      name: '投标保证金管理_保证金类型查询'
    }
  })
}

export function selectBidBond() {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '1',
      name: '投标保证金管理_投标保证金查询_新',
      param: '保金类型_check=' + arguments[0] + '&保金类型=' + arguments[1] + '&投标人_check=' + arguments[2] + '&投标人=' + arguments[3] + '&招标企业_check=' + arguments[4] + '&招标企业=' + arguments[5] + '&开始日期_check=' + arguments[6] + '&开始日期=' + arguments[7] + '&结束日期_check=' + arguments[8] + '&结束日期=' + arguments[9],
      Pagination: arguments[10] + '&' + arguments[11]
    }
  })
}
export function selectBidBond_excel() {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '1',
      name: '投标保证金管理_投标保证金查询_新',
      param: '保金类型_check=' + arguments[0] + '&保金类型=' + arguments[1] + '&投标人_check=' + arguments[2] + '&投标人=' + arguments[3] + '&招标企业_check=' + arguments[4] + '&招标企业=' + arguments[5] + '&开始日期_check=' + arguments[6] + '&开始日期=' + arguments[7] + '&结束日期_check=' + arguments[8] + '&结束日期=' + arguments[9]
    }
  })
}

export function getTree() {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: 1,
      name: '人事档案管理_部门关系_查询节点',
      param: '子节点=0=int'
    }
  })
}
export function tree(data, pid) {
  const result = []
  let temp
  for (let i = 0; i < data.length; i++) {
    if (data[i].父节点 === pid) {
      const obj = { label: data[i].节点名称, id: data[i].子节点 }
      temp = tree(data, data[i].子节点)
      if (temp.length > 0) {
        obj.children = temp
      }
      result.push(obj)
    }
  }
  return result
}
export function getTablePeople(code) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: 1,
      name: '人事档案管理_人员_部门与人员_查询数据_根据部门编号',
      param: '考核部门编号=' + code + '=int'
    }
  })
}
export function TakeBack() {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '2',
      name: '投标保证金管理_投标保证金_收回',
      param: '招标保证金流水号=' + arguments[0] + '&实际收回日期=' + arguments[1]
    }
  })
}
export function ComplianceGold() {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '2',
      name: '招标保证金管理_招标保证金_转履约金',
      param: '招标保证金流水号=' + arguments[0]
    }
  })
}
export function addBidBond() {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '2',
      name: '投标保证金管理_投标保证金信息_增加',
      param: '招标企业=' + arguments[0] + '&联系人=' + arguments[1] + '&联系电话=' + arguments[2] + '&保证金金额=' + arguments[3] + '&人员流水号=' + arguments[4] + '&保证金类型流水号=' + arguments[5] + '&投标日期=' + arguments[6] + '&备注=' + arguments[7] + '&提前X天提醒=' + arguments[8]
    }
  })
}
export function editBidBond() {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '2',
      name: '投标保证金管理_投标保证金信息_修改',
      param: '招标企业=' + arguments[0] + '&联系人=' + arguments[1] + '&联系电话=' + arguments[2] + '&保证金金额=' + arguments[3] + '&人员流水号=' + arguments[4] + '&保证金类型流水号=' + arguments[5] + '&投标日期=' + arguments[6] + '&备注=' + arguments[7] + '&提前X天提醒=' + arguments[8] + '&招标保证金流水号=' + arguments[9]
    }
  })
}
export function delBidBond() {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '2',
      name: '投标保证金管理_投标保证金信息_删除',
      param: '招标保证金流水号=' + arguments[0]
    }
  })
}
export function winningBid() {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '2',
      name: '投标保证金管理_投标保证金信息_投标结果',
      param: '招标保证金流水号=' + arguments[0] + '&投标结果=' + arguments[1] + '&公布日期=' + arguments[2] + '&中标服务费=' + arguments[3]
    }
  })
}
export function executionProgressID() {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '1',
      name: '合同信息管理_执行进度_查询'
    }
  })
}
export function intProject() {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '1',
      name: '合同信息管理_投标保证金转履约保证金_项目名称查询'
    }
  })
}
export function submitPerformanceBond() {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '2',
      name: '合同信息管理_投标保证金转履约保证金',
      param: '招标保证金流水号=' + arguments[0] + '&项目流水号=' + arguments[1] + '&保证金金额=' + arguments[2] + '&保证金类型流水号=' + arguments[3] + '&收回条件=' + arguments[4] + '&截止时间=' + arguments[5]
    }
  })
}
