mirror of
https://github.com/bufanyun/hotgo.git
synced 2025-09-22 19:26:40 +08:00
优化:没有需要查询的字段则隐藏搜索表单
This commit is contained in:
parent
e32201ea6b
commit
df70f8ec06
@ -8,6 +8,7 @@ package views
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
"github.com/gogf/gf/v2/frame/g"
|
"github.com/gogf/gf/v2/frame/g"
|
||||||
"github.com/gogf/gf/v2/text/gstr"
|
"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))
|
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
|
return data, nil
|
||||||
}
|
}
|
||||||
|
@ -6,6 +6,7 @@
|
|||||||
<!-- 这是系统自动生成的CURD表格,你可以将此行注释改为表格的描述 -->
|
<!-- 这是系统自动生成的CURD表格,你可以将此行注释改为表格的描述 -->
|
||||||
</n-card>
|
</n-card>
|
||||||
</div>
|
</div>
|
||||||
|
@{ if eq .isSearchForm true }
|
||||||
<BasicForm
|
<BasicForm
|
||||||
@register="register"
|
@register="register"
|
||||||
@submit="reloadTable"
|
@submit="reloadTable"
|
||||||
@ -16,7 +17,7 @@
|
|||||||
<template #statusSlot="{ model, field }">
|
<template #statusSlot="{ model, field }">
|
||||||
<n-input v-model:value="model[field]" />
|
<n-input v-model:value="model[field]" />
|
||||||
</template>
|
</template>
|
||||||
</BasicForm>
|
</BasicForm>@{end}
|
||||||
|
|
||||||
<BasicTable
|
<BasicTable
|
||||||
:openChecked="@{.options.Step.HasCheck}"
|
:openChecked="@{.options.Step.HasCheck}"
|
||||||
|
Loading…
Reference in New Issue
Block a user