mirror of
https://github.com/bufanyun/hotgo.git
synced 2025-02-02 18:28:41 +08:00
优化:没有需要查询的字段则隐藏搜索表单
This commit is contained in:
parent
e32201ea6b
commit
df70f8ec06
@ -8,6 +8,7 @@ package views
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
|
||||
"github.com/gogf/gf/v2/frame/g"
|
||||
"github.com/gogf/gf/v2/text/gstr"
|
||||
)
|
||||
@ -60,5 +61,28 @@ func (l *gCurd) webIndexTplData(ctx context.Context, in *CurdPreviewInput) (g.Ma
|
||||
data["iconsImport"] = fmt.Sprintf(IndexIconsImport, gstr.Implode(",", iconsImport))
|
||||
}
|
||||
|
||||
// 没有需要查询的字段则隐藏搜索表单
|
||||
isSearchForm := false
|
||||
for _, field := range in.masterFields {
|
||||
if field.IsQuery == true {
|
||||
isSearchForm = true
|
||||
break
|
||||
}
|
||||
}
|
||||
if isSearchForm == false {
|
||||
if len(in.options.Join) > 0 {
|
||||
LoopOut:
|
||||
for _, v := range in.options.Join {
|
||||
for _, column := range v.Columns {
|
||||
if column.IsQuery == true {
|
||||
isSearchForm = true
|
||||
break LoopOut
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
data["isSearchForm"] = isSearchForm
|
||||
|
||||
return data, nil
|
||||
}
|
||||
|
@ -6,6 +6,7 @@
|
||||
<!-- 这是系统自动生成的CURD表格,你可以将此行注释改为表格的描述 -->
|
||||
</n-card>
|
||||
</div>
|
||||
@{ if eq .isSearchForm true }
|
||||
<BasicForm
|
||||
@register="register"
|
||||
@submit="reloadTable"
|
||||
@ -16,7 +17,7 @@
|
||||
<template #statusSlot="{ model, field }">
|
||||
<n-input v-model:value="model[field]" />
|
||||
</template>
|
||||
</BasicForm>
|
||||
</BasicForm>@{end}
|
||||
|
||||
<BasicTable
|
||||
:openChecked="@{.options.Step.HasCheck}"
|
||||
|
Loading…
Reference in New Issue
Block a user