Ben Lin
2024-06-21 0990f596791ebc4518e293a2d60407ff1165b53c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
/*
 * @Description: 菜单Api相关
 * @Author: Ben Lin
 * @version: 
 * @Date: 2024-06-18 15:09:47
 * @LastEditors: Ben Lin
 * @LastEditTime: 2024-06-21 16:50:45
 */
import { defHttp } from '/@/utils/http/axios';
import { getMenuListResultModel } from './model/menuModel';
import { genAction, Api } from '../tigerapi/system';
 
enum _Api {
  GetMenuList = '/SYS/getMenuList',
  GetMenuListAll = '/SYS/getMenuListAll',
}
 
/**
 * @description: Get user menu based on userid
 */
 
export const getMenuList = (userid: {}) => {
  return defHttp.get<getMenuListResultModel>(
    { url: _Api.GetMenuList, params: userid },
    {
      isTransformResponse: false, //api返回不做转换格式,保留原来数据
    },
  );
};
 
export const getMenuListAll = () => {
  return defHttp.get<getMenuListResultModel>(
    { url: _Api.GetMenuListAll },
    {
      isTransformResponse: false, //api返回不做转换格式,保留原来数据
    },
  );
};
 
/**
 * @description: 菜单权限
 * @param {string} params
 * @return {*}
 */
export const getMenuAuthList = async (params: string) => {
  const usParams = genAction('V_USER_MENU', {
    QueryAble_T: '',
    where: "USER_ID = '" + params + "'",
    order: '',
  });
  return await defHttp.post(
    { url: Api.QueryUrl, params: usParams },
    {
      errorMessageMode: 'none',
      isTransformResponse: false,
    },
  );
};
 
/**
 * @description: 获取菜单下的按钮
 * @param {string} params
 * @return {*}
 */
export const getMenuButtons = async (params: string) =>{
  const usParams = genAction('SYS_MENU', {
    QueryAble_T: '',
    where: "PFUNC_CODE = '" + params + "'",
    order: '',
  });
  return await defHttp.post(
    { url: Api.QueryUrl, params: usParams },
    {
      errorMessageMode: 'none',
      isTransformResponse: false,
    },
  );
};