Forráskód Böngészése

perf(系统监控-在线用户): 在线用户支持租户查询条件

shizhongming 2 éve
szülő
commit
2244f4f218

+ 1 - 1
src/modules/smart-system/views/log/SystemLogComponent.config.ts

@@ -241,7 +241,7 @@ export const getSearchFormSchemas = (
       },
     },
     {
-      label: t('system.views.exception.title.tenant'),
+      label: t('system.views.log.title.tenant'),
       field: 'tenantId',
       slot: 'search-tenantId',
       searchSymbol: '=',

+ 13 - 1
src/modules/smart-system/views/onlineUser/OnlineUserListView.config.ts

@@ -4,6 +4,7 @@ import {
   tableBooleanColumnClass,
 } from '@/components/SmartTable';
 import { formatDuration } from '@/utils/dateUtil';
+import { Ref, unref } from 'vue';
 
 export const getTableColumns = (): SmartColumn[] => {
   return [
@@ -114,12 +115,23 @@ export const getTableExpandColumns = (): SmartColumn[] => {
   ];
 };
 
-export const getSearchFormSchemas = (t: Function): SmartSearchFormSchema[] => {
+export const getSearchFormSchemas = (
+  t: Function,
+  getIsPlatformTenant: Ref<boolean>,
+): SmartSearchFormSchema[] => {
   return [
     {
       label: t('system.views.user.table.username'),
       field: 'username',
       component: 'Input',
     },
+    {
+      label: t('system.views.onlineUser.title.tenant'),
+      field: 'tenantId',
+      slot: 'search-tenantId',
+      ifShow() {
+        return unref(getIsPlatformTenant);
+      },
+    },
   ];
 };

+ 13 - 4
src/modules/smart-system/views/onlineUser/OnlineUserListView.vue

@@ -16,6 +16,9 @@
       <template #table-operation="{ row }">
         <SmartVxeTableAction :actions="getTableActions(row, false)" />
       </template>
+      <template #search-tenantId="{ model, field }">
+        <SysTenantSelect style="width: 100px" allowClear v-model:value="model[field]" />
+      </template>
     </SmartTable>
   </div>
 </template>
@@ -36,9 +39,13 @@
     getSearchFormSchemas,
   } from './OnlineUserListView.config';
   import { listOnlineUserApi, offlineApi } from './OnlineUserListView.api';
+  import { storeToRefs } from 'pinia';
+  import { useUserStore } from '@/store/modules/user';
+  import { SysTenantSelect } from '@/modules/smart-system/components';
 
   const { t } = useI18n();
   const { getTableSize } = useSizeSetting();
+  const { getIsPlatformTenant } = storeToRefs(useUserStore());
 
   const getTableActions = (row, isExpand: boolean): ActionItem[] => {
     return [
@@ -66,20 +73,22 @@
       onOk: async () => {
         await offlineApi(username, token);
         message.success(t('system.views.onlineUser.message.offlineSuccess'));
-        reload();
+        query();
       },
     });
   };
 
-  const [registerTable, { reload }] = useSmartTable({
+  const [registerTable, { query }] = useSmartTable({
     border: true,
     height: 'auto',
-    highlightHoverRow: true,
     columns: getTableColumns(),
     useSearchForm: true,
+    rowConfig: {
+      isHover: true,
+    },
     searchFormConfig: {
       layout: 'inline',
-      schemas: getSearchFormSchemas(t),
+      schemas: getSearchFormSchemas(t, getIsPlatformTenant),
       colon: true,
       actionColOptions: {
         span: undefined,

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

@@ -11,6 +11,7 @@ export default {
           timeout: '有效时长',
           tenantCode: '租户编码',
           tenantName: '租户名字',
+          tenant: '租户',
         },
         button: {
           offline: '下线',