import { axios } from '@/utils/request'

// 申请部门
export const departmentQueryList = (params) => {
  return axios({
    url: `/department/queryList`,
    data: params,
    method: 'post',
    headers: {
      'module': encodeURIComponent('申请部门查询')
    }
  })
}
//  申请人
export const employeeQueryList = (params) => {
  return axios({
    url: `/employee/queryList`,
    data: params,
    method: 'post',
    headers: {
      'module': encodeURIComponent('申请人查询')
    }
  })
}
// 其它往来人员
export const otherOrgQuery = (params) => {
  return axios({
    url: `/otherorg/queryAll`,
    method: 'get',
    headers: {
      'module': encodeURIComponent('其它往来人员')
    }
  })
}

// 费用报销单列表
export const expenseAccountList = (params) => {
  const url = `/expenseAccount/queryPage/${params.pageNo}/${params.pageSize}`
  delete params.pageNo
  delete params.pageSize
  return axios({
    url: url,
    data: params,
    method: 'post',
    headers: {
      'module': encodeURIComponent('列表查询')
    }
  })
}
// 批量更新打印状态
export const expenseAccountUpdateBatch = (params) => {
  const url = `/expenseAccount/updateBatch`
  return axios({
    url: url,
    data: params,
    method: 'post',
    headers: {
      'module': encodeURIComponent('批量更新打印状态')
    }
  })
}
// 新增再次编辑
export const expenseAccountAgainEdit = (params) => {
  const url = `/expenseAccount/againEdit/${params.expenseAccountSn} `
  return axios({
    url: url,
    data: params,
    method: 'post',
    headers: {
      'module': encodeURIComponent('再次编辑')
    }
  })
}
// 报销单详情
export const expenseAccountDetail = (params) => {
  return axios({
    url: `/expenseAccount/queryBySn/${params.expenseAccountSn}`,
    data: params,
    method: 'get'
  })
}
// 保存
export const expenseAccountSave = (params) => {
  return axios({
    url: `/expenseAccount/save`,
    data: params,
    method: 'post',
    headers: {
      'module': encodeURIComponent('新增')
    }
  })
}
// 删除
export const expenseAccountDelete = (params) => {
  return axios({
    url: `/expenseAccount/deleteBySn/${params.expenseAccountSn}`,
    data: params,
    method: 'post',
    headers: {
      'module': encodeURIComponent('删除')
    }
  })
}
// 提交
export const expenseAccountSubmit = (params) => {
  return axios({
    url: `/expenseAccount/submit`,
    data: params,
    method: 'post',
    headers: {
      'module': encodeURIComponent('提交')
    }
  })
}

// 删除费用明细
export const expenseAcctDetailDelete = (params) => {
  return axios({
    url: `/expenseAcctDetail/deleteDetail/${params.detailSn}`,
    method: 'get',
    headers: {
      'module': encodeURIComponent('删除')
    }
  })
}

// 根据sn查询费用明细
export const expenseAcctDetailFindBySn = (params) => {
  return axios({
    url: `/expenseAcctDetail/findBySn/${params.detailSn}`,
    method: 'get',
    headers: {
      'module': encodeURIComponent('费用明细')
    }
  })
}

// 根据sn查询费用明细产品
export const expenseAcctDetailFindProductsBySn = (params) => {
  return axios({
    url: `/expenseAcctDetail/findDetailProductsBySn/${params.detailSn}`,
    method: 'get',
    headers: {
      'module': encodeURIComponent('费用明细产品')
    }
  })
}

// 根据sn查询费用明细列表
export const expenseAcctDetailFindList = (params) => {
  return axios({
    url: `/expenseAcctDetail/findList`,
    data: params,
    method: 'post',
    headers: {
      'module': encodeURIComponent('费用明细列表')
    }
  })
}

// 保存费用明细
export const expenseAcctDetailSave = (params) => {
  return axios({
    url: `/expenseAcctDetail/saveDetail`,
    data: params,
    method: 'post',
    headers: {
      'module': encodeURIComponent('保存费用明细')
    }
  })
}
// 批量保存费用明细
export const updateBatchExpenseAcctDetail = (params) => {
  return axios({
    url: `/expenseAcctDetail/updateDetailByAccount`,
    data: params,
    method: 'post',
    headers: {
      'module': encodeURIComponent('批量修改记账名称')
    }
  })
}
// 费用类型
export const expenseTypeList = (params) => {
  return axios({
    url: `/expenseType/queryTreeList`,
    data: params,
    method: 'post'
  })
}
// 导入费用报销明细
export const expenseImportDetail = (params) => {
  return axios({
    url: '/expenseAcctDetail/importDetail',
    data: params,
    method: 'post',
    headers: {
      'module': encodeURIComponent('导入费用报销明细')
    }
  })
}
// 确认导入明细
export const expenseInsertImport = (params) => {
  return axios({
    url: '/expenseAcctDetail/insertImport',
    data: params,
    method: 'post',
    headers: {
      'module': encodeURIComponent('导入明细')
    }
  })
}
// 报销明细错误导出
export const expenseFailExcel = (params) => {
  return axios({
    url: '/expenseAcctDetail/exportImportDetailError',
    data: params,
    method: 'post',
    responseType: 'blob',
    headers: {
      'module': encodeURIComponent('导出报销明细错误项')
    }
  })
}

// 保存费用明细产品
export const expenseAcctDetailSaveProducts = (params) => {
  return axios({
    url: `/expenseAcctDetail/saveDetailProducts`,
    data: params,
    method: 'post',
    headers: {
      'module': encodeURIComponent('保存费用明细产品')
    }
  })
}

// 费用报销明细单列表
export const expenseAccountDetailList = (params) => {
  const url = `/report/expenseAcctDetailReport/queryDetailReport/${params.pageNo}/${params.pageSize}`
  delete params.pageNo
  delete params.pageSize
  return axios({
    url: url,
    data: params,
    method: 'post',
    headers: {
      'module': encodeURIComponent('费用报销明细列表查询')
    }
  })
}
// 费用报销明细统计
export const expenseAccountDetailCount = (params) => {
  const url = `/report/expenseAcctDetailReport/queryDetailReport/count`
  return axios({
    url: url,
    data: params,
    method: 'post'
  })
}

//  费用报销明细单 导出
export const expenseAcctDetailReport = (params) => {
  return axios({
    url: '/report/expenseAcctDetailReport/exportDetailReport',
    data: params,
    method: 'post',
    responseType: 'blob',
    headers: {
      'module': encodeURIComponent('费用报销明细导出')
    }
  })
}

export const getProcessInstance = (params) => {
  return axios({
    url: `/dingTalk/queryList`,
    data: params,
    method: 'post',
    headers: {
      'module': encodeURIComponent('审核进度')
    }
  })
}
// 审核进度历史查看
export const getProcessInstanceList = (params) => {
  return axios({
    url: `/dingTalk/getProcessInstanceList/${params.businessType}/${params.businessSn}`,
    method: 'get',
    headers: {
      'module': encodeURIComponent('审核进度列表')
    }
  })
}
// 钉钉部门
export const getDingTalkDepartmentList = (params) => {
  return axios({
    url: `/dingTalk/getDingTalkDepartmentList/${params.deptId}`,
    data: params,
    method: 'post',
    headers: {
      'module': encodeURIComponent('钉钉部门列表')
    }
  })
}
// 钉钉人员
export const queryDingTalkDeptUser = (params) => {
  return axios({
    url: `/dingTalk/queryDingTalkDeptUser/${params.deptId}/${params.pageNo}/${params.pageSize}`,
    data: params,
    method: 'post',
    headers: {
      'module': encodeURIComponent('钉钉人员列表')
    }
  })
}

// 同步钉钉部门人员
export const refashDingTalkAllDeptUser = (params) => {
  return axios({
    url: `/dingTalk/syncAllDeptUser `,
    data: params,
    method: 'post',
    headers: {
      'module': encodeURIComponent('刷新部门人员数据')
    }
  })
}

// 获取所以部门人员
export const getDingTalkAllDeptUser = (params) => {
  return axios({
    url: `/dingTalk/getAllDeptUser`,
    data: params,
    method: 'post',
    headers: {
      'module': encodeURIComponent('部门人员数据')
    }
  })
}
