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();
|
typeStats.value = await userStore.typeStats();
|
||||||
const res = await branchStore.userStats(formData.value.userType);
|
const res = await branchStore.userStats(formData.value.userType);
|
||||||
if (res) {
|
if (res) {
|
||||||
|
|
@ -471,7 +471,7 @@ async function onSubmit(excludeDialog?: boolean) {
|
||||||
currentTab.value === formData.value.userType &&
|
currentTab.value === formData.value.userType &&
|
||||||
currentTab.value !== 'ALL'
|
currentTab.value !== 'ALL'
|
||||||
) {
|
) {
|
||||||
$q.screen.gt.xs ? await fetchUserEditXs() : await fetchUserList();
|
await fetchUserList($q.screen.xs);
|
||||||
}
|
}
|
||||||
|
|
||||||
currentTab.value = formData.value.userType;
|
currentTab.value = formData.value.userType;
|
||||||
|
|
@ -497,7 +497,7 @@ async function onDelete(id: string) {
|
||||||
action: async () => {
|
action: async () => {
|
||||||
await userStore.deleteById(id);
|
await userStore.deleteById(id);
|
||||||
|
|
||||||
await fetchUserList();
|
await fetchUserList($q.screen.xs);
|
||||||
typeStats.value = await userStore.typeStats();
|
typeStats.value = await userStore.typeStats();
|
||||||
infoDrawer.value = false;
|
infoDrawer.value = false;
|
||||||
flowStore.rotate();
|
flowStore.rotate();
|
||||||
|
|
@ -644,11 +644,15 @@ async function fetchImageList(id: string, selectedName?: string) {
|
||||||
return res;
|
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({
|
const ret = await userStore.fetchList({
|
||||||
includeBranch: true,
|
includeBranch: true,
|
||||||
pageSize: pageSize.value,
|
pageSize: mobileFetch
|
||||||
page: currentPage.value,
|
? userLength + (total === userLength ? 1 : 0)
|
||||||
|
: pageSize.value,
|
||||||
|
page: mobileFetch ? 1 : currentPage.value,
|
||||||
query: !!inputSearch.value ? inputSearch.value : undefined,
|
query: !!inputSearch.value ? inputSearch.value : undefined,
|
||||||
userType: currentTab.value === 'ALL' ? undefined : currentTab.value,
|
userType: currentTab.value === 'ALL' ? undefined : currentTab.value,
|
||||||
status:
|
status:
|
||||||
|
|
@ -660,7 +664,7 @@ async function fetchUserList() {
|
||||||
});
|
});
|
||||||
|
|
||||||
if (ret) {
|
if (ret) {
|
||||||
if ($q.screen.xs) {
|
if ($q.screen.xs && !mobileFetch) {
|
||||||
if (!userData.value) {
|
if (!userData.value) {
|
||||||
userData.value = ret;
|
userData.value = ret;
|
||||||
} else {
|
} 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() {
|
function noPersonnel() {
|
||||||
const number =
|
const number =
|
||||||
typeStats.value &&
|
typeStats.value &&
|
||||||
|
|
|
||||||
|
|
@ -267,7 +267,7 @@ async function fetchWorkflowList(mobileFetch?: boolean) {
|
||||||
page: mobileFetch ? 1 : workflowPage.value,
|
page: mobileFetch ? 1 : workflowPage.value,
|
||||||
pageSize: mobileFetch
|
pageSize: mobileFetch
|
||||||
? workflowData.value.length +
|
? workflowData.value.length +
|
||||||
(pageState.total - workflowData.value.length === 0 ? 1 : 0)
|
(pageState.total === workflowData.value.length ? 1 : 0)
|
||||||
: workflowPageSize.value,
|
: workflowPageSize.value,
|
||||||
query: pageState.inputSearch,
|
query: pageState.inputSearch,
|
||||||
status:
|
status:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue