fix 附件管理器,上传功能优化,富文本附件选择接口,移除旧版大文件上传,合并至附件管理器,优化通知图标列表,升级gf2.8

This commit is contained in:
yxh
2024-11-19 10:28:50 +08:00
parent ef357ea7e3
commit ac3f801d4f
65 changed files with 2210 additions and 1434 deletions

View File

@@ -18,13 +18,21 @@ package {{$structName}}
{{$gstr:=false}}
{{$hasLinkTable:=false}}
{{$useCommonService:=false}}
{{$hasDeptSelector:=false}}
{{$usedSystemModel := false}}
{{range $index, $column := .table.Columns}}
{{if eq $column.HtmlType "images" "file" "files"}}
{{if eq $column.HtmlType "images" "file" "files" "imageSelector" "fileSelector"}}
{{$libUtils = true}}
{{end}}
{{if and (eq $column.HtmlField "createdBy" "updatedBy" "deletedBy" "deptId") (ne $.table.ModuleName "system")}}
{{if eq $column.HtmlType "deptSelectorMultiple" "deptSelectorSingle"}}
{{$hasDeptSelector = true}}
{{end}}
{{if and (or (eq $column.HtmlField "createdBy" "updatedBy" "deletedBy" "deptId") (eq $column.HtmlType "userSelectorSingle" "userSelectorMultiple" "deptSelectorMultiple" "deptSelectorSingle")) (ne $.table.ModuleName "system")}}
{{$usedSystemModule = true}}
{{end}}
{{if and (eq $column.HtmlType "userSelectorSingle" "userSelectorMultiple" "deptSelectorMultiple" "deptSelectorSingle") (ne $.table.ModuleName "system")}}
{{$usedSystemModel = true}}
{{end}}
{{if eq $column.HtmlType "selects" "checkbox"}}
{{range $ti, $linkedTable := $.table.LinkedTables}}
{{if eq $column.LinkTableClass $linkedTable.ClassName}}
@@ -66,6 +74,9 @@ import (
{{if $usedSystemModule}}
systemService "{{.goModName}}/internal/app/system/service"
{{end}}
{{if $usedSystemModel}}
systemModel "{{.goModName}}/internal/app/system/model"
{{end}}
{{if or (eq .table.TplCategory "tree") $libUtils}}
"{{.goModName}}/library/libUtils"
{{end}}
@@ -125,7 +136,19 @@ func (s *s{{.table.ClassName}})List(ctx context.Context, req *model.{{.table.Cla
m = m.Where(dao.{{$.table.ClassName}}.Columns().{{$column.GoField}}+" like ?", "%"+req.{{$column.GoField}}+"%")
}
{{else if eq $column.QueryType "EQ"}}
{{if eq $column.GoType "string"}}
{{if eq $column.HtmlType "userSelectorMultiple" "deptSelectorMultiple"}}
if len(req.{{$column.GoField}}) > 0 {
if systemService.ToolsGenTable().IsMysql() {
for _, v := range req.{{$column.GoField}} {
m = m.Where("JSON_CONTAINS(`{{$column.ColumnName}}`,?)", gconv.String(v))
}
}else{
for _, v := range req.{{$column.GoField}} {
m = m.Where(`"{{$column.ColumnName}}" @> '[?]'::jsonb`, v)
}
}
}
{{else if eq $column.GoType "string"}}
if req.{{$column.GoField}} != "" {
m = m.Where(dao.{{$.table.ClassName}}.Columns().{{$column.GoField}}+" = ?", {{if ne $column.FieldConversion ""}}{{$column.FieldConversion}}({{end}}req.{{$column.GoField}}{{if ne $column.FieldConversion ""}}){{end}})
}
@@ -183,6 +206,17 @@ func (s *s{{.table.ClassName}})List(ctx context.Context, req *model.{{.table.Cla
listRes.List = make([]*model.{{.table.ClassName}}ListRes,len(res))
for k,v:=range res{
{{range $index, $column := .table.Columns}}
{{if eq $column.HtmlType "userSelectorMultiple"}}
var linked{{$column.GoField}} []*{{if $usedSystemModel}}systemModel{{else}}model{{end}}.SysUserSimpleRes
linked{{$column.GoField}}, err = {{if $usedSystemModule}}systemService{{else}}service{{end}}.SysUser().GetUsers(ctx, gconv.Interfaces(v.{{$column.GoField}}))
liberr.ErrIsNil(ctx, err)
{{end}}
{{if eq $column.HtmlType "deptSelectorMultiple"}}
linked{{$column.GoField}} := make([]*{{if $usedSystemModel}}systemModel{{else}}model{{end}}.LinkDeptRes, len(v.{{$column.GoField}}))
for lk, lv := range v.{{$column.GoField}} {
linked{{$column.GoField}}[lk] = {{if $usedSystemModule}}systemService{{else}}service{{end}}.SysDept().GetByDept(ctx, lv)
}
{{end}}
{{if eq $column.HtmlType "selects" "checkbox" "treeSelects"}}
{{range $ti, $linkedTable := $.table.LinkedTables}}
{{if eq $column.LinkTableClass $linkedTable.ClassName}}
@@ -214,8 +248,6 @@ func (s *s{{.table.ClassName}})List(ctx context.Context, req *model.{{.table.Cla
{{if and $column.IsList (eq $column.HtmlField "UpdatedBy")}}
UpdatedUser:v.UpdatedUser,
{{end}}
{{end}}
{{range $index, $column := .table.Columns}}
{{if and $column.IsList (ne $column.HtmlField $.table.TreeCode) (ne $column.HtmlField $.table.TreeParentCode) (ne $column.HtmlField $.table.TreeName) }}
{{if eq $column.HtmlType "images" "file" "files"}}
{{$column.GoField}} : v.{{$column.GoField}},
@@ -228,6 +260,18 @@ func (s *s{{.table.ClassName}})List(ctx context.Context, req *model.{{.table.Cla
{{end}}
{{end}}
{{end}}
{{if eq $column.HtmlType "userSelectorSingle"}}
Linked{{$column.GoField}} : v.Linked{{$column.GoField}},
{{end}}
{{if eq $column.HtmlType "userSelectorMultiple"}}
Linked{{$column.GoField}} : linked{{$column.GoField}},
{{end}}
{{if eq $column.HtmlType "deptSelectorSingle"}}
Linked{{$column.GoField}}: {{if $usedSystemModule}}systemService{{else}}service{{end}}.SysDept().GetByDept(ctx, v.{{$column.GoField}}),
{{end}}
{{if eq $column.HtmlType "deptSelectorMultiple"}}
Linked{{$column.GoField}}: linked{{$column.GoField}},
{{end}}
{{end}}
{{else}}
{{if not .table.IsPkListable}}
@@ -257,6 +301,18 @@ func (s *s{{.table.ClassName}})List(ctx context.Context, req *model.{{.table.Cla
{{end}}
{{end}}
{{end}}
{{if eq $column.HtmlType "userSelectorSingle"}}
Linked{{$column.GoField}} : v.Linked{{$column.GoField}},
{{end}}
{{if eq $column.HtmlType "userSelectorMultiple"}}
Linked{{$column.GoField}} : linked{{$column.GoField}},
{{end}}
{{if eq $column.HtmlType "deptSelectorSingle"}}
Linked{{$column.GoField}}: {{if $usedSystemModule}}systemService{{else}}service{{end}}.SysDept().GetByDept(ctx, v.{{$column.GoField}}),
{{end}}
{{if eq $column.HtmlType "deptSelectorMultiple"}}
Linked{{$column.GoField}}: linked{{$column.GoField}},
{{end}}
{{end}}
{{end}}
}
@@ -276,7 +332,19 @@ func (s *s{{.table.ClassName}})GetExportData(ctx context.Context, req *model.{{.
m = m.Where(dao.{{$.table.ClassName}}.Columns().{{$column.GoField}}+" like ?", "%"+req.{{$column.GoField}}+"%")
}
{{else if eq $column.QueryType "EQ"}}
{{if eq $column.GoType "string"}}
{{if eq $column.HtmlType "userSelectorMultiple" "deptSelectorMultiple"}}
if len(req.{{$column.GoField}}) > 0 {
if systemService.ToolsGenTable().IsMysql() {
for _, v := range req.{{$column.GoField}} {
m = m.Where("JSON_CONTAINS(`{{$column.ColumnName}}`,?)", gconv.String(v))
}
}else{
for _, v := range req.{{$column.GoField}} {
m = m.Where(`"{{$column.ColumnName}}" @> '[?]'::jsonb`, v)
}
}
}
{{else if eq $column.GoType "string"}}
if req.{{$column.GoField}} != "" {
m = m.Where(dao.{{$.table.ClassName}}.Columns().{{$column.GoField}}+" = ?", {{if ne $column.FieldConversion ""}}{{$column.FieldConversion}}({{end}}req.{{$column.GoField}}{{if ne $column.FieldConversion ""}}){{end}})
}
@@ -384,7 +452,7 @@ func(s *s{{.table.ClassName}})Import(ctx context.Context,file *ghttp.UploadFile)
{{$add = true}}
{{else if and $column.IsPk $.table.UseSnowId}}
{{$.table.PkColumn.GoField}}:{{$.table.PkColumn.HtmlField}},
{{else if and (ne $column.IsPk true) (ne $column.HtmlType "imagefile") (ne $column.HtmlType "images") (ne $column.HtmlType "file") (ne $column.HtmlType "files")}}
{{else if and (ne $column.IsPk true) (ne $column.HtmlType "imagefile") (ne $column.HtmlType "images") (ne $column.HtmlType "file") (ne $column.HtmlType "files") (ne $column.HtmlType "imageSelector") (ne $column.HtmlType "fileSelector")}}
{{$add = true}}
{{if eq $column.GoType "int" "uint" "int64" "uint64" "bool" }}
{{$column.GoField}}:gconv.Int64(d[{{$i}}]),
@@ -440,13 +508,27 @@ func (s *s{{.table.ClassName}})GetBy{{$pkGoField}}(ctx context.Context, {{$.tabl
err =g.Try(ctx, func(ctx context.Context){
err = dao.{{.table.ClassName}}.Ctx(ctx).WithAll().Where(dao.{{.table.ClassName}}.Columns().{{$pkGoField}}, {{$.table.PkColumn.HtmlField}}).Scan(&res)
liberr.ErrIsNil(ctx,err,"获取信息失败")
{{if $.table.HasDeptId}}
{{if or $.table.HasDeptId $hasDeptSelector}}
if res!=nil{
{{if $.table.HasDeptId}}
{{if $usedSystemModule}}
res.DeptInfo = systemService.SysDept().GetByDept(ctx, res.DeptId)
{{else}}
res.DeptInfo = service.SysDept().GetByDept(ctx, res.DeptId)
{{end}}
{{end}}
{{if $hasDeptSelector}}
{{range $index, $column := .table.Columns}}
{{if eq $column.HtmlType "deptSelectorSingle"}}
res.Linked{{$column.GoField}} = {{if $usedSystemModule}}systemService{{else}}service{{end}}.SysDept().GetByDept(ctx, res.{{$column.GoField}})
{{else if eq $column.HtmlType "deptSelectorMultiple"}}
res.Linked{{$column.GoField}} = make([]*{{if $usedSystemModel}}systemModel{{else}}model{{end}}.LinkDeptRes, len(res.{{$column.GoField}}))
for k, v := range res.{{$column.GoField}} {
res.Linked{{$column.GoField}}[k] = {{if $usedSystemModule}}systemService{{else}}service{{end}}.SysDept().GetByDept(ctx, v)
}
{{end}}
{{end}}
{{end}}
}
{{end}}
{{range $index, $column := .table.Columns}}
@@ -480,7 +562,7 @@ func (s *s{{.table.ClassName}})Add(ctx context.Context, req *model.{{.table.Clas
if !req.{{$column.GoField}}.IsEmpty(){
{{$column.HtmlField}}=req.{{$column.GoField}}.Join(",")
}
{{else if eq $column.HtmlType "images" "file" "files"}}
{{else if eq $column.HtmlType "images" "file" "files" "imageSelector" "fileSelector"}}
for _,obj:=range req.{{$column.GoField}}{
obj.Url,err = libUtils.GetFilesPath(ctx,obj.Url)
liberr.ErrIsNil(ctx, err)
@@ -529,7 +611,7 @@ func (s *s{{.table.ClassName}})Edit(ctx context.Context, req *model.{{.table.Cla
if !req.{{$column.GoField}}.IsEmpty(){
{{$column.HtmlField}}=req.{{$column.GoField}}.Join(",")
}
{{else if eq $column.HtmlType "images" "file" "files"}}
{{else if eq $column.HtmlType "images" "file" "files" "imageSelector" "fileSelector"}}
for _,obj:=range req.{{$column.GoField}}{
obj.Url,err = libUtils.GetFilesPath(ctx,obj.Url)
liberr.ErrIsNil(ctx, err)

View File

@@ -17,10 +17,10 @@ package model
{{range $index,$column :=.table.Columns}}
{{if and (eq $column.HtmlField "createdBy" "updatedBy" "deptId") (ne $.table.ModuleName "system")}}
{{if and (or (eq $column.HtmlField "createdBy" "updatedBy" "deptId") (eq $column.HtmlType "userSelectorSingle" "userSelectorMultiple" "deptSelectorMultiple" "deptSelectorSingle")) (ne $.table.ModuleName "system")}}
{{$hasUser = true}}
{{end}}
{{if eq $column.HtmlType "imagefile" "images" "file" "files" }}
{{if eq $column.HtmlType "imagefile" "images" "file" "files" "imageSelector" "fileSelector"}}
{{$hasUpFile = true}}
{{end}}
{{if eq $column.HtmlType "checkbox" "selects" "treeSelects"}}
@@ -28,7 +28,7 @@ package model
{{end}}
{{end}}
{{range $index,$column :=.table.EditColumns}}
{{if and (eq $column.HtmlField "createdBy" "updatedBy" "deptId") (ne $.table.ModuleName "system")}}
{{if and (or (eq $column.HtmlField "createdBy" "updatedBy" "deptId") (eq $column.HtmlType "userSelectorMultiple" "userSelectorSingle" "deptSelectorMultiple" "deptSelectorSingle")) (ne $.table.ModuleName "system")}}
{{$hasUser = true}}
{{end}}
{{if eq $column.GoType "Time"}}
@@ -54,7 +54,7 @@ import (
type {{.table.ClassName}}InfoRes struct {
gmeta.Meta `orm:"table:{{.table.TableName}}"`
{{range $index, $column := .table.Columns}}
{{if $column.IsPk}}{{$column.GoField}} {{if eq $column.GoType "Time"}}*gtime.Time{{else}}{{$column.GoType}}{{end}} `orm:"{{$column.ColumnName}},primary" json:"{{$column.HtmlField}}{{if $.table.UseSnowId}},string{{end}}" dc:"{{$column.ColumnComment}}"` // {{$column.ColumnComment}} {{else}}{{$column.GoField}} {{if eq $column.GoType "Time"}}*gtime.Time{{else}}{{$column.GoType}}{{end}} `orm:"{{$column.ColumnName}}" json:"{{$column.HtmlField}}" dc:"{{$column.ColumnComment}}"` // {{$column.ColumnComment}} {{end}}
{{if $column.IsPk}}{{$column.GoField}} {{if eq $column.GoType "Time"}}*gtime.Time{{else if eq $column.HtmlType "userSelectorMultiple" "deptSelectorMultiple"}}[]uint64{{else}}{{$column.GoType}}{{end}} `orm:"{{$column.ColumnName}},primary" json:"{{$column.HtmlField}}{{if $.table.UseSnowId}},string{{end}}" dc:"{{$column.ColumnComment}}"` // {{$column.ColumnComment}} {{else}}{{$column.GoField}} {{if eq $column.GoType "Time"}}*gtime.Time{{else if eq $column.HtmlType "userSelectorMultiple" "deptSelectorMultiple"}}[]uint64{{else}}{{$column.GoType}}{{end}} `orm:"{{$column.ColumnName}}" json:"{{$column.HtmlField}}" dc:"{{$column.ColumnComment}}"` // {{$column.ColumnComment}} {{end}}
{{range $ti, $linkedTable := $.table.LinkedTables}}
{{if eq $column.LinkTableClass $linkedTable.ClassName}}
Linked{{$column.GoField}} {{if eq $column.HtmlType "selects" "checkbox" "treeSelects"}}[]{{end}}*Linked{{$.table.ClassName}}{{$linkedTable.ClassName}} `{{if not (eq $column.HtmlType "selects" "checkbox" "treeSelects")}}orm:"with:{{$column.LinkLabelId}}={{$column.ColumnName}}" {{end}}json:"linked{{$column.GoField}}"`
@@ -69,6 +69,18 @@ type {{.table.ClassName}}InfoRes struct {
{{if eq $column.HtmlField "updatedBy"}}
UpdatedUser *{{if $hasUser}}systemModel.{{end}}LinkUserRes `orm:"with:id=updated_by" json:"updatedUser"`
{{end}}
{{if eq $column.HtmlType "userSelectorSingle"}}
Linked{{$column.GoField}} *{{if $hasUser}}systemModel.{{end}}LinkUserRes `orm:"with:id={{$column.ColumnName}}" json:"linked{{$column.GoField}}" dc:"{{$column.ColumnComment}}"`
{{end}}
{{if eq $column.HtmlType "userSelectorMultiple"}}
Linked{{$column.GoField}} []*{{if $hasUser}}systemModel.{{end}}LinkUserRes `orm:"with:id={{$column.ColumnName}}" json:"linked{{$column.GoField}}" dc:"{{$column.ColumnComment}}"`
{{end}}
{{if eq $column.HtmlType "deptSelectorSingle"}}
Linked{{$column.GoField}} *{{if $hasUser}}systemModel.{{end}}LinkDeptRes `json:"linked{{$column.GoField}}" dc:"{{$column.ColumnComment}}"`
{{end}}
{{if eq $column.HtmlType "deptSelectorMultiple"}}
Linked{{$column.GoField}} []*{{if $hasUser}}systemModel.{{end}}LinkDeptRes `json:"linked{{$column.GoField}}" dc:"{{$column.ColumnComment}}"`
{{end}}
{{end}}
}
@@ -76,7 +88,7 @@ type {{.table.ClassName}}InfoRes struct {
type Linked{{$.table.ClassName}}{{$linkedTable.ClassName}} struct {
gmeta.Meta `orm:"table:{{$linkedTable.TableName}}"`
{{range $ci, $linkedColumn := $linkedTable.RefColumns.Values}}
{{$linkedColumn.GoField}} {{if eq $linkedColumn.GoType "Time"}}*gtime.Time{{else}}{{$linkedColumn.GoType}}{{end}} `orm:"{{$linkedColumn.ColumnName}}" json:"{{$linkedColumn.HtmlField}}" dc:"{{$linkedColumn.ColumnComment}}"` // {{$linkedColumn.ColumnComment}}
{{$linkedColumn.GoField}} {{if eq $linkedColumn.GoType "Time"}}*gtime.Time{{else if eq $linkedColumn.HtmlType "userSelectorMultiple" "deptSelectorMultiple"}}[]uint64{{else}}{{$linkedColumn.GoType}}{{end}} `orm:"{{$linkedColumn.ColumnName}}" json:"{{$linkedColumn.HtmlField}}" dc:"{{$linkedColumn.ColumnComment}}"` // {{$linkedColumn.ColumnComment}}
{{end}}
{{if eq $linkedTable.TplCategory "tree"}}
{{$linkedTable.OptionsStruct.ColumnAttr.GoField}} {{$linkedTable.OptionsStruct.ColumnAttr.GoType}} `orm:"{{$linkedTable.OptionsStruct.ColumnAttr.ColumnName}}" json:"{{$linkedTable.OptionsStruct.ColumnAttr.HtmlField}}"`
@@ -90,12 +102,12 @@ type {{.table.ClassName}}ListRes struct{
{{if eq .table.TplCategory "tree"}}
{{range $index, $column := .table.Columns}}
{{if or (eq $column.HtmlField $.table.TreeCode) (eq $column.HtmlField $.table.TreeParentCode) (eq $column.HtmlField $.table.TreeName) }}
{{$column.GoField}} {{if eq $column.GoType "Time"}}*gtime.Time{{else}}{{$column.GoType}}{{end}} `json:"{{$column.HtmlField}}{{if and $column.IsPk $.table.UseSnowId}},string{{end}}" dc:"{{$column.ColumnComment}}"`
{{$column.GoField}} {{if eq $column.GoType "Time"}}*gtime.Time{{else if eq $column.HtmlType "userSelectorMultiple" "deptSelectorMultiple"}}[]uint64{{else}}{{$column.GoType}}{{end}} `json:"{{$column.HtmlField}}{{if and $column.IsPk $.table.UseSnowId}},string{{end}}" dc:"{{$column.ColumnComment}}"`
{{end}}
{{end}}
{{range $index, $column := .table.Columns}}
{{if and $column.IsList (ne $column.HtmlField $.table.TreeCode) (ne $column.HtmlField $.table.TreeParentCode) (ne $column.HtmlField $.table.TreeName) }}
{{$column.GoField}} {{if eq $column.GoType "Time"}}*gtime.Time{{else}}{{$column.GoType}}{{end}} `json:"{{$column.HtmlField}}" dc:"{{$column.ColumnComment}}"`
{{$column.GoField}} {{if eq $column.GoType "Time"}}*gtime.Time{{else if eq $column.HtmlType "userSelectorMultiple" "deptSelectorMultiple"}}[]uint64{{else}}{{$column.GoType}}{{end}} `json:"{{$column.HtmlField}}" dc:"{{$column.ColumnComment}}"`
{{range $ti, $linkedTable := $.table.LinkedTables}}
{{if eq $column.LinkTableClass $linkedTable.ClassName}}
Linked{{$column.GoField}} {{if eq $column.HtmlType "selects" "checkbox" "treeSelects"}}[]{{end}}*Linked{{$.table.ClassName}}{{$linkedTable.ClassName}} `{{if not (eq $column.HtmlType "selects" "checkbox" "treeSelects")}}orm:"with:{{$column.LinkLabelId}}={{$column.ColumnName}}" {{end}}json:"linked{{$column.GoField}}" dc:"{{$column.ColumnComment}}"`
@@ -111,6 +123,18 @@ type {{.table.ClassName}}ListRes struct{
UpdatedUser *{{if $hasUser}}systemModel.{{end}}LinkUserRes `orm:"with:id=updated_by" json:"updatedUser"`
{{end}}
{{end}}
{{if eq $column.HtmlType "userSelectorSingle"}}
Linked{{$column.GoField}} *{{if $hasUser}}systemModel.{{end}}LinkUserRes `orm:"with:id={{$column.ColumnName}}" json:"linked{{$column.GoField}}" dc:"{{$column.ColumnComment}}"`
{{end}}
{{if eq $column.HtmlType "userSelectorMultiple"}}
Linked{{$column.GoField}} []*{{if $hasUser}}systemModel.{{end}}SysUserSimpleRes `json:"linked{{$column.GoField}}" dc:"{{$column.ColumnComment}}"`
{{end}}
{{if eq $column.HtmlType "deptSelectorSingle"}}
Linked{{$column.GoField}} *{{if $hasUser}}systemModel.{{end}}LinkDeptRes `json:"linked{{$column.GoField}}" dc:"{{$column.ColumnComment}}"`
{{end}}
{{if eq $column.HtmlType "deptSelectorMultiple"}}
Linked{{$column.GoField}} []*{{if $hasUser}}systemModel.{{end}}LinkDeptRes `json:"linked{{$column.GoField}}" dc:"{{$column.ColumnComment}}"`
{{end}}
{{end}}
{{else}}
{{if not .table.IsPkListable }}
@@ -126,12 +150,24 @@ type {{.table.ClassName}}ListRes struct{
{{if eq $column.HtmlField "updatedBy"}}
UpdatedUser *{{if $hasUser}}systemModel.{{end}}LinkUserRes `orm:"with:id=updated_by" json:"updatedBy"`
{{end}}
{{$column.GoField}} {{if eq $column.GoType "Time"}}*gtime.Time{{else}}{{$column.GoType}}{{end}} `json:"{{$column.HtmlField}}{{if and $column.IsPk $.table.UseSnowId}},string{{end}}" dc:"{{$column.ColumnComment}}"`
{{$column.GoField}} {{if eq $column.GoType "Time"}}*gtime.Time{{else if eq $column.HtmlType "userSelectorMultiple" "deptSelectorMultiple"}}[]uint64{{else}}{{$column.GoType}}{{end}} `json:"{{$column.HtmlField}}{{if and $column.IsPk $.table.UseSnowId}},string{{end}}" dc:"{{$column.ColumnComment}}"`
{{range $ti, $linkedTable := $.table.LinkedTables}}
{{if eq $column.LinkTableClass $linkedTable.ClassName}}
Linked{{$column.GoField}} {{if eq $column.HtmlType "selects" "checkbox" "treeSelects"}}[]{{end}}*Linked{{$.table.ClassName}}{{$linkedTable.ClassName}} `{{if not (eq $column.HtmlType "selects" "checkbox" "treeSelects")}}orm:"with:{{$column.LinkLabelId}}={{$column.ColumnName}}" {{end}}json:"linked{{$column.GoField}}" dc:"{{$column.ColumnComment}}"`
{{end}}
{{end}}
{{if eq $column.HtmlType "userSelectorSingle"}}
Linked{{$column.GoField}} *{{if $hasUser}}systemModel.{{end}}LinkUserRes `orm:"with:id={{$column.ColumnName}}" json:"linked{{$column.GoField}}" dc:"{{$column.ColumnComment}}"`
{{end}}
{{if eq $column.HtmlType "userSelectorMultiple"}}
Linked{{$column.GoField}} []*{{if $hasUser}}systemModel.{{end}}SysUserSimpleRes `json:"linked{{$column.GoField}}" dc:"{{$column.ColumnComment}}"`
{{end}}
{{if eq $column.HtmlType "deptSelectorSingle"}}
Linked{{$column.GoField}} *{{if $hasUser}}systemModel.{{end}}LinkDeptRes `json:"linked{{$column.GoField}}" dc:"{{$column.ColumnComment}}"`
{{end}}
{{if eq $column.HtmlType "deptSelectorMultiple"}}
Linked{{$column.GoField}} []*{{if $hasUser}}systemModel.{{end}}LinkDeptRes `json:"linked{{$column.GoField}}" dc:"{{$column.ColumnComment}}"`
{{end}}
{{end}}
{{end}}
}
@@ -143,7 +179,7 @@ type {{.table.ClassName}}SearchReq struct {
comModel.PageReq
{{end}}
{{range $index, $column := .table.QueryColumns}}
{{$column.GoField}} {{if eq $column.GoType "Time" "int" "int64" "uint" "uint64" "float" "float64" "bool"}}{{if eq $column.QueryType "BETWEEN"}}[]{{end}}string{{else}}{{if eq $column.QueryType "BETWEEN"}}[]{{end}}{{$column.GoType}}{{end}} `p:"{{$column.HtmlField}}"{{if ne $column.FieldValidation ""}} v:"{{$column.FieldValidation}}"{{end}} dc:"{{$column.ColumnComment}}"` //{{$column.ColumnComment}}
{{$column.GoField}} {{if eq $column.GoType "Time" "int" "int64" "uint" "uint64" "float" "float64" "bool"}}{{if eq $column.QueryType "BETWEEN"}}[]{{end}}string{{else if eq $column.HtmlType "userSelectorMultiple" "deptSelectorMultiple"}}[]uint64{{else}}{{if eq $column.QueryType "BETWEEN"}}[]{{end}}{{$column.GoType}}{{end}} `p:"{{$column.HtmlField}}"{{if ne $column.FieldValidation ""}} v:"{{$column.FieldValidation}}"{{end}} dc:"{{$column.ColumnComment}}"` //{{$column.ColumnComment}}
{{end}}
}
@@ -172,7 +208,7 @@ type {{.table.ClassName}}AddReq struct {
{{.table.PkColumn.GoField}} {{.table.PkColumn.GoType}} `p:"{{.table.PkColumn.HtmlField}}" v:"required#主键ID不能为空" dc:"{{.table.PkColumn.ColumnComment}}"`
{{end}}
{{range $index, $column := .table.EditColumns}}
{{$column.GoField}} {{if eq $column.GoType "Time"}}*gtime.Time{{else if eq $column.HtmlType "images" "file" "files"}}[]*comModel.UpFile{{else if eq $column.HtmlType "checkbox" "selects" "treeSelects"}}garray.StrArray{{else}}{{$column.GoType}}{{end}} `p:"{{$column.HtmlField}}" {{if $column.IsRequired}}v:"required#{{$column.ColumnComment}}不能为空"{{end}} dc:"{{$column.ColumnComment}}"`
{{$column.GoField}} {{if eq $column.GoType "Time"}}*gtime.Time{{else if eq $column.HtmlType "images" "file" "files" "imageSelector" "fileSelector"}}[]*comModel.UpFile{{else if eq $column.HtmlType "checkbox" "selects" "treeSelects"}}garray.StrArray{{else if eq $column.HtmlType "userSelectorMultiple" "deptSelectorMultiple"}}[]uint64{{else}}{{$column.GoType}}{{end}} `p:"{{$column.HtmlField}}" {{if $column.IsRequired}}v:"required#{{$column.ColumnComment}}不能为空"{{end}} dc:"{{$column.ColumnComment}}"`
{{end}}
{{if .table.HasCreatedBy}}
CreatedBy uint64
@@ -187,7 +223,7 @@ type {{.table.ClassName}}AddReq struct {
type {{.table.ClassName}}EditReq struct {
{{.table.PkColumn.GoField}} {{.table.PkColumn.GoType}} `p:"{{.table.PkColumn.HtmlField}}" v:"required#主键ID不能为空" dc:"{{.table.PkColumn.ColumnComment}}"`
{{range $index, $column := .table.EditColumns}}
{{$column.GoField}} {{if eq $column.GoType "Time"}}*gtime.Time{{else if eq $column.HtmlType "images" "file" "files"}}[]*comModel.UpFile{{else if eq $column.HtmlType "checkbox" "selects" "treeSelects"}}garray.StrArray{{else}}{{$column.GoType}}{{end}} `p:"{{$column.HtmlField}}" {{if $column.IsRequired}}v:"required#{{$column.ColumnComment}}不能为空"{{end}} dc:"{{$column.ColumnComment}}"`
{{$column.GoField}} {{if eq $column.GoType "Time"}}*gtime.Time{{else if eq $column.HtmlType "images" "file" "files" "imageSelector" "fileSelector"}}[]*comModel.UpFile{{else if eq $column.HtmlType "checkbox" "selects" "treeSelects"}}garray.StrArray{{else if eq $column.HtmlType "userSelectorMultiple" "deptSelectorMultiple"}}[]uint64{{else}}{{$column.GoType}}{{end}} `p:"{{$column.HtmlField}}" {{if $column.IsRequired}}v:"required#{{$column.ColumnComment}}不能为空"{{end}} dc:"{{$column.ColumnComment}}"`
{{end}}
{{if .table.HasUpdatedBy}}
UpdatedBy uint64

View File

@@ -7,7 +7,7 @@ export interface {{.table.ClassName}}TableColumns {
{{end}}
{{range $index, $column := .table.Columns}}
{{if and $column.IsList (ne $column.HtmlField $.table.TreeCode) (ne $column.HtmlField $.table.TreeParentCode) (ne $column.HtmlField $.table.TreeName) }}
{{$column.HtmlField}}:{{if and (eq $column.HtmlType "images" "file" "files" "checkbox" "selects" "treeSelects") (eq $column.DictType "")}}any[]{{else}}{{$column.TsType}}{{end}}; // {{$column.ColumnComment}}
{{$column.HtmlField}}:{{if and (eq $column.HtmlType "images" "file" "files" "checkbox" "selects" "treeSelects" "imageSelector" "fileSelector") (eq $column.DictType "")}}any[]{{else if eq $column.HtmlType "userSelectorMultiple" "deptSelectorMultiple"}}number[]{{else}}{{$column.TsType}}{{end}}; // {{$column.ColumnComment}}
{{end}}
{{range $ti, $linkedTable := $.table.LinkedTables}}
{{if eq $column.LinkTableClass $linkedTable.ClassName}}
@@ -23,7 +23,7 @@ export interface {{.table.ClassName}}TableColumns {
{{if eq $column.HtmlField "createdBy" "updatedBy"}}
{{$column.HtmlField}}:string; // {{$column.ColumnComment}}
{{else}}
{{$column.HtmlField}}:{{if and (eq $column.HtmlType "images" "file" "files" "checkbox" "selects" "treeSelects") (eq $column.DictType "")}}any[]{{else}}{{$column.TsType}}{{end}}; // {{$column.ColumnComment}}
{{$column.HtmlField}}:{{if and (eq $column.HtmlType "images" "file" "files" "checkbox" "selects" "treeSelects" "imageSelector" "fileSelector") (eq $column.DictType "")}}any[]{{else if eq $column.HtmlType "userSelectorMultiple" "deptSelectorMultiple"}}number[]{{else}}{{$column.TsType}}{{end}}; // {{$column.ColumnComment}}
{{end}}
{{range $ti, $linkedTable := $.table.LinkedTables}}
{{if eq $column.LinkTableClass $linkedTable.ClassName}}
@@ -40,12 +40,24 @@ export interface {{.table.ClassName}}TableColumns {
////
export interface {{.table.ClassName}}InfoData {
{{range $index, $column := .table.Columns}}
{{if $column.IsPk}}{{$column.HtmlField}}:{{if eq $column.HtmlType "images" "file" "files" "checkbox" "selects" "treeSelects"}}any[]{{else if eq $column.HtmlType "switch"}}boolean{{else if eq $column.HtmlType "keyValue"}}{key:string,value:any}[]{{else}}{{$column.TsType}}|undefined{{end}}; // {{$column.ColumnComment}} {{else}}{{$column.HtmlField}}:{{if eq $column.HtmlType "images" "file" "files" "checkbox" "selects" "treeSelects"}}any[]{{else if eq $column.HtmlType "switch"}}boolean{{else if eq $column.HtmlType "keyValue"}}{key:string,value:any}[]{{else}}{{$column.TsType}}|undefined{{end}}; // {{$column.ColumnComment}} {{end}}
{{if $column.IsPk}}{{$column.HtmlField}}:{{if eq $column.HtmlType "images" "file" "files" "checkbox" "selects" "treeSelects" "imageSelector" "fileSelector"}}any[]{{else if eq $column.HtmlType "userSelectorMultiple" "deptSelectorMultiple"}}number[]{{else if eq $column.HtmlType "switch"}}boolean{{else if eq $column.HtmlType "keyValue"}}{key:string,value:any}[]{{else}}{{$column.TsType}}|undefined{{end}}; // {{$column.ColumnComment}} {{else}}{{$column.HtmlField}}:{{if eq $column.HtmlType "images" "file" "files" "checkbox" "selects" "treeSelects" "imageSelector" "fileSelector"}}any[]{{else if eq $column.HtmlType "userSelectorMultiple" "deptSelectorMultiple"}}number[]{{else if eq $column.HtmlType "switch"}}boolean{{else if eq $column.HtmlType "keyValue"}}{key:string,value:any}[]{{else}}{{$column.TsType}}|undefined{{end}}; // {{$column.ColumnComment}} {{end}}
{{range $ti, $linkedTable := $.table.LinkedTables}}
{{if eq $column.LinkTableClass $linkedTable.ClassName}}
linked{{$column.GoField}}?:Linked{{$.table.ClassName}}{{$linkedTable.ClassName}}{{if eq $column.HtmlType "checkbox" "selects" "treeSelects"}}[]{{end}}; // {{$column.ColumnComment}}
{{end}}
{{end}}
{{if eq $column.HtmlType "userSelectorSingle"}}
linked{{$column.GoField}} : LinkedUserData|null;
{{end}}
{{if eq $column.HtmlType "userSelectorMultiple"}}
linked{{$column.GoField}} : LinkedUserData[];
{{end}}
{{if eq $column.HtmlType "deptSelectorSingle"}}
linked{{$column.GoField}} : LinkedDeptData|null;
{{end}}
{{if eq $column.HtmlType "deptSelectorMultiple"}}
linked{{$column.GoField}} : LinkedDeptData[];
{{end}}
{{end}}
{{range $ti, $linkedTable := .table.LinkedTables}}
linked{{$.table.ClassName}}{{$linkedTable.ClassName}}?:Linked{{$.table.ClassName}}{{$linkedTable.ClassName}};
@@ -56,7 +68,7 @@ export interface {{.table.ClassName}}InfoData {
////
export interface Linked{{$.table.ClassName}}{{$linkedTable.ClassName}} {
{{range $ci, $linkedColumn := $linkedTable.RefColumns.Values}}
{{$linkedColumn.HtmlField}}:{{if eq $linkedColumn.HtmlType "images" "file" "files"}}any[]{{else}}{{$linkedColumn.TsType}}|undefined{{end}}; // {{$linkedColumn.ColumnComment}}
{{$linkedColumn.HtmlField}}:{{if eq $linkedColumn.HtmlType "images" "file" "files" "imageSelector" "fileSelector"}}any[]{{else if eq $linkedColumn.HtmlType "userSelectorMultiple" "deptSelectorMultiple"}}number[]{{else}}{{$linkedColumn.TsType}}|undefined{{end}}; // {{$linkedColumn.ColumnComment}}
{{end}}
}
{{end}}
@@ -74,6 +86,8 @@ export interface {{.table.ClassName}}TableDataState {
{{range $index, $column := .table.QueryColumns}}
{{if eq $column.QueryType "BETWEEN"}}
{{$column.HtmlField}}: {{$column.TsType}}[];
{{else if eq $column.HtmlType "userSelectorMultiple" "deptSelectorMultiple"}}
{{$column.HtmlField}}: number[];
{{else}}
{{$column.HtmlField}}: {{$column.TsType}}|undefined;
{{end}}{{end}}
@@ -82,6 +96,31 @@ export interface {{.table.ClassName}}TableDataState {
};
}
{{$hasUserSelector := false}}
{{$hasDeptSelector := false}}
{{range $index, $column := .table.Columns}}
{{if eq $column.HtmlType "userSelectorMultiple" "userSelectorSingle"}}
{{$hasUserSelector = true}}
{{end}}
{{if eq $column.HtmlType "deptSelectorMultiple" "deptSelectorSingle"}}
{{$hasDeptSelector = true}}
{{end}}
{{end}}
{{if $hasUserSelector}}
////
export interface LinkedDeptData {
deptId:number;
deptName:string;
}
{{end}}
{{if $hasDeptSelector}}
////
export interface LinkedUserData {
id:number;
userNickname:string;
}
{{end}}
////
export interface {{.table.ClassName}}EditState{
loading:boolean;

View File

@@ -154,6 +154,69 @@
:href="proxy.getUpFileUrl(item.url)" target="_blank">{{"{{"}}item.name{{"}}"}}</el-link>
</div>
</el-descriptions-item>
{{else if eq $column.HtmlType "imageSelector"}}
<el-descriptions-item :span="{{$column.ColSpan}}">
<template #label>
<div class="cell-item">
{{$column.ColumnComment}}
</div>
</template>
<div class="pic-block" v-for="(img,key) in formData.{{$column.HtmlField}}" :key="'{{$column.HtmlField}}-'+key">
<el-image
style="width: 150px; height: 150px"
v-if="!proxy.isEmpty(img.url)"
:src="proxy.getUpFileUrl(img.url)"
fit="contain"></el-image>
</div>
</el-descriptions-item>
{{else if eq $column.HtmlType "fileSelector"}}
<el-descriptions-item :span="{{$column.ColSpan}}">
<template #label>
<div class="cell-item">
{{$column.ColumnComment}}
</div>
</template>
<div class="file-block" v-for="(item,key) in formData.{{$column.HtmlField}}" :key="'{{$column.HtmlField}}-'+key">
<el-link type="primary" :underline="false"
:href="proxy.getUpFileUrl(item.url)" target="_blank">{{"{{"}}item.name{{"}}"}}</el-link>
</div>
</el-descriptions-item>
{{else if eq $column.HtmlType "userSelectorSingle"}}
<el-descriptions-item :span="{{$column.ColSpan}}">
<template #label>
<div class="cell-item">
{{$column.ColumnComment}}
</div>
</template>
{{"{{"}} formData.linked{{$column.GoField}}?formData.linked{{$column.GoField}}.userNickname:'' {{"}}"}}
</el-descriptions-item>
{{else if eq $column.HtmlType "deptSelectorSingle"}}
<el-descriptions-item :span="{{$column.ColSpan}}">
<template #label>
<div class="cell-item">
{{$column.ColumnComment}}
</div>
</template>
{{"{{"}} formData.linked{{$column.GoField}}?formData.linked{{$column.GoField}}.deptName:'' {{"}}"}}
</el-descriptions-item>
{{else if eq $column.HtmlType "userSelectorMultiple"}}
<el-descriptions-item :span="{{$column.ColSpan}}">
<template #label>
<div class="cell-item">
{{$column.ColumnComment}}
</div>
</template>
{{"{{"}} formData.linked{{$column.GoField}}?formData.linked{{$column.GoField}}.map((res:any)=>{return res.userNickname}).join(''):'' {{"}}"}}
</el-descriptions-item>
{{else if eq $column.HtmlType "deptSelectorMultiple"}}
<el-descriptions-item :span="{{$column.ColSpan}}">
<template #label>
<div class="cell-item">
{{$column.ColumnComment}}
</div>
</template>
{{"{{"}} formData.linked{{$column.GoField}}?formData.linked{{$column.GoField}}.map((res:any)=>{return res.deptName}).join(''):'' {{"}}"}}
</el-descriptions-item>
{{else if eq $column.HtmlType "keyValue"}}
<el-descriptions-item :span="{{$column.ColSpan}}">
<template #label>
@@ -296,7 +359,7 @@
{{range $index, $column := .table.Columns}}
{{if eq $column.HtmlType "radio"}}
{{$column.HtmlField}}: false ,
{{else if eq $column.HtmlType "images" "file" "files" "checkbox" "selects" "treeSelects" "keyValue"}}
{{else if eq $column.HtmlType "images" "file" "files" "checkbox" "selects" "treeSelects" "keyValue" "imageSelector" "fileSelector" "deptSelectorMultiple" "userSelectorMultiple"}}
{{$column.HtmlField}}: [] ,
{{else}}
{{$column.HtmlField}}: undefined,
@@ -310,11 +373,16 @@
{{end}}
{{end}}
{{end}}
{{if eq $column.HtmlType "userSelectorMultiple" "deptSelectorMultiple"}}
linked{{$column.GoField}}:[],
{{else if eq $column.HtmlType "userSelectorSingle" "deptSelectorSingle"}}
linked{{$column.GoField}}:null,
{{end}}
{{end}}
{{range $ti, $linkedTable := .table.LinkedTables}}
linked{{$.table.ClassName}}{{$linkedTable.ClassName}}: {
{{range $ci, $linkedColumn := $linkedTable.RefColumns.Values}}
{{$linkedColumn.HtmlField}}:{{if eq $linkedColumn.HtmlType "images" "file" "files"}}[]{{else}}undefined{{end}}, // {{$linkedColumn.ColumnComment}}
{{$linkedColumn.HtmlField}}:{{if eq $linkedColumn.HtmlType "images" "file" "files" "imageSelector" "fileSelector" "deptSelectorMultiple" "userSelectorMultiple"}}[]{{else}}undefined{{end}}, // {{$linkedColumn.ColumnComment}}
{{end}}
},
{{end}}
@@ -345,8 +413,10 @@
{{else if eq $column.HtmlType "imagefile"}}
//单图地址赋值
imageUrl{{$column.GoField}}.value = data.{{$column.HtmlField}} ? proxy.getUpFileUrl(data.{{$column.HtmlField}}) : ''
{{else if eq $column.HtmlType "images" "file" "files" "keyValue"}}
{{else if eq $column.HtmlType "images" "file" "files" "keyValue" "imageSelector" "fileSelector"}}
data.{{$column.HtmlField}} =data.{{$column.HtmlField}}?JSON.parse(data.{{$column.HtmlField}}) : []
{{else if eq $column.HtmlType "userSelectorMultiple" "deptSelectorMultiple"}}
data.{{$column.HtmlField}} = data.{{$column.HtmlField}}?data.{{$column.HtmlField}}:[]
{{end}}
{{if eq $column.HtmlField "createdBy"}}
data.createdBy = data.createdUser?.userNickname
@@ -379,7 +449,7 @@
{{range $index, $column := .table.Columns}}
{{if eq $column.HtmlType "radio"}}
{{$column.HtmlField}}: false ,
{{else if eq $column.HtmlType "images" "file" "files" "checkbox" "selects" "treeSelects" "keyValue"}}
{{else if eq $column.HtmlType "images" "file" "files" "checkbox" "selects" "treeSelects" "keyValue" "imageSelector" "fileSelector" "userSelectorMultiple" "deptSelectorMultiple"}}
{{$column.HtmlField}}: [] ,
{{else}}
{{$column.HtmlField}}: undefined,
@@ -393,11 +463,16 @@
{{end}}
{{end}}
{{end}}
{{if eq $column.HtmlType "userSelectorMultiple" "deptSelectorMultiple"}}
linked{{$column.GoField}}:[],
{{else if eq $column.HtmlType "userSelectorSingle" "deptSelectorSingle"}}
linked{{$column.GoField}}:null,
{{end}}
{{end}}
{{range $ti, $linkedTable := .table.LinkedTables}}
linked{{$.table.ClassName}}{{$linkedTable.ClassName}}: {
{{range $ci, $linkedColumn := $linkedTable.RefColumns.Values}}
{{$linkedColumn.HtmlField}}:{{if eq $linkedColumn.HtmlType "images" "file" "files"}}[]{{else}}undefined{{end}}, // {{$linkedColumn.ColumnComment}}
{{$linkedColumn.HtmlField}}:{{if eq $linkedColumn.HtmlType "images" "file" "files" "imageSelector" "fileSelector" "userSelectorMultiple" "deptSelectorMultiple"}}[]{{else}}undefined{{end}}, // {{$linkedColumn.ColumnComment}}
{{end}}
},
{{end}}

View File

@@ -39,7 +39,7 @@
{{else if eq $column.HtmlType "select" "selects"}}
{{if ne $column.LinkTableName ""}}
<el-form-item label="{{$column.ColumnComment}}" prop="{{$column.HtmlField}}">
<el-select v-model="formData.{{$column.HtmlField}}" placeholder="请选择{{$column.ColumnComment}}" {{if $column.IsPk}}v-bind:disabled="this.currentOp === 'edit'" {{end}} {{if $column.IsCascadeParent}}@change="form{{$column.ColumnName | CaseCamel}}Changed"{{end}} {{if eq $column.HtmlType "selects"}}multiple{{end}}>
<el-select filterable v-model="formData.{{$column.HtmlField}}" placeholder="请选择{{$column.ColumnComment}}" {{if $column.IsPk}}v-bind:disabled="this.currentOp === 'edit'" {{end}} {{if $column.IsCascadeParent}}@change="form{{$column.ColumnName | CaseCamel}}Changed"{{end}} {{if eq $column.HtmlType "selects"}}multiple{{end}}>
<el-option
{{if $column.IsCascade}}
v-for="item in {{$column.HtmlField}}FormOptions"
@@ -54,7 +54,7 @@
</el-form-item>
{{else if ne $column.DictType ""}}
<el-form-item label="{{$column.ColumnComment}}" prop="{{$column.HtmlField}}">
<el-select v-model="formData.{{$column.HtmlField}}" placeholder="请选择{{$column.ColumnComment}}" {{if $column.IsPk}}v-bind:disabled="this.currentOp === 'edit'" {{end}}>
<el-select filterable v-model="formData.{{$column.HtmlField}}" placeholder="请选择{{$column.ColumnComment}}" {{if $column.IsPk}}v-bind:disabled="this.currentOp === 'edit'" {{end}}>
<el-option
v-for="dict in {{$column.HtmlField}}Options"
:key="dict.value"
@@ -69,7 +69,7 @@
</el-form-item>
{{else}}
<el-form-item label="{{$column.ColumnComment}}" prop="{{$column.HtmlField}}">
<el-select v-model="formData.{{$column.HtmlField}}" placeholder="请选择{{$column.ColumnComment}}" {{if $column.IsPk}}v-bind:disabled="this.currentOp === 'edit'" {{end}}>
<el-select filterable v-model="formData.{{$column.HtmlField}}" placeholder="请选择{{$column.ColumnComment}}" {{if $column.IsPk}}v-bind:disabled="this.currentOp === 'edit'" {{end}}>
<el-option label="请选择字典生成" value="" />
</el-select>
</el-form-item>
@@ -171,7 +171,7 @@
{{end}}
{{else if eq $column.HtmlType "richtext"}}
<el-form-item label="{{$column.ColumnComment}}">
<gf-ueditor editorId="ue{{$.table.ClassName}}{{$column.GoField}}" v-model="formData.{{$column.HtmlField}}" @setEditContent="set{{$column.GoField}}EditContent"></gf-ueditor>
<gf-ueditor editorId="ue{{$.table.ClassName}}{{$column.GoField}}" v-model="formData.{{$column.HtmlField}}"></gf-ueditor>
</el-form-item>
{{else if eq $column.HtmlType "imagefile"}}
<el-form-item label="{{$column.ColumnComment}}" prop="{{$column.HtmlField}}">
@@ -191,15 +191,39 @@
</el-form-item>
{{else if eq $column.HtmlType "images"}}
<el-form-item label="{{$column.ColumnComment}}" prop="{{$column.HtmlField}}" >
<upload-img :action="baseURL+'{{$.apiVersion}}/system/upload/singleImg'" v-model="formData.{{$column.HtmlField}}" @uploadData="setUpImgList{{$column.GoField}}" :limit="10"></upload-img>
<upload-img :action="baseURL+'{{$.apiVersion}}/system/upload/singleImg'" v-model="formData.{{$column.HtmlField}}" :limit="10"></upload-img>
</el-form-item>
{{else if eq $column.HtmlType "file"}}
<el-form-item label="{{$column.ColumnComment}}" prop="{{$column.HtmlField}}" >
<upload-file :action="baseURL+'{{$.apiVersion}}/system/upload/singleFile'" v-model="formData.{{$column.HtmlField}}" @upFileData="setUpFileList{{$column.GoField}}" :limit="1"></upload-file>
<upload-file :action="baseURL+'{{$.apiVersion}}/system/upload/singleFile'" v-model="formData.{{$column.HtmlField}}" :limit="1"></upload-file>
</el-form-item>
{{else if eq $column.HtmlType "files"}}
<el-form-item label="{{$column.ColumnComment}}" prop="{{$column.HtmlField}}" >
<upload-file :action="baseURL+'{{$.apiVersion}}/system/upload/singleFile'" v-model="formData.{{$column.HtmlField}}" @upFileData="setUpFileList{{$column.GoField}}" :limit="10"></upload-file>
<upload-file :action="baseURL+'{{$.apiVersion}}/system/upload/singleFile'" v-model="formData.{{$column.HtmlField}}" :limit="10"></upload-file>
</el-form-item>
{{else if eq $column.HtmlType "imageSelector"}}
<el-form-item label="{{$column.ColumnComment}}" prop="{{$column.HtmlField}}">
<upload-selector v-model="formData.{{$column.HtmlField}}" fileType="image" :limit="10"></upload-selector>
</el-form-item>
{{else if eq $column.HtmlType "fileSelector"}}
<el-form-item label="{{$column.ColumnComment}}" prop="{{$column.HtmlField}}">
<upload-selector v-model="formData.{{$column.HtmlField}}" fileType="file" :limit="10"></upload-selector>
</el-form-item>
{{else if eq $column.HtmlType "userSelectorSingle"}}
<el-form-item label="{{$column.ColumnComment}}" prop="{{$column.HtmlField}}">
<select-user v-model="{{$column.HtmlField}}" :multiple="false"></select-user>
</el-form-item>
{{else if eq $column.HtmlType "userSelectorMultiple"}}
<el-form-item label="{{$column.ColumnComment}}" prop="{{$column.HtmlField}}">
<select-user v-model="formData.{{$column.HtmlField}}"></select-user>
</el-form-item>
{{else if eq $column.HtmlType "deptSelectorSingle"}}
<el-form-item label="{{$column.ColumnComment}}" prop="{{$column.HtmlField}}">
<select-dept v-model="formData.{{$column.HtmlField}}"></select-dept>
</el-form-item>
{{else if eq $column.HtmlType "deptSelectorMultiple"}}
<el-form-item label="{{$column.ColumnComment}}" prop="{{$column.HtmlField}}">
<select-dept v-model="formData.{{$column.HtmlField}}" :multiple="true"></select-dept>
</el-form-item>
{{else if eq $column.HtmlType "keyValue"}}
<p class="kv-label" >{{$column.ColumnComment}}</p>
@@ -251,7 +275,10 @@
{{$imgsImp := false}}
{{$editImp := false }}
{{$fileImp := false}}
{{$fileSelectorImp := false}}
{{$getUserList:=false}}
{{$selectorUserImp:=false}}
{{$selectorDeptImp:=false}}
{{range $index,$column:=.table.Columns}}
{{if eq $column.HtmlType "richtext"}}
@@ -262,6 +289,12 @@
{{$imgsImp = true}}
{{else if eq $column.HtmlType "file" "files"}}
{{$fileImp = true}}
{{else if or (eq $column.HtmlType "fileSelector") (eq $column.HtmlType "imageSelector")}}
{{$fileSelectorImp = true}}
{{else if or (eq $column.HtmlType "userSelectorSingle") (eq $column.HtmlType "userSelectorMultiple")}}
{{$selectorUserImp = true}}
{{else if or (eq $column.HtmlType "deptSelectorSingle") (eq $column.HtmlType "deptSelectorMultiple")}}
{{$selectorDeptImp = true}}
{{end}}
{{if eq $column.HtmlField "createdBy" "updatedBy"}}
{{$getUserList = true}}
@@ -269,7 +302,7 @@
{{end}}
<script setup lang="ts">
import { reactive, toRefs, ref,unref,getCurrentInstance } from 'vue';
import { reactive, toRefs, ref,unref,getCurrentInstance,computed } from 'vue';
import {ElMessageBox, ElMessage, FormInstance,UploadProps} from 'element-plus';
{{/*去重处理*/}}
import {
@@ -297,6 +330,15 @@ import uploadImg from "/@/components/uploadImg/index.vue"
{{if $fileImp}}
import uploadFile from "/@/components/uploadFile/index.vue"
{{end}}
{{if $fileSelectorImp}}
import uploadSelector from "/@/components/uploadSelector/index.vue"
{{end}}
{{if $selectorUserImp}}
import selectUser from "/@/components/selectUser/index.vue"
{{end}}
{{if $selectorDeptImp}}
import selectDept from "/@/components/selectDept/index.vue"
{{end}}
import {
{{.table.ClassName}}TableColumns,
{{.table.ClassName}}InfoData,
@@ -370,18 +412,23 @@ const state = reactive<{{.table.ClassName}}EditState>({
{{range $index, $column := .table.Columns}}
{{if eq $column.HtmlType "switch"}}
{{$column.HtmlField}}: false ,
{{else if eq $column.HtmlType "images" "file" "files" "checkbox" "selects" "treeSelects"}}
{{else if eq $column.HtmlType "images" "file" "files" "checkbox" "selects" "treeSelects" "imageSelector" "fileSelector" "deptSelectorMultiple" "userSelectorMultiple"}}
{{$column.HtmlField}}: [] ,
{{else if eq $column.HtmlType "keyValue"}}
{{$column.HtmlField}}:[{key:"",value:""}],
{{else}}
{{$column.HtmlField}}: undefined,
{{end}}
{{if eq $column.HtmlType "userSelectorMultiple" "deptSelectorMultiple"}}
linked{{$column.GoField}}:[],
{{else if eq $column.HtmlType "userSelectorSingle" "deptSelectorSingle"}}
linked{{$column.GoField}}:null,
{{end}}
{{end}}
{{range $ti, $linkedTable := .table.LinkedTables}}
linked{{$.table.ClassName}}{{$linkedTable.ClassName}}: {
{{range $ci, $linkedColumn := $linkedTable.RefColumns.Values}}
{{$linkedColumn.HtmlField}}:{{if eq $linkedColumn.HtmlType "images" "file" "files"}}[]{{else}}undefined{{end}}, // {{$linkedColumn.ColumnComment}}
{{$linkedColumn.HtmlField}}:{{if eq $linkedColumn.HtmlType "images" "file" "files" "imageSelector" "fileSelector" "deptSelectorMultiple" "userSelectorMultiple"}}[]{{else}}undefined{{end}}, // {{$linkedColumn.ColumnComment}}
{{end}}
},
{{end}}
@@ -398,6 +445,18 @@ const state = reactive<{{.table.ClassName}}EditState>({
}
});
const { loading,isShowDialog,formData,rules } = toRefs(state);
{{range $index, $column := .table.EditColumns}}
{{if eq $column.HtmlType "userSelectorSingle"}}
const {{$column.HtmlField}} = computed({
get:()=>{
return state.formData.{{$column.HtmlField}}?[state.formData.{{$column.HtmlField}}]:[]
},
set:(val:number[])=>{
state.formData.{{$column.HtmlField}} = val?val[0]:0
}
})
{{end}}
{{end}}
// 打开弹窗
const openDialog = (row?: {{.table.ClassName}}InfoData) => {
resetForm();
@@ -453,10 +512,12 @@ const openDialog = (row?: {{.table.ClassName}}InfoData) => {
{{else if eq $column.HtmlType "imagefile"}}
//单图地址赋值
imageUrl{{$column.GoField}}.value = data.{{$column.HtmlField}} ? proxy.getUpFileUrl(data.{{$column.HtmlField}}) : ''
{{else if eq $column.HtmlType "images" "file" "files"}}
{{else if eq $column.HtmlType "images" "file" "files" "imageSelector" "fileSelector"}}
data.{{$column.HtmlField}} =data.{{$column.HtmlField}}?JSON.parse(data.{{$column.HtmlField}}) : []
{{else if eq $column.HtmlType "keyValue"}}
data.{{$column.HtmlField}} = data.{{$column.HtmlField}}?JSON.parse(data.{{$column.HtmlField}}) : [{key:'',value:''}]
{{else if eq $column.HtmlType "userSelectorMultiple" "deptSelectorMultiple"}}
data.{{$column.HtmlField}} = data.{{$column.HtmlField}}?data.{{$column.HtmlField}}:[]
{{end}}
{{end}}
state.formData = data;
@@ -511,18 +572,23 @@ const resetForm = ()=>{
{{$column.HtmlField}}: false ,
{{else if eq $column.HtmlType "radio"}}
{{$column.HtmlField}}: '' ,
{{else if eq $column.HtmlType "images" "file" "files" "checkbox" "selects" "treeSelects"}}
{{else if eq $column.HtmlType "images" "file" "files" "checkbox" "selects" "treeSelects" "imageSelector" "fileSelector" "userSelectorMultiple" "deptSelectorMultiple"}}
{{$column.HtmlField}}: [] ,
{{else if eq $column.HtmlType "keyValue"}}
{{$column.HtmlField}}:[{key:"",value:""}],
{{else}}
{{$column.HtmlField}}: undefined,
{{end}}
{{if eq $column.HtmlType "userSelectorMultiple" "deptSelectorMultiple"}}
linked{{$column.GoField}}:[],
{{else if eq $column.HtmlType "userSelectorSingle" "deptSelectorSingle"}}
linked{{$column.GoField}}:null,
{{end}}
{{end}}
{{range $ti, $linkedTable := .table.LinkedTables}}
linked{{$.table.ClassName}}{{$linkedTable.ClassName}}: {
{{range $ci, $linkedColumn := $linkedTable.RefColumns.Values}}
{{$linkedColumn.HtmlField}}:{{if eq $linkedColumn.HtmlType "images" "file" "files"}}[]{{else}}undefined{{end}}, // {{$linkedColumn.ColumnComment}}
{{$linkedColumn.HtmlField}}:{{if eq $linkedColumn.HtmlType "images" "file" "files" "imageSelector" "fileSelector" "userSelectorMultiple" "deptSelectorMultiple"}}[]{{else}}undefined{{end}}, // {{$linkedColumn.ColumnComment}}
{{end}}
},
{{end}}
@@ -535,12 +601,7 @@ const resetForm = ()=>{
};
{{$setUpData:=true}}
{{range $index, $column := .table.Columns}}
{{if eq $column.HtmlType "richtext"}}
//富文本编辑器{{$column.ColumnComment}}
const set{{$column.GoField}}EditContent = (data:string) => {
state.formData.{{$column.HtmlField}} = data
}
{{else if eq $column.HtmlType "imagefile"}}
{{if eq $column.HtmlType "imagefile"}}
//单图上传{{$column.ColumnComment}}
const handleAvatarSuccess{{$column.GoField}}:UploadProps['onSuccess'] = (res, file) => {
if (res.code === 0) {
@@ -561,14 +622,6 @@ const setUpData = () => {
}
{{$setUpData = false}}
{{end}}
{{else if eq $column.HtmlType "images"}}
const setUpImgList{{$column.GoField}} = (data:any)=>{
state.formData.{{$column.HtmlField}} = data
}
{{else if eq $column.HtmlType "file" "files"}}
const setUpFileList{{$column.GoField}} = (data:any)=>{
state.formData.{{$column.HtmlField}} = data
}
{{else if eq $column.HtmlType "keyValue"}}
// 新增{{$column.ColumnComment}}行
const onAddRow{{$column.GoField}} = () => {

View File

@@ -22,7 +22,7 @@
</el-form-item>
</el-col>
{{end}}
{{if eq $column.HtmlType "input" "textarea"}}
{{if eq $column.HtmlType "input" "textarea" "inputNumber"}}
<el-col :span="8" {{if lt $colIndex 2}}class="colBlock"{{else}}:class="showAll ? 'colBlock' : 'colNone'"{{end}}>
<el-form-item label="{{$column.ColumnComment}}" prop="{{$column.HtmlField}}">
<el-input
@@ -53,7 +53,7 @@
{{else if and (eq $column.HtmlType "select" "radio" "checkbox" "selects") (ne $column.DictType "") }}
<el-col :span="8" {{if lt $colIndex 2}}class="colBlock"{{else}}:class="showAll ? 'colBlock' : 'colNone'"{{end}}>
<el-form-item label="{{$column.ColumnComment}}" prop="{{$column.HtmlField}}">
<el-select v-model="tableData.param.{{$column.HtmlField}}" placeholder="请选择{{$column.ColumnComment}}" clearable style="width:200px;">
<el-select filterable v-model="tableData.param.{{$column.HtmlField}}" placeholder="请选择{{$column.ColumnComment}}" clearable style="width:200px;">
<el-option
v-for="dict in {{$column.DictType}}"
:key="dict.value"
@@ -130,7 +130,7 @@
{{else if and (eq $column.HtmlType "select" "radio" "checkbox" "selects") (ne $column.LinkTableName "")}}
<el-col :span="8" {{if lt $colIndex 2}}class="colBlock"{{else}}:class="showAll ? 'colBlock' : 'colNone'"{{end}}>
<el-form-item label="{{$column.ColumnComment}}" prop="{{$column.HtmlField}}">
<el-select v-model="tableData.param.{{$column.HtmlField}}" placeholder="请选择{{$column.ColumnComment}}" clearable {{if $column.IsCascadeParent}}@change="query{{$column.ColumnName | CaseCamel}}Changed"{{end}} style="width:200px;">
<el-select filterable v-model="tableData.param.{{$column.HtmlField}}" placeholder="请选择{{$column.ColumnComment}}" clearable {{if $column.IsCascadeParent}}@change="query{{$column.ColumnName | CaseCamel}}Changed"{{end}} style="width:200px;">
<el-option
{{if $column.IsCascade}}
v-for="item in {{$column.HtmlField}}QueryOptions"
@@ -167,10 +167,38 @@
</el-form-item>
</el-col>
{{$colIndex = ($colIndex | plus 1)}}
{{else if eq $column.HtmlType "userSelectorSingle"}}
<el-col :span="8" {{if lt $colIndex 2}}class="colBlock"{{else}}:class="showAll ? 'colBlock' : 'colNone'"{{end}}>
<el-form-item label="{{$column.ColumnComment}}" prop="{{$column.HtmlField}}">
<select-user v-model="{{$column.HtmlField}}" :multiple="false"></select-user>
</el-form-item>
</el-col>
{{$colIndex = ($colIndex | plus 1)}}
{{else if eq $column.HtmlType "userSelectorMultiple"}}
<el-col :span="8" {{if lt $colIndex 2}}class="colBlock"{{else}}:class="showAll ? 'colBlock' : 'colNone'"{{end}}>
<el-form-item label="{{$column.ColumnComment}}" prop="{{$column.HtmlField}}">
<select-user v-model="tableData.param.{{$column.HtmlField}}"></select-user>
</el-form-item>
</el-col>
{{$colIndex = ($colIndex | plus 1)}}
{{else if eq $column.HtmlType "deptSelectorSingle"}}
<el-col :span="8" {{if lt $colIndex 2}}class="colBlock"{{else}}:class="showAll ? 'colBlock' : 'colNone'"{{end}}>
<el-form-item label="{{$column.ColumnComment}}" prop="{{$column.HtmlField}}">
<select-dept v-model="tableData.param.{{$column.HtmlField}}"></select-dept>
</el-form-item>
</el-col>
{{$colIndex = ($colIndex | plus 1)}}
{{else if eq $column.HtmlType "deptSelectorMultiple"}}
<el-col :span="8" {{if lt $colIndex 2}}class="colBlock"{{else}}:class="showAll ? 'colBlock' : 'colNone'"{{end}}>
<el-form-item label="{{$column.ColumnComment}}" prop="{{$column.HtmlField}}">
<select-dept v-model="tableData.param.{{$column.HtmlField}}" :multiple="true"></select-dept>
</el-form-item>
</el-col>
{{$colIndex = ($colIndex | plus 1)}}
{{else}}
<el-col :span="8" {{if lt $colIndex 2}}class="colBlock"{{else}}:class="showAll ? 'colBlock' : 'colNone'"{{end}}>
<el-form-item label="{{$column.ColumnComment}}" prop="{{$column.HtmlField}}">
<el-select v-model="tableData.param.{{$column.HtmlField}}" placeholder="请选择{{$column.ColumnComment}}" clearable style="width:200px;">
<el-select filterable v-model="tableData.param.{{$column.HtmlField}}" placeholder="请选择{{$column.ColumnComment}}" clearable style="width:200px;">
<el-option label="请选择字典生成" value="" />
</el-select>
</el-form-item>
@@ -334,6 +362,42 @@
></el-switch>
</template>
</el-table-column>
{{else if eq $column.HtmlType "userSelectorSingle"}}
<el-table-column label="{{$column.ColumnComment}}" align="center"
{{if gt $column.MinWidth 0}}min-width="{{$column.MinWidth}}px"{{end}}
{{if $column.IsOverflowTooltip}}:show-overflow-tooltip="true"{{end}}
{{if $column.IsFixed}}fixed="left"{{end}}>
<template #default="scope">
{{"{{"}} scope.row.linked{{$column.GoField}}?scope.row.linked{{$column.GoField}}.userNickname:'' {{"}}"}}
</template>
</el-table-column>
{{else if eq $column.HtmlType "userSelectorMultiple"}}
<el-table-column label="{{$column.ColumnComment}}" align="center"
{{if gt $column.MinWidth 0}}min-width="{{$column.MinWidth}}px"{{end}}
{{if $column.IsOverflowTooltip}}:show-overflow-tooltip="true"{{end}}
{{if $column.IsFixed}}fixed="left"{{end}}>
<template #default="scope">
{{"{{"}} scope.row.linked{{$column.GoField}}?scope.row.linked{{$column.GoField}}.map((res:any)=>{return res.userNickname}).join(''):'' {{"}}"}}
</template>
</el-table-column>
{{else if eq $column.HtmlType "deptSelectorSingle"}}
<el-table-column label="{{$column.ColumnComment}}" align="center"
{{if gt $column.MinWidth 0}}min-width="{{$column.MinWidth}}px"{{end}}
{{if $column.IsOverflowTooltip}}:show-overflow-tooltip="true"{{end}}
{{if $column.IsFixed}}fixed="left"{{end}}>
<template #default="scope">
{{"{{"}} scope.row.linked{{$column.GoField}}?scope.row.linked{{$column.GoField}}.deptName:'' {{"}}"}}
</template>
</el-table-column>
{{else if eq $column.HtmlType "deptSelectorMultiple"}}
<el-table-column label="{{$column.ColumnComment}}" align="center"
{{if gt $column.MinWidth 0}}min-width="{{$column.MinWidth}}px"{{end}}
{{if $column.IsOverflowTooltip}}:show-overflow-tooltip="true"{{end}}
{{if $column.IsFixed}}fixed="left"{{end}}>
<template #default="scope">
{{"{{"}} scope.row.linked{{$column.GoField}}?scope.row.linked{{$column.GoField}}.map((res:any)=>{return res.deptName}).join(''):'' {{"}}"}}
</template>
</el-table-column>
{{else if ne $column.LinkTableName ""}}
<el-table-column label="{{$column.ColumnComment}}" align="center" prop="linked{{$column.GoField}}.{{$column.LinkLabelName | CaseCamelLower}}"
{{if gt $column.MinWidth 0}}min-width="{{$column.MinWidth}}px"{{end}}
@@ -432,6 +496,8 @@
{{$editImp := false }}
{{$fileImp := false}}
{{$getUserList:=false}}
{{$selectorUserImp:=false}}
{{$selectorDeptImp:=false}}
{{range $index,$column:=.table.Columns}}
{{if eq $column.HtmlType "richtext"}}
@@ -442,6 +508,10 @@
{{$imgsImp = true}}
{{else if eq $column.HtmlType "file" "files"}}
{{$fileImp = true}}
{{else if or (eq $column.HtmlType "userSelectorSingle") (eq $column.HtmlType "userSelectorMultiple")}}
{{$selectorUserImp = true}}
{{else if or (eq $column.HtmlType "deptSelectorSingle") (eq $column.HtmlType "deptSelectorMultiple")}}
{{$selectorDeptImp = true}}
{{end}}
{{if eq $column.HtmlField "createdBy" "updatedBy"}}
{{$getUserList = true}}
@@ -483,6 +553,12 @@ import {downLoadXml} from "/@/utils/zipdownload";
{{if .table.ExcelImp}}
import loadExcel from "/@/components/loadExcel/index.vue"
{{end}}
{{if $selectorUserImp}}
import selectUser from "/@/components/selectUser/index.vue"
{{end}}
{{if $selectorDeptImp}}
import selectDept from "/@/components/selectDept/index.vue"
{{end}}
defineOptions({ name: "{{.apiVersion|replace "/" "_"|CaseCamelLower}}{{.modulePath|replace "/" "_"|CaseCamel}}{{.table.ClassName}}List"})
const {proxy} = <any>getCurrentInstance()
const loading = ref(false)
@@ -547,14 +623,29 @@ const state = reactive<{{.table.ClassName}}TableDataState>({
{{range $index, $column := .table.QueryColumns}}
{{if eq $column.QueryType "BETWEEN"}}
{{$column.HtmlField}}: [],
{{else if eq $column.HtmlType "userSelectorMultiple" "deptSelectorMultiple"}}
{{$column.HtmlField}}: [],
{{else}}
{{$column.HtmlField}}: undefined,
{{end}}{{end}}
{{end}}
{{end}}
dateRange: []
},
},
});
const { tableData } = toRefs(state);
{{range $index, $column := .table.QueryColumns}}
{{if eq $column.HtmlType "userSelectorSingle"}}
const {{$column.HtmlField}} = computed({
get:()=>{
return state.tableData.param.{{$column.HtmlField}}?[state.tableData.param.{{$column.HtmlField}}]:[]
},
set:(val:number[])=>{
state.tableData.param.{{$column.HtmlField}} = val?val[0]:0
}
})
{{end}}
{{end}}
// 页面加载时
onMounted(() => {
initTableData();

View File

@@ -27,7 +27,7 @@
</el-form-item>
</el-col>
{{end}}
{{if eq $column.HtmlType "input" "textarea"}}
{{if eq $column.HtmlType "input" "textarea" "inputNumber"}}
<el-col :span="8" {{if lt $colIndex 2}}class="colBlock"{{else}}:class="showAll ? 'colBlock' : 'colNone'"{{end}}>
<el-form-item label="{{$column.ColumnComment}}" prop="{{$column.HtmlField}}">
<el-input
@@ -58,7 +58,7 @@
{{else if and (eq $column.HtmlType "select" "radio" "checkbox" "selects") (ne $column.DictType "") }}
<el-col :span="8" {{if lt $colIndex 2}}class="colBlock"{{else}}:class="showAll ? 'colBlock' : 'colNone'"{{end}}>
<el-form-item label="{{$column.ColumnComment}}" prop="{{$column.HtmlField}}">
<el-select v-model="tableData.param.{{$column.HtmlField}}" placeholder="请选择{{$column.ColumnComment}}" clearable style="width:200px;">
<el-select filterable v-model="tableData.param.{{$column.HtmlField}}" placeholder="请选择{{$column.ColumnComment}}" clearable style="width:200px;">
<el-option
v-for="dict in {{$column.DictType}}"
:key="dict.value"
@@ -135,7 +135,7 @@
{{else if and (eq $column.HtmlType "select" "radio" "checkbox" "selects") (ne $column.LinkTableName "")}}
<el-col :span="8" {{if lt $colIndex 2}}class="colBlock"{{else}}:class="showAll ? 'colBlock' : 'colNone'"{{end}}>
<el-form-item label="{{$column.ColumnComment}}" prop="{{$column.HtmlField}}">
<el-select v-model="tableData.param.{{$column.HtmlField}}" placeholder="请选择{{$column.ColumnComment}}" clearable {{if $column.IsCascadeParent}}@change="query{{$column.ColumnName | CaseCamel}}Changed"{{end}} style="width:200px;">
<el-select filterable v-model="tableData.param.{{$column.HtmlField}}" placeholder="请选择{{$column.ColumnComment}}" clearable {{if $column.IsCascadeParent}}@change="query{{$column.ColumnName | CaseCamel}}Changed"{{end}} style="width:200px;">
<el-option
{{if $column.IsCascade}}
v-for="item in {{$column.HtmlField}}QueryOptions"
@@ -172,10 +172,38 @@
</el-form-item>
</el-col>
{{$colIndex = ($colIndex | plus 1)}}
{{else if eq $column.HtmlType "userSelectorSingle"}}
<el-col :span="8" {{if lt $colIndex 2}}class="colBlock"{{else}}:class="showAll ? 'colBlock' : 'colNone'"{{end}}>
<el-form-item label="{{$column.ColumnComment}}" prop="{{$column.HtmlField}}">
<select-user v-model="{{$column.HtmlField}}" :multiple="false"></select-user>
</el-form-item>
</el-col>
{{$colIndex = ($colIndex | plus 1)}}
{{else if eq $column.HtmlType "userSelectorMultiple"}}
<el-col :span="8" {{if lt $colIndex 2}}class="colBlock"{{else}}:class="showAll ? 'colBlock' : 'colNone'"{{end}}>
<el-form-item label="{{$column.ColumnComment}}" prop="{{$column.HtmlField}}">
<select-user v-model="tableData.param.{{$column.HtmlField}}"></select-user>
</el-form-item>
</el-col>
{{$colIndex = ($colIndex | plus 1)}}
{{else if eq $column.HtmlType "deptSelectorSingle"}}
<el-col :span="8" {{if lt $colIndex 2}}class="colBlock"{{else}}:class="showAll ? 'colBlock' : 'colNone'"{{end}}>
<el-form-item label="{{$column.ColumnComment}}" prop="{{$column.HtmlField}}">
<select-dept v-model="tableData.param.{{$column.HtmlField}}"></select-dept>
</el-form-item>
</el-col>
{{$colIndex = ($colIndex | plus 1)}}
{{else if eq $column.HtmlType "deptSelectorMultiple"}}
<el-col :span="8" {{if lt $colIndex 2}}class="colBlock"{{else}}:class="showAll ? 'colBlock' : 'colNone'"{{end}}>
<el-form-item label="{{$column.ColumnComment}}" prop="{{$column.HtmlField}}">
<select-dept v-model="tableData.param.{{$column.HtmlField}}" :multiple="true"></select-dept>
</el-form-item>
</el-col>
{{$colIndex = ($colIndex | plus 1)}}
{{else}}
<el-col :span="8" {{if lt $colIndex 2}}class="colBlock"{{else}}:class="showAll ? 'colBlock' : 'colNone'"{{end}}>
<el-form-item label="{{$column.ColumnComment}}" prop="{{$column.HtmlField}}">
<el-select v-model="tableData.param.{{$column.HtmlField}}" placeholder="请选择{{$column.ColumnComment}}" clearable style="width:200px;">
<el-select filterable v-model="tableData.param.{{$column.HtmlField}}" placeholder="请选择{{$column.ColumnComment}}" clearable style="width:200px;">
<el-option label="请选择字典生成" value="" />
</el-select>
</el-form-item>
@@ -298,6 +326,8 @@
{{$editImp := false }}
{{$fileImp := false}}
{{$getUserList:=false}}
{{$selectorUserImp:=false}}
{{$selectorDeptImp:=false}}
{{range $index,$column:=.table.Columns}}
{{if eq $column.HtmlType "richtext"}}
@@ -308,6 +338,10 @@
{{$imgsImp = true}}
{{else if eq $column.HtmlType "file" "files"}}
{{$fileImp = true}}
{{else if or (eq $column.HtmlType "userSelectorSingle") (eq $column.HtmlType "userSelectorMultiple")}}
{{$selectorUserImp = true}}
{{else if or (eq $column.HtmlType "deptSelectorSingle") (eq $column.HtmlType "deptSelectorMultiple")}}
{{$selectorDeptImp = true}}
{{end}}
{{if eq $column.HtmlField "createdBy" "updatedBy"}}
{{$getUserList = true}}
@@ -345,6 +379,12 @@ import {
import {{.apiVersion|replace "/" "_"|CaseCamel}}{{.modulePath|replace "/" "_"|CaseCamel}}{{.table.ClassName}}Edit from "/@/views/{{.modulePath}}/{{$businessName}}/list/component/edit.vue"
import {{.apiVersion|replace "/" "_"|CaseCamel}}{{.modulePath|replace "/" "_"|CaseCamel}}{{.table.ClassName}}Detail from "/@/views/{{.modulePath}}/{{$businessName}}/list/component/detail.vue"
import _ from 'lodash'
{{if $selectorUserImp}}
import selectUser from "/@/components/selectUser/index.vue"
{{end}}
{{if $selectorDeptImp}}
import selectDept from "/@/components/selectDept/index.vue"
{{end}}
defineOptions({ name: "{{.apiVersion|replace "/" "_"|CaseCamelLower}}{{.modulePath|replace "/" "_"|CaseCamel}}{{.table.ClassName}}List"})
const {proxy} = <any>getCurrentInstance()
const loading = ref(false)
@@ -407,6 +447,8 @@ const state = reactive<{{.table.ClassName}}TableDataState>({
{{range $index, $column := .table.QueryColumns}}
{{if eq $column.QueryType "BETWEEN"}}
{{$column.HtmlField}}: [],
{{else if eq $column.HtmlType "userSelectorMultiple" "deptSelectorMultiple"}}
{{$column.HtmlField}}: [],
{{else}}
{{$column.HtmlField}}: undefined,
{{end}}{{end}}
@@ -415,6 +457,18 @@ const state = reactive<{{.table.ClassName}}TableDataState>({
},
});
const { tableData } = toRefs(state);
{{range $index, $column := .table.QueryColumns}}
{{if eq $column.HtmlType "userSelectorSingle"}}
const {{$column.HtmlField}} = computed({
get:()=>{
return state.tableData.param.{{$column.HtmlField}}?[state.tableData.param.{{$column.HtmlField}}]:[]
},
set:(val:number[])=>{
state.tableData.param.{{$column.HtmlField}} = val?val[0]:0
}
})
{{end}}
{{end}}
// 页面加载时
onMounted(() => {
initTableData();
@@ -677,6 +731,38 @@ const setVrData = (list:{{$.table.ClassName}}TableColumns[])=>{
onClick: () => { change{{$column.GoField}}(row)}});
}
})
{{else if eq $column.HtmlType "userSelectorSingle" }}
_columns.push({key: 'linked{{$column.GoField}}',dataKey: 'linked{{$column.GoField}}',title: `{{$column.ColumnComment}}`,
{{if gt $column.MinWidth 0}}width:{{$column.MinWidth}},{{end}}
{{if $column.IsFixed}}fixed: TableV2FixedDir.LEFT,{{end}}
cellRenderer: ({ cellData: linked{{$column.GoField}} }) => {
return h('span', linked{{$column.GoField}}?linked{{$column.GoField}}.userNickname:'');
}
})
{{else if eq $column.HtmlType "userSelectorMultiple" }}
_columns.push({key: 'linked{{$column.GoField}}',dataKey: 'linked{{$column.GoField}}',title: `{{$column.ColumnComment}}`,
{{if gt $column.MinWidth 0}}width:{{$column.MinWidth}},{{end}}
{{if $column.IsFixed}}fixed: TableV2FixedDir.LEFT,{{end}}
cellRenderer: ({ cellData: linked{{$column.GoField}} }) => {
return h('span', linked{{$column.GoField}}?linked{{$column.GoField}}.map((res:any)=>{return res.userNickname}).join(''):'');
}
})
{{else if eq $column.HtmlType "deptSelectorSingle" }}
_columns.push({key: 'linked{{$column.GoField}}',dataKey: 'linked{{$column.GoField}}',title: `{{$column.ColumnComment}}`,
{{if gt $column.MinWidth 0}}width:{{$column.MinWidth}},{{end}}
{{if $column.IsFixed}}fixed: TableV2FixedDir.LEFT,{{end}}
cellRenderer: ({ cellData: linked{{$column.GoField}} }) => {
return h('span', linked{{$column.GoField}}?linked{{$column.GoField}}.deptName:'');
}
})
{{else if eq $column.HtmlType "deptSelectorMultiple" }}
_columns.push({key: 'linked{{$column.GoField}}',dataKey: 'linked{{$column.GoField}}',title: `{{$column.ColumnComment}}`,
{{if gt $column.MinWidth 0}}width:{{$column.MinWidth}},{{end}}
{{if $column.IsFixed}}fixed: TableV2FixedDir.LEFT,{{end}}
cellRenderer: ({ cellData: linked{{$column.GoField}} }) => {
return h('span',linked{{$column.GoField}}?linked{{$column.GoField}}.map((res:any)=>{return res.deptName}).join(''):'');
}
})
{{else if eq $column.HtmlType "selects" "checkbox" "treeSelects"}}
{{if ne $column.LinkTableName ""}}
_columns.push({key: '{{$column.HtmlField}}',dataKey: '{{$column.HtmlField}}',title: `{{$column.ColumnComment}}`,

View File

@@ -25,7 +25,7 @@
</el-form-item>
</el-col>
{{end}}
{{if eq $column.HtmlType "input" "textarea"}}
{{if eq $column.HtmlType "input" "textarea" "inputNumber"}}
<el-col :span="8" {{if lt $colIndex 2}}class="colBlock"{{else}}:class="showAll ? 'colBlock' : 'colNone'"{{end}}>
<el-form-item label="{{$column.ColumnComment}}" prop="{{$column.HtmlField}}">
<el-input
@@ -56,7 +56,7 @@
{{else if and (eq $column.HtmlType "select" "radio" "checkbox" "selects") (ne $column.DictType "") }}
<el-col :span="8" {{if lt $colIndex 2}}class="colBlock"{{else}}:class="showAll ? 'colBlock' : 'colNone'"{{end}}>
<el-form-item label="{{$column.ColumnComment}}" prop="{{$column.HtmlField}}">
<el-select v-model="tableData.param.{{$column.HtmlField}}" placeholder="请选择{{$column.ColumnComment}}" clearable style="width:200px;">
<el-select filterable v-model="tableData.param.{{$column.HtmlField}}" placeholder="请选择{{$column.ColumnComment}}" clearable style="width:200px;">
<el-option
v-for="dict in {{$column.DictType}}"
:key="dict.value"
@@ -133,7 +133,7 @@
{{else if and (eq $column.HtmlType "select" "radio" "checkbox" "selects") (ne $column.LinkTableName "")}}
<el-col :span="8" {{if lt $colIndex 2}}class="colBlock"{{else}}:class="showAll ? 'colBlock' : 'colNone'"{{end}}>
<el-form-item label="{{$column.ColumnComment}}" prop="{{$column.HtmlField}}">
<el-select v-model="tableData.param.{{$column.HtmlField}}" placeholder="请选择{{$column.ColumnComment}}" clearable {{if $column.IsCascadeParent}}@change="query{{$column.ColumnName | CaseCamel}}Changed"{{end}} style="width:200px;">
<el-select filterable v-model="tableData.param.{{$column.HtmlField}}" placeholder="请选择{{$column.ColumnComment}}" clearable {{if $column.IsCascadeParent}}@change="query{{$column.ColumnName | CaseCamel}}Changed"{{end}} style="width:200px;">
<el-option
{{if $column.IsCascade}}
v-for="item in {{$column.HtmlField}}QueryOptions"
@@ -170,10 +170,38 @@
</el-form-item>
</el-col>
{{$colIndex = ($colIndex | plus 1)}}
{{else if eq $column.HtmlType "userSelectorSingle"}}
<el-col :span="8" {{if lt $colIndex 2}}class="colBlock"{{else}}:class="showAll ? 'colBlock' : 'colNone'"{{end}}>
<el-form-item label="{{$column.ColumnComment}}" prop="{{$column.HtmlField}}">
<select-user v-model="{{$column.HtmlField}}" :multiple="false"></select-user>
</el-form-item>
</el-col>
{{$colIndex = ($colIndex | plus 1)}}
{{else if eq $column.HtmlType "userSelectorMultiple"}}
<el-col :span="8" {{if lt $colIndex 2}}class="colBlock"{{else}}:class="showAll ? 'colBlock' : 'colNone'"{{end}}>
<el-form-item label="{{$column.ColumnComment}}" prop="{{$column.HtmlField}}">
<select-user v-model="tableData.param.{{$column.HtmlField}}"></select-user>
</el-form-item>
</el-col>
{{$colIndex = ($colIndex | plus 1)}}
{{else if eq $column.HtmlType "deptSelectorSingle"}}
<el-col :span="8" {{if lt $colIndex 2}}class="colBlock"{{else}}:class="showAll ? 'colBlock' : 'colNone'"{{end}}>
<el-form-item label="{{$column.ColumnComment}}" prop="{{$column.HtmlField}}">
<select-dept v-model="tableData.param.{{$column.HtmlField}}"></select-dept>
</el-form-item>
</el-col>
{{$colIndex = ($colIndex | plus 1)}}
{{else if eq $column.HtmlType "deptSelectorMultiple"}}
<el-col :span="8" {{if lt $colIndex 2}}class="colBlock"{{else}}:class="showAll ? 'colBlock' : 'colNone'"{{end}}>
<el-form-item label="{{$column.ColumnComment}}" prop="{{$column.HtmlField}}">
<select-dept v-model="tableData.param.{{$column.HtmlField}}" :multiple="true"></select-dept>
</el-form-item>
</el-col>
{{$colIndex = ($colIndex | plus 1)}}
{{else}}
<el-col :span="8" {{if lt $colIndex 2}}class="colBlock"{{else}}:class="showAll ? 'colBlock' : 'colNone'"{{end}}>
<el-form-item label="{{$column.ColumnComment}}" prop="{{$column.HtmlField}}">
<el-select v-model="tableData.param.{{$column.HtmlField}}" placeholder="请选择{{$column.ColumnComment}}" clearable style="width:200px;">
<el-select filterable v-model="tableData.param.{{$column.HtmlField}}" placeholder="请选择{{$column.ColumnComment}}" clearable style="width:200px;">
<el-option label="请选择字典生成" value="" />
</el-select>
</el-form-item>
@@ -328,6 +356,42 @@
></el-switch>
</template>
</el-table-column>
{{else if eq $column.HtmlType "userSelectorSingle"}}
<el-table-column label="{{$column.ColumnComment}}" align="center"
{{if gt $column.MinWidth 0}}min-width="{{$column.MinWidth}}px"{{end}}
{{if $column.IsOverflowTooltip}}:show-overflow-tooltip="true"{{end}}
{{if $column.IsFixed}}fixed="left"{{end}}>
<template #default="scope">
{{"{{"}} scope.row.linked{{$column.GoField}}?scope.row.linked{{$column.GoField}}.userNickname:'' {{"}}"}}
</template>
</el-table-column>
{{else if eq $column.HtmlType "userSelectorMultiple"}}
<el-table-column label="{{$column.ColumnComment}}" align="center"
{{if gt $column.MinWidth 0}}min-width="{{$column.MinWidth}}px"{{end}}
{{if $column.IsOverflowTooltip}}:show-overflow-tooltip="true"{{end}}
{{if $column.IsFixed}}fixed="left"{{end}}>
<template #default="scope">
{{"{{"}} scope.row.linked{{$column.GoField}}?scope.row.linked{{$column.GoField}}.map((res:any)=>{return res.userNickname}).join(''):'' {{"}}"}}
</template>
</el-table-column>
{{else if eq $column.HtmlType "deptSelectorSingle"}}
<el-table-column label="{{$column.ColumnComment}}" align="center"
{{if gt $column.MinWidth 0}}min-width="{{$column.MinWidth}}px"{{end}}
{{if $column.IsOverflowTooltip}}:show-overflow-tooltip="true"{{end}}
{{if $column.IsFixed}}fixed="left"{{end}}>
<template #default="scope">
{{"{{"}} scope.row.linked{{$column.GoField}}?scope.row.linked{{$column.GoField}}.deptName:'' {{"}}"}}
</template>
</el-table-column>
{{else if eq $column.HtmlType "deptSelectorMultiple"}}
<el-table-column label="{{$column.ColumnComment}}" align="center"
{{if gt $column.MinWidth 0}}min-width="{{$column.MinWidth}}px"{{end}}
{{if $column.IsOverflowTooltip}}:show-overflow-tooltip="true"{{end}}
{{if $column.IsFixed}}fixed="left"{{end}}>
<template #default="scope">
{{"{{"}} scope.row.linked{{$column.GoField}}?scope.row.linked{{$column.GoField}}.map((res:any)=>{return res.deptName}).join(''):'' {{"}}"}}
</template>
</el-table-column>
{{else if ne $column.LinkTableName ""}}
<el-table-column label="{{$column.ColumnComment}}" align="center" prop="linked{{$column.GoField}}.{{$column.LinkLabelName | CaseCamelLower}}"
{{if gt $column.MinWidth 0}}min-width="{{$column.MinWidth}}px"{{end}}
@@ -415,6 +479,8 @@
{{$editImp := false }}
{{$fileImp := false}}
{{$getUserList:=false}}
{{$selectorUserImp:=false}}
{{$selectorDeptImp:=false}}
{{range $index,$column:=.table.Columns}}
{{if eq $column.HtmlType "richtext"}}
@@ -425,6 +491,10 @@
{{$imgsImp = true}}
{{else if eq $column.HtmlType "file" "files"}}
{{$fileImp = true}}
{{else if or (eq $column.HtmlType "userSelectorSingle") (eq $column.HtmlType "userSelectorMultiple")}}
{{$selectorUserImp = true}}
{{else if or (eq $column.HtmlType "deptSelectorSingle") (eq $column.HtmlType "deptSelectorMultiple")}}
{{$selectorDeptImp = true}}
{{end}}
{{if eq $column.HtmlField "createdBy" "updatedBy"}}
{{$getUserList = true}}
@@ -461,6 +531,12 @@ import {
import {{.apiVersion|replace "/" "_"|CaseCamel}}{{.modulePath|replace "/" "_"|CaseCamel}}{{.table.ClassName}}Edit from "/@/views/{{.modulePath}}/{{$businessName}}/list/component/edit.vue"
import {{.apiVersion|replace "/" "_"|CaseCamel}}{{.modulePath|replace "/" "_"|CaseCamel}}{{.table.ClassName}}Detail from "/@/views/{{.modulePath}}/{{$businessName}}/list/component/detail.vue"
import _ from 'lodash'
{{if $selectorUserImp}}
import selectUser from "/@/components/selectUser/index.vue"
{{end}}
{{if $selectorDeptImp}}
import selectDept from "/@/components/selectDept/index.vue"
{{end}}
defineOptions({ name: "{{.apiVersion|replace "/" "_"|CaseCamelLower}}{{.modulePath|replace "/" "_"|CaseCamel}}{{.table.ClassName}}List"})
const {proxy} = <any>getCurrentInstance()
const loading = ref(false)
@@ -523,6 +599,8 @@ const state = reactive<{{.table.ClassName}}TableDataState>({
{{range $index, $column := .table.QueryColumns}}
{{if eq $column.QueryType "BETWEEN"}}
{{$column.HtmlField}}: [],
{{else if eq $column.HtmlType "userSelectorMultiple" "deptSelectorMultiple"}}
{{$column.HtmlField}}: [],
{{else}}
{{$column.HtmlField}}: undefined,
{{end}}{{end}}
@@ -531,6 +609,18 @@ const state = reactive<{{.table.ClassName}}TableDataState>({
},
});
const { tableData } = toRefs(state);
{{range $index, $column := .table.QueryColumns}}
{{if eq $column.HtmlType "userSelectorSingle"}}
const {{$column.HtmlField}} = computed({
get:()=>{
return state.tableData.param.{{$column.HtmlField}}?[state.tableData.param.{{$column.HtmlField}}]:[]
},
set:(val:number[])=>{
state.tableData.param.{{$column.HtmlField}} = val?val[0]:0
}
})
{{end}}
{{end}}
// 页面加载时
onMounted(() => {
initTableData();