Commit 54956fcbb9fb12fd05c2c8d85c8a82206723f30b

Authored by YunaiV
1 parent 2f9d9723

【功能优化】INFRA:VBEN 的 dict 下拉类型不精准的问题

yudao-module-infra/yudao-module-infra-biz/src/main/resources/codegen/vue3_vben/views/data.ts.vm
... ... @@ -42,9 +42,17 @@ export const searchFormSchema: FormSchema[] = [
42 42 #foreach($column in $columns)
43 43 #if ($column.listOperation)
44 44 #set ($dictType=$column.dictType)
  45 + #set ($javaType = $column.javaType)
45 46 #set ($javaField = $column.javaField)
46 47 #set ($AttrName=$column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)})
47 48 #set ($comment=$column.columnComment)
  49 + #if ($javaType == "Integer" || $javaType == "Long" || $javaType == "Byte" || $javaType == "Short")
  50 + #set ($dictMethod = "number")
  51 + #elseif ($javaType == "String")
  52 + #set ($dictMethod = "string")
  53 + #elseif ($javaType == "Boolean")
  54 + #set ($dictMethod = "boolean")
  55 + #end
48 56 {
49 57 label: '${comment}',
50 58 field: '${javaField}',
... ... @@ -54,16 +62,16 @@ export const searchFormSchema: FormSchema[] = [
54 62 component: 'Select',
55 63 componentProps: {
56 64 #if ("" != $dictType)## 设置了 dictType 数据字典的情况
57   - options: getDictOptions(DICT_TYPE.$dictType.toUpperCase()),
  65 + options: getDictOptions(DICT_TYPE.$dictType.toUpperCase(), '$dictMethod'),
58 66 #else## 未设置 dictType 数据字典的情况
59 67 options: [],
60 68 #end
61 69 },
62 70 #elseif ($column.htmlType == "radio")
63   - component: 'Radio',
  71 + component: 'RadioButtonGroup',
64 72 componentProps: {
65 73 #if ("" != $dictType)## 设置了 dictType 数据字典的情况
66   - options: getDictOptions(DICT_TYPE.$dictType.toUpperCase()),
  74 + options: getDictOptions(DICT_TYPE.$dictType.toUpperCase(), '$dictMethod'),
67 75 #else## 未设置 dictType 数据字典的情况
68 76 options: [],
69 77 #end
... ... @@ -87,9 +95,17 @@ export const createFormSchema: FormSchema[] = [
87 95 #foreach($column in $columns)
88 96 #if ($column.createOperation)
89 97 #set ($dictType = $column.dictType)
  98 + #set ($javaType = $column.javaType)
90 99 #set ($javaField = $column.javaField)
91 100 #set ($AttrName = $column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)})
92 101 #set ($comment = $column.columnComment)
  102 + #if ($javaType == "Integer" || $javaType == "Long" || $javaType == "Byte" || $javaType == "Short")
  103 + #set ($dictMethod = "number")
  104 + #elseif ($javaType == "String")
  105 + #set ($dictMethod = "string")
  106 + #elseif ($javaType == "Boolean")
  107 + #set ($dictMethod = "boolean")
  108 + #end
93 109 #if (!$column.primaryKey)## 忽略主键,不用在表单里
94 110 {
95 111 label: '${comment}',
... ... @@ -117,7 +133,7 @@ export const createFormSchema: FormSchema[] = [
117 133 component: 'Select',
118 134 componentProps: {
119 135 #if ("" != $dictType)## 有数据字典
120   - options: getDictOptions(DICT_TYPE.$dictType.toUpperCase(), 'number'),
  136 + options: getDictOptions(DICT_TYPE.$dictType.toUpperCase(), '$dictMethod'),
121 137 #else##没数据字典
122 138 options:[],
123 139 #end
... ... @@ -126,7 +142,7 @@ export const createFormSchema: FormSchema[] = [
126 142 component: 'Checkbox',
127 143 componentProps: {
128 144 #if ("" != $dictType)## 有数据字典
129   - options: getDictOptions(DICT_TYPE.$dictType.toUpperCase(), 'number'),
  145 + options: getDictOptions(DICT_TYPE.$dictType.toUpperCase(), '$dictMethod'),
130 146 #else##没数据字典
131 147 options:[],
132 148 #end
... ... @@ -135,7 +151,7 @@ export const createFormSchema: FormSchema[] = [
135 151 component: 'RadioButtonGroup',
136 152 componentProps: {
137 153 #if ("" != $dictType)## 有数据字典
138   - options: getDictOptions(DICT_TYPE.$dictType.toUpperCase(), 'number'),
  154 + options: getDictOptions(DICT_TYPE.$dictType.toUpperCase(), '$dictMethod'),
139 155 #else##没数据字典
140 156 options:[],
141 157 #end
... ... @@ -166,9 +182,17 @@ export const updateFormSchema: FormSchema[] = [
166 182 #foreach($column in $columns)
167 183 #if ($column.updateOperation)
168 184 #set ($dictType = $column.dictType)
  185 +#set ($javaType = $column.javaType)
169 186 #set ($javaField = $column.javaField)
170 187 #set ($AttrName = $column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)})
171 188 #set ($comment = $column.columnComment)
  189 +#if ($javaType == "Integer" || $javaType == "Long" || $javaType == "Byte" || $javaType == "Short")
  190 + #set ($dictMethod = "number")
  191 +#elseif ($javaType == "String")
  192 + #set ($dictMethod = "string")
  193 +#elseif ($javaType == "Boolean")
  194 + #set ($dictMethod = "boolean")
  195 +#end
172 196 #if (!$column.primaryKey)## 忽略主键,不用在表单里
173 197 {
174 198 label: '${comment}',
... ... @@ -196,7 +220,7 @@ export const updateFormSchema: FormSchema[] = [
196 220 component: 'Select',
197 221 componentProps: {
198 222 #if ("" != $dictType)## 有数据字典
199   - options: getDictOptions(DICT_TYPE.$dictType.toUpperCase(), 'number'),
  223 + options: getDictOptions(DICT_TYPE.$dictType.toUpperCase(), '$dictMethod'),
200 224 #else##没数据字典
201 225 options:[],
202 226 #end
... ... @@ -205,7 +229,7 @@ export const updateFormSchema: FormSchema[] = [
205 229 component: 'Checkbox',
206 230 componentProps: {
207 231 #if ("" != $dictType)## 有数据字典
208   - options: getDictOptions(DICT_TYPE.$dictType.toUpperCase(), 'number'),
  232 + options: getDictOptions(DICT_TYPE.$dictType.toUpperCase(), '$dictMethod'),
209 233 #else##没数据字典
210 234 options:[],
211 235 #end
... ... @@ -214,7 +238,7 @@ export const updateFormSchema: FormSchema[] = [
214 238 component: 'RadioButtonGroup',
215 239 componentProps: {
216 240 #if ("" != $dictType)## 有数据字典
217   - options: getDictOptions(DICT_TYPE.$dictType.toUpperCase(), 'number'),
  241 + options: getDictOptions(DICT_TYPE.$dictType.toUpperCase(), '$dictMethod'),
218 242 #else##没数据字典
219 243 options:[],
220 244 #end
... ...