index.js 1.17 KB
Newer Older
陈浩玮's avatar
yonghu  
陈浩玮 committed
1
import { request, METHOD, formatObj } from '@/utils';
陈浩玮's avatar
陈浩玮 committed
2
import Lang from '@/utils/langUtils';
3
export * from './menu';
水落(YangLei)'s avatar
水落(YangLei) committed
4
export * from './system';
水落(YangLei)'s avatar
水落(YangLei) committed
5
export * from './task';
陈浩玮's avatar
地点  
陈浩玮 committed
6
export * from './ranger';
水落(YangLei)'s avatar
水落(YangLei) committed
7 8 9 10

export function getUserDetailInfoApi() {
    return request('/api/v1/detail', METHOD.GET);
}
11
export const getStaticParam = async (staticKey) => {
陈浩玮's avatar
yonghu  
陈浩玮 committed
12 13 14
    const res = await request('/api/v1/parameters/business/multi/list', METHOD.GET, {
        queryList: staticKey,
    });
15
    const curData = res.find((i) => i.key === staticKey);
陈浩玮's avatar
yonghu  
陈浩玮 committed
16 17 18 19 20 21 22
    const newData = await formatObj(curData.businessParameterList || [], {
        value: 'paramValue',
        label: 'paramName',
        key: 'paramId',
    });
    return newData;
};
陈浩玮's avatar
陈浩玮 committed
23

24
export const getStaticDataApi = async (data) => {
陈浩玮's avatar
陈浩玮 committed
25 26 27 28 29 30 31 32 33 34 35
    const res = await request('/api/v1/parameters/business/list', METHOD.GET, {
        ...data,
        paramLocale: Lang.get(),
    });
    const newData = await formatObj(res || [], {
        value: 'paramValue',
        label: 'paramName',
        key: 'paramId',
    });
    return newData;
};
36 37

export function getStaticDataByTwoParamsApi(paramModule, paramCode) {
水落(YangLei)'s avatar
水落(YangLei) committed
38
    return () => getStaticDataApi({ paramModule, paramCode });
39
}