mirror of
https://github.com/jumpserver/lina.git
synced 2025-09-24 12:40:36 +00:00
fix: 修复表格的时间过滤问题
This commit is contained in:
@@ -145,6 +145,13 @@ export function getDaysFuture(days, now) {
|
|||||||
return new Date(now.getTime() + 3600 * 1000 * 24 * days)
|
return new Date(now.getTime() + 3600 * 1000 * 24 * days)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function getDayEnd(now) {
|
||||||
|
if (!now) {
|
||||||
|
now = new Date()
|
||||||
|
}
|
||||||
|
return new Date(new Date(now.toLocaleDateString()).getTime() + 24 * 60 * 60 * 1000 - 1)
|
||||||
|
}
|
||||||
|
|
||||||
export function setUrlParam(url, name, value) {
|
export function setUrlParam(url, name, value) {
|
||||||
const urlArray = url.split('?')
|
const urlArray = url.split('?')
|
||||||
if (urlArray.length === 1) {
|
if (urlArray.length === 1) {
|
||||||
|
@@ -9,7 +9,7 @@
|
|||||||
|
|
||||||
<script type="text/jsx">
|
<script type="text/jsx">
|
||||||
import GenericListPage from '@/layout/components/GenericListPage'
|
import GenericListPage from '@/layout/components/GenericListPage'
|
||||||
import { getDaysAgo } from '@/utils/common'
|
import { getDayEnd, getDaysAgo } from '@/utils/common'
|
||||||
import { Dialog, ListTable } from '@/components'
|
import { Dialog, ListTable } from '@/components'
|
||||||
import { DisplayFormatter } from '@/components/ListTable/formatters'
|
import { DisplayFormatter } from '@/components/ListTable/formatters'
|
||||||
import { setUrlParam } from '@/utils/common'
|
import { setUrlParam } from '@/utils/common'
|
||||||
@@ -21,7 +21,7 @@ export default {
|
|||||||
data() {
|
data() {
|
||||||
const now = new Date()
|
const now = new Date()
|
||||||
const dateFrom = getDaysAgo(7, now).toISOString()
|
const dateFrom = getDaysAgo(7, now).toISOString()
|
||||||
const dateTo = now.toISOString()
|
const dateTo = getDayEnd(now).toISOString()
|
||||||
const vm = this
|
const vm = this
|
||||||
return {
|
return {
|
||||||
tableConfig: {
|
tableConfig: {
|
||||||
|
@@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
import GenericListPage from '@/layout/components/GenericListPage'
|
import GenericListPage from '@/layout/components/GenericListPage'
|
||||||
import { getDaysAgo } from '@/utils/common'
|
import { getDayEnd, getDaysAgo } from '@/utils/common'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
components: {
|
components: {
|
||||||
@@ -13,7 +13,7 @@ export default {
|
|||||||
data() {
|
data() {
|
||||||
const now = new Date()
|
const now = new Date()
|
||||||
const dateFrom = getDaysAgo(7, now).toISOString()
|
const dateFrom = getDaysAgo(7, now).toISOString()
|
||||||
const dateTo = now.toISOString()
|
const dateTo = getDayEnd(now).toISOString()
|
||||||
return {
|
return {
|
||||||
tableConfig: {
|
tableConfig: {
|
||||||
url: '/api/v1/audits/ftp-logs/',
|
url: '/api/v1/audits/ftp-logs/',
|
||||||
|
@@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
import GenericListPage from '@/layout/components/GenericListPage'
|
import GenericListPage from '@/layout/components/GenericListPage'
|
||||||
import { getDaysAgo } from '@/utils/common'
|
import { getDayEnd, getDaysAgo } from '@/utils/common'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
components: {
|
components: {
|
||||||
@@ -13,7 +13,7 @@ export default {
|
|||||||
data() {
|
data() {
|
||||||
const now = new Date()
|
const now = new Date()
|
||||||
const dateFrom = getDaysAgo(7, now).toISOString()
|
const dateFrom = getDaysAgo(7, now).toISOString()
|
||||||
const dateTo = now.toISOString()
|
const dateTo = getDayEnd(now).toISOString()
|
||||||
return {
|
return {
|
||||||
tableConfig: {
|
tableConfig: {
|
||||||
url: '/api/v1/audits/login-logs/',
|
url: '/api/v1/audits/login-logs/',
|
||||||
|
@@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
import GenericListPage from '@/layout/components/GenericListPage'
|
import GenericListPage from '@/layout/components/GenericListPage'
|
||||||
import { getDaysAgo } from '@/utils/common'
|
import { getDayEnd, getDaysAgo } from '@/utils/common'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
components: {
|
components: {
|
||||||
@@ -13,7 +13,7 @@ export default {
|
|||||||
data() {
|
data() {
|
||||||
const now = new Date()
|
const now = new Date()
|
||||||
const dateFrom = getDaysAgo(7, now).toISOString()
|
const dateFrom = getDaysAgo(7, now).toISOString()
|
||||||
const dateTo = now.toISOString()
|
const dateTo = getDayEnd(now).toISOString()
|
||||||
return {
|
return {
|
||||||
tableConfig: {
|
tableConfig: {
|
||||||
url: '/api/v1/audits/operate-logs/',
|
url: '/api/v1/audits/operate-logs/',
|
||||||
|
@@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
import GenericListPage from '@/layout/components/GenericListPage'
|
import GenericListPage from '@/layout/components/GenericListPage'
|
||||||
import { getDaysAgo } from '@/utils/common'
|
import { getDayEnd, getDaysAgo } from '@/utils/common'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
components: {
|
components: {
|
||||||
@@ -13,7 +13,7 @@ export default {
|
|||||||
data() {
|
data() {
|
||||||
const now = new Date()
|
const now = new Date()
|
||||||
const dateFrom = getDaysAgo(7, now).toISOString()
|
const dateFrom = getDaysAgo(7, now).toISOString()
|
||||||
const dateTo = now.toISOString()
|
const dateTo = getDayEnd(now).toISOString()
|
||||||
return {
|
return {
|
||||||
tableConfig: {
|
tableConfig: {
|
||||||
url: '/api/v1/audits/password-change-logs/',
|
url: '/api/v1/audits/password-change-logs/',
|
||||||
|
@@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { GenericListPage } from '@/layout/components'
|
import { GenericListPage } from '@/layout/components'
|
||||||
import { getDaysAgo, toSafeLocalDateStr } from '@/utils/common'
|
import { getDayEnd, getDaysAgo, toSafeLocalDateStr } from '@/utils/common'
|
||||||
import { OutputExpandFormatter } from './formatters'
|
import { OutputExpandFormatter } from './formatters'
|
||||||
import { DetailFormatter } from '@/components/ListTable/formatters'
|
import { DetailFormatter } from '@/components/ListTable/formatters'
|
||||||
|
|
||||||
@@ -16,7 +16,7 @@ export default {
|
|||||||
const vm = this
|
const vm = this
|
||||||
const now = new Date()
|
const now = new Date()
|
||||||
const dateFrom = getDaysAgo(2, now).toISOString()
|
const dateFrom = getDaysAgo(2, now).toISOString()
|
||||||
const dateTo = now.toISOString()
|
const dateTo = getDayEnd(now).toISOString()
|
||||||
return {
|
return {
|
||||||
tableConfig: {
|
tableConfig: {
|
||||||
url: '/api/v1/terminal/commands/',
|
url: '/api/v1/terminal/commands/',
|
||||||
|
@@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
<script type="text/jsx">
|
<script type="text/jsx">
|
||||||
import ListTable from '@/components/ListTable'
|
import ListTable from '@/components/ListTable'
|
||||||
import { timeOffset, getDaysAgo } from '@/utils/common'
|
import { timeOffset, getDaysAgo, getDayEnd } from '@/utils/common'
|
||||||
import { ActionsFormatter } from '@/components/ListTable/formatters'
|
import { ActionsFormatter } from '@/components/ListTable/formatters'
|
||||||
export default {
|
export default {
|
||||||
name: 'BaseList',
|
name: 'BaseList',
|
||||||
@@ -24,7 +24,7 @@ export default {
|
|||||||
data() {
|
data() {
|
||||||
const now = new Date()
|
const now = new Date()
|
||||||
const dateFrom = getDaysAgo(2, now).toISOString()
|
const dateFrom = getDaysAgo(2, now).toISOString()
|
||||||
const dateTo = now.toISOString()
|
const dateTo = getDayEnd(now).toISOString()
|
||||||
return {
|
return {
|
||||||
tableConfig: {
|
tableConfig: {
|
||||||
url: this.url,
|
url: this.url,
|
||||||
|
Reference in New Issue
Block a user