From 179843f98e106a6f83a9504ca3905185e53defeb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=87=AA=E5=B8=A6=E5=A4=A7=E4=BD=AC=E6=B0=94=E5=9C=BA?= <188633308@qq.com> Date: Fri, 21 May 2021 17:45:50 +0800 Subject: [PATCH] =?UTF-8?q?update=20=E5=8C=BA=E5=9F=9F=E5=A2=9E=E5=8A=A0?= =?UTF-8?q?=E6=A0=91=E7=BB=93=E6=9E=84=E6=98=BE=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controller/AreaCodeController.cs | 4 +- Api/Ewide.Core/Ewide.Core.xml | 4 +- .../Service/Area/AreaCodeService.cs | 12 +- .../Service/Area/Dto/AreaCodeInput.cs | 1 + .../Service/Area/IAreaCodeService.cs | 2 +- Web/src/pages/system/area/form.vue | 34 ++-- Web/src/pages/system/area/index.vue | 147 ++++++++++++------ 7 files changed, 130 insertions(+), 74 deletions(-) diff --git a/Api/Ewide.Core/Controller/AreaCodeController.cs b/Api/Ewide.Core/Controller/AreaCodeController.cs index 713b87d..12010bc 100644 --- a/Api/Ewide.Core/Controller/AreaCodeController.cs +++ b/Api/Ewide.Core/Controller/AreaCodeController.cs @@ -79,9 +79,9 @@ namespace Ewide.Core.Controller /// /// [HttpGet("/sysArea/tree")] - public async Task> GetAreaCodeTree() + public async Task> GetAreaCodeTree([FromQuery]int? level) { - return await _areaCodeService.GetAreaCodeTree(); + return await _areaCodeService.GetAreaCodeTree(level); } } } diff --git a/Api/Ewide.Core/Ewide.Core.xml b/Api/Ewide.Core/Ewide.Core.xml index 794dbb8..1070fe2 100644 --- a/Api/Ewide.Core/Ewide.Core.xml +++ b/Api/Ewide.Core/Ewide.Core.xml @@ -348,7 +348,7 @@ - + 获取目录树 @@ -3016,7 +3016,7 @@ 区域代码 - + 获取区域目录树 diff --git a/Api/Ewide.Core/Service/Area/AreaCodeService.cs b/Api/Ewide.Core/Service/Area/AreaCodeService.cs index 01dfaad..671fa93 100644 --- a/Api/Ewide.Core/Service/Area/AreaCodeService.cs +++ b/Api/Ewide.Core/Service/Area/AreaCodeService.cs @@ -71,12 +71,13 @@ namespace Ewide.Core.Service.Area /// 获取区域目录树 /// /// - public async Task> GetAreaCodeTree() + public async Task> GetAreaCodeTree(int? level) { + level = level.GetValueOrDefault(100); var cachedAreaCodes = await _sysCacheService.GetAreaCode(); if (cachedAreaCodes == null || cachedAreaCodes.Count < 0) { - cachedAreaCodes = await _areaCodeRep.DetachedEntities.ToListAsync(); + cachedAreaCodes = await _areaCodeRep.DetachedEntities.Where(p => p.LevelType <= level).ToListAsync(); await _sysCacheService.SetAreaCode(cachedAreaCodes); } return new TreeBuildUtil().DoTreeBuild(cachedAreaCodes.Select(u => new AreaTreeNode @@ -99,9 +100,10 @@ namespace Ewide.Core.Service.Area { var AreaCodes = await _areaCodeRep.DetachedEntities .Where(input.LevelType.HasValue, a => a.LevelType == input.LevelType) - .Where(!string.IsNullOrEmpty(input.Code), a => a.Code.StartsWith(input.Code)) - .Where(!string.IsNullOrEmpty(input.AdCode), a => a.AdCode.StartsWith(input.AdCode)) - .Where(!string.IsNullOrEmpty(input.Name), a => a.Name.StartsWith(input.Name)) + .Where(!string.IsNullOrEmpty(input.Code), a => a.Code.Contains(input.Code)) + .Where(!string.IsNullOrEmpty(input.AdCode), a => a.AdCode.Contains(input.AdCode)) + .Where(!string.IsNullOrEmpty(input.Name), a => a.Name.Contains(input.Name)) + .Where(!string.IsNullOrEmpty(input.Pcode), a => a.Code.StartsWith(input.Pcode)) .ToPageData(input); return XnPageResult.PageResult(AreaCodes); } diff --git a/Api/Ewide.Core/Service/Area/Dto/AreaCodeInput.cs b/Api/Ewide.Core/Service/Area/Dto/AreaCodeInput.cs index 3870438..7ef0404 100644 --- a/Api/Ewide.Core/Service/Area/Dto/AreaCodeInput.cs +++ b/Api/Ewide.Core/Service/Area/Dto/AreaCodeInput.cs @@ -15,6 +15,7 @@ namespace Ewide.Core.Service.Area.Dto public int? LevelType { get; set; } public string Note { get; set; } public int Sort { get; set; } + public string Pcode { get; set; } } public class UpdateAreaCodeInput { diff --git a/Api/Ewide.Core/Service/Area/IAreaCodeService.cs b/Api/Ewide.Core/Service/Area/IAreaCodeService.cs index 10d700e..8c5d20b 100644 --- a/Api/Ewide.Core/Service/Area/IAreaCodeService.cs +++ b/Api/Ewide.Core/Service/Area/IAreaCodeService.cs @@ -16,7 +16,7 @@ namespace Ewide.Core.Service.Area Task GetAreaCode(string code); Task> GetAreaCodeWithChildren(string code); - Task> GetAreaCodeTree(); + Task> GetAreaCodeTree(int? level); Task QueryAreaCodePageList([FromQuery] AreaCodeInput input); } diff --git a/Web/src/pages/system/area/form.vue b/Web/src/pages/system/area/form.vue index 265fd83..f8336c0 100644 --- a/Web/src/pages/system/area/form.vue +++ b/Web/src/pages/system/area/form.vue @@ -11,8 +11,8 @@
- - + + - + - - + + + 区域编码 + + + + + - - + + + 行政编码 + + + + + - + diff --git a/Web/src/pages/system/area/index.vue b/Web/src/pages/system/area/index.vue index 9fa61e7..8f57a3e 100644 --- a/Web/src/pages/system/area/index.vue +++ b/Web/src/pages/system/area/index.vue @@ -1,47 +1,60 @@ \ No newline at end of file +