123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051 |
- import { getCommon, getByDictType } from '../api/main';
- import { IOptions } from '../types/global';
- export function outTypeList(type: string) {
- const typeList: Array<IOptions> = [];
- 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<IOptions> = [];
- 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<IOptions> = [];
- const globalList: Array<IOptions> = [];
- 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,
- };
- }
|