|
|
@ -37,6 +37,16 @@ const { isViewDataLoading, isPaginationLoading } = storeToRefs(useViewsStore()) |
|
|
|
|
|
|
|
|
|
|
|
const reloadViewDataHook = inject(ReloadViewDataHookInj, createEventHook()) |
|
|
|
const reloadViewDataHook = inject(ReloadViewDataHookInj, createEventHook()) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const _loadGroupData = async (group: Group, force?: boolean, params?: any) => { |
|
|
|
|
|
|
|
isViewDataLoading.value = true |
|
|
|
|
|
|
|
isPaginationLoading.value = true |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await props.loadGroupData(group, force, params) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
isViewDataLoading.value = false |
|
|
|
|
|
|
|
isPaginationLoading.value = false |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
const _depth = props.depth ?? 0 |
|
|
|
const _depth = props.depth ?? 0 |
|
|
|
|
|
|
|
|
|
|
|
const wrapper = ref<HTMLElement | undefined>() |
|
|
|
const wrapper = ref<HTMLElement | undefined>() |
|
|
@ -67,12 +77,12 @@ const findAndLoadSubGroup = (key: any) => { |
|
|
|
if (key.length > 0 && vGroup.value.children) { |
|
|
|
if (key.length > 0 && vGroup.value.children) { |
|
|
|
if (!oldActiveGroups.value.includes(key[key.length - 1])) { |
|
|
|
if (!oldActiveGroups.value.includes(key[key.length - 1])) { |
|
|
|
const k = key[key.length - 1].replace('group-panel-', '') |
|
|
|
const k = key[key.length - 1].replace('group-panel-', '') |
|
|
|
const grp = vGroup.value.children[k] |
|
|
|
const grp = vGroup.value.children.find((g) => `${g.key}` === k) |
|
|
|
if (grp) { |
|
|
|
if (grp) { |
|
|
|
if (grp.nested) { |
|
|
|
if (grp.nested) { |
|
|
|
if (!grp.children?.length) props.loadGroups({}, grp) |
|
|
|
if (!grp.children?.length) props.loadGroups({}, grp) |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
if (!grp.rows?.length || grp.count !== grp.rows?.length) props.loadGroupData(grp) |
|
|
|
if (!grp.rows?.length || grp.count !== grp.rows?.length) _loadGroupData(grp) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -84,37 +94,35 @@ const reloadViewDataHandler = (params: void | { shouldShowLoading?: boolean | un |
|
|
|
if (vGroup.value.nested) { |
|
|
|
if (vGroup.value.nested) { |
|
|
|
props.loadGroups({ ...(params?.offset !== undefined ? { offset: params.offset } : {}) }, vGroup.value) |
|
|
|
props.loadGroups({ ...(params?.offset !== undefined ? { offset: params.offset } : {}) }, vGroup.value) |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
props.loadGroupData(vGroup.value, true, { |
|
|
|
_loadGroupData(vGroup.value, true, { |
|
|
|
...(params?.offset !== undefined ? { offset: params.offset } : {}), |
|
|
|
...(params?.offset !== undefined ? { offset: params.offset } : {}), |
|
|
|
}) |
|
|
|
}) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
onMounted(async () => { |
|
|
|
|
|
|
|
reloadViewDataHook?.on(reloadViewDataHandler) |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
onBeforeUnmount(async () => { |
|
|
|
onBeforeUnmount(async () => { |
|
|
|
reloadViewDataHook?.off(reloadViewDataHandler) |
|
|
|
reloadViewDataHook?.off(reloadViewDataHandler) |
|
|
|
}) |
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
reloadViewDataHook?.on(reloadViewDataHandler) |
|
|
|
watch([() => vGroup.value.key], async (n, o) => { |
|
|
|
|
|
|
|
if (n !== o) { |
|
|
|
watch( |
|
|
|
if (!vGroup.value.nested) { |
|
|
|
[() => vGroup.value.key], |
|
|
|
await _loadGroupData(vGroup.value, true) |
|
|
|
async (n, o) => { |
|
|
|
} else if (vGroup.value.nested) { |
|
|
|
if (n !== o) { |
|
|
|
await props.loadGroups({}, vGroup.value) |
|
|
|
isViewDataLoading.value = true |
|
|
|
|
|
|
|
isPaginationLoading.value = true |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (vGroup.value.nested) { |
|
|
|
|
|
|
|
await props.loadGroups({}, vGroup.value) |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
await props.loadGroupData(vGroup.value, true) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
isViewDataLoading.value = false |
|
|
|
|
|
|
|
isPaginationLoading.value = false |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
} |
|
|
|
{ immediate: true }, |
|
|
|
}) |
|
|
|
) |
|
|
|
|
|
|
|
|
|
|
|
onMounted(async () => { |
|
|
|
|
|
|
|
if (vGroup.value.root === true) { |
|
|
|
|
|
|
|
await props.loadGroups({}, vGroup.value) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
if (vGroup.value.root === true) provide(ScrollParentInj, wrapper) |
|
|
|
if (vGroup.value.root === true) provide(ScrollParentInj, wrapper) |
|
|
|
|
|
|
|
|
|
|
@ -231,7 +239,7 @@ const shouldRenderCell = (column) => |
|
|
|
> |
|
|
|
> |
|
|
|
<a-collapse-panel |
|
|
|
<a-collapse-panel |
|
|
|
v-for="[i, grp] of Object.entries(vGroup?.children ?? [])" |
|
|
|
v-for="[i, grp] of Object.entries(vGroup?.children ?? [])" |
|
|
|
:key="`group-panel-${i}`" |
|
|
|
:key="`group-panel-${grp.key}`" |
|
|
|
class="!border-1 nc-group rounded-[12px]" |
|
|
|
class="!border-1 nc-group rounded-[12px]" |
|
|
|
:class="{ 'mb-4': vGroup.children && +i !== vGroup.children.length - 1 }" |
|
|
|
:class="{ 'mb-4': vGroup.children && +i !== vGroup.children.length - 1 }" |
|
|
|
:style="`background: rgb(${245 - _depth * 10}, ${245 - _depth * 10}, ${245 - _depth * 10})`" |
|
|
|
:style="`background: rgb(${245 - _depth * 10}, ${245 - _depth * 10}, ${245 - _depth * 10})`" |
|
|
@ -243,7 +251,7 @@ const shouldRenderCell = (column) => |
|
|
|
<span role="img" aria-label="right" class="anticon anticon-right ant-collapse-arrow"> |
|
|
|
<span role="img" aria-label="right" class="anticon anticon-right ant-collapse-arrow"> |
|
|
|
<GeneralIcon |
|
|
|
<GeneralIcon |
|
|
|
icon="chevronDown" |
|
|
|
icon="chevronDown" |
|
|
|
:style="`${activeGroups.includes(i) ? 'transform: rotate(360deg)' : 'transform: rotate(270deg)'}`" |
|
|
|
:style="`${activeGroups.includes(grp.key) ? 'transform: rotate(360deg)' : 'transform: rotate(270deg)'}`" |
|
|
|
></GeneralIcon> |
|
|
|
></GeneralIcon> |
|
|
|
</span> |
|
|
|
</span> |
|
|
|
</div> |
|
|
|
</div> |
|
|
@ -328,7 +336,7 @@ const shouldRenderCell = (column) => |
|
|
|
v-if="!grp.nested && grp.rows" |
|
|
|
v-if="!grp.nested && grp.rows" |
|
|
|
:group="grp" |
|
|
|
:group="grp" |
|
|
|
:load-groups="loadGroups" |
|
|
|
:load-groups="loadGroups" |
|
|
|
:load-group-data="loadGroupData" |
|
|
|
:load-group-data="_loadGroupData" |
|
|
|
:load-group-page="loadGroupPage" |
|
|
|
:load-group-page="loadGroupPage" |
|
|
|
:group-wrapper-change-page="groupWrapperChangePage" |
|
|
|
:group-wrapper-change-page="groupWrapperChangePage" |
|
|
|
:row-height="rowHeight" |
|
|
|
:row-height="rowHeight" |
|
|
@ -345,7 +353,7 @@ const shouldRenderCell = (column) => |
|
|
|
v-else |
|
|
|
v-else |
|
|
|
:group="grp" |
|
|
|
:group="grp" |
|
|
|
:load-groups="loadGroups" |
|
|
|
:load-groups="loadGroups" |
|
|
|
:load-group-data="loadGroupData" |
|
|
|
:load-group-data="_loadGroupData" |
|
|
|
:load-group-page="loadGroupPage" |
|
|
|
:load-group-page="loadGroupPage" |
|
|
|
:group-wrapper-change-page="groupWrapperChangePage" |
|
|
|
:group-wrapper-change-page="groupWrapperChangePage" |
|
|
|
:row-height="rowHeight" |
|
|
|
:row-height="rowHeight" |
|
|
|