56 lines
1.2 KiB
TypeScript
56 lines
1.2 KiB
TypeScript
import request from '@/utils/request';
|
|
|
|
// 定义接口返回数据类型
|
|
export type DictResponse = {
|
|
code: number;
|
|
data: DictItem[];
|
|
message: string;
|
|
success: boolean;
|
|
[property: string]: any;
|
|
}
|
|
|
|
export type DictItem = {
|
|
basePageRequest: null;
|
|
code: string;
|
|
createBy: null;
|
|
createDate: null;
|
|
defaultFlag: null;
|
|
deleteFlag: null;
|
|
description: string;
|
|
dicName: string;
|
|
dictTypeCode: null | string;
|
|
dictTypeName: null | string;
|
|
id: string;
|
|
lastUpdateTime: null;
|
|
orderFlag: string;
|
|
parentCode: string;
|
|
parentType: string;
|
|
tenantId: null;
|
|
tenantName: null;
|
|
updateBy: null;
|
|
updateDate: null;
|
|
useFlag: string;
|
|
[property: string]: any;
|
|
}
|
|
|
|
/**
|
|
* 获取字典列表
|
|
* @param code 字典编码
|
|
* @returns 字典列表
|
|
*/
|
|
export async function getDictList(code: string): Promise<DictResponse> {
|
|
const data: string | null = sessionStorage.getItem('dict');
|
|
if (data) {
|
|
const dictData = JSON.parse(data);
|
|
const codeType = `${code}=supplier_manage_type`;
|
|
return Promise.resolve({
|
|
code: 200,
|
|
data: dictData[codeType],
|
|
message: 'success',
|
|
success: true,
|
|
})
|
|
}else{
|
|
return Promise.reject(new Error('请先请求字典数据'));
|
|
}
|
|
}
|