function loadList() { this.listLoading = true; const params = { orgId: this.form.orgId, }; API_EMP.selectRegisterVirt(params) .then((res) => { if (res.data?.length) { const getRecord = (data, level) => { const children = data.childList || []; const current = { level, value: data.id, label: data.nameinfo, children, }; if (children?.length) { current.children = children.map((v) => getRecord(v, level + 1)); } return current; }; const dataSource = res.data.map((item) => getRecord(item, 0)); this.list = dataSource; } }) .finally(() => { this.listLoading = false; }); }