|
@@ -5,6 +5,7 @@
|
|
|
checkable
|
|
|
@check="onCheck"
|
|
|
@expand="onExpand"
|
|
|
+ :expandedKeys="expandedKeys"
|
|
|
:autoExpandParent="autoExpandParent"
|
|
|
v-model="checkedKeys"
|
|
|
:treeData="treeData"
|
|
@@ -50,14 +51,9 @@ export default {
|
|
|
this.menuIds = dr.mould.menuIds
|
|
|
if (this.menuIds) {
|
|
|
const arr = this.menuIds.split(',')
|
|
|
- const temp = []
|
|
|
- arr.map(item => {
|
|
|
- temp.push(Number(item))
|
|
|
- })
|
|
|
- this.checkedData = temp
|
|
|
- this.expandedKeys = temp
|
|
|
+ this.checkedData = arr
|
|
|
// 找出叶子节点
|
|
|
- this.findLeaf(this.treeData, temp)
|
|
|
+ this.findLeaf(this.treeData, arr)
|
|
|
}
|
|
|
},
|
|
|
// 获取连锁树数据
|
|
@@ -79,7 +75,6 @@ export default {
|
|
|
})
|
|
|
},
|
|
|
onExpand (expandedKeys) {
|
|
|
- console.log('onExpand', expandedKeys)
|
|
|
this.expandedKeys = expandedKeys
|
|
|
this.autoExpandParent = false
|
|
|
},
|
|
@@ -87,7 +82,7 @@ export default {
|
|
|
this.checkedData = [...checkedKeys, ...info.halfCheckedKeys]
|
|
|
this.checkedKeys = checkedKeys
|
|
|
},
|
|
|
- // 勾选已选的菜单
|
|
|
+ // 查找叶子节点
|
|
|
findLeaf (data, arr) {
|
|
|
for (let i = 0; i < data.length; i++) {
|
|
|
const node = data[i]
|
|
@@ -98,6 +93,7 @@ export default {
|
|
|
return item == node.id
|
|
|
})
|
|
|
if (hasNode) {
|
|
|
+ this.expandedKeys.push(node.id)
|
|
|
this.checkedKeys.push(node.id)
|
|
|
}
|
|
|
}
|
|
@@ -105,10 +101,8 @@ export default {
|
|
|
},
|
|
|
// 保存提交
|
|
|
handleSubmit () {
|
|
|
- const _this = this
|
|
|
this.form.validateFields((err, values) => {
|
|
|
if (!err) {
|
|
|
- // console.log(this.checkedData)
|
|
|
if (this.checkedData.length == 0) {
|
|
|
return this.$message.warning('请先选择菜单')
|
|
|
}
|