feat: 刷新字典缓存.
This commit is contained in:
@@ -69,6 +69,13 @@ export function getDictKeyPage(request: DictKeyQueryRequest) {
|
||||
return axios.post<DataGrid<DictKeyQueryResponse>>('/infra/dict-key/query', request);
|
||||
}
|
||||
|
||||
/**
|
||||
* 刷新字典缓存
|
||||
*/
|
||||
export function refreshCache() {
|
||||
return axios.put('/infra/dict-key/refresh-cache');
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除字典配置项
|
||||
*/
|
||||
|
||||
@@ -88,8 +88,8 @@ export function deleteMenu(id: number) {
|
||||
}
|
||||
|
||||
/**
|
||||
* 初始化缓存
|
||||
* 刷新缓存
|
||||
*/
|
||||
export function initCache() {
|
||||
return axios.put('/infra/permission/init-cache');
|
||||
export function refreshCache() {
|
||||
return axios.put('/infra/permission/refresh-cache');
|
||||
}
|
||||
|
||||
@@ -65,11 +65,7 @@
|
||||
}
|
||||
|
||||
.modal-form {
|
||||
.arco-form-item {
|
||||
&:last-child {
|
||||
margin-bottom: 0 !important;
|
||||
}
|
||||
}
|
||||
padding: 24px 20px 4px 20px;
|
||||
}
|
||||
|
||||
.card-list-item {
|
||||
|
||||
@@ -223,7 +223,7 @@
|
||||
</script>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import type { PropType } from 'vue';
|
||||
import type { CSSProperties, PropType } from 'vue';
|
||||
import type { PaginationProps, ResponsiveValue } from '@arco-design/web-vue';
|
||||
import type { CardRecord, ColResponsiveValue, HandleVisible, CardFieldConfig, CardPosition } from '@/types/card';
|
||||
import { compile, computed, h, ref } from 'vue';
|
||||
@@ -278,7 +278,7 @@
|
||||
default: '100%'
|
||||
},
|
||||
cardClass: String,
|
||||
cardBodyStyle: Object,
|
||||
cardBodyStyle: Object as PropType<CSSProperties>,
|
||||
contextMenu: {
|
||||
type: Boolean,
|
||||
default: true
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
|
||||
<script lang="ts" setup>
|
||||
import type { Theme, Options } from './core';
|
||||
import type { PropType } from 'vue';
|
||||
import type { CSSProperties, PropType } from 'vue';
|
||||
import * as monaco from 'monaco-editor';
|
||||
import { createDefaultOptions } from './core';
|
||||
import { onBeforeUnmount, onMounted, ref, watch } from 'vue';
|
||||
@@ -48,7 +48,7 @@
|
||||
default: 'json',
|
||||
},
|
||||
containerClass: String,
|
||||
containerStyle: Object,
|
||||
containerStyle: Object as PropType<CSSProperties>,
|
||||
theme: {
|
||||
type: [String, Boolean] as PropType<Theme | boolean>,
|
||||
default: true,
|
||||
|
||||
@@ -116,6 +116,10 @@
|
||||
message
|
||||
}
|
||||
});
|
||||
// 因为输入框已经限制数量 这里只做提示
|
||||
setTimeout(() => {
|
||||
formRef.value.clearValidate('tags');
|
||||
}, 3000);
|
||||
};
|
||||
|
||||
// 确定
|
||||
|
||||
@@ -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