This commit is contained in:
Yuanjianghong 2021-08-28 17:43:09 +08:00
parent 46ca4f3b72
commit c0056a2764
1 changed files with 45 additions and 35 deletions

View File

@ -1,7 +1,8 @@
<template>
<page-header-wrapper title="请选择单位">
<page-header-wrapper title="请选择受训单位">
<!-- showSearch -->
<!-- height: '500px',overflowY: 'auto' -->
<a-form-model :model="form">
<a-transfer
class="tree-transfer"
:data-source="dataSource"
@ -35,6 +36,11 @@
/>
</template>
</a-transfer>
<a-form-model-item :wrapper-col="{ span: 14, offset: 4 }">
<a-button type="primary" @click="toNext"> 下一步 </a-button>
<a-button style="margin-left: 10px"> 取消 </a-button>
</a-form-model-item>
</a-form-model>
</page-header-wrapper>
</template>
@ -76,6 +82,7 @@ const treeData = [
const transferDataSource = []
function flatten(list = []) {
console.log('执行了flatten函数list', list)
list.forEach((item) => {
transferDataSource.push(item)
flatten(item.children)
@ -84,11 +91,12 @@ function flatten(list = []) {
flatten(JSON.parse(JSON.stringify(treeData)))
function isChecked(selectedKeys, eventKey) {
console.log('执行了isChecked函数', eventKey, selectedKeys)
return selectedKeys.indexOf(eventKey) !== -1
}
function handleTreeData(data, targetKeys = []) {
console.log("执行了handleTreeData函数",data,targetKeys)
console.log('执行了handleTreeData函数', data, targetKeys)
data.forEach((item) => {
item['disabled'] = targetKeys.includes(item.key)
if (item.children) {
@ -101,6 +109,7 @@ function handleTreeData(data, targetKeys = []) {
export default {
data() {
return {
form: {},
targetKeys: [],
dataSource: transferDataSource,
@ -123,6 +132,7 @@ export default {
onChange(targetKeys) {
console.log('Target Keys:', targetKeys)
this.targetKeys = targetKeys
// this.form = targetKeys
},
onChecked(_, e, checkedKeys, itemSelect) {
const { eventKey } = e.node