| | |
| | | searchValue: '', |
| | | expandedKeys: [], |
| | | autoExpandParent: true, |
| | | dataSource: transferDataSource |
| | | dataSource: [] |
| | | } |
| | | }, |
| | | watch: { |
| | |
| | | getHasPermissionDepartByApi() { |
| | | const that = this |
| | | that.spinning = true |
| | | dncApi.getHasPermissionDepartApi(this.currentTreeNodeInfo) |
| | | that.targetKeys = [] |
| | | that.dataSource = [] |
| | | dncApi.getHasPermissionDepartApi(that.currentTreeNodeInfo) |
| | | .then(res => { |
| | | if (res.success) this.targetKeys = res.list.map(item => item.id) |
| | | if (res.success) that.targetKeys = res.list.map(item => item.id) |
| | | }) |
| | | .finally(() => { |
| | | that.spinning = false |
| | |
| | | handleSearch(direction, value) { |
| | | if (direction === 'left') { |
| | | let search = value |
| | | let expandedKeys = transferDataSource |
| | | let expandedKeys = this.dataSource |
| | | .map(item => { |
| | | if (item.title != null) { |
| | | if (item.title.indexOf(search) > -1) { |
| | |
| | | |
| | | flatten(list = []) { |
| | | list.forEach(item => { |
| | | transferDataSource.push(item) |
| | | if (item.children) { |
| | | this.flatten(item.children) |
| | | const transformedItem = { |
| | | key: item.key, |
| | | title: item.title, |
| | | children: item.children |
| | | } |
| | | this.dataSource.push(transformedItem) |
| | | if (transformedItem.children) { |
| | | this.flatten(transformedItem.children) |
| | | } |
| | | }) |
| | | } |