添加首页.

This commit is contained in:
lijiahang
2024-02-26 18:48:21 +08:00
parent b268db556f
commit b488bb326d
19 changed files with 157 additions and 917 deletions

View File

@@ -55,8 +55,8 @@
<script lang="ts" setup>
import type { OperatorLogQueryRequest, OperatorLogQueryResponse } from '@/api/user/operator-log';
import { ref, onMounted } from 'vue';
import { operatorLogModuleKey, operatorLogTypeKey, operatorRiskLevelKey, operatorLogResultKey } from '../types/const';
import { ref, onMounted, onBeforeMount } from 'vue';
import { operatorLogModuleKey, operatorLogTypeKey, operatorRiskLevelKey, operatorLogResultKey, dictKeys } from '../types/const';
import columns from '../types/table.columns';
import useLoading from '@/hooks/loading';
import { usePagination } from '@/types/table';
@@ -73,6 +73,10 @@
type: Boolean,
default: true
},
visibleHandle: {
type: Boolean,
default: true
},
current: {
type: Boolean,
default: false
@@ -141,12 +145,24 @@
doFetchTableData({ page, limit, ...form });
};
// 加载字典值
onBeforeMount(async () => {
const dictStore = useDictStore();
await dictStore.loadKeys(dictKeys);
});
// 初始化
onMounted(() => {
if (props.visibleUser) {
tableColumns.value = columns;
} else {
tableColumns.value = columns.filter(s => s.dataIndex !== 'username');
let cols = columns;
// 不显示用户
if (!props.visibleUser) {
cols = cols.filter(s => s.dataIndex !== 'username');
}
// 不显示操作
if (!props.visibleHandle) {
cols = cols.filter(s => s.dataIndex !== 'handle');
}
tableColumns.value = cols;
fetchTableData();
});

View File

@@ -1,5 +1,5 @@
<template>
<div class="layout-container" v-if="render">
<div class="layout-container">
<!-- 查询头 -->
<a-card class="general-card table-search-card">
<!-- 查询头组件 -->
@@ -31,30 +31,22 @@
</script>
<script lang="ts" setup>
import { ref, onBeforeMount, onUnmounted } from 'vue';
import { useCacheStore, useDictStore } from '@/store';
import { dictKeys } from './types/const';
import { ref, onUnmounted } from 'vue';
import { useCacheStore } from '@/store';
import OperatorLogQueryHeader from './components/operator-log-query-header.vue';
import OperatorLogTable from './components/operator-log-table.vue';
import JsonEditorModal from '@/components/view/json-editor/json-editor-modal.vue';
const cacheStore = useCacheStore();
const render = ref();
const table = ref();
const view = ref();
onBeforeMount(async () => {
// 加载字典值
const dictStore = useDictStore();
await dictStore.loadKeys(dictKeys);
render.value = true;
});
// 卸载时清除 cache
onUnmounted(() => {
cacheStore.reset('users');
});
</script>
<style lang="less" scoped>

View File

@@ -59,6 +59,7 @@ const columns = [
},
}, {
title: '操作',
dataIndex: 'handle',
slotName: 'handle',
width: 90,
align: 'center',