Commit c88794f212f506d69b0228bbb762014c54da13cf

Authored by xingyu
1 parent 1df0fd1b

feat: vue3 vben 代码生成支持创建和更新两种表单

yudao-module-infra/yudao-module-infra-biz/src/main/resources/codegen/vue3_vben/views/data.ts.vm
@@ -154,68 +154,68 @@ export const updateFormSchema: FormSchema[] = [ @@ -154,68 +154,68 @@ export const updateFormSchema: FormSchema[] = [
154 show: false, 154 show: false,
155 component: 'Input' 155 component: 'Input'
156 }, 156 },
157 - #foreach($column in $columns)  
158 - #if ($column.updateOperation)  
159 - #set ($dictType = $column.dictType)  
160 - #set ($javaField = $column.javaField)  
161 - #set ($AttrName = $column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)})  
162 - #set ($comment = $column.columnComment)  
163 - #if (!$column.primaryKey)## 忽略主键,不用在表单里  
164 - {  
165 - label: '${comment}',  
166 - field: '${javaField}',  
167 - #if (($column.createOperation || $column.updateOperation) && !$column.nullable && !${column.primaryKey})## 创建或者更新操作 && 要求非空 && 非主键  
168 - required: true,  
169 - #end  
170 - #if ($column.htmlType == "input")  
171 - component: 'Input'  
172 - #elseif($column.htmlType == "imageUpload")## 图片上传  
173 - component: 'Upload'  
174 - #elseif($column.htmlType == "fileUpload")## 文件上传  
175 - component: 'Upload'  
176 - #elseif($column.htmlType == "editor")## 文本编辑器  
177 - component: 'InputTextArea'  
178 - #elseif($column.htmlType == "select")## 下拉框  
179 - component: 'Select',  
180 - componentProps: {  
181 - #if ("" != $dictType)## 有数据字典  
182 - #if ($javaType == "Integer" || $javaType == "Long" || $javaType == "Byte" || $javaType == "Short")  
183 - #set ($dictMethod = "getIntDictOptions")  
184 - #elseif ($javaType == "String")  
185 - #set ($dictMethod = "getStrDictOptions")  
186 - #elseif ($javaType == "Boolean")  
187 - #set ($dictMethod = "getBoolDictOptions")  
188 - #end  
189 - options: $dictMethod(DICT_TYPE.$dictType.toUpperCase())  
190 - #else##没数据字典  
191 - options:[]  
192 - #end  
193 - }  
194 - #elseif($column.htmlType == "checkbox")## 多选框  
195 - component: 'Checkbox',  
196 - componentProps: {  
197 - #if ("" != $dictType)## 有数据字典  
198 - options: getIntDictOptions(DICT_TYPE.COMMON_STATUS)  
199 - #else##没数据字典  
200 - options:[]  
201 - #end  
202 - }  
203 - #elseif($column.htmlType == "radio")## 单选框  
204 - component: 'Radio',  
205 - componentProps: {  
206 - #if ("" != $dictType)## 有数据字典  
207 - options: getIntDictOptions(DICT_TYPE.COMMON_STATUS)  
208 - #else##没数据字典  
209 - options:[]  
210 - #end  
211 - }  
212 - #elseif($column.htmlType == "datetime")## 时间框  
213 - component: 'DatePicker'  
214 - #elseif($column.htmlType == "textarea")## 文本域  
215 - component: 'InputTextArea'  
216 - #end  
217 - }, 157 +#foreach($column in $columns)
  158 +#if ($column.updateOperation)
  159 +#set ($dictType = $column.dictType)
  160 +#set ($javaField = $column.javaField)
  161 +#set ($AttrName = $column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)})
  162 +#set ($comment = $column.columnComment)
  163 +#if (!$column.primaryKey)## 忽略主键,不用在表单里
  164 + {
  165 + label: '${comment}',
  166 + field: '${javaField}',
  167 + #if (($column.createOperation || $column.updateOperation) && !$column.nullable && !${column.primaryKey})## 创建或者更新操作 && 要求非空 && 非主键
  168 + required: true,
  169 + #end
  170 + #if ($column.htmlType == "input")
  171 + component: 'Input'
  172 + #elseif($column.htmlType == "imageUpload")## 图片上传
  173 + component: 'Upload'
  174 + #elseif($column.htmlType == "fileUpload")## 文件上传
  175 + component: 'Upload'
  176 + #elseif($column.htmlType == "editor")## 文本编辑器
  177 + component: 'InputTextArea'
  178 + #elseif($column.htmlType == "select")## 下拉框
  179 + component: 'Select',
  180 + componentProps: {
  181 + #if ("" != $dictType)## 有数据字典
  182 + #if ($javaType == "Integer" || $javaType == "Long" || $javaType == "Byte" || $javaType == "Short")
  183 + #set ($dictMethod = "getIntDictOptions")
  184 + #elseif ($javaType == "String")
  185 + #set ($dictMethod = "getStrDictOptions")
  186 + #elseif ($javaType == "Boolean")
  187 + #set ($dictMethod = "getBoolDictOptions")
  188 + #end
  189 + options: $dictMethod(DICT_TYPE.$dictType.toUpperCase())
  190 + #else##没数据字典
  191 + options:[]
218 #end 192 #end
  193 + }
  194 + #elseif($column.htmlType == "checkbox")## 多选框
  195 + component: 'Checkbox',
  196 + componentProps: {
  197 + #if ("" != $dictType)## 有数据字典
  198 + options: getIntDictOptions(DICT_TYPE.COMMON_STATUS)
  199 + #else##没数据字典
  200 + options:[]
  201 + #end
  202 + }
  203 + #elseif($column.htmlType == "radio")## 单选框
  204 + component: 'Radio',
  205 + componentProps: {
  206 + #if ("" != $dictType)## 有数据字典
  207 + options: getIntDictOptions(DICT_TYPE.COMMON_STATUS)
  208 + #else##没数据字典
  209 + options:[]
  210 + #end
  211 + }
  212 + #elseif($column.htmlType == "datetime")## 时间框
  213 + component: 'DatePicker'
  214 + #elseif($column.htmlType == "textarea")## 文本域
  215 + component: 'InputTextArea'
219 #end 216 #end
220 - #end 217 + },
  218 +#end
  219 +#end
  220 +#end
221 ] 221 ]
222 \ No newline at end of file 222 \ No newline at end of file