using iWare.Wms.Core.Util.LowCode.Front.Model; using Furion.Extras.iWare.Wms.Util.LowCode.Front.Att; using Furion.Extras.iWare.Wms.Util.LowCode.Front.Code; using Furion.Extras.iWare.Wms.Util.LowCode.Front.Interface; using Newtonsoft.Json.Linq; namespace Furion.Extras.iWare.Wms.Util.LowCode.Front { [FrontType("grid")] public class Front_Grid : IFront, IFrontLayout { public string Key { get; set; } public string Label { get; set; } public string Type { get; set; } public string Model { get; set; } /// /// 栅格布局项 /// public List Columns { get; set; } /// /// 栅格配置 /// public Front_Grid_Options Options { get; set; } public ViewDynamic Dynamic { get { return null; } } /// /// 布局子组件解析 /// /// /// public IFront ConvertFront(JObject JData) { List front_Grid_Cols = new List(); var columns = JData["columns"].Values(); if (columns != null) { foreach (var column_item in columns) { front_Grid_Cols.Add(new Front_Grid_Col() { Span = column_item["span"].Value(), List = AutoCode_Front.ReadFront(column_item["list"].Values().ToList()) }); } } return new Front_Grid() { Key = JData["key"].Value(), Label = JData["label"].Value(), Type = JData["type"].Value(), Options = new Front_Grid_Options { Gutter = JData["options"]["gutter"].Value() }, Columns = front_Grid_Cols }; } public void ReadFront(Action action) { this.Columns.SelectMany(x => x.List).ToList().ForEach(item => { if (item is IFrontLayout) { (item as IFrontLayout).ReadFront(action); } else { action(item); } }); } } /// /// 栅格布局项 /// public class Front_Grid_Col { /// /// 列配置项(最大值:24) /// public int Span { get; set; } /// /// 组件集 /// public List List { get; set; } } /// /// 栅格配置 /// public class Front_Grid_Options { /// /// 栅格间距 /// public int Gutter { get; set; } } }