From 49503e3bcbb76f5e0b2e0209a5f42fbea94978ad Mon Sep 17 00:00:00 2001 From: wanggang <76527413@qq.com> Date: Mon, 4 Sep 2023 10:27:37 +0800 Subject: [PATCH 1/2] update --- .../host/SettleAccount.HttpApi.Host/wwwroot/models/_options.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/models/_options.js b/code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/models/_options.js index 940222c0..63c578ca 100644 --- a/code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/models/_options.js +++ b/code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/models/_options.js @@ -17,7 +17,7 @@ const stateOptions = [ { value: 5, label: "已扣减" }, { value: 6, label: "已提交扣减" }, ]; -const state = { title: "状态", type: "string", input: "select", options: stateOptions }; +const state = { title: "状态", type: "number", input: "select", options: stateOptions }; const state2 = Object.assign(Object.assign({}, state), { options: stateOptions.filter((a) => parseInt(a.value) > 0) }); const state3 = Object.assign(Object.assign({}, state), { options: stateOptions.filter((a) => parseInt(a.value) > 3) }); From 17cb888dd94331d87f5772d250e037b1662921ee Mon Sep 17 00:00:00 2001 From: wanggang <76527413@qq.com> Date: Mon, 4 Sep 2023 10:27:59 +0800 Subject: [PATCH 2/2] update --- .../Win.Sfs.Shared/Filter/FilterExtensions.cs | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/code/src/Shared/Win.Sfs.Shared/Filter/FilterExtensions.cs b/code/src/Shared/Win.Sfs.Shared/Filter/FilterExtensions.cs index b1c6c7b9..5518ea1a 100644 --- a/code/src/Shared/Win.Sfs.Shared/Filter/FilterExtensions.cs +++ b/code/src/Shared/Win.Sfs.Shared/Filter/FilterExtensions.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.ComponentModel; using System.Linq; using System.Linq.Expressions; using System.Text.Json; @@ -77,6 +78,7 @@ namespace Win.Sfs.Shared.Filter //var constant = Expression.Constant(filterCondition.Value);//创建常数 ConstantExpression constant = null; + if (filterCondition.Action != EnumFilterAction.In && filterCondition.Action != EnumFilterAction.NotIn) { constant = CreateConstantExpression(member.Type, filterCondition.Value); @@ -150,12 +152,13 @@ namespace Win.Sfs.Shared.Filter if (propertyType.IsGenericType && propertyType.GetGenericTypeDefinition() == typeof(Nullable<>)) { - var objValue = Convert.ChangeType(value, propertyType.GetGenericArguments()[0]); - constant = Expression.Constant(objValue); + var type = propertyType.GetGenericArguments()[0]; + var objValue = type.IsEnum ? (Enum)Enum.Parse(type, value, true) : Convert.ChangeType(value, type); + constant = Expression.Constant(new NullableConverter(propertyType).ConvertFrom(objValue)); } else if (propertyType.IsEnum) { - var enumValue = (Enum)Enum.Parse(propertyType, value, true); + var enumValue = (Enum?)Enum.Parse(propertyType, value, true); constant = Expression.Constant(enumValue); } else @@ -174,7 +177,11 @@ namespace Win.Sfs.Shared.Filter return constant; } - + public static T? CreateNullable(this T item) where T : struct + { + T? v = (T?)(new NullableConverter(typeof(T?))).ConvertFrom(item); + return v; + } private static Expression> GetExpressionLikeMethod(string methodName, FilterCondition filterCondition) {