|
|
@ -35,7 +35,7 @@ |
|
|
|
defineOptions({ |
|
|
|
name: 'NsTreeApi', |
|
|
|
}); |
|
|
|
const emit = defineEmits(['update:treeData', 'select']); |
|
|
|
const emit = defineEmits(['update:treeData', 'select', 'reload']); |
|
|
|
// const model = defineModel('treeData'); |
|
|
|
|
|
|
|
const formElRef = ref(); |
|
|
@ -73,6 +73,15 @@ |
|
|
|
const formFinish = debounce((data: object) => { |
|
|
|
// selectedKeys.value = []; |
|
|
|
getData(data); |
|
|
|
// formConfig.value.schemas.forEach((item: any) => { |
|
|
|
// if (item.callList) { |
|
|
|
// emit('reload'); |
|
|
|
// } |
|
|
|
// }); |
|
|
|
//只刷新列表 |
|
|
|
if (formConfig.value.callList && !formConfig.value.defaultSelection) { |
|
|
|
emit('reload'); |
|
|
|
} |
|
|
|
}, 200); |
|
|
|
|
|
|
|
const handleSelect = (keys: any, selectedRows: any) => { |
|
|
@ -109,6 +118,20 @@ |
|
|
|
}) |
|
|
|
.then((res) => { |
|
|
|
treeData.value = transform(get(res, resultField)); |
|
|
|
//默认选择第一个 并刷新列表 |
|
|
|
selectedKeys.value = []; |
|
|
|
if (formConfig.value.callList && formConfig.value.defaultSelection) { |
|
|
|
handleSelect([treeData.value[0].id], { |
|
|
|
selected: true, |
|
|
|
event: 'select', |
|
|
|
selectedNodes: treeData.value, |
|
|
|
node: { |
|
|
|
...treeData.value[0], |
|
|
|
dataRef: { ...treeData.value[0] }, |
|
|
|
}, |
|
|
|
}); |
|
|
|
// 默认选择第一个 |
|
|
|
} |
|
|
|
emit('update:treeData', treeData.value); |
|
|
|
// model.value = treeData.value; |
|
|
|
}) |
|
|
|