|
@@ -13,9 +13,19 @@
|
|
|
<template>
|
|
|
<div>
|
|
|
<a-modal title="账户选择" v-model="showEdit" @ok="handleOk" @cancel="close" width="80%">
|
|
|
- <a-checkbox :indeterminate="indeterminate" @change="onCheckAllChange" :checked="checkAll">全选</a-checkbox>
|
|
|
+ <!-- <a-checkbox :indeterminate="indeterminate" @change="onCheckAllChange" :checked="checkAll">全选</a-checkbox>
|
|
|
<br />
|
|
|
- <a-checkbox-group :options="showList" v-model="dataValue" class="checked-account" @change="onChange"/>
|
|
|
+ <a-checkbox-group :options="showList" v-model="dataValue" class="checked-account" @change="onChange" /> -->
|
|
|
+ <a-tree
|
|
|
+ v-model="checkedKeys"
|
|
|
+ checkable
|
|
|
+ :expanded-keys="expandedKeys"
|
|
|
+ :auto-expand-parent="autoExpandParent"
|
|
|
+ :selected-keys="selectedKeys"
|
|
|
+ :tree-data="treeData"
|
|
|
+ @expand="onExpand"
|
|
|
+ @select="onSelect"
|
|
|
+ />
|
|
|
</a-modal>
|
|
|
</div>
|
|
|
</template>
|
|
@@ -30,19 +40,44 @@ export default {
|
|
|
|
|
|
data: function () {
|
|
|
return {
|
|
|
+ checkedKeys: [],
|
|
|
showEdit: false,
|
|
|
dataList: [],
|
|
|
showList: null,
|
|
|
dataValue: [],
|
|
|
indeterminate: false,
|
|
|
checkAll: false,
|
|
|
+ expandedKeys: [],
|
|
|
+ autoExpandParent: true,
|
|
|
+ selectedKeys: [],
|
|
|
+ treeData:[],
|
|
|
}
|
|
|
},
|
|
|
+ watch: {
|
|
|
+ checkedKeys(val) {
|
|
|
+ console.log('onCheck', val)
|
|
|
+ },
|
|
|
+ },
|
|
|
methods: {
|
|
|
+ onExpand(expandedKeys) {
|
|
|
+ console.log('onExpand', expandedKeys)
|
|
|
+ // if not set autoExpandParent to false, if children expanded, parent can not collapse.
|
|
|
+ // or, you can remove all expanded children keys.
|
|
|
+ this.expandedKeys = expandedKeys
|
|
|
+ this.autoExpandParent = false
|
|
|
+ },
|
|
|
+ onCheck(checkedKeys) {
|
|
|
+ console.log('onCheck', checkedKeys)
|
|
|
+ this.checkedKeys = checkedKeys
|
|
|
+ },
|
|
|
+ onSelect(selectedKeys, info) {
|
|
|
+ console.log('onSelect', info)
|
|
|
+ this.selectedKeys = selectedKeys
|
|
|
+ },
|
|
|
handleOk(e) {
|
|
|
console.log(e)
|
|
|
this.showEdit = false
|
|
|
- this.$emit('synchro', this.dataValue)
|
|
|
+ this.$emit('synchro', this.checkedKeys)
|
|
|
},
|
|
|
close() {
|
|
|
this.showEdit = false
|
|
@@ -72,17 +107,26 @@ export default {
|
|
|
this.dataList = []
|
|
|
this.showList = null
|
|
|
this.dataValue = []
|
|
|
+ this.checkedKeys = []
|
|
|
this.indeterminate = false
|
|
|
this.checkAll = false
|
|
|
console.log(url, item)
|
|
|
getAction(url, item).then((res) => {
|
|
|
if (res.success) {
|
|
|
- this.showList = res.result.records.map((item) => {
|
|
|
+ let arrList = []
|
|
|
+ this.treeData = res.result.map(item=>{
|
|
|
return {
|
|
|
- label: item.authName,
|
|
|
- value: item.accountId,
|
|
|
+ title: item.projectName,
|
|
|
+ key: item.projectId,
|
|
|
+ children:item.userAllocationList.map(i=>{
|
|
|
+ return {
|
|
|
+ title: i.authName+'\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0'+(item.userName?item.userName:'管理员'),
|
|
|
+ key: i.accountId
|
|
|
+ }
|
|
|
+ })
|
|
|
}
|
|
|
})
|
|
|
+
|
|
|
}
|
|
|
console.log(res)
|
|
|
})
|