Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
T
traffic-front
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wangxiaoming
traffic-front
Commits
dae528a7
Commit
dae528a7
authored
May 07, 2019
by
weizhikai
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
机构地区三级联动选到区县
parent
7c182ce6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
81 additions
and
6 deletions
+81
-6
CommonConstants.java
...rc/main/java/pwc/taxtech/atms/common/CommonConstants.java
+2
-0
AreaRegionController.java
...ava/pwc/taxtech/atms/controller/AreaRegionController.java
+8
-0
AreaRegionServiceImpl.java
.../pwc/taxtech/atms/service/impl/AreaRegionServiceImpl.java
+8
-0
edit-organization-modal.ctrl.js
...s/edit-organization-modal/edit-organization-modal.ctrl.js
+44
-3
edit-organization-modal.html
...rols/edit-organization-modal/edit-organization-modal.html
+15
-3
areaRegion.svc.js
.../src/main/webapp/app/common/webservices/areaRegion.svc.js
+4
-0
No files found.
atms-api/src/main/java/pwc/taxtech/atms/common/CommonConstants.java
View file @
dae528a7
...
...
@@ -32,6 +32,8 @@ public class CommonConstants {
public
static
final
Integer
REGION_LEVELTYPE_CITY
=
2
;
public
static
final
Integer
REGION_LEVELTYPE_DISTRICT
=
3
;
public
static
final
Boolean
ACTIVE_STATUS
=
true
;
public
static
final
Boolean
DEACTIVE_STATUS
=
false
;
...
...
atms-api/src/main/java/pwc/taxtech/atms/controller/AreaRegionController.java
View file @
dae528a7
...
...
@@ -58,4 +58,12 @@ public class AreaRegionController {
logger
.
info
(
"/api/v1/areaRegion/getCities"
);
return
areaRegionService
.
getProvinces
();
}
// @ApiOperation(value = "Get Provinces")
@RequestMapping
(
value
=
"getDistricts"
,
method
=
RequestMethod
.
GET
)
public
@ResponseBody
List
<
AreaRegionDto
>
getDistricts
(
@RequestParam
(
name
=
"parentID"
)
String
parentId
)
{
logger
.
info
(
"/api/v1/areaRegion/getDistricts"
);
return
areaRegionService
.
getDistricts
(
parentId
);
}
}
atms-api/src/main/java/pwc/taxtech/atms/service/impl/AreaRegionServiceImpl.java
View file @
dae528a7
...
...
@@ -246,6 +246,14 @@ public class AreaRegionServiceImpl {
}
public
List
<
AreaRegionDto
>
getDistricts
(
String
parentId
)
{
List
<
AreaRegionDto
>
districts
=
getRegions
(
CommonConstants
.
REGION_LEVELTYPE_DISTRICT
);
List
<
AreaRegionDto
>
query
=
districts
.
stream
().
filter
(
s
->
s
.
getRegionParentId
().
equals
(
parentId
))
.
collect
(
Collectors
.
toList
());
return
query
;
}
private
List
<
AreaRegionDto
>
getRegions
(
int
levelType
)
{
RegionExample
regionExample
=
new
RegionExample
();
regionExample
.
createCriteria
().
andIsActiveEqualTo
(
CommonConstants
.
ACTIVE_STATUS
).
andLevelTypeEqualTo
(
levelType
);
...
...
atms-web/src/main/webapp/app/common/controls/edit-organization-modal/edit-organization-modal.ctrl.js
View file @
dae528a7
...
...
@@ -612,6 +612,7 @@ controller('editOrganizationModalController', ['$scope', '$log', '$translate', '
$scope
.
CityList
=
defaultData
;
$scope
.
ProvinceList
=
defaultData
;
$scope
.
selectProvince
=
defaultData
;
$scope
.
selectCity
=
defaultData
;
$scope
.
selectRegionID
=
defaultData
;
};
...
...
@@ -694,9 +695,43 @@ controller('editOrganizationModalController', ['$scope', '$log', '$translate', '
areaRegionService
.
getCities
(
regionID
).
success
(
function
(
data
)
{
if
(
data
&&
data
.
length
>
0
)
{
$scope
.
CityList
=
data
;
$scope
.
selectCity
=
_
.
find
(
$scope
.
CityList
,
function
(
num
)
{
return
num
.
regionID
===
$scope
.
selectProvince
.
regionID
||
num
.
regionID
===
$scope
.
editOrgModel
.
parentRegionID
;
});
if
(
$scope
.
selectCity
)
{
$scope
.
selectCityID
=
$scope
.
selectCity
.
regionID
;
$scope
.
selectProvince
=
_
.
find
(
$scope
.
ProvinceList
,
function
(
num
)
{
return
num
.
regionID
===
$scope
.
selectCity
.
parentRegionID
;
});
loadDistrictList
(
$scope
.
selectCity
.
regionID
);
}
else
{
$scope
.
selectCityID
=
data
[
0
].
regionID
;
}
}
else
{
data
=
null
;
$scope
.
CityList
=
data
;
$scope
.
selectCity
=
data
;
}
var
target
=
_
.
find
(
$scope
.
CityList
,
function
(
num
)
{
return
num
.
regionID
===
$scope
.
editOrgModel
.
regionID
;
});
}
};
// 加载区县信息
var
loadDistrictList
=
function
(
regionID
)
{
if
(
regionID
!==
undefined
&&
regionID
!==
null
)
{
areaRegionService
.
getDistricts
(
regionID
).
success
(
function
(
data
)
{
if
(
data
&&
data
.
length
>
0
)
{
$scope
.
DistrictList
=
data
;
var
target
=
_
.
find
(
$scope
.
DistrictList
,
function
(
num
)
{
return
num
.
regionID
===
$scope
.
selectCity
;
});
if
(
target
)
{
...
...
@@ -707,7 +742,7 @@ controller('editOrganizationModalController', ['$scope', '$log', '$translate', '
}
else
{
data
=
null
;
$scope
.
City
List
=
data
;
$scope
.
District
List
=
data
;
$scope
.
selectRegionID
=
null
;
}
});
...
...
@@ -1184,6 +1219,12 @@ controller('editOrganizationModalController', ['$scope', '$log', '$translate', '
loadCityList
(
regionID
);
};
// 市改变时联动区
$scope
.
populateDistricts
=
function
()
{
var
regionID
=
$scope
.
selectCity
&&
$scope
.
selectCity
.
regionID
;
loadDistrictList
(
regionID
);
};
// 验证是否为时间段
var
validateDate
=
function
(
from
,
to
)
{
var
fromDate
=
new
Date
(
from
+
'-01'
);
...
...
atms-web/src/main/webapp/app/common/controls/edit-organization-modal/edit-organization-modal.html
View file @
dae528a7
...
...
@@ -452,15 +452,27 @@
<div
class=
"col-sm-5"
style=
"padding-left: 10px;"
ng-class=
"{'has-error':orgControlForm.selectCity.$invalid && (orgControlForm.selectCity.$dirty || orgControlForm.$submitted)}"
>
<select
class=
"form-control localRequired"
name=
"selectCity"
id=
"selectCity"
style=
"width: 119px; "
style=
"width: 120px; "
ng-change=
"populateDistricts()"
ng-model=
"selectCity"
ng-options=
"x.regionName for x in CityList"
>
<option
value=
""
>
{{pleaseSelect}}
</option>
</select>
<p
ng-show=
"orgControlForm.selectCity.$error.required && (orgControlForm.selectCity.$dirty || orgControlForm.$submitted)"
class=
"has-error label"
style=
"margin-left: 30px"
>
{{resources.OrganizationMsgCityRequired}}
</p>
</div>
<div
class=
"col-sm-5"
style=
"padding-left: 10px;"
ng-class=
"{'has-error':orgControlForm.selectDistrict.$invalid && (orgControlForm.selectDistrict.$dirty || orgControlForm.$submitted)}"
>
<select
class=
"form-control localRequired"
name=
"selectDistrict"
id=
"selectDistrict"
style=
"width: 119px; "
ng-model=
"selectRegionID"
>
<option
value=
""
>
{{pleaseSelect}}
</option>
<option
ng-repeat=
"x in
City
List"
value=
"{{x.regionID}}"
<option
ng-repeat=
"x in
District
List"
value=
"{{x.regionID}}"
title=
"{{x.regionName}}"
>
{{x.regionName |
limitString:10}}
</option>
</select>
<p
ng-show=
"orgControlForm.select
City.$error.required && (orgControlForm.selectCity
.$dirty || orgControlForm.$submitted)"
<p
ng-show=
"orgControlForm.select
District.$error.required && (orgControlForm.selectDistrict
.$dirty || orgControlForm.$submitted)"
class=
"has-error label"
style=
"margin-left: 30px"
>
{{resources.OrganizationMsgCityRequired}}
</p>
</div>
...
...
atms-web/src/main/webapp/app/common/webservices/areaRegion.svc.js
View file @
dae528a7
...
...
@@ -15,6 +15,10 @@ function ($http, apiConfig, httpCacheService) {
//return $http.get('/areaRegion/getCities?parentID=' + parentID, apiConfig.create());
return
httpCacheService
.
get
(
'/areaRegion/getCities?parentID='
+
parentID
);
},
getDistricts
:
function
(
parentID
)
{
//return $http.get('/areaRegion/getCities?parentID=' + parentID, apiConfig.create());
return
httpCacheService
.
get
(
'/areaRegion/getDistricts?parentID='
+
parentID
);
},
update
:
function
(
model
)
{
return
$http
.
post
(
'/areaRegion/update'
,
model
,
apiConfig
.
create
());
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment