feat: 刷新字典缓存.
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
<template>
|
||||
<a-modal v-model:visible="visible"
|
||||
body-class="modal-form"
|
||||
:body-style="{'padding-bottom': '24px'}"
|
||||
title-align="start"
|
||||
:title="title"
|
||||
:top="80"
|
||||
|
||||
@@ -38,6 +38,19 @@
|
||||
<icon-plus />
|
||||
</template>
|
||||
</a-button>
|
||||
<!-- 刷新缓存 -->
|
||||
<a-popconfirm content="确定要刷新全局字典缓存吗?"
|
||||
position="left"
|
||||
type="warning"
|
||||
@ok="doRefreshCache">
|
||||
<a-button type="primary" status="warning"
|
||||
v-permission="['infra:dict-key:refresh-cache']">
|
||||
刷新缓存
|
||||
<template #icon>
|
||||
<icon-sync />
|
||||
</template>
|
||||
</a-button>
|
||||
</a-popconfirm>
|
||||
</a-space>
|
||||
</div>
|
||||
</template>
|
||||
@@ -124,7 +137,7 @@
|
||||
<script lang="ts" setup>
|
||||
import type { DictKeyQueryRequest, DictKeyQueryResponse } from '@/api/system/dict-key';
|
||||
import { reactive, ref, onMounted } from 'vue';
|
||||
import { batchDeleteDictKey, deleteDictKey, getDictKeyPage } from '@/api/system/dict-key';
|
||||
import { batchDeleteDictKey, deleteDictKey, getDictKeyPage, refreshCache } from '@/api/system/dict-key';
|
||||
import { Message } from '@arco-design/web-vue';
|
||||
import useLoading from '@/hooks/loading';
|
||||
import columns from '../types/table.columns';
|
||||
@@ -178,6 +191,18 @@
|
||||
addedCallback, updatedCallback
|
||||
});
|
||||
|
||||
// 刷新缓存
|
||||
const doRefreshCache = async () => {
|
||||
try {
|
||||
setLoading(true);
|
||||
await refreshCache();
|
||||
Message.success('刷新成功 页面缓存刷新后生效');
|
||||
} catch (e) {
|
||||
} finally {
|
||||
setLoading(false);
|
||||
}
|
||||
};
|
||||
|
||||
// 加载数据
|
||||
const doFetchTableData = async (request: DictKeyQueryRequest) => {
|
||||
try {
|
||||
|
||||
@@ -29,6 +29,9 @@ export const definedExtraKeys = [
|
||||
}
|
||||
];
|
||||
|
||||
// 自增排序步长
|
||||
export const sortStep = 10;
|
||||
|
||||
// 内置字段
|
||||
export const innerKeys = ['value', 'label'];
|
||||
|
||||
|
||||
@@ -92,7 +92,7 @@
|
||||
import formRules from '../types/form.rules';
|
||||
import { createDictValue, updateDictValue } from '@/api/system/dict-value';
|
||||
import { Message } from '@arco-design/web-vue';
|
||||
import { ValueType } from '../../dict-key/types/const';
|
||||
import { ValueType, sortStep } from '../../dict-key/types/const';
|
||||
import DictKeySelector from '@/components/system/dict-key/dict-key-selector.vue';
|
||||
import { DictKeyQueryResponse } from '@/api/system/dict-key';
|
||||
import { useCacheStore } from '@/store';
|
||||
@@ -126,7 +126,7 @@
|
||||
const openAdd = () => {
|
||||
title.value = '添加字典配置值';
|
||||
isAddHandle.value = true;
|
||||
renderForm({ ...defaultForm(), keyId: formModel.value.keyId, sort: (formModel.value.sort || 0) + 10 });
|
||||
renderForm({ ...defaultForm(), keyId: formModel.value.keyId, sort: (formModel.value.sort || 0) + sortStep });
|
||||
setVisible(true);
|
||||
};
|
||||
|
||||
|
||||
@@ -65,9 +65,9 @@
|
||||
<a-popconfirm content="确定要刷新全局菜单缓存吗?"
|
||||
position="left"
|
||||
type="warning"
|
||||
@ok="doInitCache">
|
||||
@ok="doRefreshCache">
|
||||
<a-button type="primary" status="warning"
|
||||
v-permission="['infra:system-menu:init-cache']">
|
||||
v-permission="['infra:system-menu:refresh-cache']">
|
||||
刷新缓存
|
||||
<template #icon>
|
||||
<icon-sync />
|
||||
@@ -184,7 +184,7 @@
|
||||
import type { MenuQueryRequest, MenuQueryResponse } from '@/api/system/menu';
|
||||
import { reactive, ref, onMounted } from 'vue';
|
||||
import useLoading from '@/hooks/loading';
|
||||
import { getMenuList, deleteMenu, updateMenuStatus, initCache } from '@/api/system/menu';
|
||||
import { getMenuList, deleteMenu, updateMenuStatus, refreshCache } from '@/api/system/menu';
|
||||
import { menuStatusKey, menuVisibleKey, menuTypeKey, MenuType } from '../types/const';
|
||||
import columns from '../types/table.columns';
|
||||
import { Message } from '@arco-design/web-vue';
|
||||
@@ -298,11 +298,11 @@
|
||||
};
|
||||
|
||||
// 刷新缓存
|
||||
const doInitCache = async () => {
|
||||
const doRefreshCache = async () => {
|
||||
try {
|
||||
setFetchLoading(true);
|
||||
await initCache();
|
||||
Message.success('刷新成功');
|
||||
await refreshCache();
|
||||
Message.success('刷新成功 页面缓存刷新后生效');
|
||||
} catch (e) {
|
||||
} finally {
|
||||
setFetchLoading(false);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// 排序步长
|
||||
// 自增排序步长
|
||||
export const sortStep = 10;
|
||||
|
||||
// 菜单类型 值
|
||||
|
||||
Reference in New Issue
Block a user