From 36fc063fec47f54b4cc3eedd5ddb85a5ac5c6cd8 Mon Sep 17 00:00:00 2001 From: schangxiang@126.com <schangxiang@126.com> Date: 周二, 20 5月 2025 11:38:17 +0800 Subject: [PATCH] 高级查询过滤优化了,不再用这种方式了 --- Weben_CMS专用代码生成器/Code/Templete/Web/Controllers/EntityModeQueryDrawer模板.txt | 70 +++++++++++++++++++++++++++------- 1 files changed, 55 insertions(+), 15 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 eb91ad8..2969266 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" @@ -14,6 +14,15 @@ import isEqual from 'lodash/isEqual' import { ConfirmBox } from '@/components/ConfirmBox/ConfirmBox' import { cloneDeep } from 'lodash' +// 引入公共选项配置 +import { + FILTER_MODE_OPTIONS_STRING, + FILTER_MODE_OPTIONS_NUM, + FILTER_MODE_OPTIONS_BOOL +} from '@/components/DyFormForHighQuery/DyFormForHighQueryOptions'; +import { + BOOLEAN_OPTIONS +} from '@/utils/commonOptionConstants'; export const use$EntityName$QueryDrawer = (props: any, ctx?: any) => { const $PageMenuInstanceName$Drawer = injectModel<$EntityName$Drawer>('$EntityName$Drawer') @@ -42,6 +51,29 @@ ) } + const datePickerRange = (attrs) => { + return ( + <el-date-picker + type="daterange" + value-format="YYYY-MM-DD HH:mm:ss" + start-placeholder="开始日期" + end-placeholder="结束日期" + {...attrs} + ></el-date-picker> + ) + } + + const dateTimePickerRange = (attrs) => { + return ( + <el-date-picker + type="datetimerange" + value-format="YYYY-MM-DD HH:mm:ss" + start-placeholder="开始日期" + end-placeholder="结束日期" + {...attrs} + ></el-date-picker> + ) + } const visible = computed({ get() { @@ -52,7 +84,7 @@ }, }) /** - * 添加的form字段 + * 高级查询的form字段 */ const formItems = reactive([ $PageAddFormAttributes_Query$ @@ -87,26 +119,33 @@ const data =commonGetFormData(); 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$ - formData.value.materialCode = '' - formData.value.materialName = '' - formData.value.purchaseType = '' - formData.value.materialType = '' - formData.value.primaryUnit = '' - formData.value.standard = '' - formData.value.outerDiameter = '' - formData.value.wallThickness = '' - formData.value.materialQuality = '' - formData.value.length = '' - formData.value.isMainBranch = '' - formData.value.factory = '' - formData.value.certification = '' - formData.value.remark = '' //向父组件发送自定义事件 ctx.emit('restQuery'); } @@ -134,6 +173,7 @@ $CommonQueryEnumForFrom$ } commonQueryEnumForFrom() + onResetForHighSelect();//重置公共select查询 /** * 弹窗打开获取详情 */ -- Gitblit v1.9.3