Ejemplo n.º 1
0
        private void CheckUiType()
        {
            if (Context.SelectEntity == null)
            {
                return;
            }
            var result = MessageBox.Show(Application.Current.MainWindow, "点是执行重置,点否执行修复", "控件类型修复",
                                         MessageBoxButton.YesNoCancel);

            if (result == MessageBoxResult.Cancel)
            {
                return;
            }
            foreach (var field in Context.SelectEntity.Properties)
            {
                PropertyEasyUiModel.CheckField(field, result == MessageBoxResult.Yes);
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        ///     生成列表字段
        /// </summary>
        /// <param name="code"></param>
        /// <param name="field"></param>
        private static void GridField(StringBuilder code, PropertyConfig field)
        {
            var align  = string.IsNullOrWhiteSpace(field.GridAlign) ? "left" : field.GridAlign;
            var extend = string.Empty;

            if (!string.IsNullOrWhiteSpace(field.DataFormater))
            {
                extend = $@", formatter: {field.DataFormater}";
            }
            else if (field.CsType == "bool")
            {
                extend = ", formatter: yesnoFormat";
            }
            else if (field.CsType == "DateTime")
            {
                extend = ", formatter: dateFormat";
            }
            else if (!string.IsNullOrWhiteSpace(field.CustomType))
            {
                extend = $", formatter: {field.CustomType.ToLWord()}Format";
            }
            else if (field.IsMoney) //unixDateFormat
            {
                extend = @", formatter: moneyFormat";
                align  = "right";
            }
            else if (!string.IsNullOrWhiteSpace(field.Prefix) || !string.IsNullOrWhiteSpace(field.Suffix))
            {
                extend = $@", formatter: function(value, row) {{
                    return '{field.Prefix}' + value + '{field.Suffix}';
                }}";
            }
            PropertyEasyUiModel.CheckField(field);
            code.Append($@"
            , {{ styler: vlStyle,width:{field.GridWidth}, halign: 'center', align: '{align}', sortable: true, field: '{
                    field.Name
                }', title: '{field.Caption}'{extend}}}");
        }
Ejemplo n.º 3
0
        private static void FormField(StringBuilder code, PropertyConfig field, string caption, string description)
        {
            string cssEnd = "";
            int    wid    = 0;

            if (field.FormCloumnSapn > 1)
            {
                cssEnd = "_" + field.FormCloumnSapn + "c";
                code.Append(@"<br/>");
            }

            code.Append($@"
            <div class='inputField{cssEnd}' id='fr_{field.Name}'>
                <div class='inputRegion' id='ir_{field.Name}'>
                    <div class='inputLabel'>{caption}:</div>");

            PropertyEasyUiModel.CheckField(field);

            if (field.InputType == "editor")
            {
                var css = field.FormCloumnSapn <= 1 ? "inputValue_Rich_S" : "inputValue_Rich";
                code.Append($@"<br/>
                    <div class='inputValue_Rich_b'>
                        <div id='{field.Name}' name='{field.Name}' class='myueditor {css}'></div>
                    </div>");
            }
            else
            {
                if (!string.IsNullOrWhiteSpace(field.Prefix))
                {
                    code.Append(field.Prefix);
                }

                string br = null;
                string css;
                string attributes = "";
                if (field.MulitLine)
                {
                    br  = "<br/>";
                    css = field.FormCloumnSapn <= 1 ? "inputValue_Memo_S" : "inputValue_Memo";
                }
                else
                {
                    css = "inputValue" + cssEnd + " inputS";
                    if (field.IsMoney)
                    {
                        wid = 120;
                        if (field.FormCloumnSapn > 2)
                        {
                            wid += (field.FormCloumnSapn - 1) * 485;
                        }
                    }
                    else
                    {
                        int len = 0;
                        if (!string.IsNullOrWhiteSpace(field.Prefix))
                        {
                            len = field.Prefix.Length;
                        }
                        if (!string.IsNullOrWhiteSpace(field.Suffix))
                        {
                            len += field.Suffix.Length;
                        }

                        if (len > 0)
                        {
                            if (field.FormCloumnSapn > 2)
                            {
                                wid = (field.FormCloumnSapn - 1) * 485;
                            }
                            else
                            {
                                wid = 480;
                            }
                            wid -= len * 12;
                        }
                    }
                    if (wid > 0)
                    {
                        attributes += $" style='width:{wid}px'";
                    }
                    if (field.IsLinkKey)
                    {
                        var title = field.Parent.ClientProperty.FirstOrDefault(p => p.LinkTable == field.LinkTable && p.IsLinkCaption);
                        if (title != null)
                        {
                            attributes += $" readfield='{title.Name}'";
                        }
                    }
                }


                var options = FieldOptions(field, description);
                code.Append($@"{br}
                    <input id='{field.Name}' name='{field.Name}' class='{css} {field.InputType}'{attributes}
                           data-options=""{options}""/>");
                if (!string.IsNullOrWhiteSpace(field.Suffix))
                {
                    code.Append(field.Suffix);
                }
                if (field.IsMoney)
                {
                    code.Append($@"<label id = 'cm_{field.Name}' style = 'color: red;' ></label>");
                }
            }
            code.Append(@"
                </div>
            </div>");
            //code.Append(
            //    $@"
            //    </div>
            //    <div class='inputHelp' id='hr_{field.Name}'>{
            //        description}</div>
            //</div>");
        }