feat: 网站过期时间增加排序 (#5833)

This commit is contained in:
zhengkunwang 2024-07-16 12:03:28 +08:00 committed by GitHub
parent 74bd997f07
commit b562d9f8e8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 5 additions and 4 deletions

View File

@ -7,7 +7,7 @@ import (
type WebsiteSearch struct {
dto.PageInfo
Name string `json:"name"`
OrderBy string `json:"orderBy" validate:"required,oneof=primary_domain type status created_at"`
OrderBy string `json:"orderBy" validate:"required,oneof=primary_domain type status created_at expire_date"`
Order string `json:"order" validate:"required,oneof=null ascending descending"`
WebsiteGroupID uint `json:"websiteGroupId"`
}
@ -55,7 +55,7 @@ type WebsiteUpdate struct {
ID uint `json:"id" validate:"required"`
PrimaryDomain string `json:"primaryDomain" validate:"required"`
Remark string `json:"remark"`
WebsiteGroupID uint `json:"webSiteGroupID" validate:"required"`
WebsiteGroupID uint `json:"webSiteGroupID"`
ExpireDate string `json:"expireDate"`
IPV6 bool `json:"IPV6"`
}

View File

@ -96,7 +96,7 @@ func (w *WebsiteRepo) Page(page, size int, opts ...DBOption) (int64, []model.Web
db := getDb(opts...).Model(&model.Website{})
count := int64(0)
db = db.Count(&count)
err := db.Limit(size).Offset(size * (page - 1)).Preload("WebsiteSSL").Find(&websites).Error
err := db.Debug().Limit(size).Offset(size * (page - 1)).Preload("WebsiteSSL").Find(&websites).Error
return count, websites, err
}

View File

@ -128,7 +128,7 @@
prop="protocol"
width="90px"
></el-table-column>
<el-table-column :label="$t('website.expireDate')">
<el-table-column :label="$t('website.expireDate')" prop="expireDate" sortable>
<template #default="{ row, $index }">
<div v-show="row.showdate">
<el-date-picker
@ -271,6 +271,7 @@ const mobile = computed(() => {
const changeSort = ({ prop, order }) => {
if (order) {
req.orderBy = prop == 'primaryDomain' ? 'primary_domain' : prop;
req.orderBy = prop == 'expireDate' ? 'expire_date' : prop;
req.order = order;
} else {
req.orderBy = 'created_at';