Sfoglia il codice sorgente

feat(系统模块-数据字典): 数据字典功能完善

shizhongming 2 anni fa
parent
commit
4586559355

+ 1 - 0
src/modules/smart-app/i18n/lang/zh_CN.ts

@@ -25,6 +25,7 @@ export default {
       add: '添加',
       edit: '修改',
       useYn: '启用状态',
+      tenantCommonYn: '平台通用',
     },
     form: {
       use: '启用',

+ 7 - 3
src/modules/smart-system/views/dataDict/DataDictGroup.vue

@@ -17,13 +17,17 @@
     listDictApi,
     getByIdDictApi,
     deleteDictApi,
-    batchSaveUpdateDictApi,
+    saveUpdateDictApi,
   } from './DataDictListView.api';
+  import { storeToRefs } from 'pinia';
+  import { useUserStore } from '@/store/modules/user';
 
   const emit = defineEmits(['code-change']);
 
   const { t } = useI18n();
 
+  const { getIsPlatformTenant } = storeToRefs(useUserStore());
+
   const handleCurrentChange = ({ row }: any) => {
     emit('code-change', row.id);
   };
@@ -57,7 +61,7 @@
     },
     addEditConfig: {
       formConfig: {
-        schemas: getDataDictGroupAddEditSchemas(t),
+        schemas: getDataDictGroupAddEditSchemas(t, getIsPlatformTenant),
         baseColProps: {
           span: 24,
         },
@@ -79,7 +83,7 @@
           return listDictApi(parameter);
         },
         save: ({ body: { insertRecords, updateRecords } }) =>
-          batchSaveUpdateDictApi([...insertRecords, ...updateRecords]),
+          saveUpdateDictApi([...insertRecords, ...updateRecords][0]),
         delete: ({ body: { removeRecords } }) => deleteDictApi(removeRecords),
         getById: (params) => getByIdDictApi(params.id),
       },

+ 3 - 3
src/modules/smart-system/views/dataDict/DataDictListView.api.ts

@@ -3,7 +3,7 @@ import { ApiServiceEnum, defHttp } from '@/utils/http/axios';
 enum Api {
   listDict = 'sys/dict/listFilterTenant',
   getByIdDict = 'sys/dict/getById',
-  batchSaveUpdateDict = 'sys/dict/batchSaveUpdate',
+  saveUpdate = 'sys/dict/saveUpdate',
   deleteDict = 'sys/dict/batchDeleteById',
 
   listItem = 'sys/dictItem/list',
@@ -30,10 +30,10 @@ export const getByIdDictApi = (id) => {
   });
 };
 
-export const batchSaveUpdateDictApi = (parameter: any[]) => {
+export const saveUpdateDictApi = (parameter: Recordable) => {
   return defHttp.post({
     service: ApiServiceEnum.SMART_SYSTEM,
-    url: Api.batchSaveUpdateDict,
+    url: Api.saveUpdate,
     data: parameter,
   });
 };

+ 15 - 2
src/modules/smart-system/views/dataDict/DataDictListView.config.ts

@@ -1,6 +1,7 @@
 import type { SmartColumn, SmartSearchFormSchema } from '@/components/SmartTable';
 import { tableUseYnClass } from '@/components/SmartTable';
 import { FormSchema } from '@/components/Form';
+import { ComputedRef, unref } from 'vue';
 
 export const getDataDictGroupColumns = (): SmartColumn[] => {
   return [
@@ -110,7 +111,10 @@ export const getDataDictGroupSearchSchemas = (t: Function): SmartSearchFormSchem
   ];
 };
 
-export const getDataDictGroupAddEditSchemas = (t: Function): FormSchema[] => {
+export const getDataDictGroupAddEditSchemas = (
+  t: Function,
+  getIsPlatformTenant: ComputedRef<boolean>,
+): FormSchema[] => {
   return [
     {
       label: '',
@@ -146,7 +150,16 @@ export const getDataDictGroupAddEditSchemas = (t: Function): FormSchema[] => {
     {
       label: t('common.table.remark'),
       field: 'remark',
-      component: 'Input',
+      component: 'InputTextArea',
+    },
+    {
+      label: t('common.title.tenantCommonYn'),
+      field: 'tenantCommonYn',
+      component: 'Switch',
+      defaultValue: false,
+      ifShow() {
+        return unref(getIsPlatformTenant);
+      },
     },
   ];
 };