From dfcd7292930616dfa36207cd23ebbb7a99813178 Mon Sep 17 00:00:00 2001
From: schangxiang@126.com <schangxiang@126.com>
Date: 周二, 20 5月 2025 18:14:03 +0800
Subject: [PATCH] //将抽屉强制挂载到 body 元素上,确保样式隔离和滚动行为正常,不受嵌套页面的影响
---
Weben_CMS专用代码生成器/Code/Templete/Web/Controllers/EntityModeQueryDrawer模板.txt | 58 +++++++++++++++++++---------------------------------------
1 files changed, 19 insertions(+), 39 deletions(-)
diff --git "a/Weben_CMS\344\270\223\347\224\250\344\273\243\347\240\201\347\224\237\346\210\220\345\231\250/Code/Templete/Web/Controllers/EntityModeQueryDrawer\346\250\241\346\235\277.txt" "b/Weben_CMS\344\270\223\347\224\250\344\273\243\347\240\201\347\224\237\346\210\220\345\231\250/Code/Templete/Web/Controllers/EntityModeQueryDrawer\346\250\241\346\235\277.txt"
index 2969266..9ef83ba 100644
--- "a/Weben_CMS\344\270\223\347\224\250\344\273\243\347\240\201\347\224\237\346\210\220\345\231\250/Code/Templete/Web/Controllers/EntityModeQueryDrawer\346\250\241\346\235\277.txt"
+++ "b/Weben_CMS\344\270\223\347\224\250\344\273\243\347\240\201\347\224\237\346\210\220\345\231\250/Code/Templete/Web/Controllers/EntityModeQueryDrawer\346\250\241\346\235\277.txt"
@@ -20,6 +20,8 @@
FILTER_MODE_OPTIONS_NUM,
FILTER_MODE_OPTIONS_BOOL
} from '@/components/DyFormForHighQuery/DyFormForHighQueryOptions';
+// 引入公共表单工具文件
+import { collectFormDataForHighQuery,onResetForHighSelect,onResetForHighQuery } from '@/utils/myformUtils';
import {
BOOLEAN_OPTIONS
} from '@/utils/commonOptionConstants';
@@ -99,16 +101,11 @@
const check = isEqual(initiateData.value, data)
return check
}
- const commonGetFormData=()=>{
- const data = {
- $Save_PageAddFormAttributes_Query$
- }
- return data;
- }
+
const onClose = (done: () => void) => {
if (visible.value) {
visible.value = false
- const data =commonGetFormData();
+ const data =collectFormDataForHighQuery(formItems,formData);
ctx.emit('close', data)
}
}
@@ -116,39 +113,22 @@
* 确认查询
*/
const onConfirmQuery = async () => {
- const data =commonGetFormData();
+ const data =collectFormDataForHighQuery(formItems,formData);
ctx.emit('confirmQuery', data)
}
- /**
- * 重置公共select查询
- */
- const onResetForHighSelect = () => {
- // 遍历所有表单字段
- formItems.forEach(item => {
- // 检查字段是否有高级查询的过滤模式配置
- if (item.highSelectAttrs && item.highSelectAttrs.prop) {
- const filterModeProp = item.highSelectAttrs.prop;
- const options = item.highSelectAttrs.options || [];
-
- // 如果存在选项,则设置为第一个选项的值
- if (options.length > 0) {
- // 假设选项格式为 { value, label } 或类似结构
- const firstValue = options[0].value !== undefined ? options[0].value : options[0];
- formData.value[filterModeProp] = firstValue;
- }
- }
- });
- }
- /**
- * 重置查询
- */
- const onReset = async () => {
- formData.value = {}
- onResetForHighSelect();//重置公共select查询
- $Save_PageAddFormAttributes_Query_Clear$
- //向父组件发送自定义事件
- ctx.emit('restQuery');
- }
+ /**
+ * 重置查询 - 优化版
+ */
+ const onReset = async () => {
+ // 1. 清空所有基础字段(不包含过滤模式字段),应用基础字段初始值
+ onResetForHighQuery(formItems,formData);
+
+ // 2. 使用原有方法重置过滤模式字段
+ onResetForHighSelect(formItems,formData);
+
+ // 3. 向父组件发送自定义事件
+ ctx.emit('restQuery');
+ }
const updateCheckData = () => {
initiateData.value = {
@@ -173,7 +153,7 @@
$CommonQueryEnumForFrom$
}
commonQueryEnumForFrom()
- onResetForHighSelect();//重置公共select查询
+ onResetForHighSelect(formItems,formData);//重置公共select查询
/**
* 弹窗打开获取详情
*/
--
Gitblit v1.9.3