using JNPF.Common.Const; using JNPF.Common.Models; using JNPF.Common.Security; using JNPF.DependencyInjection; namespace JNPF.Common.CodeGenUpload; /// /// 代码生成导入. /// [SuppressSniffer] [AttributeUsage(AttributeTargets.Property)] public class CodeGenUploadAttribute : Attribute { /// /// 构造函数. /// "createUser" /// "modifyUser" /// "createTime" /// "modifyTime" /// "currOrganize" /// "currPosition" /// "currDept" /// "billRule" /// "comInput" /// "textarea" /// "colorPicker" /// "rate" /// "slider" /// "editor". /// public CodeGenUploadAttribute(string Model, string Config) { __Model__ = Model; __config__ = Config.ToObject(); } /// /// 构造函数 /// "radio" /// "checkbox" /// "time" /// "date". /// public CodeGenUploadAttribute(string Model, string SecondParameter, string Config) { __Model__ = Model; __config__ = Config.ToObject(); switch (__config__.jnpfKey) { case JnpfKeyConst.CHECKBOX: case JnpfKeyConst.RADIO: __slot__ = SecondParameter?.ToObject(); break; default: format = SecondParameter; break; } } /// /// 构造函数 /// "numInput". /// public CodeGenUploadAttribute(string Model, string Config, int Min = default, int Max = default) { __Model__ = Model; min = Min; max = Max; __config__ = Config.ToObject(); } /// /// 构造函数 /// "switch". /// public CodeGenUploadAttribute(string Model, string ActiveTxt, string InactiveTxt, string Config) { __Model__ = Model; activeTxt = ActiveTxt; inactiveTxt = InactiveTxt; __config__ = Config.ToObject(); } /// /// 构造函数 /// "popupSelect". /// public CodeGenUploadAttribute(string Model, string dataConversionModel, string SecondParameter, string ThreeParameters, string FourParameters, string ShowField, string Config) { __Model__ = Model; __vModel__ = dataConversionModel; interfaceId = SecondParameter; propsValue = ThreeParameters; relationField = FourParameters; showField = ShowField; __config__ = Config.ToObject(); } /// /// 构造函数 /// "comSelect": /// "roleSelect": /// "groupSelect". /// public CodeGenUploadAttribute(string Model, bool Multiple, string Config) { __Model__ = Model; multiple = Multiple; __config__ = Config.ToObject(); } /// /// 构造函数 /// "select". /// public CodeGenUploadAttribute(string Model, bool Multiple, string Slot, string Config) { __Model__ = Model; multiple = Multiple; __slot__ = Slot?.ToObject(); __config__ = Config.ToObject(); } /// /// 构造函数 /// "address". /// public CodeGenUploadAttribute(string Model, bool Multiple, int Level, string Config) { __Model__ = Model; multiple = Multiple; level = Level; __config__ = Config.ToObject(); } /// /// 构造函数 /// "treeSelect" /// "depSelect":. /// public CodeGenUploadAttribute(string Model, bool Multiple, string ThreeParameters, string FourParameters, string Config) { __Model__ = Model; multiple = Multiple; __config__ = Config.ToObject(); switch (__config__.jnpfKey) { case JnpfKeyConst.DEPSELECT: selectType = ThreeParameters; ableDepIds = FourParameters?.ToObject>(); break; default: props = ThreeParameters?.ToObject(); options = FourParameters?.ToObject>(); break; } } /// /// 构造函数 /// "usersSelect":. /// public CodeGenUploadAttribute(string Model, string dataConversionModel, bool Multiple, string ThreeParameters, string FourParameters, string Config) { __Model__ = Model; __vModel__ = dataConversionModel; multiple = Multiple; __config__ = Config.ToObject(); selectType = ThreeParameters; ableIds = FourParameters?.ToObject>(); } /// /// 构造函数 /// "cascader" /// "posSelect": /// "relationForm" /// "popupTableSelect". /// public CodeGenUploadAttribute(string Model, bool Multiple, string InterfaceId, string PropsValue, string RelationField, string Config) { __Model__ = Model; multiple = Multiple; __config__ = Config.ToObject(); switch (__config__.jnpfKey) { case JnpfKeyConst.CASCADER: separator = InterfaceId; props = PropsValue?.ToObject(); options = RelationField?.ToObject>(); break; case JnpfKeyConst.POPUPTABLESELECT: interfaceId = InterfaceId; propsValue = PropsValue; relationField = RelationField; break; case JnpfKeyConst.POSSELECT: selectType = InterfaceId; ableDepIds = PropsValue?.ToObject>(); ablePosIds = RelationField?.ToObject>(); break; } } /// /// 构造函数 /// "relationForm". /// public CodeGenUploadAttribute(string Model, string dataConversionModel, bool Multiple, string InterfaceId, string PropsValue, string RelationField, string Config) { __Model__ = Model; __vModel__ = dataConversionModel; multiple = Multiple; __config__ = Config.ToObject(); modelId = InterfaceId; relationField = PropsValue; showField = RelationField; } /// /// 构造函数 /// "userSelect":. /// public CodeGenUploadAttribute(string Model, bool Multiple, string SelectType, string AbleDepIds, string AblePosIds, string AbleUserIds, string AbleRoleIds, string AbleGroupIds, string Config) { __Model__ = Model; multiple = Multiple; selectType = SelectType; ableDepIds = AbleDepIds?.ToObject>(); ablePosIds = AblePosIds?.ToObject>(); ableUserIds = AbleUserIds?.ToObject>(); ableRoleIds = AbleRoleIds?.ToObject>(); ableGroupIds = AbleGroupIds?.ToObject>(); __config__ = Config.ToObject(); } /// /// 设置默认值为空字符串. /// public string __Model__ { get; set; } /// /// 数据转换. /// public string __vModel__ { get; set; } /// /// 最小值. /// public int min { get; set; } /// /// 最大值. /// public int max { get; set; } /// /// 开关控件 属性 - 开启展示值. /// public string? activeTxt { get; set; } /// /// 开关控件 属性 - 关闭展示值. /// public string? inactiveTxt { get; set; } /// /// 显示绑定值的格式. /// public string? format { get; set; } /// /// 是否多选. /// public bool multiple { get; set; } /// /// 选项分隔符. /// public string? separator { get; set; } /// /// 配置选项. /// public CodeGenPropsModel? props { get; set; } /// /// 配置项. /// public List? options { get; set; } /// /// 弹窗选择主键. /// public string? propsValue { get; set; } /// /// 关联表单字段. /// public string? relationField { get; set; } /// /// 关联表单id. /// public string? modelId { get; set; } /// /// 数据接口ID. /// public string? interfaceId { get; set; } /// /// 层级. /// public int level { get; set; } /// /// 插槽. /// public CodeGenSlotModel? __slot__ { get; set; } /// /// 配置. /// public CodeGenConfigModel? __config__ { get; set; } /// /// 可选范围. /// public string selectType { get; set; } /// /// 可选部门. /// public List ableDepIds { get; set; } /// /// 可选岗位. /// public List ablePosIds { get; set; } /// /// 可选用户. /// public List ableUserIds { get; set; } /// /// 可选角色. /// public List ableRoleIds { get; set; } /// /// 可选分组. /// public List ableGroupIds { get; set; } /// /// 新用户选择控件. /// public List ableIds { get; set; } /// /// 展示字段. /// public string showField { get; set; } }