refactor: 02 => screen.xs fetch scroll
This commit is contained in:
parent
17b527c078
commit
07f0c0d47b
2 changed files with 12 additions and 28 deletions
|
|
@ -435,7 +435,7 @@ async function onSubmit(excludeDialog?: boolean) {
|
|||
}
|
||||
}
|
||||
|
||||
$q.screen.xs ? await fetchUserEditXs() : await fetchUserList();
|
||||
await fetchUserList($q.screen.xs);
|
||||
typeStats.value = await userStore.typeStats();
|
||||
const res = await branchStore.userStats(formData.value.userType);
|
||||
if (res) {
|
||||
|
|
@ -471,7 +471,7 @@ async function onSubmit(excludeDialog?: boolean) {
|
|||
currentTab.value === formData.value.userType &&
|
||||
currentTab.value !== 'ALL'
|
||||
) {
|
||||
$q.screen.gt.xs ? await fetchUserEditXs() : await fetchUserList();
|
||||
await fetchUserList($q.screen.xs);
|
||||
}
|
||||
|
||||
currentTab.value = formData.value.userType;
|
||||
|
|
@ -497,7 +497,7 @@ async function onDelete(id: string) {
|
|||
action: async () => {
|
||||
await userStore.deleteById(id);
|
||||
|
||||
await fetchUserList();
|
||||
await fetchUserList($q.screen.xs);
|
||||
typeStats.value = await userStore.typeStats();
|
||||
infoDrawer.value = false;
|
||||
flowStore.rotate();
|
||||
|
|
@ -644,11 +644,15 @@ async function fetchImageList(id: string, selectedName?: string) {
|
|||
return res;
|
||||
}
|
||||
|
||||
async function fetchUserList() {
|
||||
async function fetchUserList(mobileFetch?: boolean) {
|
||||
const userLength = userData.value?.result.length || 0;
|
||||
const total = typeStats.value?.[currentTab.value] ?? 0;
|
||||
const ret = await userStore.fetchList({
|
||||
includeBranch: true,
|
||||
pageSize: pageSize.value,
|
||||
page: currentPage.value,
|
||||
pageSize: mobileFetch
|
||||
? userLength + (total === userLength ? 1 : 0)
|
||||
: pageSize.value,
|
||||
page: mobileFetch ? 1 : currentPage.value,
|
||||
query: !!inputSearch.value ? inputSearch.value : undefined,
|
||||
userType: currentTab.value === 'ALL' ? undefined : currentTab.value,
|
||||
status:
|
||||
|
|
@ -660,7 +664,7 @@ async function fetchUserList() {
|
|||
});
|
||||
|
||||
if (ret) {
|
||||
if ($q.screen.xs) {
|
||||
if ($q.screen.xs && !mobileFetch) {
|
||||
if (!userData.value) {
|
||||
userData.value = ret;
|
||||
} else {
|
||||
|
|
@ -675,26 +679,6 @@ async function fetchUserList() {
|
|||
}
|
||||
}
|
||||
|
||||
async function fetchUserEditXs() {
|
||||
const ret = await userStore.fetchList({
|
||||
includeBranch: true,
|
||||
pageSize: userData.value?.result.length || 0,
|
||||
page: 1,
|
||||
query: !!inputSearch.value ? inputSearch.value : undefined,
|
||||
userType: currentTab.value === 'ALL' ? undefined : currentTab.value,
|
||||
status:
|
||||
statusFilter.value === 'all'
|
||||
? undefined
|
||||
: statusFilter.value === 'statusACTIVE'
|
||||
? 'ACTIVE'
|
||||
: 'INACTIVE',
|
||||
});
|
||||
|
||||
if (ret) {
|
||||
userData.value = ret;
|
||||
}
|
||||
}
|
||||
|
||||
function noPersonnel() {
|
||||
const number =
|
||||
typeStats.value &&
|
||||
|
|
|
|||
|
|
@ -267,7 +267,7 @@ async function fetchWorkflowList(mobileFetch?: boolean) {
|
|||
page: mobileFetch ? 1 : workflowPage.value,
|
||||
pageSize: mobileFetch
|
||||
? workflowData.value.length +
|
||||
(pageState.total - workflowData.value.length === 0 ? 1 : 0)
|
||||
(pageState.total === workflowData.value.length ? 1 : 0)
|
||||
: workflowPageSize.value,
|
||||
query: pageState.inputSearch,
|
||||
status:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue