|
@@ -45,6 +45,10 @@ const AreaList = {
|
|
|
changeOnSelect:{
|
|
|
type: Boolean,
|
|
|
default: true
|
|
|
+ },
|
|
|
+ showLeve:{
|
|
|
+ type: String,
|
|
|
+ default: ''
|
|
|
}
|
|
|
},
|
|
|
data() {
|
|
@@ -73,17 +77,48 @@ const AreaList = {
|
|
|
getArea () {
|
|
|
subareaQueryAll().then(res => {
|
|
|
if (res.status == 200) {
|
|
|
- res.data&&res.data.map(item => {
|
|
|
- item.name = item.subareaName
|
|
|
- item.areaSn = item.subareaSn
|
|
|
- if(item.subareaAreaList){
|
|
|
- item.subareaAreaList.map(cd => {
|
|
|
- cd.name = cd.subareaAreaName
|
|
|
- cd.areaSn = cd.subareaAreaSn
|
|
|
- })
|
|
|
- }
|
|
|
- })
|
|
|
- this.list = res.data
|
|
|
+ // 显示一级二级
|
|
|
+ if(this.showLeve == ''){
|
|
|
+ res.data&&res.data.map(item => {
|
|
|
+ item.name = item.subareaName
|
|
|
+ item.areaSn = item.subareaSn
|
|
|
+ if(item.subareaAreaList){
|
|
|
+ item.subareaAreaList.map(cd => {
|
|
|
+ cd.name = cd.subareaAreaName
|
|
|
+ cd.areaSn = cd.subareaAreaSn
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
+ this.list = res.data
|
|
|
+ }
|
|
|
+
|
|
|
+ // 只显示一级
|
|
|
+ if(this.showLeve == 1){
|
|
|
+ const ret = []
|
|
|
+ res.data&&res.data.map(item => {
|
|
|
+ item.name = item.subareaName
|
|
|
+ item.areaSn = item.subareaSn
|
|
|
+ delete item.subareaAreaList
|
|
|
+ ret.push(item)
|
|
|
+ })
|
|
|
+ this.list = ret
|
|
|
+ }
|
|
|
+
|
|
|
+ // 只显示二级
|
|
|
+ if(this.showLeve == 2){
|
|
|
+ const ret = []
|
|
|
+ res.data&&res.data.map(item => {
|
|
|
+ if(item.subareaAreaList){
|
|
|
+ item.subareaAreaList.map(cd => {
|
|
|
+ cd.name = cd.subareaAreaName
|
|
|
+ cd.areaSn = cd.subareaAreaSn
|
|
|
+ ret.push(cd)
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
+ this.list = ret
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
})
|
|
|
},
|