mirror of
https://github.com/bufanyun/hotgo.git
synced 2025-10-16 23:13:44 +08:00
代码生成 使用优化
表单组件是下拉框,但是没有选择字段前端就会报错 status默认值置为1,不然表单添加的时候没有默认值 单选按钮组件在table也使用tag渲染 选择了字典类型后可清空 删除代码生成的时间
This commit is contained in:
@@ -53,6 +53,9 @@ func (l *gCurd) generateWebModelDefaultState(ctx context.Context, in *CurdPrevie
|
||||
if value == "" {
|
||||
value = "''"
|
||||
}
|
||||
if field.Name == "status" {
|
||||
value = 1
|
||||
}
|
||||
buffer.WriteString(fmt.Sprintf(" %s: %v,\n", field.TsName, value))
|
||||
}
|
||||
buffer.WriteString("};")
|
||||
@@ -261,6 +264,8 @@ func (l *gCurd) generateWebModelColumnsEach(buffer *bytes.Buffer, in *CurdPrevie
|
||||
case FormModeDate:
|
||||
component = fmt.Sprintf(" {\n title: '%s',\n key: '%s',\n render(row) {\n return formatToDate(row.%s);\n },\n },\n", field.Dc, field.TsName, field.TsName)
|
||||
|
||||
case FormModeRadio:
|
||||
fallthrough
|
||||
case FormModeSelect:
|
||||
if g.IsEmpty(in.options.dictMap[field.TsName]) {
|
||||
err = gerror.Newf("设置单选下拉框选项时,必须选择字典类型,字段名称:%v", field.Name)
|
||||
|
Reference in New Issue
Block a user