schangxiang@126.com
2024-04-23 f47411fb53aeee0c7bd514cbc841f9030349f448
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
using Admin.NET.Core.Util.LowCode.Front.Model;
using Furion.DatabaseAccessor;
using Furion.Extras.Admin.NET.Util.LowCode.Front.Att;
using Furion.Extras.Admin.NET.Util.LowCode.Front.Code;
using Furion.Extras.Admin.NET.Util.LowCode.Front.Interface;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
 
namespace Furion.Extras.Admin.NET.Util.LowCode.Front
{
    [FrontType("selectInputList")]
    public class Front_SelectInputList : IFront, IFrontLayout
    {
        public string Key { get; set; }
        public string Label { get; set; }
        public string Type { get; set; }
        public string Model { get; set; }
 
        /// <summary>
        /// 选择输入列配置
        /// </summary>
        public Front_SelectInputList_Options Options { get; set; }
 
        /// <summary>
        /// 选项
        /// </summary>
        public List<Front_SelectInputList_Column> Columns { get; set; }
 
        public ViewDynamic Dynamic
        { get { return null; } }
 
        public IFront ConvertFront(JObject JData)
        {
            var columns_obj = JData["columns"].Values<JObject>();
 
            List<Front_SelectInputList_Column> columns = new List<Front_SelectInputList_Column>();
 
            if (columns_obj != null)
            {
                foreach (var column_item in columns_obj)
                {
                    columns.Add(new Front_SelectInputList_Column()
                    {
                        Label = column_item["label"].Value<string>(),
                        Value = column_item["value"].Value<string>(),
                        List = AutoCode_Front.ReadFront(column_item["list"].Values<JObject>().ToList())
                    });
                }
            }
 
            return new Front_SelectInputList()
            {
                Key = JData["key"].Value<string>(),
                Label = JData["label"].Value<string>(),
                Type = JData["type"].Value<string>(),
                Options = JsonConvert.DeserializeObject<Front_SelectInputList_Options>(JData["options"].ToString()),
                Columns = columns
            };
        }
 
        public void ReadFront(Action<IFront> 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_SelectInputList_Options
    {
        public bool disabled { get; set; }
        public bool multiple { get; set; }
        public bool hidden { get; set; }
        public bool showLabel { get; set; }
        public string width { get; set; }
    }
 
    public class Front_SelectInputList_Column
    {
        public string Value { get; set; }
        public string Label { get; set; }
 
        /// <summary>
        /// 组件集
        /// </summary>
        public List<IFront> List { get; set; }
    }
}