From 75d03da033bb63ad434d87ca25e428792f654b4d Mon Sep 17 00:00:00 2001 From: wanggang <76527413@qq.com> Date: Mon, 3 Jul 2023 17:44:22 +0800 Subject: [PATCH 1/9] update --- .../src/WTA/wwwroot/components/list/index.js | 73 +++++++++++++++++++ docs/demo/src/WTA/wwwroot/layouts/index.js | 12 +-- 2 files changed, 75 insertions(+), 10 deletions(-) diff --git a/docs/demo/src/WTA/wwwroot/components/list/index.js b/docs/demo/src/WTA/wwwroot/components/list/index.js index b5ee3988..9e08462e 100644 --- a/docs/demo/src/WTA/wwwroot/components/list/index.js +++ b/docs/demo/src/WTA/wwwroot/components/list/index.js @@ -44,6 +44,10 @@ export default { {{item.meta.title}} + + + {{$t('高级筛选')}} + @@ -143,6 +147,62 @@ export default { /> + + + + + + + + + {{value.title}} + + + + + {{$t('等于')}} + {{$t('不等于')}} + {{$t('大于')}} + {{$t('大于等于')}} + {{$t('小于')}} + {{$t('小于等于')}} + {{$t('包含')}} + {{$t('不包含')}} + + + + + + + + {{$t('且')}} + {{$t('或')}} + + + + + + + + + + + + + + + + + + + + + + @@ -240,6 +300,8 @@ export default { const sortColumns = ref(new Map()); const schema = ref(props.schema); const queryFromSchema = ref(null); + const queryList = ref([]); + const queryDialog = ref(false); const tableSchema = ref({}); const tableData = ref([]); const editFormRef = ref(null); @@ -418,6 +480,14 @@ export default { subDrawer.value = true; } }; + const pushQueryList = () => { + queryList.value.push({ + property: "", + operator: "等于", + value: "", + logical: "且", + }); + }; onMounted(async () => { const vm = (await get(indexUrl)).data; schema.value = vm.schema; @@ -442,6 +512,8 @@ export default { dialogVisible, selectedRows, queryFromSchema, + queryDialog, + queryList, tableSchema, buttons, data, @@ -463,6 +535,7 @@ export default { submit, showList, subListQuery, + pushQueryList, }; }, }; diff --git a/docs/demo/src/WTA/wwwroot/layouts/index.js b/docs/demo/src/WTA/wwwroot/layouts/index.js index 380813c3..aa823277 100644 --- a/docs/demo/src/WTA/wwwroot/layouts/index.js +++ b/docs/demo/src/WTA/wwwroot/layouts/index.js @@ -20,17 +20,9 @@ export default { - + - + From aa7cb937544fa5c509f38de80f4acf5add11d59c Mon Sep 17 00:00:00 2001 From: wanggang <76527413@qq.com> Date: Tue, 4 Jul 2023 17:38:35 +0800 Subject: [PATCH 2/9] update --- .gitignore | 1 + .../WTA.Shared/Application/PaginationModel.cs | 1 + .../src/WTA.Shared/Application/QueryFilter.cs | 9 + .../Controllers/GenericController.cs | 17 +- .../Extensions/JsonSchemaExtensions.cs | 8 +- .../WTA.Shared/Extensions/StringExtensions.cs | 14 +- .../src/WTA/wwwroot/components/form/index.js | 2 +- .../src/WTA/wwwroot/components/icon/index.js | 2 +- .../src/WTA/wwwroot/components/list/index.js | 465 +++++++++--------- docs/demo/src/WTA/wwwroot/layouts/tabs.js | 4 + docs/demo/src/WTA/wwwroot/signalr/index.js | 2 +- docs/demo/src/WTA/wwwroot/styles/site.css | 5 +- ...统寄售库变动及表结构整理.xlsx | Bin 0 -> 16776 bytes 13 files changed, 298 insertions(+), 232 deletions(-) create mode 100644 docs/demo/src/WTA.Shared/Application/QueryFilter.cs create mode 100644 docs/结算系统寄售库变动及表结构整理.xlsx diff --git a/.gitignore b/.gitignore index bfcbf6ee..7657db0b 100644 --- a/.gitignore +++ b/.gitignore @@ -8,6 +8,7 @@ dist/ .vs/ bin/ obj/ +[Ll]ogs/ *.suo *.user *.db diff --git a/docs/demo/src/WTA.Shared/Application/PaginationModel.cs b/docs/demo/src/WTA.Shared/Application/PaginationModel.cs index f250645f..e445708b 100644 --- a/docs/demo/src/WTA.Shared/Application/PaginationModel.cs +++ b/docs/demo/src/WTA.Shared/Application/PaginationModel.cs @@ -21,4 +21,5 @@ public class PaginationModel public List Items { get; set; } = new List(); public bool QueryAll { get; set; } public TSearchModel Query { get; set; } = Activator.CreateInstance(); + public List Filters { get; set; } = new List(); } diff --git a/docs/demo/src/WTA.Shared/Application/QueryFilter.cs b/docs/demo/src/WTA.Shared/Application/QueryFilter.cs new file mode 100644 index 00000000..f5ce52cf --- /dev/null +++ b/docs/demo/src/WTA.Shared/Application/QueryFilter.cs @@ -0,0 +1,9 @@ +namespace WTA.Shared.Application; + +public class QueryFilter +{ + public string Property { get; set; } = null!; + public string Operator { get; set; } = null!; + public string Value { get; set; } = null!; + public string Logic { get; set; } = null!; +} diff --git a/docs/demo/src/WTA.Shared/Controllers/GenericController.cs b/docs/demo/src/WTA.Shared/Controllers/GenericController.cs index 12960a6a..5b50a031 100644 --- a/docs/demo/src/WTA.Shared/Controllers/GenericController.cs +++ b/docs/demo/src/WTA.Shared/Controllers/GenericController.cs @@ -1,3 +1,4 @@ +using System.Globalization; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc; using Microsoft.EntityFrameworkCore; @@ -40,6 +41,10 @@ public class GenericController)); var query = BuildQuery(model, isTree); + foreach (var item in model.Filters) + { + query = query.Where(string.Format(CultureInfo.InvariantCulture, item.Operator, item.Property.ToPascalCase()), item.Value); + } model.TotalCount = query.Count(); if (!string.IsNullOrEmpty(model.OrderBy)) { @@ -76,6 +81,12 @@ public class GenericController(), + }); } [HttpPost, Multiple, Order(-3), HtmlClass("el-button--success")] diff --git a/docs/demo/src/WTA.Shared/Extensions/JsonSchemaExtensions.cs b/docs/demo/src/WTA.Shared/Extensions/JsonSchemaExtensions.cs index fe319b65..2e26f7e0 100644 --- a/docs/demo/src/WTA.Shared/Extensions/JsonSchemaExtensions.cs +++ b/docs/demo/src/WTA.Shared/Extensions/JsonSchemaExtensions.cs @@ -133,8 +133,8 @@ public static class JsonSchemaExtensions } schema.AddNotNull("description", meta.Description); - schema.AddNotNull("format", meta.DataTypeName?.ToLowerCamelCase()); - schema.AddNotNull("input", meta.TemplateHint?.ToLowerCamelCase()); + schema.AddNotNull("format", meta.DataTypeName?.ToCamelCase()); + schema.AddNotNull("input", meta.TemplateHint?.ToCamelCase()); if (meta.TemplateHint == "select" && meta.IsEnumerableType && modelType.IsGenericType) { schema.TryAdd("url", modelType.GetGenericArguments().First().Name.ToSlugify()); @@ -152,7 +152,7 @@ public static class JsonSchemaExtensions if (defaultModelMetadata.Attributes.Attributes.FirstOrDefault(o => o.GetType() == typeof(NavigationAttribute)) is NavigationAttribute navigationAttribute) { var path = navigationAttribute.Property ?? $"{propertyName[..^2]}.Name"; - path = string.Join('.', path.Split('.').Select(o => o.ToLowerCamelCase())); + path = string.Join('.', path.Split('.').Select(o => o.ToCamelCase())); schema.Add("navigation", path); schema.Add("input", "select"); schema.Add("url", defaultModelMetadata.ContainerType?.GetProperty(propertyName[..^2])?.PropertyType.Name.ToSlugify()!); @@ -257,7 +257,7 @@ public static class JsonSchemaExtensions else if (attribute is CompareAttribute compare)//?? { rule.Add("validator", "compare"); - rule.Add("compare", compare.OtherProperty.ToLowerCamelCase()); + rule.Add("compare", compare.OtherProperty.ToCamelCase()); } else if (attribute is MinLengthAttribute minLength) { diff --git a/docs/demo/src/WTA.Shared/Extensions/StringExtensions.cs b/docs/demo/src/WTA.Shared/Extensions/StringExtensions.cs index ef47474f..2a6948b5 100644 --- a/docs/demo/src/WTA.Shared/Extensions/StringExtensions.cs +++ b/docs/demo/src/WTA.Shared/Extensions/StringExtensions.cs @@ -57,7 +57,19 @@ public static class StringExtensions return input.EndsWith(end) ? input[..^end.Length] : input; } - public static string ToLowerCamelCase(this string input) + public static string ToPascalCase(this string value) + { + if (!string.IsNullOrEmpty(value)) + { + var sb = new StringBuilder(value); + sb[0] = char.ToUpperInvariant(sb[0]); + + return sb.ToString(); + } + return value; + } + + public static string ToCamelCase(this string input) { if (string.IsNullOrEmpty(input) || !char.IsUpper(input[0])) { diff --git a/docs/demo/src/WTA/wwwroot/components/form/index.js b/docs/demo/src/WTA/wwwroot/components/form/index.js index 2a9ed526..01b3f465 100644 --- a/docs/demo/src/WTA/wwwroot/components/form/index.js +++ b/docs/demo/src/WTA/wwwroot/components/form/index.js @@ -55,7 +55,7 @@ export default { }); //} } catch (error) { - console.error(error); + console.log(error); } finally { loading.value = false; } diff --git a/docs/demo/src/WTA/wwwroot/components/icon/index.js b/docs/demo/src/WTA/wwwroot/components/icon/index.js index f8c30689..35757c36 100644 --- a/docs/demo/src/WTA/wwwroot/components/icon/index.js +++ b/docs/demo/src/WTA/wwwroot/components/icon/index.js @@ -24,7 +24,7 @@ export default { svg.value = await response.text(); } } catch (error) { - console.error(error); + console.log(error); if (!svg.value) { svg.value = ``; } diff --git a/docs/demo/src/WTA/wwwroot/components/list/index.js b/docs/demo/src/WTA/wwwroot/components/list/index.js index 9e08462e..e80ad861 100644 --- a/docs/demo/src/WTA/wwwroot/components/list/index.js +++ b/docs/demo/src/WTA/wwwroot/components/list/index.js @@ -17,192 +17,137 @@ export default { VueOfficeExcel, }, template: html` - - - - - - - - - - - {{$t('高级筛选')}} - - - - - - - - - - - - -