perf: 数据列表样式统一
This commit is contained in:
@@ -2,40 +2,7 @@ import i18n from '../i18n'
|
||||
|
||||
export const defaultPageSize = 20
|
||||
|
||||
export const staticMenus = {
|
||||
settings: {
|
||||
title: i18n.t('overall.config'),
|
||||
menu: [
|
||||
{ route: '/account', name: i18n.t('config.account.account') },
|
||||
{ route: '/roles', name: i18n.t('config.roles.roles') },
|
||||
{ route: '/promServer', name: i18n.t('config.promServer.promServerList') },
|
||||
{ route: '/dc', name: i18n.t('config.dc.dc') },
|
||||
{ route: '/model', name: i18n.t('config.model.model') },
|
||||
{ route: '/mib', name: i18n.t('config.mib.mib') },
|
||||
{ route: '/system', name: i18n.t('config.system.system') },
|
||||
{ route: '/terminalLog', name: i18n.t('config.terminallog.terminallog') },
|
||||
{ route: '/operationLog', name: i18n.t('config.operationlog.operationlog') },
|
||||
{ route: '/about', name: i18n.t('overall.about') }
|
||||
]
|
||||
},
|
||||
alerts: {
|
||||
title: i18n.t('alert.alert'),
|
||||
menu: [
|
||||
{ route: '/alertList', name: i18n.t('alert.alertList') },
|
||||
{ route: '/alertConfig', name: i18n.t('alert.alertConfig') }
|
||||
]
|
||||
},
|
||||
dashboards: {
|
||||
title: i18n.t('dashboard.title'),
|
||||
menu: [
|
||||
{ route: '/overview', name: i18n.t('dashboard.overview.title') },
|
||||
{ route: '/panel', name: i18n.t('dashboard.panel.title') },
|
||||
{ route: '/explore', name: i18n.t('dashboard.metricPreview.title') }
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
export const promServer = {
|
||||
export const agent = {
|
||||
theData: [
|
||||
{
|
||||
label: 'Federation',
|
||||
@@ -87,7 +54,7 @@ export const promServer = {
|
||||
]
|
||||
|
||||
}
|
||||
export const promServer2 = {
|
||||
export const agent2 = {
|
||||
theData: [
|
||||
{
|
||||
label: 'Global',
|
||||
@@ -179,8 +146,9 @@ export const terminalLog = {
|
||||
export const fromRoute = {
|
||||
panel: 'panel',
|
||||
explore: 'explore',
|
||||
message: 'message',
|
||||
rule: 'rule',
|
||||
alertMessage: 'alertMessage',
|
||||
alertRule: 'alertRule',
|
||||
alertSilence: 'alertSilence',
|
||||
model: 'model',
|
||||
mib: 'mib',
|
||||
asset: 'asset',
|
||||
@@ -188,7 +156,7 @@ export const fromRoute = {
|
||||
assetState: 'assetState',
|
||||
expressionTemplate: 'expressionTemplate',
|
||||
user: 'user',
|
||||
promServer: 'promServer',
|
||||
agent: 'agent',
|
||||
dc: 'dc',
|
||||
role: 'role',
|
||||
endpoint: 'endpoint',
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { getChart } from './common'
|
||||
import MessageBox from 'element-ui/packages/message-box/src/main'
|
||||
import i18n from '../i18n'
|
||||
import bus from '@/libs/bus'
|
||||
/* 弹窗点击外部后关闭 */
|
||||
const exceptClassName = ['config-dropdown', 'nz-pop', 'el-picker', 'chart-box-dropdown', 'metric-dropdown', 'el-cascader__dropdown', 'asset-dropdown', 'no-style-class', 'el-message-box', 'nz-dashboard-dropdown', 'el-autocomplete-suggestion', 'nz-temp-box', 'el-time-panel'] // clickoutside排除的class(白名单) no-style-class:没有任何样式的class
|
||||
export const clickoutside = {
|
||||
@@ -283,6 +284,47 @@ export function stringTimeParseToUnix (stringTime) {
|
||||
const time = new Date(stringTime).getTime()
|
||||
return time / 1000
|
||||
}
|
||||
export function getTime (size, unit) { // 计算时间
|
||||
const now = new Date(bus.computeTimezone(new Date().getTime()))
|
||||
if (unit) {
|
||||
switch (unit) {
|
||||
case 'y':
|
||||
now.setFullYear(now.getFullYear() + size)
|
||||
break
|
||||
case 'M':
|
||||
now.setMonth(now.getMonth() + size)
|
||||
break
|
||||
case 'd':
|
||||
now.setDate(now.getDate() + size)
|
||||
break
|
||||
case 'h':
|
||||
now.setHours(now.getHours() + size)
|
||||
break
|
||||
case 'm':
|
||||
now.setMinutes(now.getMinutes() + size)
|
||||
break
|
||||
case 's':
|
||||
now.setSeconds(now.getSeconds() + size)
|
||||
break
|
||||
default:
|
||||
console.error('unit error')
|
||||
}
|
||||
} else {
|
||||
now.setSeconds(now.getSeconds() + size)
|
||||
}
|
||||
const year = now.getFullYear()
|
||||
let month = now.getMonth() + 1
|
||||
month = month < 10 ? '0' + month : month
|
||||
let day = now.getDate()
|
||||
day = day < 10 ? '0' + day : day
|
||||
let hour = now.getHours()
|
||||
hour = hour < 10 ? '0' + hour : hour
|
||||
let minute = now.getMinutes()
|
||||
minute = minute < 10 ? '0' + minute : minute
|
||||
let second = now.getSeconds()
|
||||
second = second < 10 ? '0' + second : second
|
||||
return year + '-' + month + '-' + day + ' ' + hour + ':' + minute + ':' + second
|
||||
}
|
||||
export function calcDurationByStringTime (startTime, endTime) {
|
||||
const durationSecond = stringTimeParseToUnix(endTime) - stringTimeParseToUnix(startTime)
|
||||
let result = `${durationSecond % 60}s`
|
||||
|
||||
Reference in New Issue
Block a user