import request from '@/utils/request'

// 查询资源、工单申请列表
export function listCsResourceOrderApply(query) {
  return request({
    url: '/cs/csResourceOrderApply/list',
    method: 'get',
    params: query
  })
}

// 查询资源申请详细
export function getResourceApplyDetail(applyId) {
  return request({
    url: '/cs/csResourceOrderApply/getResourceApplyDetail/' + applyId,
    method: 'get',

  })
}

// 查询工单申请详细
export function getOrderDetail(applyId) {
  return request({
    url: '/cs/csResourceOrderApply/getOrderDetail/' + applyId,
    method: 'get'
  })
}

// 新增资源、工单申请
export function addCsResourceOrderApply(data) {
  return request({
    url: '/cs/csResourceOrderApply',
    method: 'post',
    data: data
  })
}

// 修改资源申请
export function updateCsResourceOrderApply(data) {
  return request({
    url: '/cs/csResourceOrderApply/editResourceApply',
    method: 'put',
    data: data
  })
}

// 修改工单申请
export function editOrderApply(data) {
  return request({
    url: '/cs/csResourceOrderApply/editOrderApply',
    method: 'post',
    data: data
  })
}

// 删除资源、工单申请
export function delCsResourceOrderApply(applyId) {
  return request({
    url: '/cs/csResourceOrderApply/' + applyId,
    method: 'delete'
  })
}

//获取字典数据
export function getClassListByMark(query) {
  return request({
    url: '/cs/CsClass/getClassListByMark',
    method: 'get',
    params: query
  })
}

//审核资源工单
export function checkResourceApply(data) {
  return request({
    url: '/cs/csResourceOrderApply/checkResourceApply',
    method: 'put',
    data: data
  })
}

//审核工单
export function handleOrderApply(data) {
  return request({
    url: '/cs/csResourceOrderApply/handleOrderApply',
    method: 'post',
    data: data
  })
}

//获取角色数据
export function getUserSelectListByRoleId(query) {
  return request({
    url: '/system/user/getUserSelectListByRoleId',
    method: 'get',
    params: query
  })
}

//获取角色数据
export function getOrdinaryUserSelectListByRoleId(query) {
  return request({
    url: '/system/user/getOrdinaryUserSelectListByRoleId',
    method: 'get',
    params: query
  })
}

//获取工单流程、 审核信息列表
export function getFlowList(query) {
  return request({
    url: '/cs/csApprovalConfig/getFlowList',
    method: 'get',
    params: query
  })
}

//分配审核流程
export function addConfigs(data) {
  return request({
    url: '/cs/csApprovalConfig/addConfigs',
    method: 'post',
    data: data
  })
}
//撤回审核(审核流程)
export function withdrawDelegation(data) {
  return request({
    url: '/cs/csApprovalConfig/withdrawDelegation',
    method: 'post',
    data: data
  })
}

//提交审核(审核流程)
export function checkConfigs(data) {
  return request({
    url: '/cs/csApprovalConfig/checkConfigs',
    method: 'post',
    data: data
  })
}

//更改受理人员(审核流程)
export function leaderUpdateAccept(data) {
  return request({
    url: '/cs/csApprovalConfig/leaderUpdateAccept',
    method: 'post',
    data: data
  })
}
//转交部门人员(审核流程)
export function leaderTransferOther(data) {
  return request({
    url: '/cs/csApprovalConfig/transferOther',
    method: 'post',
    data: data
  })
}

//撤回转交(审核流程)
export function withdrawTransfer(data) {
  return request({
    url: '/cs/csApprovalConfig/withdrawTransfer',
    method: 'post',
    data: data
  })
}

//拒绝转交(审核流程)
export function refuseTransfer(data) {
  return request({
    url: '/cs/csApprovalConfig/refuseTransfer',
    method: 'post',
    data: data
  })
}

//审批节点撤回(审核流程)
export function approvalRollback(data) {
  return request({
    url: '/cs/csApprovalConfig/approvalRollback',
    method: 'post',
    data: data
  })
}

//关闭审核流程及工单
export function closeApply(data) {
  return request({
    url: '/cs/csApprovalConfig/closeApply',
    method: 'post',
    data: data
  })
}
//通用字典网络模板文件
export function getCSDictParamList(query) {
  return request({
    url: '/cs/csResourceDictData/getCSDictParamList',
    method: 'get',
    params: query
  })
}

//管理端最后一条审批意见(反馈结果)
export function selectEndCsApprovalRecordByFormId(query) {
  return request({
    url: '/cs/csApprovalRecord/selectEndCsApprovalRecordByFormId',
    method: 'get',
    params: query
  })
}

//获取发起者信息
export function getLaunchInfoApi(query) {
  return request({
    url: '/system/user/getLaunchInfo',
    method: 'get',
    params: query
  })
}

//工作台统计数据
export function getStatistics(query) {
  return request({
    url: '/cs/csStatistics/getStatistics/?beginAt='+query.beginAt+'&endAt='+query.endAt,
    method: 'get',
  })
}

//获取信息
export function getInfoByFormValue(query) {
  return request({
    url: '/cs/csResourceOrderApply/getInfoByFormValue',
    method: 'get',
    params: query
  })
}
