import { getCommon, getByDictType } from '../api/main'; import { IOptions } from '../types/global'; export function outTypeList(type: string) { const typeList: Array = []; getCommon(type).then(res => { res.data.forEach((item: any) => { typeList.push({ label: item.dictLabel, value: item.dictValue, }); }); }); return typeList; } export function outDictTypeList(type: string) { const typeList: Array = []; getByDictType(type).then(res => { res.data.forEach((item: any) => { typeList.push({ label: item.dictLabel, value: item.dictValue, }); }); }); return typeList; } export function computedTypeList(type: string) { const dictList: Array = []; const globalList: Array = []; getByDictType(type).then(res => { res.data.dictList.forEach((item: any) => { dictList.push({ label: item.dictLabel, value: item.dictValue, }); }); res.data.globalList.forEach((item: any) => { globalList.push({ label: item.name, value: item.key, }); }); }); return { dictList, globalList, }; }