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: '合同信息管理_项目名称_总_查询'
    }
  })
}
export function initMarketingManager() {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '1',
      name: '合同信息管理_营销人员_总_查询'
    }
  })
}
// 导出Excel llj
export function downloadexcel(num1, num2, num3, check1, starttime, endtime, ordername, order, check2, people) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '1',
      name: '报表_合同收款计划_导出',
      param: '客户名称=' + num3 + '=string' + '&时间_check=' + check1 + '&开始时间=' + starttime + '&结束时间=' + endtime + '&排序名称=' + ordername + '&排序方式=' + order + '&人员ID_check=' + check2 + '&人员ID=' + people
    }
  })
}
export function searchTable1(pageCurrent, pageSize, num1, num2, num3, check1, starttime, endtime, ordername, order, check2, people) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '1',
      name: '合同资金管理_资金信息_查询1',
      param: '客户名称=' + num3 + '=string' + '&时间_check=' + check1 + '&开始时间=' + starttime + '&结束时间=' + endtime + '&排序名称=' + ordername + '&排序方式=' + order + '&人员ID_check=' + check2 + '&人员ID=' + people,
      Pagination: pageCurrent + '&' + pageSize
    }
  })
}
export function searchTable2(num1) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '1',
      name: '基础表_合同资金表明细_查询数据',
      param: '资金ID=' + num1 + '=int'
    }
  })
}
export function updateMoney(num1, money) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '2',
      name: '基础表_合同资金表明细_编辑数据',
      param: '资金明细ID=' + num1 + '&金额=' + money
    }
  })
}
export function addMoney(num1) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '2',
      name: '基础表_合同资金表明细_增加数据',
      param: '资金ID=' + num1
    }
  })
}
export function deleteMoney(num1) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '2',
      name: '基础表_合同资金表明细_删除数据',
      param: '资金明细ID=' + num1
    }
  })
}
export function editBatchCapitalChar(num1, num2, num3, num4) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '2',
      name: '合同资金管理_批次付款表_增加数据',
      param: '资金ID=' + num1 + '=int&付款阶段ID=' + num2 + '=int&本次付款=' + num3 + '=float&付款时间=' + num4 + '=string'
    }
  })
}
export function deletechar(num1) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '2',
      name: '合同资金管理_批次付款表_删除',
      param: '批次资金ID=' + num1 + '=int'
    }
  })
}
export function addList(num1, num2) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '2',
      name: '基础表_合同资金表_增加数据',
      param: '合同ID=' + num1 + '=int&合同总金额=' + num2 + '=float'
    }
  })
}
export function searchProjectNumber() {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '1',
      name: '合同信息管理_项目名称_总_查询'
    }
  })
}
export function searchProjectNumber2() {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '1',
      name: '合同信息管理_项目名称_总_查询_增加限制'
    }
  })
}
export function searchProjectName(num1) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '1',
      name: '合同信息管理_项目名称_通过合同ID查_查询',
      param: '合同ID=' + num1 + '=int'
    }
  })
}
export function PaymentPhase() {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '1',
      name: '合同资金管理_付款阶段_查询'
    }
  })
}
export function dellist(num1) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '2',
      name: '合同资金管理_资金信息_删除',
      param: '资金ID=' + num1 + '=int'
    }
  })
}
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 editChart(code, num1, num2, num3) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: 2,
      name: '合同资金管理_批次付款表_修改',
      param: '批次资金ID=' + code + '=int&本次付款金额新=' + num1 + '=string&付款时间=' + num2 + '=string&付款阶段ID=' + num3 + '=int'
    }
  })
}
export function editTableData(code, num1) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: 2,
      name: '合同资金管理_合同资金表_修改',
      param: '资金ID=' + code + '=int&合同总金额=' + num1 + '=string'
    }
  })
}
export function selectMachine(code) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '1',
      name: '合同收款计划_发货情况_查询数据',
      param: '项目流水号=' + code
    }
  })
}
export function selectBatchFundingDetails(code) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '1',
      name: '合同资金管理_分批付款明细_查询',
      param: '批次资金ID=' + code
    }
  })
}
export function SelectMarketingManager(code) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '1',
      name: '客户关系管理系统_按姓名查询_营销经理',
      param: '姓名=' + code
    }
  })
}
export function selectProvince() {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '1',
      name: '发货管理_省份查询'
    }
  })
}
export function fukuan(code, num1, num2) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '2',
      name: '合同资金管理_批次付款明细表_增加数据_新',
      param: '批次资金ID=' + code + '=int&本次收款金额=' + num1 + '=string&本次收款时间=' + num2 + '=string'
    }
  })
}
export function editFukuan(code, num1, num2) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '2',
      name: '合同资金管理_批次付款明细表_修改数据',
      param: '批次付款明细ID=' + code + '=int&本次收款金额=' + num1 + '=string&本次收款时间=' + num2 + '=string'
    }
  })
}
export function selectMax(code) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '1',
      name: '合同资金管理_批次资金明细修改最大值_查询',
      param: '批次付款明细ID=' + code + '=int'
    }
  })
}
export function editTime(code, num2) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '2',
      name: '合同资金管理_批次付款表_修改计划时间',
      param: '批次资金ID=' + code + '=int&执行进度ID=' + num2 + '=int'
    }
  })
}
export function delMoney(code) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '2',
      name: '合同资金管理_批次付款明细表_删除数据新',
      param: '批次付款明细ID=' + code + '=int'
    }
  })
}
export function editList(num1, num2, num3) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '2',
      name: '基础表_合同资金表_修改数据',
      param: '合同ID=' + num1 + '=int&合同总金额=' + num2 + '=float&资金ID=' + num3 + '=int'
    }
  })
}
export function selectBatch(num1) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '1',
      name: '合同资金管理_分批资金_批次查询',
      param: '资金ID=' + num1 + '=int'
    }
  })
}
export function TransPlanning(num1, num2, num3) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '2',
      name: '合同资金管理_批次付款表_转移计划',
      param: '批次资金ID原=' + num1 + '=int&批次资金ID转=' + num2 + '=int&转移金额=' + num3 + '=string'
    }
  })
}
export function editDay(num1, num2) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '2',
      name: '合同资金管理_分批资金表_修改提醒天数',
      param: '批次资金ID=' + num1 + '=int&提前X天提醒=' + num2 + '=int'
    }
  })
}
export function AccountsReceivable() {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '1',
      name: '合同资金管理_催收账款_查询'
    }
  })
}
export function SelectContractFunds(num1, pageCurrent, pageSize) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '1',
      name: '合同资金管理_资金信息_查询_通过资金ID',
      param: '资金ID=' + num1 + '=int',
      Pagination: pageCurrent + '&' + pageSize
    }
  })
}
export function executionProgressID() {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '1',
      name: '合同信息管理_执行进度_查询'
    }
  })
}
export function never(num1) {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '2',
      name: '合同资金管理_资金信息_查询',
      param: '批次资金ID=' + num1 + '=int'
    }
  })
}
export function getcustomername() {
  return request({
    url: '',
    method: 'post',
    data: {
      UserID: state.state.user.id,
      ModularID: router.currentRoute.path,
      type: '1',
      name: '合同资金管理_资金信息_查询_新'
    }
  })
}
