import request from '@/utils/require'

import { biUrl, User, loginUrl, baseServer, menus, auth } from '@/api/index'


export function irptLogin(name, pwd) {
  return request({
    url: `${biUrl}/irpt/oemlogin.do?id=${name}&pwd={${pwd}}&forcelogin=true`,
    method: 'post',
    dataType: 'jsonp',
    jsonp: 'function_name_index',
    jsonpCallback: 'function_name'
  });
}

/* 用户信息*/
export function userInfo() {
  return request({
    url: `http://192.168.80.230:11031/login/userinfo`,
    method: 'post',
    data: ''
  })
}
// 登出
export function logout(token) {
  return request({
    url: `${User}/user/logout`,
    method: 'post',
    params: { token }
  })
}

// 获取综合业务菜单林艳飞
export function getAllmenus(codes) {
  return request({
    url: `${loginUrl}/roleResources/findRoleResourcesTree?resourcesCode=RM1001007&roleCode=${codes}`,
    // url: `${User}/roleResources/findRoleResourcesTree?roleCode=${codes}`,
    method: 'post'
  })
}
// log
export function menuChange(data) {
  return request({
    url: `${menus}/systemLog/producer`,
    method: 'post',
    data: data
  })
}

// 获取企业信息代码
export function getTyxydm(qyjgdm) {
  return request({
    url: `${baseServer}/organization/${qyjgdm}`,
    method: 'get'
  })
}

//导航菜单
export function getInfo() {
  return request({
    url: `${User}/user/getCurrUserinfo`,
    method: 'get'
  })
}


export function authorityControl(data) {
  return request({
    url: `${auth}/menuPrivilege/buttonMenuList?resourceCode=${data.resourceCode}&userId=${data.userId}`,
    method: 'post',
    data: data
  });
}