Skip to content

AutoForm 属性

zhongku edited this page Jul 2, 2018 · 1 revision

` public class AutoForm { ///

/// Id /// public string Key { get; set; }
    /// <summary>
    /// 表单名称
    /// </summary>
    public string Name { get; set; }

    /// <summary>
    /// 布局方式
    /// </summary>
    public FormLayout Layout { get; set; }

    /// <summary>
    /// 字段以及分组
    /// </summary>
    public IList<FieldGroup> Groups { get; set; }

    /// <summary>
    /// 表单数据交付服务
    /// </summary>
    public FormService Service { get; set; }

}

public class FormService
{
    /// <summary>
    /// 构建使用的API
    /// </summary>
    public string ViewApi { get; set; }

    /// <summary>
    /// 提交表单数据的API
    /// </summary>
    public string PostApi { get; set; }

    /// <summary>
    /// 表单提交成功以后的返回值
    /// 可以是URL,或者其他
    /// </summary>
    public string SuccessReturn { get; set; }
}

/// <summary>
/// 表单布局方式
/// </summary>
public class FormLayout
{
    /// <summary>
    /// 表单布局方式
    /// </summary>
    public FormLayoutType Type { get; set; }

    /// <summary>
    /// 长度
    /// </summary>
    public string Width { get; set; }

}

/// <summary>
/// 字段组
/// </summary>
public class FieldGroup
{

    /// <summary>
    /// 分组名称
    /// </summary>
    public string GroupName { get; set; }

    /// <summary>
    /// 设置列表
    /// </summary>
    public IList<FormFieldProperty> Items { get; set; } = new List<FormFieldProperty>();
}

/// <summary>
/// 表单字段属性
/// </summary>
public class FormFieldProperty
{
    /// <summary>
    ///     字段英文名字
    /// </summary>
    public string Field { get; }

    /// <summary>
    ///     Gets or sets the name of the field.
    ///     字段的中文名字
    /// </summary>
    public string Name { get; set; }

    /// <summary>
    ///     控件类型,输入框类型
    /// </summary>
    public ControlsType Type { get; set; }

    /// <summary>
    /// 必填
    /// </summary>
    public bool Required { get; set; } = false;

    /// <summary>
    ///     控件的数据源
    /// </summary>
    public string DataSource { get; set; }

    /// <summary>
    ///     验证方式
    ///     远程验证方式
    /// </summary>
    public ValidType ValidType { get; set; }

    /// <summary>
    ///     提示文字
    /// </summary>
    public string PlaceHolder { get; set; }

    /// <summary>
    ///     其他标志
    /// </summary>
    public string Mark { get; set; }

    /// <summary>
    /// 最大长度
    /// </summary>
    public long Maxlength { get; set; }

    /// <summary>
    /// 最小长度
    /// </summary>
    public long MinLength { get; set; }

    /// <summary>
    ///     字段排序,从小到大排列,默认值9999
    /// </summary>
    public long SortOrder { get; set; } = 9999;

}`
Clone this wiki locally