72 lines
1.7 KiB
C#
72 lines
1.7 KiB
C#
namespace YLErp.Models
|
|
{
|
|
/// <summary>
|
|
/// 选择项目
|
|
/// </summary>
|
|
public class SelectItem
|
|
{
|
|
public SelectItem()
|
|
{
|
|
|
|
}
|
|
|
|
public SelectItem(string value)
|
|
{
|
|
Text = Value = value;
|
|
}
|
|
|
|
/// <summary>
|
|
/// 获取或设置一个值,该值指示是否禁用
|
|
/// </summary>
|
|
public bool Disabled { get; set; }
|
|
|
|
/// <summary>
|
|
/// 获取或设置一个值,该值指示是否选择
|
|
/// </summary>
|
|
public bool Selected { get; set; }
|
|
|
|
/// <summary>
|
|
/// 获取或设置选定项的文本
|
|
/// </summary>
|
|
public string Text { get; set; }
|
|
|
|
/// <summary>
|
|
/// 获取或设置选定项的值
|
|
/// </summary>
|
|
public string Value { get; set; }
|
|
|
|
/// <summary>
|
|
/// 标记对象
|
|
/// </summary>
|
|
public object Tag { get; set; }
|
|
|
|
/// <summary>
|
|
/// 是否可见
|
|
/// </summary>
|
|
public bool Visible { get; set; } = true;
|
|
|
|
public override string ToString()
|
|
{
|
|
return $"{Text}--{Value}";
|
|
}
|
|
|
|
public static implicit operator SelectItem(string value)
|
|
{
|
|
return new SelectItem { Text = value, Value = value };
|
|
}
|
|
|
|
public static implicit operator SelectItem((string text, string value) item)
|
|
{
|
|
return new SelectItem { Text = item.text, Value = item.value };
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 带嵌套选项的选项
|
|
/// </summary>
|
|
public class SelectItemNest : SelectItem
|
|
{
|
|
public IEnumerable<SelectItem> SelectItems { get; set; }
|
|
}
|
|
}
|