feat: 网站已安装页面增加分页 (#1707)

pull/1708/head
zhengkunwang 1 year ago committed by GitHub
parent 920f1112fa
commit aa8816f3ec
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -61,7 +61,12 @@ func NewIAppInstalledService() IAppInstallService {
}
func (a *AppInstallService) Page(req request.AppInstalledSearch) (int64, []response.AppInstalledDTO, error) {
var opts []repo.DBOption
var (
opts []repo.DBOption
total int64
installs []model.AppInstall
err error
)
if req.Name != "" {
opts = append(opts, commonRepo.WithLikeName(req.Name))
@ -87,15 +92,25 @@ func (a *AppInstallService) Page(req request.AppInstalledSearch) (int64, []respo
opts = append(opts, appInstallRepo.WithAppIdsIn(appIds))
}
total, installs, err := appInstallRepo.Page(req.Page, req.PageSize, opts...)
if err != nil {
return 0, nil, err
if req.Update {
installs, err = appInstallRepo.ListBy(opts...)
if err != nil {
return 0, nil, err
}
} else {
total, installs, err = appInstallRepo.Page(req.Page, req.PageSize, opts...)
if err != nil {
return 0, nil, err
}
}
installDTOs, err := handleInstalled(installs, req.Update)
if err != nil {
return 0, nil, err
}
if req.Update {
total = int64(len(installDTOs))
}
return total, installDTOs, nil
}

@ -287,13 +287,6 @@ onMounted(() => {
border: none;
}
}
.page-button {
float: right;
margin-bottom: 10px;
margin-top: 10px;
}
@media only screen and (min-width: 768px) and (max-width: 1200px) {
.app-col-12 {
max-width: 50%;

@ -91,3 +91,9 @@
border: none;
}
}
.page-button {
float: right;
margin-bottom: 10px;
margin-top: 10px;
}

@ -234,6 +234,15 @@
</div>
</el-col>
</el-row>
<div class="page-button" v-if="mode === 'installed'">
<fu-table-pagination
v-model:current-page="paginationConfig.currentPage"
v-model:page-size="paginationConfig.pageSize"
v-bind="paginationConfig"
@change="search"
:layout="'total, sizes, prev, pager, next, jumper'"
/>
</div>
</template>
</LayoutContent>
<Backups ref="backupRef" @close="search" />
@ -300,7 +309,7 @@ const tags = ref<App.Tag[]>([]);
const activeTag = ref('all');
const searchReq = reactive({
page: 1,
pageSize: 15,
pageSize: 20,
name: '',
tags: [],
update: false,

Loading…
Cancel
Save