Browse Source

perf(系统模块-异常管理): 异常管理添加租户支持

shizhongming 2 years ago
parent
commit
2ec41dd246
  1. 46
      src/modules/smart-system/components/SysTenant/SysTenantSelect.vue
  2. 1
      src/modules/smart-system/components/index.ts
  3. 23
      src/modules/smart-system/views/exception/SysExceptionListView.config.ts
  4. 9
      src/modules/smart-system/views/exception/SysExceptionListView.vue
  5. 1
      src/modules/smart-system/views/exception/lang/en_US.ts
  6. 1
      src/modules/smart-system/views/exception/lang/zh_CN.ts

46
src/modules/smart-system/components/SysTenant/SysTenantSelect.vue

@ -0,0 +1,46 @@
<template>
<a-select v-bind="$attrs" :options="computedOptions" />
</template>
<script setup lang="ts">
import { computed, ref, unref, watch } from 'vue';
import { storeToRefs } from 'pinia';
import { useUserStore } from '@/store/modules/user';
import { ApiServiceEnum, defHttp } from '@/utils/http/axios';
let dataLoaded = false;
const { getIsPlatformTenant } = storeToRefs(useUserStore());
const dataListRef = ref<Recordable[]>([]);
const computedOptions = computed(() => {
if (!unref(getIsPlatformTenant)) {
return [];
}
return unref(dataListRef).map((item) => {
return {
label: item.tenantShortName || item.tenantName,
value: item.id,
};
});
});
const loadTenantData = async () => {
dataListRef.value = await defHttp.post({
service: ApiServiceEnum.SMART_SYSTEM,
url: 'sys/tenant/manager/listTenantNoAuth',
});
dataLoaded = true;
};
watch(
getIsPlatformTenant,
(value) => {
if (value && !dataLoaded) {
loadTenantData();
}
},
{ immediate: true },
);
</script>
<style scoped lang="less"></style>

1
src/modules/smart-system/components/index.ts

@ -0,0 +1 @@
export { default as SysTenantSelect } from './SysTenant/SysTenantSelect.vue';

23
src/modules/smart-system/views/exception/SysExceptionListView.config.ts

@ -1,5 +1,6 @@
import type { SmartColumn, SmartSearchFormSchema } from '@/components/SmartTable';
import { tableBooleanColumnClass } from '@/components/SmartTable';
import { Ref, unref } from 'vue';
export const getTableColumns = (): SmartColumn[] => {
return [
@ -41,6 +42,14 @@ export const getTableColumns = (): SmartColumn[] => {
title: '{system.views.exception.title.operateUser}',
width: 120,
},
{
field: 'tenantId',
title: '{system.views.exception.title.tenant}',
width: 120,
formatter({ row }) {
return row.tenant?.tenantShortName || row.tenant?.tenantName;
},
},
{
field: 'createTime',
sortable: true,
@ -110,7 +119,10 @@ const getYesNoOptions = (t: Function) => {
];
};
export const getSearchFormSchemas = (t: Function): SmartSearchFormSchema[] => {
export const getSearchFormSchemas = (
t: Function,
getIsPlatformTenant: Ref<boolean>,
): SmartSearchFormSchema[] => {
return [
{
label: t('system.views.exception.title.exceptionMessage'),
@ -159,5 +171,14 @@ export const getSearchFormSchemas = (t: Function): SmartSearchFormSchema[] => {
style: { width: '150px' },
},
},
{
label: t('system.views.exception.title.tenant'),
field: 'tenantId',
slot: 'search-tenantId',
searchSymbol: '=',
ifShow() {
return unref(getIsPlatformTenant);
},
},
];
};

9
src/modules/smart-system/views/exception/SysExceptionListView.vue

@ -4,6 +4,9 @@
<template #table-operation="{ row }">
<SmartVxeTableAction :actions="getTableActions(row)" />
</template>
<template #search-tenantId="{ model, field }">
<SysTenantSelect style="width: 100px" allowClear v-model:value="model[field]" />
</template>
</SmartTable>
<ExceptionDetailModal @register="registerModal" />
</div>
@ -26,9 +29,13 @@
import ExceptionDetailModal from './components/ExceptionDetailModal.vue';
import { createConfirm, successMessage, warnMessage } from '@/utils/message/SystemNotice';
import { ref, unref } from 'vue';
import { SysTenantSelect } from '@/modules/smart-system/components';
import { storeToRefs } from 'pinia';
import { useUserStore } from '@/store/modules/user';
const { t } = useI18n();
const { getTableSize } = useSizeSetting();
const { getIsPlatformTenant } = storeToRefs(useUserStore());
const getTableActions = (row): ActionItem[] => {
return [
@ -90,7 +97,7 @@
searchFormConfig: {
layout: 'inline',
searchWithSymbol: true,
schemas: getSearchFormSchemas(t),
schemas: getSearchFormSchemas(t, getIsPlatformTenant),
colon: true,
actionColOptions: {
span: undefined,

1
src/modules/smart-system/views/exception/lang/en_US.ts

@ -20,6 +20,7 @@ export default {
resolvedTime: 'Resolved time',
showStackTrace: 'Show stackTrace',
stackTrace: 'Stack trace',
tenant: 'Tenant',
},
validate: {
resolvedMessage: 'Please enter processing information',

1
src/modules/smart-system/views/exception/lang/zh_CN.ts

@ -20,6 +20,7 @@ export default {
resolvedTime: '处理时间',
showStackTrace: '查看堆栈信息',
stackTrace: '堆栈信息',
tenant: '租户',
},
validate: {
resolvedMessage: '请输入处理信息',

Loading…
Cancel
Save