浏览代码

模板代码注释

yangll 3 年之前
父节点
当前提交
0ce2cad6a2

+ 57 - 51
tnc-generate/src/main/resources/jeecg/code-template-online/default/two/java/${bussiPackage}/${entityPackage}/vue/${entityName}List.vuei

@@ -20,16 +20,22 @@
 <#assign list_need_pca=false>
 <#-- 是否需要,开关  -->
 <#assign list_need_switch=false>
-<#macro addSpace1>
-123
+<#-- 是否需要,缩进  -->
+<#assign indent_flag=false>
+<#-- 缩进宏代码  -->
+<#macro indent>
+<#if indent_flag=true>  </#if><#t>
 </#macro>
+
 <#-- 开始-遍历字段 -->
 <#list columns as po>
 <#if po.isQuery=='Y'>
 <#t>
 <#-- 开始-字段一列 -->
 <#assign query_flag=true>
+  <#-- 超过指定查询字段数,折叠剩余查询字段  -->
   <#if query_field_no==2>
+    <#assign indent_flag=true>
           <template v-if="toggleSearchStatus">
   </#if>
   <#-- 开始-字段的字典值 -->
@@ -41,61 +47,61 @@
   </#if>
   <#-- 结束-字段的字典值 -->
 	<#if po.queryMode=='single'>
-          <#if query_field_no gt 1>  </#if><a-col :xl="6" :lg="7" :md="8" :sm="24">
-            <#if query_field_no gt 1>  </#if><a-form-item label="${po.filedComment}">
+          <@indent/><a-col :xl="6" :lg="7" :md="8" :sm="24">
+            <@indent/><a-form-item label="${po.filedComment}">
             <#if po.classType=='sel_search'>
-              <#if query_field_no gt 1>  </#if><j-search-select-tag placeholder="请选择${po.filedComment}" v-model="queryParam.${po.fieldName}" dict="${po.dictTable},${po.dictText},${po.dictField}"/>
+              <@indent/><j-search-select-tag placeholder="请选择${po.filedComment}" v-model="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-dep placeholder="请选择${po.filedComment}" v-model="queryParam.${po.fieldName}"/>
+              <@indent/><j-select-user-by-dep placeholder="请选择${po.filedComment}" v-model="queryParam.${po.fieldName}"/>
             <#elseif po.classType=='switch'>
-              <#if query_field_no gt 1>  </#if><j-switch placeholder="请选择${po.filedComment}" v-model="queryParam.${po.fieldName}" <#if po.dictField!= 'is_open'>:options="${po.dictField}"</#if> query></j-switch>
+              <@indent/><j-switch placeholder="请选择${po.filedComment}" v-model="queryParam.${po.fieldName}" <#if po.dictField!= 'is_open'>:options="${po.dictField}"</#if> query></j-switch>
             <#elseif po.classType=='sel_depart'>
-              <#if query_field_no gt 1>  </#if><j-select-depart placeholder="请选择${po.filedComment}" v-model="queryParam.${po.fieldName}"/>
+              <@indent/><j-select-depart placeholder="请选择${po.filedComment}" v-model="queryParam.${po.fieldName}"/>
             <#elseif po.classType=='list_multi'>
-              <#if query_field_no gt 1>  </#if><j-multi-select-tag placeholder="请选择${po.filedComment}" dictCode="${query_field_dictCode?default("")}" v-model="queryParam.${po.fieldName}"/>
+              <@indent/><j-multi-select-tag placeholder="请选择${po.filedComment}" dictCode="${query_field_dictCode?default("")}" v-model="queryParam.${po.fieldName}"/>
             <#elseif po.classType=='cat_tree'>
-              <#if query_field_no gt 1>  </#if><j-category-select placeholder="请选择${po.filedComment}" v-model="queryParam.${po.fieldName}" pcode="${po.dictField?default("")}"/>
-			<#elseif po.classType=='date'>
-              <#if query_field_no gt 1>  </#if><j-date placeholder="请选择${po.filedComment}" v-model="queryParam.${po.fieldName}"></j-date>
-			<#elseif po.classType=='datetime'>
-              <#if query_field_no gt 1>  </#if><j-date :show-time="true" date-format="YYYY-MM-DD HH:mm:ss" placeholder="请选择${po.filedComment}" v-model="queryParam.${po.fieldName}"></j-date>
+              <@indent/><j-category-select placeholder="请选择${po.filedComment}" v-model="queryParam.${po.fieldName}" pcode="${po.dictField?default("")}"/>
+			      <#elseif po.classType=='date'>
+              <@indent/><j-date placeholder="请选择${po.filedComment}" v-model="queryParam.${po.fieldName}"></j-date>
+			      <#elseif po.classType=='datetime'>
+              <@indent/><j-date :show-time="true" date-format="YYYY-MM-DD HH:mm:ss" placeholder="请选择${po.filedComment}" v-model="queryParam.${po.fieldName}"></j-date>
             <#elseif po.classType=='pca'>
-              <#if query_field_no gt 1>  </#if><j-area-linkage type="cascader" v-model="queryParam.${po.fieldName}" placeholder="请选择省市区"/>
+              <@indent/><j-area-linkage type="cascader" v-model="queryParam.${po.fieldName}" placeholder="请选择省市区"/>
             <#elseif po.classType=='popup'>
-              <#if query_field_no gt 1>  </#if><j-popup placeholder="请选择${po.filedComment}" v-model="queryParam.${po.fieldName}" code="${po.dictTable}" org-fields="${po.dictField}" dest-fields="${po.dictText}" :field="getPopupField('${po.dictText}')" :multi="${po.extendParams.popupMulti?c}"/>
-			<#elseif po.classType=='list' || po.classType=='radio' || po.classType=='checkbox'>
-			<#--  ---------------------------下拉或是单选 判断数据字典是表字典还是普通字典------------------------------- -->
-			<#if po.dictTable?default("")?trim?length gt 1>
-              <#if query_field_no gt 1>  </#if><j-dict-select-tag placeholder="请选择${po.filedComment}" v-model="queryParam.${po.fieldName}" dictCode="${po.dictTable},${po.dictText},${po.dictField}"/>
-			<#elseif po.dictField?default("")?trim?length gt 1>
-              <#if query_field_no gt 1>  </#if><j-dict-select-tag placeholder="请选择${po.filedComment}" v-model="queryParam.${po.fieldName}" dictCode="${po.dictField}"/>
-			<#else>
-              <#if query_field_no gt 1>  </#if><a-input placeholder="请输入${po.filedComment}" v-model="queryParam.${po.fieldName}"></a-input>
-			</#if>
-			<#else>
-<#--              <#if query_field_no gt 1>  </#if><a-input placeholder="请输入${po.filedComment}" v-model="queryParam.${po.fieldName}"></a-input>-->
-              <@addSpace2 count=query_field_no /><a-input placeholder="请输入3${po.filedComment}" v-model="queryParam.${po.fieldName}"></a-input>
-			</#if>
-            <#if query_field_no gt 1>  </#if></a-form-item>
-          <#if query_field_no gt 1>  </#if></a-col>
+              <@indent/><j-popup placeholder="请选择${po.filedComment}" v-model="queryParam.${po.fieldName}" code="${po.dictTable}" org-fields="${po.dictField}" dest-fields="${po.dictText}" :field="getPopupField('${po.dictText}')" :multi="${po.extendParams.popupMulti?c}"/>
+			      <#elseif po.classType=='list' || po.classType=='radio' || po.classType=='checkbox'>
+			        <#--  开始-下拉或是单选 判断数据字典是表字典还是普通字典 -->
+			        <#if po.dictTable?default("")?trim?length gt 1>
+              <@indent/><j-dict-select-tag placeholder="请选择${po.filedComment}" v-model="queryParam.${po.fieldName}" dictCode="${po.dictTable},${po.dictText},${po.dictField}"/>
+			        <#elseif po.dictField?default("")?trim?length gt 1>
+              <@indent/><j-dict-select-tag placeholder="请选择${po.filedComment}" v-model="queryParam.${po.fieldName}" dictCode="${po.dictField}"/>
+			        <#else>
+              <@indent/><a-input placeholder="请输入${po.filedComment}" v-model="queryParam.${po.fieldName}"></a-input>
+			        </#if>
+              <#--  结束-下拉或是单选 判断数据字典是表字典还是普通字典 -->
+			      <#else>
+              <@indent/><a-input placeholder="请输入${po.filedComment}" v-model="queryParam.${po.fieldName}"></a-input>
+			      </#if>
+            <@indent/></a-form-item>
+          <@indent/></a-col>
 	<#else>
-          <#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}">
+          <@indent/><a-col :xl="10" :lg="11" :md="12" :sm="24">
+            <@indent/><a-form-item label="${po.filedComment}">
 			<#if po.classType=='date'>
-              <#if query_field_no gt 1>  </#if><j-date placeholder="请选择开始日期" class="query-group-cust" v-model="queryParam.${po.fieldName}_begin"></j-date>
-              <#if query_field_no gt 1>  </#if><span class="query-group-split-cust"></span>
-              <#if query_field_no gt 1>  </#if><j-date placeholder="请选择结束日期" class="query-group-cust" v-model="queryParam.${po.fieldName}_end"></j-date>
+              <@indent/><j-date placeholder="请选择开始日期" class="query-group-cust" v-model="queryParam.${po.fieldName}_begin"></j-date>
+              <@indent/><span class="query-group-split-cust"></span>
+              <@indent/><j-date placeholder="请选择结束日期" class="query-group-cust" v-model="queryParam.${po.fieldName}_end"></j-date>
 			<#elseif po.classType=='datetime'>
-              <#if query_field_no gt 1>  </#if><j-date :show-time="true" date-format="YYYY-MM-DD HH:mm:ss" placeholder="请选择开始时间" class="query-group-cust" v-model="queryParam.${po.fieldName}_begin"></j-date>
-              <#if query_field_no gt 1>  </#if><span class="query-group-split-cust"></span>
-              <#if query_field_no gt 1>  </#if><j-date :show-time="true" date-format="YYYY-MM-DD HH:mm:ss" placeholder="请选择结束时间" class="query-group-cust" v-model="queryParam.${po.fieldName}_end"></j-date>
+              <@indent/><j-date :show-time="true" date-format="YYYY-MM-DD HH:mm:ss" placeholder="请选择开始时间" class="query-group-cust" v-model="queryParam.${po.fieldName}_begin"></j-date>
+              <@indent/><span class="query-group-split-cust"></span>
+              <@indent/><j-date :show-time="true" date-format="YYYY-MM-DD HH:mm:ss" placeholder="请选择结束时间" class="query-group-cust" v-model="queryParam.${po.fieldName}_end"></j-date>
 			<#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><span class="query-group-split-cust"></span>
-              <#if query_field_no gt 1>  </#if><a-input placeholder="请输入最大值" class="query-group-cust" v-model="queryParam.${po.fieldName}_end"></a-input>
+              <@indent/><a-input placeholder="请输入最小值" class="query-group-cust" v-model="queryParam.${po.fieldName}_begin"></a-input>
+              <@indent/><span class="query-group-split-cust"></span>
+              <@indent/><a-input placeholder="请输入最大值" class="query-group-cust" v-model="queryParam.${po.fieldName}_end"></a-input>
 			</#if>
-            <#if query_field_no gt 1>  </#if></a-form-item>
-          <#if query_field_no gt 1>   </#if></a-col>
+            <@indent/></a-form-item>
+          <@indent/></a-col>
 	</#if>
 <#assign query_field_no=query_field_no+1>
 </#if>
@@ -125,10 +131,11 @@
 <#-- 结束-遍历字段 -->
 <#t>
 
-<#if query_field_no gt 2>
+<#if indent_flag=true>
           </template>
 </#if>
-
+<#t>
+<#-- 开始-查询按钮 -->
 <#if query_flag>
           <a-col :xl="6" :lg="7" :md="8" :sm="24">
             <span style="float: left;overflow: hidden;" class="table-page-search-submitButtons">
@@ -141,6 +148,7 @@
             </span>
           </a-col>
 </#if>
+<#-- 结束-查询按钮 -->
         </a-row>
       </a-form>
     </div>
@@ -232,7 +240,7 @@
 
       </a-table>
     </div>
-
+    <#-- 使用格式化工具类转换 -->
     <${Format.humpToShortbar(entityName)}-modal ref="modalForm" @ok="modalFormOk"></${Format.humpToShortbar(entityName)}-modal>
   </a-card>
 </template>
@@ -342,6 +350,7 @@
           importExcelUrl: "${entityPackage}/${entityName?uncap_first}/importExcel",
         },
         dictOptions:{},
+        <#-- 省市区 -->
         <#if list_need_pca>
         pcaData:'',
         </#if>
@@ -396,6 +405,7 @@
       </#if>
       </#list>
       },
+      <#-- 高级查询 -->
       getSuperFieldList(){
         let fieldList=[];
          <#list columns as po>
@@ -410,7 +420,3 @@
   @import '~@assets/less/common.less';
 </style>
 
-<#macro addSpace2 count>
-${count}
-<#if count gt 1>  123</#if>
-</#macro>