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

// 申请部门
export const departmentQueryList = (params) => {
  return axios({
    url: `/department/queryList`,
    data: params,
    method: 'post'
  })
}
//  申请人
export const employeeQueryList = (params) => {
  return axios({
    url: `/employee/queryList`,
    data: params,
    method: 'post'
  })
}

// 费用报销单列表
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'
  })
}
// 批量更新打印状态
export const expenseAccountUpdateBatch = (params) => {
  const url = `/expenseAccount/updateBatch`
  return axios({
    url: url,
    data: params,
    method: 'post'
  })
}
// 新增再次编辑
export const expenseAccountAgainEdit = (params) => {
  const url = `/expenseAccount/againEdit/${params.expenseAccountSn} `
  return axios({
    url: url,
    data: params,
    method: 'post'
  })
}
// 报销单详情
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'
  })
}
// 删除
export const expenseAccountDelete = (params) => {
  return axios({
    url: `/expenseAccount/deleteBySn/${params.expenseAccountSn}`,
    data: params,
    method: 'post'
  })
}
// 提交
export const expenseAccountSubmit = (params) => {
  return axios({
    url: `/expenseAccount/submit`,
    data: params,
    method: 'post'
  })
}

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

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

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

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

// 保存费用明细
export const expenseAcctDetailSave = (params) => {
  return axios({
    url: `/expenseAcctDetail/saveDetail`,
    data: params,
    method: 'post'
  })
}
// 费用类型
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',
  })
}
// 确认导入明细
export const expenseInsertImport = (params) => {
  return axios({
    url: '/expenseAcctDetail/insertImport',
    data: params,
    method: 'post',
  })
}
// 报销明细错误导出
export const expenseFailExcel = (params) => {
  return axios({
    url: '/expenseAcctDetail/exportImportDetailError',
    data: params,
    method: 'post',
    responseType: 'blob'
  })
}

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

// 费用报销明细单列表
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'
  })
}
// 费用报销明细统计
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'
  })
}

// 费用报销单审批进度
export const getProcessInstance = (params) => {
  return axios({
    url: `/dingTalk/getProcessInstance/${params.businessType}/${params.businessSn}`,
    data: params,
    method: 'post'
  })
}
// 审核进度历史查看
export const getProcessInstanceList = (params) => {
  return axios({
    url: `/dingTalk/getProcessInstanceList/${params.businessType}/${params.businessSn}`,
    method: 'get'
  })
}
// 钉钉部门
export const getDingTalkDepartmentList = (params) => {
  return axios({
    url: `/dingTalk/getDingTalkDepartmentList/${params.deptId}`,
    data: params,
    method: 'post'
  })
}
// 钉钉人员
export const queryDingTalkDeptUser = (params) => {
  return axios({
    url: `/dingTalk/queryDingTalkDeptUser/${params.deptId}/${params.pageNo}/${params.pageSize}`,
    data: params,
    method: 'post'
  })
}

 // 同步钉钉部门人员
 export const refashDingTalkAllDeptUser = (params) => {
   return axios({
     url: `/dingTalk/syncAllDeptUser `,
     data: params,
     method: 'post'
   })
 }
 
// 获取所以部门人员
 export const getDingTalkAllDeptUser = (params) => {
   return axios({
     url: `/dingTalk/getAllDeptUser`,
     data: params,
     method: 'post'
   })
 }