mirror of
https://github.com/TeaOSLab/EdgeAdmin.git
synced 2025-11-09 16:50:26 +08:00
可以根据管理界面设置/用户界面设置隐藏财务相关功能菜单
This commit is contained in:
@@ -52,6 +52,15 @@ func UpdateAdminUIConfig(uiConfig *systemconfigs.AdminUIConfig) error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 是否显示财务信息
|
||||||
|
func ShowFinance() bool {
|
||||||
|
config, _ := LoadAdminUIConfig()
|
||||||
|
if config != nil && !config.ShowFinance {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
func loadAdminUIConfig() (*systemconfigs.AdminUIConfig, error) {
|
func loadAdminUIConfig() (*systemconfigs.AdminUIConfig, error) {
|
||||||
if sharedAdminUIConfig != nil {
|
if sharedAdminUIConfig != nil {
|
||||||
return sharedAdminUIConfig, nil
|
return sharedAdminUIConfig, nil
|
||||||
@@ -88,5 +97,6 @@ func defaultAdminUIConfig() *systemconfigs.AdminUIConfig {
|
|||||||
AdminSystemName: "GoEdge管理员系统",
|
AdminSystemName: "GoEdge管理员系统",
|
||||||
ShowOpenSourceInfo: true,
|
ShowOpenSourceInfo: true,
|
||||||
ShowVersion: true,
|
ShowVersion: true,
|
||||||
|
ShowFinance: true,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -88,5 +88,6 @@ func defaultUserUIConfig() *systemconfigs.UserUIConfig {
|
|||||||
UserSystemName: "GoEdge用户系统",
|
UserSystemName: "GoEdge用户系统",
|
||||||
ShowOpenSourceInfo: true,
|
ShowOpenSourceInfo: true,
|
||||||
ShowVersion: true,
|
ShowVersion: true,
|
||||||
|
ShowFinance: true,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,6 +29,7 @@ func (this *IndexAction) RunPost(params struct {
|
|||||||
ProductName string
|
ProductName string
|
||||||
AdminSystemName string
|
AdminSystemName string
|
||||||
ShowOpenSourceInfo bool
|
ShowOpenSourceInfo bool
|
||||||
|
ShowFinance bool
|
||||||
ShowVersion bool
|
ShowVersion bool
|
||||||
Version string
|
Version string
|
||||||
|
|
||||||
@@ -49,6 +50,7 @@ func (this *IndexAction) RunPost(params struct {
|
|||||||
config.ProductName = params.ProductName
|
config.ProductName = params.ProductName
|
||||||
config.AdminSystemName = params.AdminSystemName
|
config.AdminSystemName = params.AdminSystemName
|
||||||
config.ShowOpenSourceInfo = params.ShowOpenSourceInfo
|
config.ShowOpenSourceInfo = params.ShowOpenSourceInfo
|
||||||
|
config.ShowFinance = params.ShowFinance
|
||||||
config.ShowVersion = params.ShowVersion
|
config.ShowVersion = params.ShowVersion
|
||||||
config.Version = params.Version
|
config.Version = params.Version
|
||||||
err = configloaders.UpdateAdminUIConfig(config)
|
err = configloaders.UpdateAdminUIConfig(config)
|
||||||
|
|||||||
@@ -31,6 +31,7 @@ func (this *IndexAction) RunPost(params struct {
|
|||||||
ShowOpenSourceInfo bool
|
ShowOpenSourceInfo bool
|
||||||
ShowVersion bool
|
ShowVersion bool
|
||||||
Version string
|
Version string
|
||||||
|
ShowFinance bool
|
||||||
|
|
||||||
Must *actions.Must
|
Must *actions.Must
|
||||||
CSRF *actionutils.CSRF
|
CSRF *actionutils.CSRF
|
||||||
@@ -51,6 +52,7 @@ func (this *IndexAction) RunPost(params struct {
|
|||||||
config.ShowOpenSourceInfo = params.ShowOpenSourceInfo
|
config.ShowOpenSourceInfo = params.ShowOpenSourceInfo
|
||||||
config.ShowVersion = params.ShowVersion
|
config.ShowVersion = params.ShowVersion
|
||||||
config.Version = params.Version
|
config.Version = params.Version
|
||||||
|
config.ShowFinance = params.ShowFinance
|
||||||
err = configloaders.UpdateUserUIConfig(config)
|
err = configloaders.UpdateUserUIConfig(config)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
this.ErrorPage(err)
|
this.ErrorPage(err)
|
||||||
|
|||||||
@@ -106,6 +106,7 @@ func (this *userMustAuth) BeforeAction(actionPtr actions.ActionWrapper, paramNam
|
|||||||
action.Data["teaShowOpenSourceInfo"] = config.ShowOpenSourceInfo
|
action.Data["teaShowOpenSourceInfo"] = config.ShowOpenSourceInfo
|
||||||
action.Data["teaIsSuper"] = false
|
action.Data["teaIsSuper"] = false
|
||||||
action.Data["teaDemoEnabled"] = teaconst.IsDemo
|
action.Data["teaDemoEnabled"] = teaconst.IsDemo
|
||||||
|
action.Data["teaShowFinance"] = configloaders.ShowFinance()
|
||||||
if !action.Data.Has("teaSubMenu") {
|
if !action.Data.Has("teaSubMenu") {
|
||||||
action.Data["teaSubMenu"] = ""
|
action.Data["teaSubMenu"] = ""
|
||||||
}
|
}
|
||||||
@@ -238,6 +239,10 @@ func (this *userMustAuth) modules(adminId int64) []maps.Map {
|
|||||||
|
|
||||||
result := []maps.Map{}
|
result := []maps.Map{}
|
||||||
for _, m := range allMaps {
|
for _, m := range allMaps {
|
||||||
|
if m.GetString("code") == "finance" && !configloaders.ShowFinance() {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
module := m.GetString("module")
|
module := m.GetString("module")
|
||||||
if configloaders.AllowModule(adminId, module) {
|
if configloaders.AllowModule(adminId, module) {
|
||||||
result = append(result, m)
|
result = append(result, m)
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<first-menu>
|
<first-menu>
|
||||||
<menu-item href="/clusters/regions" code="region">区域</menu-item>
|
<menu-item href="/clusters/regions" code="region">区域</menu-item>
|
||||||
<menu-item href="/clusters/regions/prices" code="price">价格</menu-item>
|
<menu-item href="/clusters/regions/prices" code="price" v-if="teaShowFinance">价格</menu-item>
|
||||||
<span class="item">|</span>
|
<span class="item" v-if="teaShowFinance">|</span>
|
||||||
<menu-item><tip-icon content="可以设置节点所属区域,从而利用区域设置进行不同的价格设定。"></tip-icon></menu-item>
|
<menu-item v-if="teaShowFinance"><tip-icon content="可以设置节点所属区域,从而利用区域设置进行不同的价格设定。"></tip-icon></menu-item>
|
||||||
</first-menu>
|
</first-menu>
|
||||||
@@ -35,6 +35,12 @@
|
|||||||
<p class="comment">定制自己的版本号,留空表示使用系统自带的版本号。</p>
|
<p class="comment">定制自己的版本号,留空表示使用系统自带的版本号。</p>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>是否显示财务相关功能</td>
|
||||||
|
<td>
|
||||||
|
<checkbox name="showFinance" v-model="config.showFinance"></checkbox>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
<submit-btn></submit-btn>
|
<submit-btn></submit-btn>
|
||||||
|
|||||||
@@ -35,7 +35,14 @@
|
|||||||
<p class="comment">定制自己的版本号,留空表示使用系统自带的版本号。</p>
|
<p class="comment">定制自己的版本号,留空表示使用系统自带的版本号。</p>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>是否显示财务相关功能</td>
|
||||||
|
<td>
|
||||||
|
<checkbox name="showFinance" v-model="config.showFinance"></checkbox>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
|
<p class="comment">修改后,可能需要等待数分钟才会生效。</p>
|
||||||
|
|
||||||
<submit-btn></submit-btn>
|
<submit-btn></submit-btn>
|
||||||
</form>
|
</form>
|
||||||
Reference in New Issue
Block a user