/// <summary> /// 转换成为 el_input 元素; /// </summary> /// <param name="type"></param> /// <param name="property"></param> /// <returns></returns> public override AbstractPropertyComponentAttribute ConvertToClientEditVueComponentAttribute(Type type, PropertyInfo property) { if (foreignProperty != null) //有外键; { var result = new ehay_entity_singleselect(EnumComponentSchema.Edit) { entityType = getEntityType() }; result.clearable = property.PropertyType.IsGenericType; //是否可以清除可为null if (!result.clearable && (this.isRelateToUpper || this.foreignProperty != null)) { result.verifyInput += (value) => { if (value == null) { return($"需要指定{result.label}"); } int ivalue; if (!Int32.TryParse(value.ToString(), out ivalue)) { return($"需要指定{result.label}"); } if (ivalue == 0) { return($"需要指定{result.label}"); } return(null); }; } return(result); } return(new el_inputAttribute(EnumComponentSchema.Edit)); }
/// <summary> /// 转换成为 el_input 元素; /// </summary> /// <param name="type"></param> /// <param name="property"></param> /// <returns></returns> public override AbstractPropertyComponentAttribute ConvertToClientEditVueComponentAttribute(Type type, PropertyInfo property) { if (foreignProperty != null) //有外键; { var result = new ehay_entity_singleselect(EnumComponentSchema.Edit) { entityType = getEntityType() }; result.clearable = property.PropertyType.IsGenericType; //是否可以清除可为null return(result); } return(new el_inputAttribute(EnumComponentSchema.Edit)); }