diff --git a/src/main/java/com/cm/population/controller/api/areatree/AreaTreeController.java b/src/main/java/com/cm/population/controller/api/areatree/AreaTreeController.java index 04096a8..24c56f7 100644 --- a/src/main/java/com/cm/population/controller/api/areatree/AreaTreeController.java +++ b/src/main/java/com/cm/population/controller/api/areatree/AreaTreeController.java @@ -133,7 +133,7 @@ public class AreaTreeController extends AbstractController { for(AreaZtreeDTO dto : list) { ArrayList names = new ArrayList<>(); names.add(dto.getName()); - getParent(names, dto.getpId()); + getParentBaoTou(names, dto.getpId()); dto.setTitle(StringUtils.join(names, "/")); } return list; diff --git a/src/main/java/com/cm/population/controller/app/api/areatree/AreaTreeAppController.java b/src/main/java/com/cm/population/controller/app/api/areatree/AreaTreeAppController.java index 98af0da..fdf6522 100644 --- a/src/main/java/com/cm/population/controller/app/api/areatree/AreaTreeAppController.java +++ b/src/main/java/com/cm/population/controller/app/api/areatree/AreaTreeAppController.java @@ -91,7 +91,7 @@ public class AreaTreeAppController extends AbstractController { * @return */ @ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)}) - @GetMapping("tree") + @PostMapping("tree") public List tree(String id) { String parentId = id; if (StringUtils.isEmpty(id)) { @@ -101,7 +101,7 @@ public class AreaTreeAppController extends AbstractController { for(AreaZtreeDTO dto : list) { ArrayList names = new ArrayList<>(); names.add(dto.getName()); - getParent(names, dto.getpId()); + getParentBaoTou(names, dto.getpId()); dto.setTitle(StringUtils.join(names, "/")); } return list; @@ -137,4 +137,12 @@ public class AreaTreeAppController extends AbstractController { } } + public void getParentBaoTou(ArrayList names, String pId) { + DataAreaDTO areaDTO = iPopulationInfoService.getAreaById(pId); + if(areaDTO != null && !areaDTO.getAreaLevel().equals("1") && !areaDTO.getAreaLevel().equals("0") ) { + names.add(0, areaDTO.getAreaName()); + getParentBaoTou(names, areaDTO.getAreaParentId()); + } + } + } \ No newline at end of file diff --git a/src/main/resources/templates/cult/save.html b/src/main/resources/templates/cult/save.html index b100f61..612d700 100644 --- a/src/main/resources/templates/cult/save.html +++ b/src/main/resources/templates/cult/save.html @@ -166,7 +166,7 @@ callback : { onClick : function (e, treeId, treeNode) { var count = treeNode.title.split('/').length -1; - if (count > 1) { + if (count > 0) { $('#' + name + "AreaName").val(treeNode.title); $('#' + name + "AreaCode").val(treeNode.areaCode); hideMenu(); diff --git a/src/main/resources/templates/cult/update.html b/src/main/resources/templates/cult/update.html index bff8ca3..0660ac0 100644 --- a/src/main/resources/templates/cult/update.html +++ b/src/main/resources/templates/cult/update.html @@ -162,7 +162,7 @@ callback : { onClick : function (e, treeId, treeNode) { var count = treeNode.title.split('/').length -1; - if (count > 1) { + if (count > 0) { $('#' + name + "AreaName").val(treeNode.title); $('#' + name + "AreaCode").val(treeNode.areaCode); hideMenu(); diff --git a/src/main/resources/templates/dispute/save.html b/src/main/resources/templates/dispute/save.html index 4d489f2..ed9e3ad 100644 --- a/src/main/resources/templates/dispute/save.html +++ b/src/main/resources/templates/dispute/save.html @@ -750,7 +750,7 @@ callback : { onClick : function (e, treeId, treeNode) { var count = treeNode.title.split('/').length -1; - if (count > 1) { + if (count > 0) { $('#' + name + "AreaName").val(treeNode.title); $('#' + name + "AreaCode").val(treeNode.areaCode); hideMenu(); diff --git a/src/main/resources/templates/dispute/update.html b/src/main/resources/templates/dispute/update.html index d914918..3cbc5b4 100644 --- a/src/main/resources/templates/dispute/update.html +++ b/src/main/resources/templates/dispute/update.html @@ -754,7 +754,7 @@ callback : { onClick : function (e, treeId, treeNode) { var count = treeNode.title.split('/').length -1; - if (count > 1) { + if (count > 0) { $('#' + name + "AreaName").val(treeNode.title); $('#' + name + "AreaCode").val(treeNode.areaCode); hideMenu(); diff --git a/src/main/resources/templates/populationinfo/save.html b/src/main/resources/templates/populationinfo/save.html index edb8ff9..64c6d58 100644 --- a/src/main/resources/templates/populationinfo/save.html +++ b/src/main/resources/templates/populationinfo/save.html @@ -345,7 +345,7 @@
-
+
@@ -362,7 +362,7 @@
-
+
@@ -933,7 +933,7 @@ callback : { onClick : function (e, treeId, treeNode) { var count = treeNode.title.split('/').length -1; - if (count > 1) { + if (count > 0) { $('#' + name + "AreaName").val(treeNode.title); $('#' + name + "AreaCode").val(treeNode.areaCode); hideMenu(); diff --git a/src/main/resources/templates/populationinfo/update.html b/src/main/resources/templates/populationinfo/update.html index 547500a..6f8f25f 100644 --- a/src/main/resources/templates/populationinfo/update.html +++ b/src/main/resources/templates/populationinfo/update.html @@ -344,7 +344,7 @@
-
+
@@ -361,7 +361,7 @@
-
+
@@ -877,7 +877,7 @@ callback : { onClick : function (e, treeId, treeNode) { var count = treeNode.title.split('/').length -1; - if (count > 1) { + if (count > 0) { $('#' + name + "AreaName").val(treeNode.title); $('#' + name + "AreaCode").val(treeNode.areaCode); hideMenu(); @@ -908,7 +908,7 @@ callback : { onClick : function (e, treeId, treeNode) { var count = treeNode.title.split('/').length -1; - if (count > 1) { + if (count > 0) { $('#' + name + "AreaName").val(treeNode.title); $('#' + name + "AreaCode").val(treeNode.areaCode); hideMenu(); diff --git a/src/main/resources/templates/security/save.html b/src/main/resources/templates/security/save.html index 5e64e69..3c2be45 100644 --- a/src/main/resources/templates/security/save.html +++ b/src/main/resources/templates/security/save.html @@ -243,7 +243,7 @@ callback : { onClick : function (e, treeId, treeNode) { var count = treeNode.title.split('/').length -1; - if (count > 1) { + if (count > 0) { $('#' + name + "AreaName").val(treeNode.title); $('#' + name + "AreaCode").val(treeNode.areaCode); hideMenu(); diff --git a/src/main/resources/templates/security/update.html b/src/main/resources/templates/security/update.html index 18a0170..775e6e2 100644 --- a/src/main/resources/templates/security/update.html +++ b/src/main/resources/templates/security/update.html @@ -245,7 +245,7 @@ callback : { onClick : function (e, treeId, treeNode) { var count = treeNode.title.split('/').length -1; - if (count > 1) { + if (count > 0) { $('#' + name + "AreaName").val(treeNode.title); $('#' + name + "AreaCode").val(treeNode.areaCode); hideMenu();