|
@@ -19,7 +19,9 @@
|
|
:auto-expand-parent="autoExpandParent"
|
|
:auto-expand-parent="autoExpandParent"
|
|
:tree-data="subregionData"
|
|
:tree-data="subregionData"
|
|
:checkStrictly="true"
|
|
:checkStrictly="true"
|
|
|
|
+ :expanded-keys="parentArr"
|
|
@check="onCheck"
|
|
@check="onCheck"
|
|
|
|
+ @expand="onExpand"
|
|
:replaceFields="{children:'subareaAreaList', title:'name', key:'areaSn'}"
|
|
:replaceFields="{children:'subareaAreaList', title:'name', key:'areaSn'}"
|
|
/>
|
|
/>
|
|
</div>
|
|
</div>
|
|
@@ -63,7 +65,7 @@ export default {
|
|
},
|
|
},
|
|
data () {
|
|
data () {
|
|
return {
|
|
return {
|
|
- autoExpandParent: false,
|
|
|
|
|
|
+ autoExpandParent: true,
|
|
checkAll: false, // 全选
|
|
checkAll: false, // 全选
|
|
checkedKeys: {
|
|
checkedKeys: {
|
|
checked: [], halfChecked: []
|
|
checked: [], halfChecked: []
|
|
@@ -71,10 +73,17 @@ export default {
|
|
subregionData: null,
|
|
subregionData: null,
|
|
tableHeight: 0,
|
|
tableHeight: 0,
|
|
visible: false,
|
|
visible: false,
|
|
- disabled: false
|
|
|
|
|
|
+ disabled: false,
|
|
|
|
+ parentArr: []
|
|
}
|
|
}
|
|
},
|
|
},
|
|
methods: {
|
|
methods: {
|
|
|
|
+ // 树 默认展开被选子级的父级
|
|
|
|
+ onExpand (expandedKeys) {
|
|
|
|
+ console.log('onExpand', expandedKeys)
|
|
|
|
+ this.parentArr = expandedKeys
|
|
|
|
+ this.autoExpandParent = false
|
|
|
|
+ },
|
|
getArea () {
|
|
getArea () {
|
|
subareaQueryAll().then(res => {
|
|
subareaQueryAll().then(res => {
|
|
if (res.status == 200) {
|
|
if (res.status == 200) {
|
|
@@ -85,46 +94,19 @@ export default {
|
|
item.subareaAreaList.map(cd => {
|
|
item.subareaAreaList.map(cd => {
|
|
cd.name = cd.subareaAreaName
|
|
cd.name = cd.subareaAreaName
|
|
cd.areaSn = cd.subareaAreaSn + '_'
|
|
cd.areaSn = cd.subareaAreaSn + '_'
|
|
|
|
+ const falg = this.chooseData.checked.length > 0 ? this.chooseData.checked.includes(cd.subareaAreaSn + '_') : false
|
|
|
|
+ if (falg) {
|
|
|
|
+ this.parentArr.push(cd.subareaSn)
|
|
|
|
+ }
|
|
})
|
|
})
|
|
}
|
|
}
|
|
})
|
|
})
|
|
this.subregionData = res.data
|
|
this.subregionData = res.data
|
|
- // if (this.chooseData && this.chooseData.checked && this.chooseData.checked.length > 0) {
|
|
|
|
- // this.handleChooseData(res.data)
|
|
|
|
- // } else {
|
|
|
|
- // this.subregionData = res.data
|
|
|
|
- // }
|
|
|
|
this.checkedKeys = this.chooseData ? this.chooseData : []
|
|
this.checkedKeys = this.chooseData ? this.chooseData : []
|
|
}
|
|
}
|
|
})
|
|
})
|
|
},
|
|
},
|
|
- // 将选择过的禁用掉
|
|
|
|
- // handleChooseData (subregionData) {
|
|
|
|
- // var area = [] // 区域
|
|
|
|
- // var zone = []// 分区
|
|
|
|
- // this.chooseData.checked.forEach(con => {
|
|
|
|
- // if (con.indexOf('_') == -1) {
|
|
|
|
- // area.push(con)
|
|
|
|
- // } else {
|
|
|
|
- // zone.push(con)
|
|
|
|
- // }
|
|
|
|
- // })
|
|
|
|
- // if (subregionData && subregionData.length > 0) {
|
|
|
|
- // subregionData.forEach(item => {
|
|
|
|
- // if (area && area.length > 0) {
|
|
|
|
- // item.disabled = area.includes(item.areaSn)
|
|
|
|
- // item.disableCheckbox = area.includes(item.areaSn)
|
|
|
|
- // }
|
|
|
|
- // if (item.subareaAreaList && item.subareaAreaList.length > 0) {
|
|
|
|
- // item.subareaAreaList.forEach(con => {
|
|
|
|
- // con.disabled = zone.includes(con.areaSn)
|
|
|
|
- // con.disableCheckbox = zone.includes(con.areaSn)
|
|
|
|
- // })
|
|
|
|
- // }
|
|
|
|
- // })
|
|
|
|
- // }
|
|
|
|
- // this.subregionData = subregionData
|
|
|
|
- // },
|
|
|
|
|
|
+
|
|
save () {
|
|
save () {
|
|
this.$emit('ok', this.checkedKeys)
|
|
this.$emit('ok', this.checkedKeys)
|
|
},
|
|
},
|