mirror of
https://github.com/fastapiadmin/FastapiAdmin.git
synced 2026-09-22 13:05:18 +00:00
refactor: 重构查询参数处理逻辑,统一搜索参数处理
- 移除各模块查询schema中的自定义model_validator,统一通过search_to_dict处理搜索参数 - 为需要的字段添加json_schema_extra标记查询操作类型 - 重构base_crud的条件解析逻辑,支持直接处理普通字符串、数字类型参数 - 重构base_schema中的公共查询参数校验逻辑,简化时间范围和创建更新人参数处理 - 修复菜单查询的异步懒加载问题,添加多级预加载 - 调整日志打印配置,关闭uvicorn.access重复日志 - 修复前端路由跳转路径错误 - 调整弹窗宽度适配内容 - 修复测试环境限流器未注册问题 - 清理无用的导入和废弃函数
This commit is contained in:
@@ -184,6 +184,9 @@ const onCreateEditor = (editor: IDomEditor) => {
|
||||
applyCustomIcons();
|
||||
};
|
||||
|
||||
// 图标重试定时器(提升到顶层以便 onUnmounted 访问)
|
||||
let _iconTimerId: ReturnType<typeof setTimeout> | null = null;
|
||||
|
||||
// 应用自定义图标(带重试机制)
|
||||
//
|
||||
// 注意:递归 setTimeout 用于等待 wangEditor 工具栏 DOM 渲染完成。
|
||||
@@ -192,14 +195,13 @@ const applyCustomIcons = () => {
|
||||
let retryCount = 0;
|
||||
const maxRetries = 10;
|
||||
const retryDelay = 100;
|
||||
let timerId: ReturnType<typeof setTimeout> | null = null;
|
||||
|
||||
const tryApplyIcons = () => {
|
||||
const editor = editorRef.value;
|
||||
if (!editor) {
|
||||
if (retryCount < maxRetries) {
|
||||
retryCount++;
|
||||
timerId = setTimeout(tryApplyIcons, retryDelay);
|
||||
_iconTimerId = setTimeout(tryApplyIcons, retryDelay);
|
||||
}
|
||||
return;
|
||||
}
|
||||
@@ -209,7 +211,7 @@ const applyCustomIcons = () => {
|
||||
if (!editorContainer) {
|
||||
if (retryCount < maxRetries) {
|
||||
retryCount++;
|
||||
timerId = setTimeout(tryApplyIcons, retryDelay);
|
||||
_iconTimerId = setTimeout(tryApplyIcons, retryDelay);
|
||||
}
|
||||
return;
|
||||
}
|
||||
@@ -224,7 +226,7 @@ const applyCustomIcons = () => {
|
||||
// 如果工具栏还没渲染完成,继续重试
|
||||
if (retryCount < maxRetries) {
|
||||
retryCount++;
|
||||
timerId = setTimeout(tryApplyIcons, retryDelay);
|
||||
_iconTimerId = setTimeout(tryApplyIcons, retryDelay);
|
||||
} else {
|
||||
console.warn("工具栏渲染超时,无法应用自定义图标 - 编辑器实例:", editor.id);
|
||||
}
|
||||
@@ -232,16 +234,16 @@ const applyCustomIcons = () => {
|
||||
|
||||
// 使用 requestAnimationFrame 确保在下一帧执行
|
||||
requestAnimationFrame(tryApplyIcons);
|
||||
|
||||
// 组件卸载时清理挂起的重试定时器
|
||||
onUnmounted(() => {
|
||||
if (timerId !== null) {
|
||||
clearTimeout(timerId);
|
||||
timerId = null;
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
// 组件卸载时清理挂起的重试定时器(需在 setup 顶层注册)
|
||||
onUnmounted(() => {
|
||||
if (_iconTimerId !== null) {
|
||||
clearTimeout(_iconTimerId);
|
||||
_iconTimerId = null;
|
||||
}
|
||||
});
|
||||
|
||||
// 暴露编辑器实例和方法
|
||||
defineExpose({
|
||||
/** 获取编辑器实例 */
|
||||
|
||||
@@ -244,7 +244,7 @@
|
||||
</ElForm>
|
||||
|
||||
<div class="px-5 pb-4">
|
||||
<ElButton text size="small" @click="router.push('/module_system/log')">
|
||||
<ElButton text size="small" @click="router.push('/system/log')">
|
||||
<FaSvgIcon icon="ri:history-line" class="mr-1" />查看登录日志
|
||||
</ElButton>
|
||||
</div>
|
||||
|
||||
@@ -44,7 +44,7 @@
|
||||
<FaDialog
|
||||
v-model="dialogVisible.visible"
|
||||
:title="dialogVisible.title"
|
||||
width="680px"
|
||||
width="760px"
|
||||
dialog-class="crud-embed-dialog"
|
||||
modal-class="crud-embed-dialog"
|
||||
:form-mode="dialogVisible.type"
|
||||
|
||||
Reference in New Issue
Block a user