123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051 |
- import { mergeRecursive } from '@/utils/zk'
- import dictConverter from './DictConverter'
- export const options = {
- metas: {
- '*': {
-
- request: (dictMeta) => {
- console.log(`load dict ${dictMeta.type}`)
- return Promise.resolve([])
- },
-
- responseConverter,
- labelField: 'label',
- valueField: 'value',
- },
- },
-
- DEFAULT_LABEL_FIELDS: ['label', 'name', 'title'],
-
- DEFAULT_VALUE_FIELDS: ['value', 'id', 'uid', 'key'],
- }
- function responseConverter(response, dictMeta) {
- const dicts = response.resysDictionary.sysDictionaryDetails instanceof Array ? response.resysDictionary.sysDictionaryDetails : response
- if (dicts === undefined) {
- console.warn(`no dict data of "${dictMeta.type}" found in the response`)
- return []
- }
- return dicts.map(d => dictConverter(d, dictMeta))
- }
- export function mergeOptions(src) {
- mergeRecursive(options, src)
- }
- export default options
|