/**
 权限自助管理接口
 @author linqian
 @Date：2021-07-12
 */
import request from '@/utils/request';

const baseUrl = `/authsvr/v2/selfauth`;

// 权限自助申请
export function savePermissionApply(data) {
  return request({
    url: `${baseUrl}/funApplySave`,
    method: 'POST',
    data
  });
}

// 更新申请
export function updateApply(data) {
  return request({
    url: `${baseUrl}/funApplyUpdate`,
    method: 'POST',
    data
  });
}

// 权限自助列表ul
export const tableUrl = `${baseUrl}/authApplySearch`;

// 获取全量应用功能菜单树
export function allAppFuncTree(exclude) {
  return request({
    url: `/authsvr/v2/appfuninfo/allMenuTree`,
    method: 'GET',
    params: {
      exclude// 去除角色授权的菜单
    }
  });
}

// 获取申请单详情
export function applyDetail(params) {
  return request({
    url: `${baseUrl}/funApplyDetail`,
    method: 'GET',
    params
  });
}

// 删除申请单
export function delApply(params) {
  return request({
    url: `${baseUrl}/authApplyDelete`,
    method: 'DELETE',
    params
  });
}

// 申请撤回
export function recallApply(params) {
  return request({
    url: `${baseUrl}/authApplyCancel`,
    method: 'GET',
    params
  });
}

// 获取申请人已被授权得功能id
export function userHasAuthFunIds(params) {
  return request({
    url: `${baseUrl}/userHasAuthFunIds`,
    method: 'GET',
    params
  });
}

// 获取流程图配置
export function processConfig(applyOrdNo) {
  return request({
    url: `${baseUrl}/processPicView`,
    method: 'GET',
    params: {
      applyOrdNo
    }
  });
}

// 获取流程详情
export function getFlowChartDetail(data) {
  return request({
    url: `${baseUrl}/processNodeView`,
    method: 'GET',
    params: data
  });
}

// 获取流程状态
export function getFlowChartStatus(applyOrdNo) {
  return request({
    url: `${baseUrl}/processStatusView`,
    method: 'GET',
    params: {
      applyOrdNo
    }
  });
}

// 审批意见
export function getComments(applyOrdNo) {
  return request({
    url: `${baseUrl}/approvalSuggestion`,
    method: 'GET',
    params: {
      applyOrdNo
    }
  });
}

// 查询流程定义
export function getFlowDefine(applyType) {
  return request({
    url: `${baseUrl}/flowDefineInfo`,
    method: 'GET',
    params: {
      applyType
    }
  });
}
// 判断应用功能菜单是否重复申请
export function checkAppFunRepeat(params) {
  return request({
     url: `${baseUrl}/funApplyRepeatCheck`,
     method: "GET",
     params
  })
}

// 判断是否存在红白名单内容
export function rediListCheck(data) {
  return request({
     url: `${baseUrl}/redListCheck `,
     method: "POST",
     data
  })
}