From 7e412efefa7ebb636cd591e5121ce4e9e54836c2 Mon Sep 17 00:00:00 2001
From: schangxiang@126.com <schangxiang@126.com>
Date: 周二, 20 5月 2025 12:43:22 +0800
Subject: [PATCH] Merge branch 'master' of http://222.71.245.114:9086/r/HIA24016N_PipeLineDemo
---
Weben_CMS专用代码生成器/Code/Templete/Web/Controllers/EntityModeQueryDrawer模板.txt | 121 ++++++++++++++++++++++++++++++---------
1 files changed, 92 insertions(+), 29 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..d00e438 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$
@@ -67,12 +99,26 @@
const check = isEqual(initiateData.value, data)
return check
}
- const commonGetFormData=()=>{
- const data = {
- $Save_PageAddFormAttributes_Query$
+ /**
+ * 获取表单数据 - 优化版
+ */
+const commonGetFormData = () => {
+ const data = {};
+
+ // 遍历表单配置收集数据
+ formItems.forEach(item => {
+ // 收集基础字段
+ data[item.prop] = formData.value[item.prop] || '';
+
+ // 收集过滤模式字段
+ if (item.highSelectAttrs && item.highSelectAttrs.prop) {
+ const filterModeProp = item.highSelectAttrs.prop;
+ data[filterModeProp] = formData.value[filterModeProp] || '';
}
- return data;
- }
+ });
+
+ return data;
+}
const onClose = (done: () => void) => {
if (visible.value) {
visible.value = false
@@ -87,29 +133,45 @@
const data =commonGetFormData();
ctx.emit('confirmQuery', data)
}
- /**
- * 重置查询
- */
- const onReset = async () => {
- formData.value = {}
- $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');
- }
+ /**
+ * 重置公共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 () => {
+ // 1. 清空所有基础字段(不包含过滤模式字段)
+ const baseFields = formItems.reduce((acc, item) => {
+ acc[item.prop] = '';
+ return acc;
+ }, {});
+
+ // 2. 应用基础字段初始值
+ formData.value = { ...baseFields };
+
+ // 3. 使用原有方法重置过滤模式字段
+ onResetForHighSelect(); // 保留原有方法调用
+
+ // 4. 向父组件发送自定义事件
+ ctx.emit('restQuery');
+ }
const updateCheckData = () => {
initiateData.value = {
@@ -134,6 +196,7 @@
$CommonQueryEnumForFrom$
}
commonQueryEnumForFrom()
+ onResetForHighSelect();//重置公共select查询
/**
* 弹窗打开获取详情
*/
--
Gitblit v1.9.3