Commit 9d68c621776585567f5bc42f130cce74fe4a5fdf

Authored by xingyu
1 parent 912e1885

refactor: vben dict

yudao-module-infra/yudao-module-infra-biz/src/main/resources/codegen/vue3_vben/views/data.ts.vm
1 import { BasicColumn, FormSchema, useRender } from '@/components/Table' 1 import { BasicColumn, FormSchema, useRender } from '@/components/Table'
2 -import { DICT_TYPE, getIntDictOptions } from '@/utils/dict' 2 +import { DICT_TYPE, getDictOpts } from '@/utils/dict'
3 3
4 export const columns: BasicColumn[] = [ 4 export const columns: BasicColumn[] = [
5 #foreach($column in $columns) 5 #foreach($column in $columns)
@@ -53,14 +53,7 @@ export const searchFormSchema: FormSchema[] = [ @@ -53,14 +53,7 @@ export const searchFormSchema: FormSchema[] = [
53 component: 'Select', 53 component: 'Select',
54 componentProps: { 54 componentProps: {
55 #if ("" != $dictType)## 设置了 dictType 数据字典的情况 55 #if ("" != $dictType)## 设置了 dictType 数据字典的情况
56 - #if ($javaType == "Integer" || $javaType == "Long" || $javaType == "Byte" || $javaType == "Short")  
57 - #set ($dictMethod = "getIntDictOptions")  
58 - #elseif ($javaType == "String")  
59 - #set ($dictMethod = "getStrDictOptions")  
60 - #elseif ($javaType == "Boolean")  
61 - #set ($dictMethod = "getBoolDictOptions")  
62 - #end  
63 - options: $dictMethod(DICT_TYPE.$dictType.toUpperCase()) 56 + options: getDictOpts(DICT_TYPE.$dictType.toUpperCase())
64 #else## 未设置 dictType 数据字典的情况 57 #else## 未设置 dictType 数据字典的情况
65 options: [] 58 options: []
66 #end 59 #end
@@ -114,14 +107,7 @@ export const createFormSchema: FormSchema[] = [ @@ -114,14 +107,7 @@ export const createFormSchema: FormSchema[] = [
114 component: 'Select', 107 component: 'Select',
115 componentProps: { 108 componentProps: {
116 #if ("" != $dictType)## 有数据字典 109 #if ("" != $dictType)## 有数据字典
117 - #if ($javaType == "Integer" || $javaType == "Long" || $javaType == "Byte" || $javaType == "Short")  
118 - #set ($dictMethod = "getIntDictOptions")  
119 - #elseif ($javaType == "String")  
120 - #set ($dictMethod = "getStrDictOptions")  
121 - #elseif ($javaType == "Boolean")  
122 - #set ($dictMethod = "getBoolDictOptions")  
123 - #end  
124 - options: $dictMethod(DICT_TYPE.$dictType.toUpperCase()) 110 + options: getDictOpts(DICT_TYPE.$dictType.toUpperCase())
125 #else##没数据字典 111 #else##没数据字典
126 options:[] 112 options:[]
127 #end 113 #end
@@ -130,7 +116,7 @@ export const createFormSchema: FormSchema[] = [ @@ -130,7 +116,7 @@ export const createFormSchema: FormSchema[] = [
130 component: 'Checkbox', 116 component: 'Checkbox',
131 componentProps: { 117 componentProps: {
132 #if ("" != $dictType)## 有数据字典 118 #if ("" != $dictType)## 有数据字典
133 - options: getIntDictOptions(DICT_TYPE.COMMON_STATUS) 119 + options: getDictOpts(DICT_TYPE.$dictType.toUpperCase())
134 #else##没数据字典 120 #else##没数据字典
135 options:[] 121 options:[]
136 #end 122 #end
@@ -139,7 +125,7 @@ export const createFormSchema: FormSchema[] = [ @@ -139,7 +125,7 @@ export const createFormSchema: FormSchema[] = [
139 component: 'Radio', 125 component: 'Radio',
140 componentProps: { 126 componentProps: {
141 #if ("" != $dictType)## 有数据字典 127 #if ("" != $dictType)## 有数据字典
142 - options: getIntDictOptions(DICT_TYPE.COMMON_STATUS) 128 + options: getDictOpts(DICT_TYPE.$dictType.toUpperCase())
143 #else##没数据字典 129 #else##没数据字典
144 options:[] 130 options:[]
145 #end 131 #end
@@ -187,14 +173,7 @@ export const updateFormSchema: FormSchema[] = [ @@ -187,14 +173,7 @@ export const updateFormSchema: FormSchema[] = [
187 component: 'Select', 173 component: 'Select',
188 componentProps: { 174 componentProps: {
189 #if ("" != $dictType)## 有数据字典 175 #if ("" != $dictType)## 有数据字典
190 - #if ($javaType == "Integer" || $javaType == "Long" || $javaType == "Byte" || $javaType == "Short")  
191 - #set ($dictMethod = "getIntDictOptions")  
192 - #elseif ($javaType == "String")  
193 - #set ($dictMethod = "getStrDictOptions")  
194 - #elseif ($javaType == "Boolean")  
195 - #set ($dictMethod = "getBoolDictOptions")  
196 - #end  
197 - options: $dictMethod(DICT_TYPE.$dictType.toUpperCase()) 176 + options: getDictOpts(DICT_TYPE.$dictType.toUpperCase())
198 #else##没数据字典 177 #else##没数据字典
199 options:[] 178 options:[]
200 #end 179 #end
@@ -203,7 +182,7 @@ export const updateFormSchema: FormSchema[] = [ @@ -203,7 +182,7 @@ export const updateFormSchema: FormSchema[] = [
203 component: 'Checkbox', 182 component: 'Checkbox',
204 componentProps: { 183 componentProps: {
205 #if ("" != $dictType)## 有数据字典 184 #if ("" != $dictType)## 有数据字典
206 - options: getIntDictOptions(DICT_TYPE.COMMON_STATUS) 185 + options: getDictOpts(DICT_TYPE.$dictType.toUpperCase())
207 #else##没数据字典 186 #else##没数据字典
208 options:[] 187 options:[]
209 #end 188 #end
@@ -212,7 +191,7 @@ export const updateFormSchema: FormSchema[] = [ @@ -212,7 +191,7 @@ export const updateFormSchema: FormSchema[] = [
212 component: 'Radio', 191 component: 'Radio',
213 componentProps: { 192 componentProps: {
214 #if ("" != $dictType)## 有数据字典 193 #if ("" != $dictType)## 有数据字典
215 - options: getIntDictOptions(DICT_TYPE.COMMON_STATUS) 194 + options: getDictOpts(DICT_TYPE.$dictType.toUpperCase())
216 #else##没数据字典 195 #else##没数据字典
217 options:[] 196 options:[]
218 #end 197 #end