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 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 4 export const columns: BasicColumn[] = [
5 5 #foreach($column in $columns)
... ... @@ -53,14 +53,7 @@ export const searchFormSchema: FormSchema[] = [
53 53 component: 'Select',
54 54 componentProps: {
55 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 57 #else## 未设置 dictType 数据字典的情况
65 58 options: []
66 59 #end
... ... @@ -114,14 +107,7 @@ export const createFormSchema: FormSchema[] = [
114 107 component: 'Select',
115 108 componentProps: {
116 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 111 #else##没数据字典
126 112 options:[]
127 113 #end
... ... @@ -130,7 +116,7 @@ export const createFormSchema: FormSchema[] = [
130 116 component: 'Checkbox',
131 117 componentProps: {
132 118 #if ("" != $dictType)## 有数据字典
133   - options: getIntDictOptions(DICT_TYPE.COMMON_STATUS)
  119 + options: getDictOpts(DICT_TYPE.$dictType.toUpperCase())
134 120 #else##没数据字典
135 121 options:[]
136 122 #end
... ... @@ -139,7 +125,7 @@ export const createFormSchema: FormSchema[] = [
139 125 component: 'Radio',
140 126 componentProps: {
141 127 #if ("" != $dictType)## 有数据字典
142   - options: getIntDictOptions(DICT_TYPE.COMMON_STATUS)
  128 + options: getDictOpts(DICT_TYPE.$dictType.toUpperCase())
143 129 #else##没数据字典
144 130 options:[]
145 131 #end
... ... @@ -187,14 +173,7 @@ export const updateFormSchema: FormSchema[] = [
187 173 component: 'Select',
188 174 componentProps: {
189 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 177 #else##没数据字典
199 178 options:[]
200 179 #end
... ... @@ -203,7 +182,7 @@ export const updateFormSchema: FormSchema[] = [
203 182 component: 'Checkbox',
204 183 componentProps: {
205 184 #if ("" != $dictType)## 有数据字典
206   - options: getIntDictOptions(DICT_TYPE.COMMON_STATUS)
  185 + options: getDictOpts(DICT_TYPE.$dictType.toUpperCase())
207 186 #else##没数据字典
208 187 options:[]
209 188 #end
... ... @@ -212,7 +191,7 @@ export const updateFormSchema: FormSchema[] = [
212 191 component: 'Radio',
213 192 componentProps: {
214 193 #if ("" != $dictType)## 有数据字典
215   - options: getIntDictOptions(DICT_TYPE.COMMON_STATUS)
  194 + options: getDictOpts(DICT_TYPE.$dictType.toUpperCase())
216 195 #else##没数据字典
217 196 options:[]
218 197 #end
... ...