Browse Source

fix(SmartApiSelectDIct组件): SmartApiSelectDIct组件功能优化

shizhongming 2 years ago
parent
commit
500ba87755

+ 1 - 0
src/components/Form/src/helper.ts

@@ -94,6 +94,7 @@ export const NO_AUTO_LINK_COMPONENTS: ComponentType[] = [
   'RadioButtonGroup',
   'ImageUpload',
   'ApiSelect',
+  'SmartApiSelectDict',
 ];
 
 export const simpleComponents = ['Divider', 'BasicTitle'];

+ 6 - 1
src/components/Form/src/smart-boot/components/SmartApiSelectDict.vue

@@ -6,16 +6,21 @@
   import ApiSelect from '../../components/ApiSelect.vue';
   import { propTypes } from '@/utils/propTypes';
   import { ApiServiceEnum, defHttp } from '@/utils/http/axios';
+  import { type PropType } from 'vue';
+  import type { SelectValue } from 'ant-design-vue/es/select';
 
   const props = defineProps({
     dictCode: propTypes.string.isRequired,
+    value: { type: [Array, Object, String, Number] as PropType<SelectValue> },
   });
 
   const api = () => {
     return defHttp.post({
       service: ApiServiceEnum.SMART_SYSTEM,
       url: 'sys/dict/listItemByCode',
-      data: props.dictCode,
+      data: {
+        value: props.dictCode,
+      },
     });
   };
 </script>

+ 3 - 1
src/modules/system/hooks/SysDictHooks.ts

@@ -37,7 +37,9 @@ export const useLoadDictItem = (dictCodeRef: Ref<string> | string, immediate = t
         dictData.value = await defHttp.post({
           service: ApiServiceEnum.SMART_SYSTEM,
           url: 'sys/dict/listItemByCode',
-          data: dictCode,
+          data: {
+            value: dictCode,
+          },
         });
       } catch (e) {
         errorMessage(e);