字典管理
1. 获取字典列表(getDictionaryListByCode)
typescript
//! 注意,TS版本4^
import type { GetDictionaryListByCodeReq, GetDictionaryListByCodeRes } from '@homing/web'
try {
const data: GetDictionaryListByCodeRes[] = await client.getDictionaryListByCode({
dictionaryCodes: 'DICT_CODE1,DICT_CODE2',
state: 1
} as GetDictionaryListByCodeReq);
console.log('调用成功', data);
} catch (error: any) {
console.log(error, '调用失败' + error?.message);
}
参数说明
参数名 | 类型 | 必填 | 说明 | 备注/枚举值 |
---|---|---|---|---|
dictionaryCodes | string | 是 | 字典标识返回当前租户字典(如未配置则返回平台) | 多个编号以英文逗号间隔 |
state | number | 否 | 状态 | 0-禁用,1-启用 |
响应说明
字段名 | 类型 | 说明 |
---|---|---|
dictionaryId | number | 字典ID |
dictionaryCode | string | 字典类型编号 |
dictionaryType | string | 类型 |
dictionaryName | string | 名称 |
description | string | 描述 |
sortValue | number | 排序 |
readonly | number | 内置 |
category | string | 分类 |
scope | string | 配置权限 |
state | number | 状态 |
tenantCode | string | 租户编码 |
createdBy | string | 创建人 |
createdTime | string | 创建时间 |
updatedBy | string | 更新人 |
updatedTime | string | 更新时间 |
items | Array | 字典项列表 |
字典项字段(items 数组中的每个对象)
字段名 | 类型 | 说明 |
---|---|---|
dictionaryItemId | number | 字典项ID |
dictionaryItemCode | string | 键 |
dictionaryItemName | string | 值 |
icon | string | 图标 |
cssStyle | string | css样式/回显样式 |
cssClass | string | css类型 |
description | string | 描述 |
sortValue | string | 排序 |
readonly | number | 是否内置 |
state | number | 状态 |
tenantCode | string | 租户编码 |
createdBy | string | 创建人 |
createdTime | number | 创建时间 |
updatedBy | string | 更新人 |
updatedTime | number | 更新时间 |