Bläddra i källkod

perf(系统模块-租户管理): 租户管理功能完善

shizhongming 2 år sedan
förälder
incheckning
e65997d58e

+ 27 - 5
src/components/SmartTable/src/utils/TableCommon.tsx

@@ -111,22 +111,22 @@ const tableUseYn = (t: Function) => {
   };
 };
 
-const tableUseYnClass = (): SmartColumn => {
+const tableUseYnClass = (field = 'useYn'): SmartColumn => {
   const { t } = useI18n();
 
   return {
     title: '{common.table.useYn}',
-    field: 'useYn',
+    field,
     width: 100,
     formatter: ({ row }) => {
-      const useYn = row.useYn as boolean | null;
+      const useYn = row[field] as boolean | null;
       if (useYn === null) {
         return '';
       }
       return useYn ? t('common.form.use') : t('common.form.noUse');
     },
     dynamicClass: ({ row }) => {
-      const useYn = row.useYn as boolean | null;
+      const useYn = row[field] as boolean | null;
       if (useYn === null) {
         return '';
       }
@@ -135,4 +135,26 @@ const tableUseYnClass = (): SmartColumn => {
   };
 };
 
-export { tableUseYn, tableDeleteYn, tableUseYnClass };
+const tableBooleanClass = (field: string): SmartColumn => {
+  const { t } = useI18n();
+  return {
+    width: 100,
+    field,
+    formatter({ row }) {
+      const value = row[field] as boolean | null;
+      if (value === null) {
+        return '';
+      }
+      return value ? t('common.form.yes') : t('common.form.no');
+    },
+    dynamicClass: ({ row }) => {
+      const value = row[field] as boolean | null;
+      if (value === null) {
+        return '';
+      }
+      return value ? 'text-color--success-bold' : 'text-color--danger-bold';
+    },
+  };
+};
+
+export { tableUseYn, tableDeleteYn, tableUseYnClass, tableBooleanClass };

+ 5 - 1
src/modules/smart-system/views/tenant/tenantManager/SysTenantListView.config.ts

@@ -1,6 +1,6 @@
 import type { SmartColumn, SmartSearchFormSchema } from '@/components/SmartTable';
 import type { FormSchema } from '@/components/Form';
-import { tableUseYnClass } from '@/components/SmartTable';
+import { tableUseYnClass, tableBooleanClass } from '@/components/SmartTable';
 import { Ref, unref } from 'vue';
 
 import { listNoBindPackageByTenantIdApi } from './SysTenantListView.api';
@@ -55,6 +55,10 @@ export const getTableColumns = (): SmartColumn[] => {
         default: 'table-type',
       },
     },
+    {
+      ...tableBooleanClass('platformYn'),
+      title: '{system.views.tenant.manager.title.platformYn}',
+    },
     {
       field: 'contacts',
       title: '{system.views.tenant.manager.title.contacts}',

+ 5 - 0
src/modules/smart-system/views/tenant/tenantManager/SysTenantListView.vue

@@ -90,6 +90,10 @@
     border: true,
     sortConfig: {
       remote: true,
+      defaultSort: {
+        field: 'seq',
+        order: 'asc',
+      },
     },
     customConfig: { storage: true },
     showOverflow: 'tooltip',
@@ -146,6 +150,7 @@
       column: {
         columnOrder: true,
       },
+      sizeSetting: true,
       buttons: [
         {
           code: 'ModalAdd',

+ 1 - 0
src/modules/smart-system/views/tenant/tenantManager/lang/zh_CN.ts

@@ -25,6 +25,7 @@ export default {
       setPackage: '设置套餐',
       tabUser: '绑定用户',
       tabSubscribe: '订阅套餐',
+      platformYn: '平台管理',
       user: {
         username: '用户名',
         fullName: '姓名',