fix bug 代码生成器时间范围查询的组件优化

This commit is contained in:
zhaoxiao
2023-03-15 17:22:49 +08:00
parent 1262fecd2d
commit 0d111ae337
@@ -69,9 +69,11 @@
<#if query_field_no gt 1> </#if><a-col :xl="10" :lg="11" :md="12" :sm="24"> <#if query_field_no gt 1> </#if><a-col :xl="10" :lg="11" :md="12" :sm="24">
<#if query_field_no gt 1> </#if><a-form-item label="${po.filedComment}"> <#if query_field_no gt 1> </#if><a-form-item label="${po.filedComment}">
<#if po.classType=='date'> <#if po.classType=='date'>
<#if query_field_no gt 1> <a-range-picker format="YYYY-MM-DD" :placeholder="['请选择开始日期', '请选择结束日期']" v-model="queryParam.${po.fieldName}Range" @ok="${po.fieldName}OnOk"/> <#assign date_flag=true>
<#if query_field_no gt 1> </#if><a-range-picker format="YYYY-MM-DD" :placeholder="['请选择开始日期', '请选择结束日期']" v-model="queryParam.${po.fieldName}Range" @change="${po.fieldName}Change"/>
<#elseif po.classType=='datetime'> <#elseif po.classType=='datetime'>
<#if query_field_no gt 1> <a-range-picker :show-time="{ format: 'HH:mm:ss' }" format="YYYY-MM-DD HH:mm:ss" :placeholder="['请选择开始时间', '请选择结束时间']" v-model="queryParam.${po.fieldName}Range" @ok="${po.fieldName}OnOk"/> <#assign date_flag=true>
<#if query_field_no gt 1> </#if><a-range-picker :show-time="{ format: 'HH:mm:ss' }" format="YYYY-MM-DD HH:mm:ss" :placeholder="['请选择开始时间', '请选择结束时间']" v-model="queryParam.${po.fieldName}Range" @change="${po.fieldName}Change"/>
<#else> <#else>
<#if query_field_no gt 1> </#if><a-input placeholder="请输入最小值" class="query-group-cust" v-model="queryParam.${po.fieldName}_begin"></a-input> <#if query_field_no gt 1> </#if><a-input placeholder="请输入最小值" class="query-group-cust" v-model="queryParam.${po.fieldName}_begin"></a-input>
<#if query_field_no gt 1> </#if><span class="query-group-split-cust"></span> <#if query_field_no gt 1> </#if><span class="query-group-split-cust"></span>
@@ -227,6 +229,9 @@ import {filterMultiDictText} from '@/components/dict/JDictSelectUtil'
<#if list_need_pca> <#if list_need_pca>
import Area from '@/components/_util/Area' import Area from '@/components/_util/Area'
</#if> </#if>
<#if date_flag>
import { filterObj } from '@/utils/util'
</#if>
export default { export default {
name: '${entityName}List', name: '${entityName}List',
@@ -404,12 +409,36 @@ export default {
}, },
<#list columns as po> <#list columns as po>
<#if po.classType=='datetime' || po.classType=='date'> <#if po.classType=='datetime' || po.classType=='date'>
${po.fieldName}OnOk () { // 范围查询需要处理查询参数
this.queryParam.${po.fieldName}_begin = this.queryParam.${po.fieldName}Range[0] ${po.fieldName}Change (value, valueString) {
this.queryParam.${po.fieldName}_end = this.queryParam.${po.fieldName}Range[1] if (valueString && valueString.length > 0) {
this.queryParam.${po.fieldName}_begin = valueString[0]
this.queryParam.${po.fieldName}_end = valueString[1]
}
}, },
</#if> </#if>
</#list> </#list>
<#if date_flag>
getQueryParams () {
// 获取查询条件
const sqp = {}
if (this.superQueryParams) {
sqp.superQueryParams = encodeURI(this.superQueryParams)
sqp.superQueryMatchType = this.superQueryMatchType
}
const param = JSON.parse(JSON.stringify(Object.assign(sqp, this.queryParam, this.isorter, this.filters)))
param.field = this.getQueryField()
param.pageNo = this.ipagination.current
param.pageSize = this.ipagination.pageSize
<#list columns as po>
<#if po.classType=='datetime' || po.classType=='date'>
// 范围查询需要吧range的属性去掉
delete param.${po.fieldName}Range
</#if>
</#list>
return filterObj(param)
},
</#if>
getSuperFieldList () { getSuperFieldList () {
<#include "/common/utils.ftl"> <#include "/common/utils.ftl">
const fieldList = [] const fieldList = []