Commit b38bb164874e5eb8ac157c11bb9b41e090315b71

Authored by fengtao
2 parents faa28e45 765b5b97

Merge branch 'main_dev' into fix/teambition/10-16/2024

@@ -14,6 +14,7 @@ import { useI18n } from '/@/hooks/web/useI18n'; @@ -14,6 +14,7 @@ import { useI18n } from '/@/hooks/web/useI18n';
14 enum SysDictApi { 14 enum SysDictApi {
15 CONFIG_URL = '/dict', 15 CONFIG_URL = '/dict',
16 CONFIG_ITEM_URL = '/dict_item', 16 CONFIG_ITEM_URL = '/dict_item',
  17 + CONFIG_LIST_DICT = '/dict/all',
17 } 18 }
18 19
19 /** 20 /**
@@ -45,6 +46,17 @@ export const sysDictPage = (params: SysDictParams) => @@ -45,6 +46,17 @@ export const sysDictPage = (params: SysDictParams) =>
45 }); 46 });
46 47
47 /** 48 /**
  49 + * 获取字典list 用于查询
  50 + */
  51 +
  52 +export const getDictList = (_params?: string) => {
  53 + return defHttp.get<{ code: number; data: SysDict[]; message: string }>({
  54 + url: SysDictApi.CONFIG_LIST_DICT,
  55 + // params,
  56 + });
  57 +};
  58 +
  59 +/**
48 * 获取SysDictItem列表 60 * 获取SysDictItem列表
49 * @param params 查询参数 61 * @param params 查询参数
50 */ 62 */
  1 +import { getDictList } from '/@/api/system/dict';
1 import { BasicColumn } from '/@/components/Table'; 2 import { BasicColumn } from '/@/components/Table';
2 import { FormSchema } from '/@/components/Table'; 3 import { FormSchema } from '/@/components/Table';
3 import { useI18n } from '/@/hooks/web/useI18n'; 4 import { useI18n } from '/@/hooks/web/useI18n';
@@ -36,26 +37,46 @@ export const columns: BasicColumn[] = [ @@ -36,26 +37,46 @@ export const columns: BasicColumn[] = [
36 ]; 37 ];
37 38
38 export const searchFormSchema: FormSchema[] = [ 39 export const searchFormSchema: FormSchema[] = [
  40 + // {
  41 + // field: 'dictName',
  42 + // label: t('system.dict.dictName'),
  43 + // component: 'Input',
  44 + // colProps: { span: 6 },
  45 + // componentProps: {
  46 + // maxLength: 32,
  47 + // },
  48 + // dynamicRules: () => {
  49 + // return [
  50 + // {
  51 + // required: false,
  52 + // validator: (_, value) => {
  53 + // if (String(value).length > 32) {
  54 + // return Promise.reject(t('system.dict.textRule32'));
  55 + // }
  56 + // return Promise.resolve();
  57 + // },
  58 + // },
  59 + // ];
  60 + // },
  61 + // },
39 { 62 {
40 field: 'dictName', 63 field: 'dictName',
41 label: t('system.dict.dictName'), 64 label: t('system.dict.dictName'),
42 - component: 'Input', 65 + component: 'ApiSelect',
43 colProps: { span: 6 }, 66 colProps: { span: 6 },
44 componentProps: { 67 componentProps: {
45 - maxLength: 32,  
46 - },  
47 - dynamicRules: () => {  
48 - return [  
49 - {  
50 - required: false,  
51 - validator: (_, value) => {  
52 - if (String(value).length > 32) {  
53 - return Promise.reject(t('system.dict.textRule32'));  
54 - }  
55 - return Promise.resolve();  
56 - },  
57 - },  
58 - ]; 68 + api: async () => {
  69 + const { data: values } = await getDictList();
  70 + return (values || []).map((item) => ({
  71 + label: t(item.dictName) ? t(item.dictName) : item.dictName,
  72 + value: item.dictName,
  73 + }));
  74 + },
  75 +
  76 + showSearch: true,
  77 + filterOption: (inputValue: string, options: Record<'label', string>) => {
  78 + return options.label.includes(inputValue);
  79 + },
59 }, 80 },
60 }, 81 },
61 { 82 {