Beispiel #1
0
        private static string FieldOptions(PropertyConfig field, string description)
        {
            StringBuilder options = new StringBuilder();

            options.Append($"prompt:'{description.Replace('\'', ' ')}'");
            if (field.MulitLine)
            {
                options.Append(",multiline:true");
            }
            if (field.IsUserReadOnly)
            {
                options.Append(",readonly:true");
            }
            if (!field.CanEmpty)
            {
                options.Append(",required:true");
            }
            if (!string.IsNullOrWhiteSpace(field.FormOption))
            {
                options.Append("," + field.FormOption);
            }
            if (!string.IsNullOrWhiteSpace(field.ComboBoxUrl))
            {
                options.Append($",url:'{field.ComboBoxUrl}'");
            }
            var validType = EasyUiPageScriptCoder.ValidType(field, out bool required);

            if (validType.Count > 0)
            {
                options.Append($",validType:[{validType.LinkToString(",")}]");
            }
            return(options.ToString());
        }
        /// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        public static string PageScript(ConfigBase config)
        {
            var entity = config as EntityConfig;

            if (entity == null)
            {
                return("请选择一个实体模型");
            }
            var coder = new EasyUiPageScriptCoder
            {
                Entity  = entity,
                Project = entity.Parent
            };

            return(coder.Code());
        }