From 27090fe116acffcc53830d4d8b6d39ed640c6b44 Mon Sep 17 00:00:00 2001 From: 疯狂的狮子Li <15040126243@163.com> Date: 星期一, 17 七月 2023 22:28:39 +0800 Subject: [PATCH] !397 fix issues I7HWO0 Merge pull request !397 from ahaos/5.X --- ruoyi-modules/ruoyi-generator/src/main/resources/vm/vue/index.vue.vm | 34 ++++++++++++++++++++-------------- 1 files changed, 20 insertions(+), 14 deletions(-) diff --git a/ruoyi-modules/ruoyi-generator/src/main/resources/vm/vue/index.vue.vm b/ruoyi-modules/ruoyi-generator/src/main/resources/vm/vue/index.vue.vm index 81784c8..5af7118 100644 --- a/ruoyi-modules/ruoyi-generator/src/main/resources/vm/vue/index.vue.vm +++ b/ruoyi-modules/ruoyi-generator/src/main/resources/vm/vue/index.vue.vm @@ -46,7 +46,7 @@ #elseif($column.htmlType == "datetime" && $column.queryType == "BETWEEN") <el-form-item label="${comment}" style="width: 308px"> <el-date-picker - v-model="daterange${AttrName}" + v-model="dateRange${AttrName}" value-format="YYYY-MM-DD HH:mm:ss" type="daterange" range-separator="-" @@ -260,8 +260,6 @@ <script setup name="${BusinessName}" lang="ts"> import { list${BusinessName}, get${BusinessName}, del${BusinessName}, add${BusinessName}, update${BusinessName} } from '@/api/${moduleName}/${businessName}'; import { ${BusinessName}VO, ${BusinessName}Query, ${BusinessName}Form } from '@/api/${moduleName}/${businessName}/types'; -import { ComponentInternalInstance } from 'vue'; -import { ElForm } from 'element-plus'; const { proxy } = getCurrentInstance() as ComponentInternalInstance; #if(${dicts} != '') @@ -280,12 +278,12 @@ #foreach ($column in $columns) #if($column.htmlType == "datetime" && $column.queryType == "BETWEEN") #set($AttrName=$column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)}) -const daterange${AttrName} = ref([]); +const dateRange${AttrName} = ref<[DateModelType, DateModelType]>(['', '']); #end #end -const queryFormRef = ref(ElForm); -const ${businessName}FormRef = ref(ElForm); +const queryFormRef = ref<ElFormInstance>(); +const ${businessName}FormRef = ref<ElFormInstance>(); const dialog = reactive<DialogOption>({ visible: false, @@ -310,9 +308,20 @@ pageSize: 10, #foreach ($column in $columns) #if($column.query) + #if($column.htmlType != "datetime" || $column.queryType != "BETWEEN") $column.javaField: undefined#if($foreach.count != $columns.size()),#end + #end #end #end + params: { + #foreach ($column in $columns) + #if($column.query) + #if($column.htmlType == "datetime" && $column.queryType == "BETWEEN") + $column.javaField: undefined#if($foreach.count != $columns.size()),#end + #end + #end + #end + } }, rules: { #foreach ($column in $columns) @@ -347,10 +356,7 @@ #foreach ($column in $columns) #if($column.htmlType == "datetime" && $column.queryType == "BETWEEN") #set($AttrName=$column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)}) - if (null != daterange${AttrName} && '' != daterange${AttrName}) { - queryParams.value.params["begin${AttrName}"] = daterange${AttrName}.value[0]; - queryParams.value.params["end${AttrName}"] = daterange${AttrName}.value[1]; - } + proxy?.addDateRange(queryParams.value, dateRange${AttrName}.value, '${AttrName}'); #end #end const res = await list${BusinessName}(queryParams.value); @@ -368,7 +374,7 @@ /** 琛ㄥ崟閲嶇疆 */ const reset = () => { form.value = {...initFormData}; - ${businessName}FormRef.value.resetFields(); + ${businessName}FormRef.value?.resetFields(); } /** 鎼滅储鎸夐挳鎿嶄綔 */ @@ -382,10 +388,10 @@ #foreach ($column in $columns) #if($column.htmlType == "datetime" && $column.queryType == "BETWEEN") #set($AttrName=$column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)}) - daterange${AttrName}.value = []; + dateRange${AttrName}.value = ['', '']; #end #end - queryFormRef.value.resetFields(); + queryFormRef.value?.resetFields(); handleQuery(); } @@ -426,7 +432,7 @@ /** 鎻愪氦鎸夐挳 */ const submitForm = () => { - ${businessName}FormRef.value.validate(async (valid: boolean) => { + ${businessName}FormRef.value?.validate(async (valid: boolean) => { if (valid) { buttonLoading.value = true; #foreach ($column in $columns) -- Gitblit v1.9.3