fix: tree i18n branch

This commit is contained in:
Methapon Metanipat 2024-09-11 11:13:12 +07:00
parent 0f30a88a24
commit 7765469853

View file

@ -191,13 +191,15 @@ const treeData = computed(() => {
const children: Branch[] = []; const children: Branch[] = [];
branchData.value?.result.forEach((v) => { branchData.value?.result.forEach((v) => {
if (v.isHeadOffice) map[v.id] = Object.assign(v, { branch: [] }); const name = locale.value === 'eng' ? v.nameEN : v.name;
else children.push(v); if (v.isHeadOffice) map[v.id] = { ...v, name, branch: [] };
else children.push({ ...v, name });
}); });
children.forEach((v) => { children.forEach((v) => {
const name = locale.value === 'eng' ? v.nameEN : v.name;
if (v.headOfficeId && map[v.headOfficeId]) { if (v.headOfficeId && map[v.headOfficeId]) {
map[v.headOfficeId].branch.push(v); map[v.headOfficeId].branch.push({ ...v, name });
} }
}); });