|
@@ -16,12 +16,12 @@
|
|
|
checkable
|
|
checkable
|
|
|
:checked-keys="checkedKeys"
|
|
:checked-keys="checkedKeys"
|
|
|
:tree-data="treeData"
|
|
:tree-data="treeData"
|
|
|
- :selected-keys="selectedKeys"
|
|
|
|
|
- :expanded-keys="expandedKeysss"
|
|
|
|
|
:check-strictly="checkStrictly"
|
|
:check-strictly="checkStrictly"
|
|
|
|
|
+ :expanded-keys="iExpandedKeys"
|
|
|
|
|
+ :auto-expand-parent="autoExpandParent"
|
|
|
|
|
+ :replace-fields="{children:'children', title:'label', key:'id', value: 'id' }"
|
|
|
@check="onCheck"
|
|
@check="onCheck"
|
|
|
@expand="onExpand"
|
|
@expand="onExpand"
|
|
|
- @select="onTreeNodeSelect"
|
|
|
|
|
>
|
|
>
|
|
|
<span slot="hasDatarule" slot-scope="{slotTitle,ruleFlag}">
|
|
<span slot="hasDatarule" slot-scope="{slotTitle,ruleFlag}">
|
|
|
{{ slotTitle }}<a-icon v-if="ruleFlag" type="align-left" style="margin-left:5px;color: red;" />
|
|
{{ slotTitle }}<a-icon v-if="ruleFlag" type="align-left" style="margin-left:5px;color: red;" />
|
|
@@ -57,22 +57,18 @@ export default {
|
|
|
name: 'RoleModal',
|
|
name: 'RoleModal',
|
|
|
components: {
|
|
components: {
|
|
|
},
|
|
},
|
|
|
|
|
+ props: ['treeCheckList', 'treeList'],
|
|
|
data() {
|
|
data() {
|
|
|
return {
|
|
return {
|
|
|
- jobId: '',
|
|
|
|
|
title: '',
|
|
title: '',
|
|
|
- treeList: '',
|
|
|
|
|
- treeKey: '',
|
|
|
|
|
treeData: [],
|
|
treeData: [],
|
|
|
- defaultCheckedKeys: [],
|
|
|
|
|
|
|
+ iExpandedKeys: [],
|
|
|
|
|
+ autoExpandParent: true,
|
|
|
checkedKeys: [],
|
|
checkedKeys: [],
|
|
|
- expandedKeysss: [],
|
|
|
|
|
allTreeKeys: [],
|
|
allTreeKeys: [],
|
|
|
- autoExpandParent: true,
|
|
|
|
|
checkStrictly: true,
|
|
checkStrictly: true,
|
|
|
visible: false,
|
|
visible: false,
|
|
|
- loading: false,
|
|
|
|
|
- selectedKeys: []
|
|
|
|
|
|
|
+ loading: false
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
watch: {
|
|
watch: {
|
|
@@ -83,12 +79,6 @@ export default {
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
methods: {
|
|
methods: {
|
|
|
- onTreeNodeSelect(id) {
|
|
|
|
|
- if (id && id.length > 0) {
|
|
|
|
|
- this.selectedKeys = id
|
|
|
|
|
- }
|
|
|
|
|
- this.$refs.datarule.show(this.selectedKeys[0], this.jobId)
|
|
|
|
|
- },
|
|
|
|
|
onCheck(o) {
|
|
onCheck(o) {
|
|
|
if (this.checkStrictly) {
|
|
if (this.checkStrictly) {
|
|
|
this.checkedKeys = o.checked
|
|
this.checkedKeys = o.checked
|
|
@@ -96,8 +86,7 @@ export default {
|
|
|
this.checkedKeys = o
|
|
this.checkedKeys = o
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
- show(jobId) {
|
|
|
|
|
- this.jobId = jobId
|
|
|
|
|
|
|
+ show() {
|
|
|
this.visible = true
|
|
this.visible = true
|
|
|
},
|
|
},
|
|
|
close() {
|
|
close() {
|
|
@@ -105,35 +94,20 @@ export default {
|
|
|
this.$emit('close')
|
|
this.$emit('close')
|
|
|
this.visible = false
|
|
this.visible = false
|
|
|
},
|
|
},
|
|
|
- onExpand(expandedKeys) {
|
|
|
|
|
- this.expandedKeysss = expandedKeys
|
|
|
|
|
- this.autoExpandParent = false
|
|
|
|
|
- },
|
|
|
|
|
reset() {
|
|
reset() {
|
|
|
- this.expandedKeysss = []
|
|
|
|
|
this.checkedKeys = []
|
|
this.checkedKeys = []
|
|
|
- this.defaultCheckedKeys = []
|
|
|
|
|
this.loading = false
|
|
this.loading = false
|
|
|
},
|
|
},
|
|
|
expandAll() {
|
|
expandAll() {
|
|
|
- this.expandedKeysss = this.allTreeKeys
|
|
|
|
|
|
|
+ this.iExpandedKeys = this.allTreeKeys
|
|
|
},
|
|
},
|
|
|
closeAll() {
|
|
closeAll() {
|
|
|
- this.expandedKeysss = []
|
|
|
|
|
|
|
+ this.iExpandedKeys = []
|
|
|
},
|
|
},
|
|
|
- checkALL() {
|
|
|
|
|
- this.checkedKeys = this.allTreeKeys
|
|
|
|
|
- },
|
|
|
|
|
- cancelCheckALL() {
|
|
|
|
|
- // this.checkedKeys = this.defaultCheckedKeys
|
|
|
|
|
- this.checkedKeys = []
|
|
|
|
|
- },
|
|
|
|
|
- switchCheckStrictly(v) {
|
|
|
|
|
- if (v == 1) {
|
|
|
|
|
- this.checkStrictly = false
|
|
|
|
|
- } else if (v == 2) {
|
|
|
|
|
- this.checkStrictly = true
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ onExpand(expandedKeys) {
|
|
|
|
|
+ console.log('onExpand', expandedKeys)
|
|
|
|
|
+ this.iExpandedKeys = expandedKeys
|
|
|
|
|
+ this.autoExpandParent = false
|
|
|
},
|
|
},
|
|
|
handleCancel() {
|
|
handleCancel() {
|
|
|
this.close()
|
|
this.close()
|
|
@@ -141,21 +115,36 @@ export default {
|
|
|
handleSubmit(exit) {
|
|
handleSubmit(exit) {
|
|
|
const that = this
|
|
const that = this
|
|
|
const params = {
|
|
const params = {
|
|
|
- jobId: that.jobId,
|
|
|
|
|
permissionIds: that.checkedKeys.join(','),
|
|
permissionIds: that.checkedKeys.join(','),
|
|
|
- lastpermissionIds: that.defaultCheckedKeys.join(',')
|
|
|
|
|
}
|
|
}
|
|
|
console.log(params)
|
|
console.log(params)
|
|
|
},
|
|
},
|
|
|
|
|
+ setThisExpandedKeys(node) {
|
|
|
|
|
+ if (node.children && node.children.length > 0) {
|
|
|
|
|
+ this.iExpandedKeys.push(node.id)
|
|
|
|
|
+ for (let a = 0; a < node.children.length; a++) {
|
|
|
|
|
+ this.setThisExpandedKeys(node.children[a])
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ },
|
|
|
|
|
+ getAllKeys(node) {
|
|
|
|
|
+ this.allTreeKeys.push(node.id)
|
|
|
|
|
+ if (node.children && node.children.length > 0) {
|
|
|
|
|
+ for (let a = 0; a < node.children.length; a++) {
|
|
|
|
|
+ this.getAllKeys(node.children[a])
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ },
|
|
|
loadData() {
|
|
loadData() {
|
|
|
getAction(this.treeList).then((res) => {
|
|
getAction(this.treeList).then((res) => {
|
|
|
- this.treeData = res.result.treeList
|
|
|
|
|
- this.allTreeKeys = res.result.ids
|
|
|
|
|
- getAction({ jobId: this.jobId }).then((res) => {
|
|
|
|
|
- this.checkedKeys = [...res.result]
|
|
|
|
|
- this.defaultCheckedKeys = [...res.result]
|
|
|
|
|
- this.expandedKeysss = this.allTreeKeys
|
|
|
|
|
- console.log(this.defaultCheckedKeys)
|
|
|
|
|
|
|
+ this.allTreeKeys = []
|
|
|
|
|
+ for (let i = 0; i < res.data.length; i++) {
|
|
|
|
|
+ const temp = res.data[i]
|
|
|
|
|
+ this.treeData.push(temp)
|
|
|
|
|
+ this.setThisExpandedKeys(temp)
|
|
|
|
|
+ this.getAllKeys(temp)
|
|
|
|
|
+ }
|
|
|
|
|
+ getAction(this.treeCheckList).then((res) => {
|
|
|
})
|
|
})
|
|
|
})
|
|
})
|
|
|
}
|
|
}
|