feat: 用户操作日志.

This commit is contained in:
lijiahang
2023-11-01 18:57:53 +08:00
parent cfcb5cb7a8
commit eafe69ebca
45 changed files with 1255 additions and 157 deletions

View File

@@ -100,7 +100,7 @@
<!-- 查看 -->
<a-button type="text"
size="mini"
@click="emits('openView', record)">
@click="openView(record)">
查看
</a-button>
<!-- 修改 -->
@@ -145,6 +145,7 @@
import { dictValueTypeKey } from '../types/const';
import useCopy from '@/hooks/copy';
import { useDictStore } from '@/store';
import { getDictValueList } from '@/api/system/dict-value';
const tableRenderData = ref<DictKeyQueryResponse[]>([]);
const emits = defineEmits(['openAdd', 'openUpdate', 'openView']);
@@ -191,6 +192,19 @@
addedCallback, updatedCallback
});
// 打开查看视图
const openView = async (record: DictKeyQueryResponse) => {
try {
setLoading(true);
// 查看
const { data } = await getDictValueList([record.keyName]);
emits('openView', data[record.keyName], `${record.keyName} - ${record.description}`);
} catch (e) {
} finally {
setLoading(false);
}
};
// 刷新缓存
const doRefreshCache = async () => {
try {

View File

@@ -1,73 +0,0 @@
<template>
<a-modal v-model:visible="visible"
title-align="start"
width="60%"
:body-style="{padding: '16px 8px'}"
:top="80"
:title="title"
:align-center="false"
:draggable="true"
:mask-closable="false"
:unmount-on-close="true"
:footer="false"
@close="handleClose">
<a-spin :loading="loading" style="width: 100%; height: calc(100vh - 240px)">
<editor v-model="value" readonly />
</a-spin>
</a-modal>
</template>
<script lang="ts">
export default {
name: 'dict-key-view-modal'
};
</script>
<script lang="ts" setup>
import { ref } from 'vue';
import useLoading from '@/hooks/loading';
import useVisible from '@/hooks/visible';
import { getDictValueList } from '@/api/system/dict-value';
const { visible, setVisible } = useVisible();
const { loading, setLoading } = useLoading();
const title = ref<string>();
const value = ref<string>();
// 打开新增
const open = (e: any) => {
title.value = e.keyName;
value.value = undefined;
render(e.keyName);
setVisible(true);
};
// 渲染
const render = async (keyName: string) => {
try {
setLoading(true);
// 查看
const { data } = await getDictValueList([keyName]);
value.value = JSON.stringify(data[keyName], undefined, 4);
} catch (e) {
} finally {
setLoading(false);
}
};
defineExpose({ open });
// 关闭
const handleClose = () => {
setLoading(false);
setVisible(false);
};
</script>
<style lang="less" scoped>
:deep(.arco-modal-title) {
font-size: 14px;
}
</style>

View File

@@ -4,13 +4,13 @@
<dict-key-table ref="table"
@openAdd="() => modal.openAdd()"
@openUpdate="(e) => modal.openUpdate(e)"
@openView="(e) => view.open(e)" />
@openView="(v, t) => view.open(v, t)" />
<!-- 添加修改模态框 -->
<dict-key-form-modal ref="modal"
@added="modalAddCallback"
@updated="modalUpdateCallback" />
<!-- json 查看器模态框 -->
<dict-key-view-modal ref="view" />
<json-view-modal ref="view" />
</div>
</template>
@@ -24,7 +24,7 @@
import { ref, onBeforeMount } from 'vue';
import DictKeyTable from './components/dict-key-table.vue';
import DictKeyFormModal from './components/dict-key-form-modal.vue';
import DictKeyViewModal from './components/dict-key-view-modal.vue';
import JsonViewModal from '@/components/view/json/json-view-modal.vue';
import { useDictStore } from '@/store';
import { dictKeys } from './types/const';