mirror of
				https://github.com/YunaiV/ruoyi-vue-pro.git
				synced 2025-10-31 10:37:41 +08:00 
			
		
		
		
	代码生成:完善 Vue3 标准模版的列表
This commit is contained in:
		| @ -1,11 +1,19 @@ | |||||||
| <template> | <template> | ||||||
|   <content-wrap> |   <content-wrap> | ||||||
|     <!-- 搜索工作栏 --> |     <!-- 搜索工作栏 --> | ||||||
|     <el-form class="-mb-15px" :model="queryParams" ref="queryFormRef" :inline="true"> |     <el-form | ||||||
|  |       class="-mb-15px" | ||||||
|  |       :model="queryParams" | ||||||
|  |       ref="queryFormRef" | ||||||
|  |       :inline="true" | ||||||
|  |       label-width="68px" | ||||||
|  |     > | ||||||
|  |     #set ($dictMethods = []) ## 使用到的 dict 字典方法 | ||||||
|     #foreach($column in $columns) |     #foreach($column in $columns) | ||||||
|       #if ($column.listOperation) |       #if ($column.listOperation) | ||||||
|         #set ($dictType = $column.dictType) |         #set ($dictType = $column.dictType) | ||||||
|         #set ($javaField = $column.javaField) |         #set ($javaField = $column.javaField) | ||||||
|  |         #set ($javaType = $column.javaType) | ||||||
|         #set ($AttrName = $column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)}) |         #set ($AttrName = $column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)}) | ||||||
|         #set ($comment = $column.columnComment) |         #set ($comment = $column.columnComment) | ||||||
|         #if ($column.htmlType == "input") |         #if ($column.htmlType == "input") | ||||||
| @ -15,15 +23,31 @@ | |||||||
|           placeholder="请输入${comment}" |           placeholder="请输入${comment}" | ||||||
|           clearable |           clearable | ||||||
|           @keyup.enter="handleQuery" |           @keyup.enter="handleQuery" | ||||||
|  |           class="!w-240px" | ||||||
|         /> |         /> | ||||||
|       </el-form-item> |       </el-form-item> | ||||||
|     #elseif ($column.htmlType == "select" || $column.htmlType == "radio") |     #elseif ($column.htmlType == "select" || $column.htmlType == "radio") | ||||||
|       <el-form-item label="${comment}" prop="${javaField}"> |       <el-form-item label="${comment}" prop="${javaField}"> | ||||||
|         <el-select v-model="queryParams.${javaField}" placeholder="请选择${comment}" clearable> |         <el-select | ||||||
|  |           v-model="queryParams.${javaField}" | ||||||
|  |           placeholder="请选择${comment}" | ||||||
|  |           clearable | ||||||
|  |           class="!w-240px" | ||||||
|  |         > | ||||||
|           #if ("" != $dictType)## 设置了 dictType 数据字典的情况 |           #if ("" != $dictType)## 设置了 dictType 数据字典的情况 | ||||||
|           <!-- TODO 芋艿:需要考虑不同类型的处理 --> |               #set ($dictMethod = "getDictOptions") ## 计算使用哪个 dict 字典方法 | ||||||
|  |               #if ($javaType == "Integer" || $javaType == "Long" || $javaType == "Byte" || $javaType == "Short") | ||||||
|  |                 #set ($dictMethod = "getIntDictOptions") | ||||||
|  |               #elseif ($javaType == "String") | ||||||
|  |                 #set ($dictMethod = "getStrDictOptions") | ||||||
|  |               #elseif ($javaType == "Boolean") | ||||||
|  |                 #set ($dictMethod = "getBoolDictOptions") | ||||||
|  |               #end | ||||||
|  |               #if (!$dictMethods.contains($dictMethod)) ## 如果不存在,则添加到 dictMethods 数组中,后续好 import | ||||||
|  |                   #( $dictMethods.add($dictMethod) ) | ||||||
|  |               #end | ||||||
|           <el-option |           <el-option | ||||||
|             v-for="dict in getDictDatas(DICT_TYPE.$dictType.toUpperCase())" |             v-for="dict in $dictMethod(DICT_TYPE.$dictType.toUpperCase())" | ||||||
|             :key="dict.value" |             :key="dict.value" | ||||||
|             :label="dict.label" |             :label="dict.label" | ||||||
|             :value="dict.value" |             :value="dict.value" | ||||||
| @ -42,6 +66,7 @@ | |||||||
|           type="date" |           type="date" | ||||||
|           placeholder="选择${comment}" |           placeholder="选择${comment}" | ||||||
|           clearable |           clearable | ||||||
|  |           class="!w-240px" | ||||||
|         /> |         /> | ||||||
|       </el-form-item> |       </el-form-item> | ||||||
|       #else## 范围 |       #else## 范围 | ||||||
| @ -53,6 +78,7 @@ | |||||||
|           start-placeholder="开始日期" |           start-placeholder="开始日期" | ||||||
|           end-placeholder="结束日期" |           end-placeholder="结束日期" | ||||||
|           :default-time="[new Date('1 00:00:00'), new Date('1 23:59:59')]" |           :default-time="[new Date('1 00:00:00'), new Date('1 23:59:59')]" | ||||||
|  |           class="!w-240px" | ||||||
|         /> |         /> | ||||||
|       </el-form-item> |       </el-form-item> | ||||||
|       #end |       #end | ||||||
| @ -137,7 +163,9 @@ | |||||||
| </template> | </template> | ||||||
|  |  | ||||||
| <script setup lang="ts" name="${simpleClassName}"> | <script setup lang="ts" name="${simpleClassName}"> | ||||||
| import { DICT_TYPE, getDictOptions } from '@/utils/dict' | #if ($dictMethods.size() > 0) | ||||||
|  | import { DICT_TYPE#foreach ($dictMethod in $dictMethods), ${dictMethod}#end } from '@/utils/dict' | ||||||
|  | #end | ||||||
| import { dateFormatter } from '@/utils/formatTime' | import { dateFormatter } from '@/utils/formatTime' | ||||||
| import download from '@/utils/download' | import download from '@/utils/download' | ||||||
| import * as ${simpleClassName}Api from '@/api/${table.moduleName}/${classNameVar}' | import * as ${simpleClassName}Api from '@/api/${table.moduleName}/${classNameVar}' | ||||||
| @ -151,13 +179,19 @@ const list = ref([]) // 列表的数据 | |||||||
| const queryParams = reactive({ | const queryParams = reactive({ | ||||||
|   pageNo: 1, |   pageNo: 1, | ||||||
|   pageSize: 10, |   pageSize: 10, | ||||||
|  |   #set ($listOperationLastIndex = -1) ## 求最后一个需要 , 的地方 | ||||||
|  |   #foreach ($column in $columns) | ||||||
|  |     #if ($column.listOperation) | ||||||
|  |       #set ($listOperationLastIndex = $foreach.index) | ||||||
|  |     #end | ||||||
|  |   #end | ||||||
|   #foreach ($column in $columns) |   #foreach ($column in $columns) | ||||||
|     #if ($column.listOperation) |     #if ($column.listOperation) | ||||||
|       #if ($column.listOperationCondition != 'BETWEEN') |       #if ($column.listOperationCondition != 'BETWEEN') | ||||||
|   $column.javaField: null, |   $column.javaField: null#if($foreach.index < $listOperationLastIndex),#end | ||||||
|   #end |   #end | ||||||
|       #if ($column.htmlType == "datetime" || $column.listOperationCondition == "BETWEEN") |       #if ($column.htmlType == "datetime" || $column.listOperationCondition == "BETWEEN") | ||||||
|   $column.javaField: [], |   $column.javaField: []#if($foreach.index < $listOperationLastIndex),#end | ||||||
|       #end |       #end | ||||||
|     #end |     #end | ||||||
|   #end |   #end | ||||||
|  | |||||||
		Reference in New Issue
	
	Block a user
	 YunaiV
					YunaiV