Mini.Crm/Mini.Web/WebHelper/ToolBar.cs

84 lines
2.9 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace Mini.Web.WebHelper
{
public class ToolBar
{
public string[] ShowButton { get; set; }
public Dictionary<string, ToolBarButton> OtherButton { get; set; }
/// <summary>
/// 添加自定义按钮
/// </summary>
/// <param name="button"></param>
public void AddOtherButton(string id, ToolBarButton button)
{
if (this.OtherButton == null)
this.OtherButton = new Dictionary<string, ToolBarButton>();
this.OtherButton.Add(id, button);
}
/// <summary>
/// 添加自定义按钮
/// </summary>
/// <param name="id"></param>
/// <param name="text"></param>
/// <param name="icon"></param>
/// <param name="hr"></param>
public void AddOtherButton(string id, string text, string icon, string click, bool hr)
{
if (this.OtherButton == null)
this.OtherButton = new Dictionary<string, ToolBarButton>();
this.OtherButton.Add(id, new ToolBarButton() { id = id, text = text, icon = icon, click = click, hr = hr });
}
/// <summary>
/// 添加自定义按钮
/// </summary>
/// <param name="id">控件ID</param>
/// <param name="text">显示文本</param>
/// <param name="icon">样式图标</param>
/// <param name="click">点击函数名称</param>
/// <param name="hr">是否有分割线</param>
/// <param name="type">类型</param>
public void AddOtherButton(string id, string text, string icon, string click, bool hr, List<ToolBarButton> child)
{
if (this.OtherButton == null)
this.OtherButton = new Dictionary<string, ToolBarButton>();
this.OtherButton.Add(id, new ToolBarButton() { id = id, text = text, icon = icon, click = click, hr = hr, child = child });
}
/// <summary>
/// 允许的
/// </summary>
/// <param name="args"></param>
public void AllowButton(params string[] buttons)
{
ShowButton = buttons;
}
}
public class ToolBarButton
{
public string id { get; set; }
public string text { get; set; }
public string icon { get; set; }
public string click { get; set; }
public bool hr { get; set; }
/// <summary>
/// 普通按钮ToolButton 下拉按钮SplitButton
/// </summary>
public List<ToolBarButton> child { get; set; }
}
public class ToolBarNew
{
/// <summary>
/// 按钮颜色
/// </summary>
public string btnColor { get; set; }
/// <summary>
/// 按钮名称
/// </summary>
public string btnName { get; set; }
}
}