Commit 54956fcbb9fb12fd05c2c8d85c8a82206723f30b
1 parent
2f9d9723
【功能优化】INFRA:VBEN 的 dict 下拉类型不精准的问题
Showing
1 changed file
with
33 additions
and
9 deletions
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,9 +42,17 @@ export const searchFormSchema: FormSchema[] = [ | ||
| 42 | #foreach($column in $columns) | 42 | #foreach($column in $columns) |
| 43 | #if ($column.listOperation) | 43 | #if ($column.listOperation) |
| 44 | #set ($dictType=$column.dictType) | 44 | #set ($dictType=$column.dictType) |
| 45 | + #set ($javaType = $column.javaType) | ||
| 45 | #set ($javaField = $column.javaField) | 46 | #set ($javaField = $column.javaField) |
| 46 | #set ($AttrName=$column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)}) | 47 | #set ($AttrName=$column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)}) |
| 47 | #set ($comment=$column.columnComment) | 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 | label: '${comment}', | 57 | label: '${comment}', |
| 50 | field: '${javaField}', | 58 | field: '${javaField}', |
| @@ -54,16 +62,16 @@ export const searchFormSchema: FormSchema[] = [ | @@ -54,16 +62,16 @@ export const searchFormSchema: FormSchema[] = [ | ||
| 54 | component: 'Select', | 62 | component: 'Select', |
| 55 | componentProps: { | 63 | componentProps: { |
| 56 | #if ("" != $dictType)## 设置了 dictType 数据字典的情况 | 64 | #if ("" != $dictType)## 设置了 dictType 数据字典的情况 |
| 57 | - options: getDictOptions(DICT_TYPE.$dictType.toUpperCase()), | 65 | + options: getDictOptions(DICT_TYPE.$dictType.toUpperCase(), '$dictMethod'), |
| 58 | #else## 未设置 dictType 数据字典的情况 | 66 | #else## 未设置 dictType 数据字典的情况 |
| 59 | options: [], | 67 | options: [], |
| 60 | #end | 68 | #end |
| 61 | }, | 69 | }, |
| 62 | #elseif ($column.htmlType == "radio") | 70 | #elseif ($column.htmlType == "radio") |
| 63 | - component: 'Radio', | 71 | + component: 'RadioButtonGroup', |
| 64 | componentProps: { | 72 | componentProps: { |
| 65 | #if ("" != $dictType)## 设置了 dictType 数据字典的情况 | 73 | #if ("" != $dictType)## 设置了 dictType 数据字典的情况 |
| 66 | - options: getDictOptions(DICT_TYPE.$dictType.toUpperCase()), | 74 | + options: getDictOptions(DICT_TYPE.$dictType.toUpperCase(), '$dictMethod'), |
| 67 | #else## 未设置 dictType 数据字典的情况 | 75 | #else## 未设置 dictType 数据字典的情况 |
| 68 | options: [], | 76 | options: [], |
| 69 | #end | 77 | #end |
| @@ -87,9 +95,17 @@ export const createFormSchema: FormSchema[] = [ | @@ -87,9 +95,17 @@ export const createFormSchema: FormSchema[] = [ | ||
| 87 | #foreach($column in $columns) | 95 | #foreach($column in $columns) |
| 88 | #if ($column.createOperation) | 96 | #if ($column.createOperation) |
| 89 | #set ($dictType = $column.dictType) | 97 | #set ($dictType = $column.dictType) |
| 98 | + #set ($javaType = $column.javaType) | ||
| 90 | #set ($javaField = $column.javaField) | 99 | #set ($javaField = $column.javaField) |
| 91 | #set ($AttrName = $column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)}) | 100 | #set ($AttrName = $column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)}) |
| 92 | #set ($comment = $column.columnComment) | 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 | #if (!$column.primaryKey)## 忽略主键,不用在表单里 | 109 | #if (!$column.primaryKey)## 忽略主键,不用在表单里 |
| 94 | { | 110 | { |
| 95 | label: '${comment}', | 111 | label: '${comment}', |
| @@ -117,7 +133,7 @@ export const createFormSchema: FormSchema[] = [ | @@ -117,7 +133,7 @@ export const createFormSchema: FormSchema[] = [ | ||
| 117 | component: 'Select', | 133 | component: 'Select', |
| 118 | componentProps: { | 134 | componentProps: { |
| 119 | #if ("" != $dictType)## 有数据字典 | 135 | #if ("" != $dictType)## 有数据字典 |
| 120 | - options: getDictOptions(DICT_TYPE.$dictType.toUpperCase(), 'number'), | 136 | + options: getDictOptions(DICT_TYPE.$dictType.toUpperCase(), '$dictMethod'), |
| 121 | #else##没数据字典 | 137 | #else##没数据字典 |
| 122 | options:[], | 138 | options:[], |
| 123 | #end | 139 | #end |
| @@ -126,7 +142,7 @@ export const createFormSchema: FormSchema[] = [ | @@ -126,7 +142,7 @@ export const createFormSchema: FormSchema[] = [ | ||
| 126 | component: 'Checkbox', | 142 | component: 'Checkbox', |
| 127 | componentProps: { | 143 | componentProps: { |
| 128 | #if ("" != $dictType)## 有数据字典 | 144 | #if ("" != $dictType)## 有数据字典 |
| 129 | - options: getDictOptions(DICT_TYPE.$dictType.toUpperCase(), 'number'), | 145 | + options: getDictOptions(DICT_TYPE.$dictType.toUpperCase(), '$dictMethod'), |
| 130 | #else##没数据字典 | 146 | #else##没数据字典 |
| 131 | options:[], | 147 | options:[], |
| 132 | #end | 148 | #end |
| @@ -135,7 +151,7 @@ export const createFormSchema: FormSchema[] = [ | @@ -135,7 +151,7 @@ export const createFormSchema: FormSchema[] = [ | ||
| 135 | component: 'RadioButtonGroup', | 151 | component: 'RadioButtonGroup', |
| 136 | componentProps: { | 152 | componentProps: { |
| 137 | #if ("" != $dictType)## 有数据字典 | 153 | #if ("" != $dictType)## 有数据字典 |
| 138 | - options: getDictOptions(DICT_TYPE.$dictType.toUpperCase(), 'number'), | 154 | + options: getDictOptions(DICT_TYPE.$dictType.toUpperCase(), '$dictMethod'), |
| 139 | #else##没数据字典 | 155 | #else##没数据字典 |
| 140 | options:[], | 156 | options:[], |
| 141 | #end | 157 | #end |
| @@ -166,9 +182,17 @@ export const updateFormSchema: FormSchema[] = [ | @@ -166,9 +182,17 @@ export const updateFormSchema: FormSchema[] = [ | ||
| 166 | #foreach($column in $columns) | 182 | #foreach($column in $columns) |
| 167 | #if ($column.updateOperation) | 183 | #if ($column.updateOperation) |
| 168 | #set ($dictType = $column.dictType) | 184 | #set ($dictType = $column.dictType) |
| 185 | +#set ($javaType = $column.javaType) | ||
| 169 | #set ($javaField = $column.javaField) | 186 | #set ($javaField = $column.javaField) |
| 170 | #set ($AttrName = $column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)}) | 187 | #set ($AttrName = $column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)}) |
| 171 | #set ($comment = $column.columnComment) | 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 | #if (!$column.primaryKey)## 忽略主键,不用在表单里 | 196 | #if (!$column.primaryKey)## 忽略主键,不用在表单里 |
| 173 | { | 197 | { |
| 174 | label: '${comment}', | 198 | label: '${comment}', |
| @@ -196,7 +220,7 @@ export const updateFormSchema: FormSchema[] = [ | @@ -196,7 +220,7 @@ export const updateFormSchema: FormSchema[] = [ | ||
| 196 | component: 'Select', | 220 | component: 'Select', |
| 197 | componentProps: { | 221 | componentProps: { |
| 198 | #if ("" != $dictType)## 有数据字典 | 222 | #if ("" != $dictType)## 有数据字典 |
| 199 | - options: getDictOptions(DICT_TYPE.$dictType.toUpperCase(), 'number'), | 223 | + options: getDictOptions(DICT_TYPE.$dictType.toUpperCase(), '$dictMethod'), |
| 200 | #else##没数据字典 | 224 | #else##没数据字典 |
| 201 | options:[], | 225 | options:[], |
| 202 | #end | 226 | #end |
| @@ -205,7 +229,7 @@ export const updateFormSchema: FormSchema[] = [ | @@ -205,7 +229,7 @@ export const updateFormSchema: FormSchema[] = [ | ||
| 205 | component: 'Checkbox', | 229 | component: 'Checkbox', |
| 206 | componentProps: { | 230 | componentProps: { |
| 207 | #if ("" != $dictType)## 有数据字典 | 231 | #if ("" != $dictType)## 有数据字典 |
| 208 | - options: getDictOptions(DICT_TYPE.$dictType.toUpperCase(), 'number'), | 232 | + options: getDictOptions(DICT_TYPE.$dictType.toUpperCase(), '$dictMethod'), |
| 209 | #else##没数据字典 | 233 | #else##没数据字典 |
| 210 | options:[], | 234 | options:[], |
| 211 | #end | 235 | #end |
| @@ -214,7 +238,7 @@ export const updateFormSchema: FormSchema[] = [ | @@ -214,7 +238,7 @@ export const updateFormSchema: FormSchema[] = [ | ||
| 214 | component: 'RadioButtonGroup', | 238 | component: 'RadioButtonGroup', |
| 215 | componentProps: { | 239 | componentProps: { |
| 216 | #if ("" != $dictType)## 有数据字典 | 240 | #if ("" != $dictType)## 有数据字典 |
| 217 | - options: getDictOptions(DICT_TYPE.$dictType.toUpperCase(), 'number'), | 241 | + options: getDictOptions(DICT_TYPE.$dictType.toUpperCase(), '$dictMethod'), |
| 218 | #else##没数据字典 | 242 | #else##没数据字典 |
| 219 | options:[], | 243 | options:[], |
| 220 | #end | 244 | #end |