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 @@