Browse Source

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

pull/5836/head
zhengkunwang 4 months ago committed by GitHub
parent
commit
b562d9f8e8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 4
      backend/app/dto/request/website.go
  2. 2
      backend/app/repo/website.go
  3. 3
      frontend/src/views/website/website/index.vue

4
backend/app/dto/request/website.go

@ -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"`
}

2
backend/app/repo/website.go

@ -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
}

3
frontend/src/views/website/website/index.vue

@ -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';

Loading…
Cancel
Save