Skip to content

Commit

Permalink
优化代码生成器模板
Browse files Browse the repository at this point in the history
  • Loading branch information
zhangdaiscott committed Nov 15, 2023
1 parent 6ab4ee6 commit 8216889
Show file tree
Hide file tree
Showing 10 changed files with 75 additions and 41 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@
</#if>
<#if po.queryMode=='single'>
<#if query_field_no gt 1> </#if><a-col :lg="6">
<#if query_field_no gt 1> </#if><a-form-item name="${po.fieldName}">
<#if query_field_no gt 1> </#if><a-form-item name="${autoStringSuffixForModel(po)}">
<#if query_field_no gt 1> </#if><template #label><span title="${po.filedComment}"><#if po.filedComment?default("")?trim?length gt 4>${po.filedComment?substring(0,4)}<#else>${po.filedComment}</#if></span></template>
<#if po.classType=='sel_search'>
<#if query_field_no gt 1> </#if><j-search-select placeholder="请选择${po.filedComment}" v-model:value="queryParam.${po.fieldName}" dict="${po.dictTable},${po.dictText},${po.dictField}" />
<#elseif po.classType=='sel_user'>
<#if query_field_no gt 1> </#if><j-select-user-by-dept placeholder="请选择${po.filedComment}" v-model:value="queryParam.${po.fieldName}" />
<#if query_field_no gt 1> </#if><j-select-user-by-dept placeholder="请选择${po.filedComment}" v-model:value="queryParam.${po.fieldName}" @change="(value)=>handleFormJoinChange('${po.fieldName}',value)"/>
<#elseif po.classType=='switch'>
<#if query_field_no gt 1> </#if><j-switch placeholder="请选择${po.filedComment}" v-model:value="queryParam.${po.fieldName}" <#if po.dictField!= 'is_open'>:options="${po.dictField}"</#if> query />
<#elseif po.classType=='sel_depart'>
Expand All @@ -32,8 +32,10 @@
<#if query_field_no gt 1> </#if><a-date-picker valueFormat="YYYY-MM-DD" placeholder="请选择${po.filedComment}" v-model:value="queryParam.${po.fieldName}" />
<#elseif po.classType=='datetime'>
<#if query_field_no gt 1> </#if><a-date-picker showTime valueFormat="YYYY-MM-DD HH:mm:ss" placeholder="请选择${po.filedComment}" v-model:value="queryParam.${po.fieldName}" />
<#elseif po.classType=='time'>
<#if query_field_no gt 1> </#if><time-picker valueFormat="HH:mm:ss" placeholder="请选择${po.filedComment}" v-model:value="queryParam.${po.fieldName}" />
<#elseif po.classType=='pca'>
<#if query_field_no gt 1> </#if><j-area-linkage v-model:value="queryParam.${po.fieldName}" placeholder="请选择${po.filedComment}" @change="(value) => handleAreaChange('${po.fieldName}', value)" />
<#if query_field_no gt 1> </#if><j-area-linkage v-model:value="queryParam.${po.fieldName}" placeholder="请选择${po.filedComment}" @change="(value) => handleFormJoinChange('${po.fieldName}', value)" />
<#elseif po.classType=='sel_tree'>
<#if query_field_no gt 1> </#if><j-tree-select v-model:value="queryParam.${po.fieldName}" placeholder="请选择${po.filedComment}" <#if po.dictText??><#if po.dictText?split(',')[2]?? && po.dictText?split(',')[0]??>dict="${po.dictTable},${po.dictText?split(',')[2]},${po.dictText?split(',')[0]}" <#elseif po.dictText?split(',')[1]??>pidField:"${po.dictText?split(',')[1]}", <#elseif po.dictText?split(',')[3]??>hasChildField:"${po.dictText?split(',')[3]}"</#if> </#if>pidValue="${po.dictField}" />
<#elseif po.classType=='popup'>
Expand All @@ -60,7 +62,7 @@
<#if query_field_no gt 1> </#if><a-input placeholder="请输入${po.filedComment}" v-model:value="queryParam.${po.fieldName}"></a-input>
</#if>
<#else>
<#if query_field_no gt 1> </#if><a-input placeholder="请输入${po.filedComment}" v-model:value="queryParam.${po.fieldName}"></a-input>
<#if query_field_no gt 1> </#if><a-input placeholder="请输入${po.filedComment}" v-model:value="queryParam.${autoStringSuffixForModel(po)}"></a-input>
</#if>
<#if query_field_no gt 1> </#if></a-form-item>
<#if query_field_no gt 1> </#if></a-col>
Expand All @@ -69,17 +71,45 @@
<#if query_field_no gt 1> </#if><a-form-item>
<#if query_field_no gt 1> </#if><template #label><span title="${po.filedComment}"><#if po.filedComment?default("")?trim?length gt 4>${po.filedComment?substring(0,4)}<#else>${po.filedComment}</#if></span></template>
<#if po.classType=='date'>
<#if query_field_no gt 1> </#if><a-date-picker value-format="YYYY-MM-DD" placeholder="请选择开始时间" v-model:value="queryParam.${po.fieldName}_begin" class="query-group-cust"/>
<#if query_field_no gt 1> </#if><span class="query-group-split-cust">~</span>
<#if query_field_no gt 1> </#if><a-date-picker value-format="YYYY-MM-DD" placeholder="请选择结束日期" v-model:value="queryParam.${po.fieldName}_end" class="query-group-cust"/>
<#if query_field_no gt 1> </#if><div style="display: flex">
<#if query_field_no gt 1> </#if><a-form-item name="${po.fieldName}_begin" style="margin-bottom: 0;">
<#if query_field_no gt 1> </#if><a-date-picker value-format="YYYY-MM-DD" placeholder="请选择开始日期" v-model:value="queryParam.${po.fieldName}_begin" class="query-group-cust"/>
<#if query_field_no gt 1> </#if></a-form-item>
<#if query_field_no gt 1> </#if><span class="query-group-split-cust">~</span>
<#if query_field_no gt 1> </#if><a-form-item name="${po.fieldName}_end" style="margin-bottom: 0;">
<#if query_field_no gt 1> </#if><a-date-picker value-format="YYYY-MM-DD" placeholder="请选择结束日期" v-model:value="queryParam.${po.fieldName}_end" class="query-group-cust"/>
<#if query_field_no gt 1> </#if></a-form-item>
<#if query_field_no gt 1> </#if></div>
<#elseif po.classType=='time'>
<#if query_field_no gt 1> </#if><div style="display: flex">
<#if query_field_no gt 1> </#if><a-form-item name="${po.fieldName}_begin" style="margin-bottom: 0;">
<#if query_field_no gt 1> </#if><time-picker value-format="HH:mm:ss" placeholder="请选择开始时间" v-model:value="queryParam.${po.fieldName}_begin" class="query-group-cust"/>
<#if query_field_no gt 1> </#if></a-form-item>
<#if query_field_no gt 1> </#if><span class="query-group-split-cust">~</span>
<#if query_field_no gt 1> </#if><a-form-item name="${po.fieldName}_end" style="margin-bottom: 0;">
<#if query_field_no gt 1> </#if><time-picker value-format="HH:mm:ss" placeholder="请选择结束日期" v-model:value="queryParam.${po.fieldName}_end" class="query-group-cust"/>
<#if query_field_no gt 1> </#if></a-form-item>
<#if query_field_no gt 1> </#if></div>
<#elseif po.classType=='datetime'>
<#if query_field_no gt 1> </#if><a-date-picker showTime value-format="YYYY-MM-DD HH:mm:ss" placeholder="请选择开始时间" v-model:value="queryParam.${po.fieldName}_begin" class="query-group-cust" />
<#if query_field_no gt 1> </#if><span class="query-group-split-cust">~</span>
<#if query_field_no gt 1> </#if><a-date-picker showTime value-format="YYYY-MM-DD HH:mm:ss" placeholder="请选择结束时间" v-model:value="queryParam.${po.fieldName}_end" class="query-group-cust" />
<#if query_field_no gt 1> </#if><div style="display: flex">
<#if query_field_no gt 1> </#if><a-form-item name="${po.fieldName}_begin" style="margin-bottom: 0;">
<#if query_field_no gt 1> </#if><a-date-picker showTime value-format="YYYY-MM-DD HH:mm:ss" placeholder="请选择开始时间" v-model:value="queryParam.${po.fieldName}_begin" class="query-group-cust" />
<#if query_field_no gt 1> </#if></a-form-item>
<#if query_field_no gt 1> </#if><span class="query-group-split-cust">~</span>
<#if query_field_no gt 1> </#if><a-form-item name="${po.fieldName}_end" style="margin-bottom: 0;">
<#if query_field_no gt 1> </#if><a-date-picker showTime value-format="YYYY-MM-DD HH:mm:ss" placeholder="请选择结束时间" v-model:value="queryParam.${po.fieldName}_end" class="query-group-cust" />
<#if query_field_no gt 1> </#if></a-form-item>
<#if query_field_no gt 1> </#if></div>
<#else>
<#if query_field_no gt 1> </#if><a-input placeholder="请输入最小值" v-model:value="queryParam.${po.fieldName}_begin" class="query-group-cust"></a-input>
<#if query_field_no gt 1> </#if><span class="query-group-split-cust">~</span>
<#if query_field_no gt 1> </#if><a-input placeholder="请输入最大值" v-model:value="queryParam.${po.fieldName}_end" class="query-group-cust"></a-input>
<#if query_field_no gt 1> </#if><div style="display: flex">
<#if query_field_no gt 1> </#if><a-form-item name="${po.fieldName}_begin" style="margin-bottom: 0;">
<#if query_field_no gt 1> </#if><a-input placeholder="请输入最小值" v-model:value="queryParam.${po.fieldName}_begin" class="query-group-cust"></a-input>
<#if query_field_no gt 1> </#if></a-form-item>
<#if query_field_no gt 1> </#if><span class="query-group-left query-group-split-cust">~</span>
<#if query_field_no gt 1> </#if><a-form-item name="${po.fieldName}_end" style="margin-bottom: 0;">
<#if query_field_no gt 1> </#if><a-input placeholder="请输入最大值" v-model:value="queryParam.${po.fieldName}_end" class="query-group-cust"></a-input>
<#if query_field_no gt 1> </#if></a-form-item>
<#if query_field_no gt 1> </#if></div>
</#if>
<#if query_field_no gt 1> </#if></a-form-item>
<#if query_field_no gt 1> </#if></a-col>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -329,13 +329,13 @@
}
</#if>

<#if need_pca>
<#if need_pca || need_dept_user>
/**
* 省市区点击事件
* form点击事件(以逗号分割)
* @param key
* @param value
*/
function handleAreaChange(key, value) {
function handleFormJoinChange(key, value) {
queryParam[key] = value.join(',');
}
</#if>
Expand Down Expand Up @@ -397,7 +397,6 @@
white-space: nowrap;
}
.query-group-cust{
width: calc(50% - 15px);
min-width: 100px !important;
}
.query-group-split-cust{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -212,8 +212,8 @@

<style lang="less" scoped>
.antd-modal-form {
min-height: 500px !important;
height: 500px !important;
overflow-y: auto;
padding: 24px 24px 24px 24px;
padding: 14px;
}
</style>
Original file line number Diff line number Diff line change
Expand Up @@ -501,14 +501,14 @@
}
</#if>

<#if need_pca>
<#if need_pca || need_dept_user>
/**
* 省市区点击事件
* form点击事件(以逗号分割)
* @param key
* @param value
*/
function handleAreaChange(key, value) {
queryParam.value[key] = value.join(',');
function handleFormJoinChange(key, value) {
queryParam[key] = value.join(',');
}
</#if>

Expand Down Expand Up @@ -554,7 +554,6 @@
white-space: nowrap;
}
.query-group-cust{
width: calc(50% - 15px);
min-width: 100px !important;
}
.query-group-split-cust{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,7 @@
.then(async (res) => {
if (res.success) {
await getExpandKeysByPid(formData['${pidFieldName}'], unref(treeData));
delete formData['children'];
emit('ok', {
isUpdate: unref(isUpdate),
values: { ...formData },
Expand Down Expand Up @@ -263,8 +264,8 @@

<style lang="less" scoped>
.antd-modal-form {
min-height: 500px !important;
height: 500px !important;
overflow-y: auto;
padding: 24px 24px 24px 24px;
padding: 14px;
}
</style>
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,10 @@
<span v-if="!text" style="font-size: 12px;font-style: italic;">无文件</span>
<a-button v-else :ghost="true" type="primary" preIcon="ant-design:download-outlined" size="small" @click="downloadFile(text)">下载</a-button>
</#if>
<#if po.classType=='pca'>
<!--省市区字段回显插槽-->
{{ getAreaTextByCode(text) }}
</#if>
</template>
</#if>
</#list>
Expand Down Expand Up @@ -393,13 +397,13 @@
}
</#if>

<#if need_pca>
<#if need_pca || need_dept_user>
/**
* 省市区点击事件
* form点击事件(以逗号分割)
* @param key
* @param value
*/
function handleAreaChange(key, value) {
function handleFormJoinChange(key, value) {
queryParam[key] = value.join(',');
}
</#if>
Expand All @@ -413,7 +417,6 @@
white-space: nowrap;
}
.query-group-cust{
width: calc(50% - 15px);
min-width: 100px !important;
}
.query-group-split-cust{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,10 @@
<span v-if="!text" style="font-size: 12px;font-style: italic;">无文件</span>
<a-button v-else :ghost="true" type="primary" preIcon="ant-design:download-outlined" size="small" @click="downloadFile(text)">下载</a-button>
</#if>
<#if po.classType=='pca'>
<!--省市区字段回显插槽-->
{{ getAreaTextByCode(text) }}
</#if>
</template>
</#if>
</#list>
Expand Down Expand Up @@ -138,7 +142,7 @@
*/
async function handleEdit(record: Recordable) {
registerModal.value.disableSubmit = false;
registerModal.value.edit();
registerModal.value.edit(record);
}

/**
Expand Down Expand Up @@ -227,7 +231,6 @@
white-space: nowrap;
}
.query-group-cust{
width: calc(50% - 15px);
min-width: 100px !important;
}
.query-group-split-cust{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -211,8 +211,8 @@

<style lang="less" scoped>
.antd-modal-form {
min-height: 500px !important;
height: 500px !important;
overflow-y: auto;
padding: 24px 24px 24px 24px;
padding: 14px;
}
</style>
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
<#assign hasOnlyValidate = false>
<template>
<a-spin :spinning="confirmLoading">
<a-form v-bind="formItemLayout" ref="formRef">
<a-form class="antd-modal-form" v-bind="formItemLayout" ref="formRef">
<a-row>
<#list sub.colums as po>
<#if po.isShow == 'Y' && po.fieldValidType?default("") == 'only'>
Expand Down Expand Up @@ -186,9 +186,9 @@

<style lang="less" scoped>
.antd-modal-form {
min-height: 500px !important;
height: 500px !important;
overflow-y: auto;
padding: 24px 24px 24px 24px;
padding: 14px;
}
</style>
</#list>
Original file line number Diff line number Diff line change
Expand Up @@ -376,13 +376,13 @@
}
</#if>

<#if need_pca>
<#if need_pca || need_dept_user>
/**
* 省市区点击事件
* form点击事件(以逗号分割)
* @param key
* @param value
*/
function handleAreaChange(key, value) {
function handleFormJoinChange(key, value) {
queryParam[key] = value.join(',');
}
</#if>
Expand All @@ -396,7 +396,6 @@
white-space: nowrap;
}
.query-group-cust{
width: calc(50% - 15px);
min-width: 100px !important;
}
.query-group-split-cust{
Expand Down

0 comments on commit 8216889

Please sign in to comment.