12345678910111213141516171819202122232425262728293031323334 |
- 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;
- });
- }
|