fix: 修改 日期格式

This commit is contained in:
zhangyu
2021-12-31 16:41:30 +08:00
parent fd25007284
commit 45b6e953d2
32 changed files with 209 additions and 202 deletions

View File

@@ -130,6 +130,7 @@ export default {
// 参数 isRefresh 标识是否是刷新操作 // 参数 isRefresh 标识是否是刷新操作
getChartData (isRefresh) { getChartData (isRefresh) {
this.loading = true this.loading = true
console.log(this.timeRange)
// TODO assetInfo、endpointInfo、echarts等进行不同的处理 // TODO assetInfo、endpointInfo、echarts等进行不同的处理
let startTime = '' let startTime = ''
let endTime = '' let endTime = ''
@@ -138,15 +139,15 @@ export default {
const origin = new Date(this.timeRange[1]) const origin = new Date(this.timeRange[1])
const numInterval = now.getTime() - origin.getTime() const numInterval = now.getTime() - origin.getTime()
if (numInterval >= 60000) { // 大于1分钟则start、end均往后移numInterval否则时间不变 if (numInterval >= 60000) { // 大于1分钟则start、end均往后移numInterval否则时间不变
startTime = bus.getNewTime(this.timeRange[0], numInterval) startTime = bus.getNewTime(bus.formateTimeToTime(this.timeRange[0]), numInterval)
endTime = bus.timeFormate(now, 'yyyy-MM-dd hh:mm:ss') endTime = bus.timeFormate(now, 'YYYY-MM-DD HH:mm:ss')
} else { } else {
startTime = this.timeRange[0] startTime = bus.formateTimeToTime(this.timeRange[0])
endTime = this.timeRange[1] endTime = bus.formateTimeToTime(this.timeRange[1])
} }
} else { } else {
startTime = this.timeRange[0] startTime = bus.formateTimeToTime(this.timeRange[0])
endTime = this.timeRange[1] endTime = bus.formateTimeToTime(this.timeRange[1])
} }
const step = bus.getStep(startTime, endTime) const step = bus.getStep(startTime, endTime)
startTime = this.$stringTimeParseToUnix(startTime) startTime = this.$stringTimeParseToUnix(startTime)

View File

@@ -892,8 +892,8 @@ export default {
}, },
// 全屏时间条件查询 // 全屏时间条件查询
dateChange (time) { dateChange (time) {
// this.filter.start_time = bus.timeFormate(this.searchTime[0], 'yyyy-MM-dd hh:mm:ss'); // this.filter.start_time = bus.timeFormate(this.searchTime[0], 'YYYY-MM-DD HH:mm:ss');
// this.filter.end_time = bus.timeFormate(this.searchTime[1], 'yyyy-MM-dd hh:mm:ss'); // this.filter.end_time = bus.timeFormate(this.searchTime[1], 'YYYY-MM-DD HH:mm:ss');
// this.showTable = false; // this.showTable = false;
this.seriesItemScreen = [] this.seriesItemScreen = []
for (let i = 0; i < 8; i++) { for (let i = 0; i < 8; i++) {
@@ -1113,8 +1113,8 @@ export default {
this.dialogText = row.alertRule.trbShot this.dialogText = row.alertRule.trbShot
}, },
addSilence (row, type) { addSilence (row, type) {
this.blankSilenceObject.startAt = bus.timeFormate(bus.getOffsetTimezoneData(), 'yyyy-MM-dd hh:mm:ss') this.blankSilenceObject.startAt = bus.timeFormate(bus.getOffsetTimezoneData(), 'YYYY-MM-DD HH:mm:ss')
this.blankSilenceObject.endAt = bus.timeFormate(bus.getOffsetTimezoneData(1), 'yyyy-MM-dd hh:mm:ss') this.blankSilenceObject.endAt = bus.timeFormate(bus.getOffsetTimezoneData(1), 'YYYY-MM-DD HH:mm:ss')
this.objectSilence = JSON.parse(JSON.stringify(this.blankSilenceObject)) this.objectSilence = JSON.parse(JSON.stringify(this.blankSilenceObject))
this.objectSilence.name = 'Quick silence' this.objectSilence.name = 'Quick silence'
if (type !== 'alertMessage' && type !== 'alertRule') { if (type !== 'alertMessage' && type !== 'alertRule') {

View File

@@ -688,7 +688,7 @@ export default {
const numInterval = now.getTime() - origin.getTime() const numInterval = now.getTime() - origin.getTime()
if (numInterval >= 60000) { // 大于1分钟则start、end均往后移numInterval否则时间不变 if (numInterval >= 60000) { // 大于1分钟则start、end均往后移numInterval否则时间不变
startTime = this.getNewTime(this.filter.start_time, numInterval) startTime = this.getNewTime(this.filter.start_time, numInterval)
endTime = bus.timeFormate(now, 'yyyy-MM-dd hh:mm:ss') endTime = bus.timeFormate(now, 'YYYY-MM-DD HH:mm:ss')
} else { } else {
startTime = this.filter.start_time startTime = this.filter.start_time
endTime = this.filter.end_time endTime = this.filter.end_time
@@ -895,7 +895,7 @@ export default {
} }
*/ */
// let t_date = new Date(dpsItem[0] * 1000); // let t_date = new Date(dpsItem[0] * 1000);
// let timeTmp = bus.timeFormate(t_date, 'yyyy-MM-dd hh:mm:ss'); // let timeTmp = bus.timeFormate(t_date, 'YYYY-MM-DD HH:mm:ss');
tableData.push({ // 表格数据 tableData.push({ // 表格数据
// label: host.slice(host.indexOf('{') + 1,host.indexOf('}')),//label // label: host.slice(host.indexOf('{') + 1,host.indexOf('}')),//label
// metric: queryItem.metric.__name__?queryItem.metric.__name__:'',//metric列 // metric: queryItem.metric.__name__?queryItem.metric.__name__:'',//metric列
@@ -1122,7 +1122,7 @@ export default {
// alert('table=='+JSON.stringify(queryItem)) // alert('table=='+JSON.stringify(queryItem))
seriesItem.theData.data = tempArr.map((dpsItem, dpsIndex) => { seriesItem.theData.data = tempArr.map((dpsItem, dpsIndex) => {
const tData = new Date(dpsItem[0] * 1000) const tData = new Date(dpsItem[0] * 1000)
const timeTmp = bus.timeFormate(tData, 'yyyy-MM-dd hh:mm:ss') const timeTmp = bus.timeFormate(tData, 'YYYY-MM-DD HH:mm:ss')
tableData.push({ // 表格数据 tableData.push({ // 表格数据
// label: host.slice(host.indexOf('{') + 1,host.indexOf('}')),//label // label: host.slice(host.indexOf('{') + 1,host.indexOf('}')),//label
// metric: queryItem.metric.__name__?queryItem.metric.__name__:'',//metric列 // metric: queryItem.metric.__name__?queryItem.metric.__name__:'',//metric列
@@ -1195,8 +1195,8 @@ export default {
const basicInfo = JSON.parse(JSON.stringify(this.detail)) const basicInfo = JSON.parse(JSON.stringify(this.detail))
const basicInfoReq = new Promise((resolve, reject) => { const basicInfoReq = new Promise((resolve, reject) => {
const now = new Date() const now = new Date()
const startTime = bus.timeFormate(new Date(now).setHours(now.getHours() - 1), 'yyyy-MM-dd hh:mm:ss') const startTime = bus.timeFormate(new Date(now).setHours(now.getHours() - 1), 'YYYY-MM-DD HH:mm:ss')
const endTime = bus.timeFormate(now, 'yyyy-MM-dd hh:mm:ss') const endTime = bus.timeFormate(now, 'YYYY-MM-DD HH:mm:ss')
// const step = bus.getStep(startTime, endTime) // const step = bus.getStep(startTime, endTime)
this.$nextTick(() => { this.$nextTick(() => {
let query = encodeURIComponent(chartInfo.elements[0].expression) let query = encodeURIComponent(chartInfo.elements[0].expression)
@@ -1466,7 +1466,7 @@ export default {
getNewTime (time, num) { getNewTime (time, num) {
const date = new Date(time) const date = new Date(time)
const newDate = new Date(parseInt(date.getTime(), 10) + num) const newDate = new Date(parseInt(date.getTime(), 10) + num)
return bus.timeFormate(newDate, 'yyyy-MM-dd hh:mm:ss') return bus.timeFormate(newDate, 'YYYY-MM-DD HH:mm:ss')
}, },
// 删除图表 // 删除图表
removeChart (chartId) { // from 区分从哪里点击的删除 1.从图表面板 2.从编辑框 removeChart (chartId) { // from 区分从哪里点击的删除 1.从图表面板 2.从编辑框
@@ -1523,8 +1523,8 @@ export default {
}, },
searchData (chartId, searchTime) { searchData (chartId, searchTime) {
if (searchTime) { // 全屏时间查询 if (searchTime) { // 全屏时间查询
this.filter.start_time = bus.timeFormate(searchTime[0], 'yyyy-MM-dd hh:mm:ss') this.filter.start_time = bus.timeFormate(searchTime[0], 'YYYY-MM-DD HH:mm:ss')
this.filter.end_time = bus.timeFormate(searchTime[1], 'yyyy-MM-dd hh:mm:ss') this.filter.end_time = bus.timeFormate(searchTime[1], 'YYYY-MM-DD HH:mm:ss')
} }
this.dataList.forEach((item, index) => { this.dataList.forEach((item, index) => {
if (item.id === chartId) { if (item.id === chartId) {

View File

@@ -607,8 +607,8 @@ export default {
type: '' type: ''
}] }]
}) })
this.$set(this.filter, 'start_time', bus.timeFormate(new Date().getTime() - 24 * 60 * 60 * 1000, 'yyyy-MM-dd hh:mm:ss')) this.$set(this.filter, 'start_time', bus.timeFormate(new Date().getTime() - 24 * 60 * 60 * 1000, 'YYYY-MM-DD HH:mm:ss'))
this.$set(this.filter, 'end_time', bus.timeFormate(new Date().getTime(), 'yyyy-MM-dd hh:mm:ss')) this.$set(this.filter, 'end_time', bus.timeFormate(new Date().getTime(), 'YYYY-MM-DD HH:mm:ss'))
this.$nextTick(() => { this.$nextTick(() => {
this.dataList.forEach((item, index) => { this.dataList.forEach((item, index) => {
this.$set(item, 'from', params.from) this.$set(item, 'from', params.from)
@@ -910,7 +910,7 @@ export default {
const numInterval = now.getTime() - origin.getTime() const numInterval = now.getTime() - origin.getTime()
if (numInterval >= 60000) { // 大于1分钟则start、end均往后移numInterval否则时间不变 if (numInterval >= 60000) { // 大于1分钟则start、end均往后移numInterval否则时间不变
startTime = this.getNewTime(this.filter.start_time, numInterval) startTime = this.getNewTime(this.filter.start_time, numInterval)
endTime = bus.timeFormate(now, 'yyyy-MM-dd hh:mm:ss') endTime = bus.timeFormate(now, 'YYYY-MM-DD HH:mm:ss')
this.filter.start_time = startTime this.filter.start_time = startTime
this.filter.end_time = endTime this.filter.end_time = endTime
} else { } else {
@@ -1118,7 +1118,7 @@ export default {
} }
*/ */
// let t_date = new Date(dpsItem[0] * 1000); // let t_date = new Date(dpsItem[0] * 1000);
// let timeTmp = bus.timeFormate(t_date, 'yyyy-MM-dd hh:mm:ss'); // let timeTmp = bus.timeFormate(t_date, 'YYYY-MM-DD HH:mm:ss');
tableData.push({ // 表格数据 tableData.push({ // 表格数据
// label: host.slice(host.indexOf('{') + 1,host.indexOf('}')),//label // label: host.slice(host.indexOf('{') + 1,host.indexOf('}')),//label
// metric: queryItem.metric.__name__?queryItem.metric.__name__:'',//metric列 // metric: queryItem.metric.__name__?queryItem.metric.__name__:'',//metric列
@@ -1349,7 +1349,7 @@ export default {
// alert('table=='+JSON.stringify(queryItem)) // alert('table=='+JSON.stringify(queryItem))
seriesItem.theData.data = tempArr.map((dpsItem, dpsIndex) => { seriesItem.theData.data = tempArr.map((dpsItem, dpsIndex) => {
const tData = new Date(dpsItem[0] * 1000) const tData = new Date(dpsItem[0] * 1000)
const timeTmp = bus.timeFormate(tData, 'yyyy-MM-dd hh:mm:ss') const timeTmp = bus.timeFormate(tData, 'YYYY-MM-DD HH:mm:ss')
tableData.push({ // 表格数据 tableData.push({ // 表格数据
// label: host.slice(host.indexOf('{') + 1,host.indexOf('}')),//label // label: host.slice(host.indexOf('{') + 1,host.indexOf('}')),//label
// metric: queryItem.metric.__name__?queryItem.metric.__name__:'',//metric列 // metric: queryItem.metric.__name__?queryItem.metric.__name__:'',//metric列
@@ -1687,7 +1687,7 @@ export default {
getNewTime (time, num) { getNewTime (time, num) {
const date = new Date(time) const date = new Date(time)
const newDate = new Date(parseInt(date.getTime(), 10) + num) const newDate = new Date(parseInt(date.getTime(), 10) + num)
return bus.timeFormate(newDate, 'yyyy-MM-dd hh:mm:ss') return bus.timeFormate(newDate, 'YYYY-MM-DD HH:mm:ss')
}, },
// 删除图表 // 删除图表
removeChart (chartId) { // from 区分从哪里点击的删除 1.从图表面板 2.从编辑框 removeChart (chartId) { // from 区分从哪里点击的删除 1.从图表面板 2.从编辑框
@@ -1759,8 +1759,8 @@ export default {
}, },
searchData (chartId, searchTime) { searchData (chartId, searchTime) {
if (searchTime) { // 全屏时间查询 if (searchTime) { // 全屏时间查询
this.filter.showFullScreenStart_time = bus.timeFormate(searchTime[0], 'yyyy-MM-dd hh:mm:ss') this.filter.showFullScreenStart_time = bus.timeFormate(searchTime[0], 'YYYY-MM-DD HH:mm:ss')
this.filter.showFullScreenEnd_time = bus.timeFormate(searchTime[1], 'yyyy-MM-dd hh:mm:ss') this.filter.showFullScreenEnd_time = bus.timeFormate(searchTime[1], 'YYYY-MM-DD HH:mm:ss')
} }
this.dataList.forEach((item, index) => { this.dataList.forEach((item, index) => {
if (item.id === chartId) { if (item.id === chartId) {

View File

@@ -204,7 +204,7 @@ export default {
title: '采集时间', title: '采集时间',
key: 'time', key: 'time',
width: 160, width: 160,
render: (h, params) => h('span', bus.timeFormate(params.row.time, 'yyyy-MM-dd hh:mm:ss')) render: (h, params) => h('span', bus.timeFormate(params.row.time, 'YYYY-MM-DD HH:mm:ss'))
}, { }, {
title: '数值', title: '数值',
key: 'value', key: 'value',
@@ -461,7 +461,7 @@ export default {
result = copy.map(item => { result = copy.map(item => {
return { return {
element: item.element, element: item.element,
time: bus.timeFormate(new Date(item.data[0]), 'yyyy-MM-dd hh:mm:ss'), time: bus.timeFormate(new Date(item.data[0]), 'YYYY-MM-DD HH:mm:ss'),
value: item.data[1] value: item.data[1]
} }
}) })
@@ -475,7 +475,7 @@ export default {
return { return {
element: groupMin.element, element: groupMin.element,
time: bus.timeFormate(new Date(groupMin.data[0]), 'yyyy-MM-dd hh:mm:ss'), time: bus.timeFormate(new Date(groupMin.data[0]), 'YYYY-MM-DD HH:mm:ss'),
value: groupMin.data[1] value: groupMin.data[1]
} }
}) })
@@ -489,7 +489,7 @@ export default {
return { return {
element: groupMax.element, element: groupMax.element,
time: bus.timeFormate(new Date(groupMax.data[0]), 'yyyy-MM-dd hh:mm:ss'), time: bus.timeFormate(new Date(groupMax.data[0]), 'YYYY-MM-DD HH:mm:ss'),
value: groupMax.data[1] value: groupMax.data[1]
} }
}) })
@@ -505,7 +505,7 @@ export default {
})[0] })[0]
return { return {
element: last.element, element: last.element,
time: bus.timeFormate(new Date(last.data[0]), 'yyyy-MM-dd hh:mm:ss'), time: bus.timeFormate(new Date(last.data[0]), 'YYYY-MM-DD HH:mm:ss'),
value: avg value: avg
} }
}) })
@@ -520,7 +520,7 @@ export default {
})[0] })[0]
return { return {
element: last.element, element: last.element,
time: bus.timeFormate(new Date(last.data[0]), 'yyyy-MM-dd hh:mm:ss'), time: bus.timeFormate(new Date(last.data[0]), 'YYYY-MM-DD HH:mm:ss'),
value: total value: total
} }
}) })
@@ -534,7 +534,7 @@ export default {
return { return {
element: first.element, element: first.element,
time: bus.timeFormate(new Date(first.data[0]), 'yyyy-MM-dd hh:mm:ss'), time: bus.timeFormate(new Date(first.data[0]), 'YYYY-MM-DD HH:mm:ss'),
value: first.data[1] value: first.data[1]
} }
}) })
@@ -547,7 +547,7 @@ export default {
})[0] })[0]
return { return {
element: last.element, element: last.element,
time: bus.timeFormate(new Date(last.data[0]), 'yyyy-MM-dd hh:mm:ss'), time: bus.timeFormate(new Date(last.data[0]), 'YYYY-MM-DD HH:mm:ss'),
value: last.data[1] value: last.data[1]
} }
}) })
@@ -566,7 +566,7 @@ export default {
const range = max.data[1] - min.data[1] const range = max.data[1] - min.data[1]
return { return {
element: last.element, element: last.element,
time: bus.timeFormate(new Date(last.data[0]), 'yyyy-MM-dd hh:mm:ss'), time: bus.timeFormate(new Date(last.data[0]), 'YYYY-MM-DD HH:mm:ss'),
value: range value: range
} }
}) })
@@ -581,7 +581,7 @@ export default {
const first = sort[copy.length - 1] const first = sort[copy.length - 1]
return { return {
element: last.element, element: last.element,
time: bus.timeFormate(new Date(last.data[0]), 'yyyy-MM-dd hh:mm:ss'), time: bus.timeFormate(new Date(last.data[0]), 'YYYY-MM-DD HH:mm:ss'),
value: last.data[1] - first.data[1] value: last.data[1] - first.data[1]
} }
}) })
@@ -593,7 +593,7 @@ export default {
result = copy.map(item => { result = copy.map(item => {
return { return {
element: item.element, element: item.element,
time: bus.timeFormate(new Date(item.data[0]), 'yyyy-MM-dd hh:mm:ss'), time: bus.timeFormate(new Date(item.data[0]), 'YYYY-MM-DD HH:mm:ss'),
value: item.data[1] value: item.data[1]
} }
}) })

View File

@@ -392,7 +392,7 @@ function timeCompute (value, unit, dot = 0) {
} }
function timeFormat34 (value) { function timeFormat34 (value) {
return bus.timeFormate(parseInt(value), 'yyyy-MM-dd hh:mm:ss') return bus.timeFormate(parseInt(value), 'YYYY-MM-DD HH:mm:ss')
} }
function timeFormat35 (value) { function timeFormat35 (value) {
return bus.timeFormate(parseInt(value), 'MM/dd/yyyy h:mm:ss a') return bus.timeFormate(parseInt(value), 'MM/dd/yyyy h:mm:ss a')

View File

@@ -351,12 +351,12 @@ export default {
} }
}) })
} else { } else {
let startTime = bus.timeFormate(this.searchTime[0], 'yyyy-MM-dd hh:mm:ss') let startTime = bus.timeFormate(this.searchTime[0], 'YYYY-MM-DD HH:mm:ss')
let endTime = bus.timeFormate(this.searchTime[1], 'yyyy-MM-dd hh:mm:ss') let endTime = bus.timeFormate(this.searchTime[1], 'YYYY-MM-DD HH:mm:ss')
if (!startTime || !endTime) { // 如果时间为空则默认取最近1小时 if (!startTime || !endTime) { // 如果时间为空则默认取最近1小时
const now = new Date(bus.computeTimezone(new Date().getTime())) const now = new Date(bus.computeTimezone(new Date().getTime()))
startTime = bus.timeFormate(now, 'yyyy-MM-dd hh:mm:ss') startTime = bus.timeFormate(now, 'YYYY-MM-DD HH:mm:ss')
endTime = bus.timeFormate(now.setHours(now.getHours() - 1), 'yyyy-MM-dd hh:mm:ss') endTime = bus.timeFormate(now.setHours(now.getHours() - 1), 'YYYY-MM-DD HH:mm:ss')
this.searchTime[0] = startTime this.searchTime[0] = startTime
this.searchTime[1] = endTime this.searchTime[1] = endTime
} }
@@ -530,7 +530,7 @@ export default {
// alert('table=='+JSON.stringify(queryItem)) // alert('table=='+JSON.stringify(queryItem))
seriesItem.theData.data = queryItem.values.map((dpsItem, dpsIndex) => { seriesItem.theData.data = queryItem.values.map((dpsItem, dpsIndex) => {
// const tData = new Date(dpsItem[0] * 1000) // const tData = new Date(dpsItem[0] * 1000)
// const timeTmp = bus.timeFormate(tData, 'yyyy-MM-dd hh:mm:ss') // const timeTmp = bus.timeFormate(tData, 'YYYY-MM-DD HH:mm:ss')
tableData.push({ // 表格数据 tableData.push({ // 表格数据
// label: host.slice(host.indexOf('{') + 1,host.indexOf('}')),//label // label: host.slice(host.indexOf('{') + 1,host.indexOf('}')),//label
// metric: queryItem.metric.__name__?queryItem.metric.__name__:'',//metric列 // metric: queryItem.metric.__name__?queryItem.metric.__name__:'',//metric列
@@ -1415,7 +1415,7 @@ export default {
result = copy.map(item => { result = copy.map(item => {
return { return {
element: item.element, element: item.element,
time: bus.timeFormate(new Date(item.data[0]), 'yyyy-MM-dd hh:mm:ss'), time: bus.timeFormate(new Date(item.data[0]), 'YYYY-MM-DD HH:mm:ss'),
value: item.data[1] value: item.data[1]
} }
}) })
@@ -1429,7 +1429,7 @@ export default {
return { return {
element: groupMin.element, element: groupMin.element,
time: bus.timeFormate(new Date(groupMin.data[0]), 'yyyy-MM-dd hh:mm:ss'), time: bus.timeFormate(new Date(groupMin.data[0]), 'YYYY-MM-DD HH:mm:ss'),
value: groupMin.data[1] value: groupMin.data[1]
} }
}) })
@@ -1443,7 +1443,7 @@ export default {
return { return {
element: groupMax.element, element: groupMax.element,
time: bus.timeFormate(new Date(groupMax.data[0]), 'yyyy-MM-dd hh:mm:ss'), time: bus.timeFormate(new Date(groupMax.data[0]), 'YYYY-MM-DD HH:mm:ss'),
value: groupMax.data[1] value: groupMax.data[1]
} }
}) })
@@ -1459,7 +1459,7 @@ export default {
})[0] })[0]
return { return {
element: last.element, element: last.element,
time: bus.timeFormate(new Date(last.data[0]), 'yyyy-MM-dd hh:mm:ss'), time: bus.timeFormate(new Date(last.data[0]), 'YYYY-MM-DD HH:mm:ss'),
value: avg value: avg
} }
}) })
@@ -1474,7 +1474,7 @@ export default {
})[0] })[0]
return { return {
element: last.element, element: last.element,
time: bus.timeFormate(new Date(last.data[0]), 'yyyy-MM-dd hh:mm:ss'), time: bus.timeFormate(new Date(last.data[0]), 'YYYY-MM-DD HH:mm:ss'),
value: total value: total
} }
}) })
@@ -1488,7 +1488,7 @@ export default {
return { return {
element: first.element, element: first.element,
time: bus.timeFormate(new Date(first.data[0]), 'yyyy-MM-dd hh:mm:ss'), time: bus.timeFormate(new Date(first.data[0]), 'YYYY-MM-DD HH:mm:ss'),
value: first.data[1] value: first.data[1]
} }
}) })
@@ -1501,7 +1501,7 @@ export default {
})[0] })[0]
return { return {
element: last.element, element: last.element,
time: bus.timeFormate(new Date(last.data[0]), 'yyyy-MM-dd hh:mm:ss'), time: bus.timeFormate(new Date(last.data[0]), 'YYYY-MM-DD HH:mm:ss'),
value: last.data[1] value: last.data[1]
} }
}) })
@@ -1520,7 +1520,7 @@ export default {
const range = max.data[1] - min.data[1] const range = max.data[1] - min.data[1]
return { return {
element: last.element, element: last.element,
time: bus.timeFormate(new Date(last.data[0]), 'yyyy-MM-dd hh:mm:ss'), time: bus.timeFormate(new Date(last.data[0]), 'YYYY-MM-DD HH:mm:ss'),
value: range value: range
} }
}) })
@@ -1535,7 +1535,7 @@ export default {
const first = sort[copy.length - 1] const first = sort[copy.length - 1]
return { return {
element: last.element, element: last.element,
time: bus.timeFormate(new Date(last.data[0]), 'yyyy-MM-dd hh:mm:ss'), time: bus.timeFormate(new Date(last.data[0]), 'YYYY-MM-DD HH:mm:ss'),
value: last.data[1] - first.data[1] value: last.data[1] - first.data[1]
} }
}) })
@@ -1606,12 +1606,12 @@ export default {
let axiosArr = [] let axiosArr = []
const chartItem = this.chart const chartItem = this.chart
this.$nextTick(() => { this.$nextTick(() => {
let startTime = bus.timeFormate(this.searchTime[0], 'yyyy-MM-dd hh:mm:ss') let startTime = bus.timeFormate(this.searchTime[0], 'YYYY-MM-DD HH:mm:ss')
let endTime = bus.timeFormate(this.searchTime[1], 'yyyy-MM-dd hh:mm:ss') let endTime = bus.timeFormate(this.searchTime[1], 'YYYY-MM-DD HH:mm:ss')
if (!startTime || !endTime) { // 如果时间为空则默认取最近1小时 if (!startTime || !endTime) { // 如果时间为空则默认取最近1小时
const now = new Date() const now = new Date()
startTime = bus.timeFormate(now, 'yyyy-MM-dd hh:mm:ss') startTime = bus.timeFormate(now, 'YYYY-MM-DD HH:mm:ss')
endTime = bus.timeFormate(now.setHours(now.getHours() - 1), 'yyyy-MM-dd hh:mm:ss') endTime = bus.timeFormate(now.setHours(now.getHours() - 1), 'YYYY-MM-DD HH:mm:ss')
this.searchTime[0] = startTime this.searchTime[0] = startTime
this.searchTime[1] = endTime this.searchTime[1] = endTime
} }

View File

@@ -1613,8 +1613,8 @@ export default {
dateChange (time) { dateChange (time) {
const nowTimeType = this.$refs.pickTime.$refs.timePicker.nowTimeType const nowTimeType = this.$refs.pickTime.$refs.timePicker.nowTimeType
this.setSearchTime(nowTimeType.type, nowTimeType.value, nowTimeType) this.setSearchTime(nowTimeType.type, nowTimeType.value, nowTimeType)
this.filter.start_time = bus.timeFormate(this.searchTime[0], 'yyyy-MM-dd hh:mm:ss') this.filter.start_time = bus.timeFormate(this.searchTime[0], 'YYYY-MM-DD HH:mm:ss')
this.filter.end_time = bus.timeFormate(this.searchTime[1], 'yyyy-MM-dd hh:mm:ss') this.filter.end_time = bus.timeFormate(this.searchTime[1], 'YYYY-MM-DD HH:mm:ss')
this.filter.value = this.searchTime[2] this.filter.value = this.searchTime[2]
this.filter.id = this.$refs.pickTime.$refs.timePicker.showTime.id this.filter.id = this.$refs.pickTime.$refs.timePicker.showTime.id
// this.echartModalStore.clear() // this.echartModalStore.clear()
@@ -1628,20 +1628,20 @@ export default {
}, },
setSearchTime (type, val, nowTimeType) { // 设置searchTime setSearchTime (type, val, nowTimeType) { // 设置searchTime
if (type === 'minute') { if (type === 'minute') {
const startTime = bus.timeFormate(new Date(bus.computeTimezone(new Date().getTime())).setMinutes(new Date(bus.computeTimezone(new Date().getTime())).getMinutes() - val), 'yyyy-MM-dd hh:mm:ss') const startTime = bus.timeFormate(new Date(bus.computeTimezone(new Date().getTime())).setMinutes(new Date(bus.computeTimezone(new Date().getTime())).getMinutes() - val), 'YYYY-MM-DD HH:mm:ss')
const endTime = bus.timeFormate(new Date(bus.computeTimezone(new Date().getTime())), 'yyyy-MM-dd hh:mm:ss') const endTime = bus.timeFormate(new Date(bus.computeTimezone(new Date().getTime())), 'YYYY-MM-DD HH:mm:ss')
this.$set(this.searchTime, 0, startTime) this.$set(this.searchTime, 0, startTime)
this.$set(this.searchTime, 1, endTime) this.$set(this.searchTime, 1, endTime)
this.$set(this.searchTime, 2, val + 'm') this.$set(this.searchTime, 2, val + 'm')
} else if (type === 'hour') { } else if (type === 'hour') {
const startTime = bus.timeFormate(new Date(bus.computeTimezone(new Date().getTime())).setHours(new Date(bus.computeTimezone(new Date().getTime())).getHours() - val), 'yyyy-MM-dd hh:mm:ss') const startTime = bus.timeFormate(new Date(bus.computeTimezone(new Date().getTime())).setHours(new Date(bus.computeTimezone(new Date().getTime())).getHours() - val), 'YYYY-MM-DD HH:mm:ss')
const endTime = bus.timeFormate(new Date(bus.computeTimezone(new Date().getTime())), 'yyyy-MM-dd hh:mm:ss') const endTime = bus.timeFormate(new Date(bus.computeTimezone(new Date().getTime())), 'YYYY-MM-DD HH:mm:ss')
this.$set(this.searchTime, 0, startTime) this.$set(this.searchTime, 0, startTime)
this.$set(this.searchTime, 1, endTime) this.$set(this.searchTime, 1, endTime)
this.$set(this.searchTime, 2, val + 'h') this.$set(this.searchTime, 2, val + 'h')
} else if (type === 'date') { } else if (type === 'date') {
const startTime = bus.timeFormate(new Date(bus.computeTimezone(new Date().getTime())).setDate(new Date(bus.computeTimezone(new Date().getTime())).getDate() - val), 'yyyy-MM-dd hh:mm:ss') const startTime = bus.timeFormate(new Date(bus.computeTimezone(new Date().getTime())).setDate(new Date(bus.computeTimezone(new Date().getTime())).getDate() - val), 'YYYY-MM-DD HH:mm:ss')
const endTime = bus.timeFormate(new Date(bus.computeTimezone(new Date().getTime())), 'yyyy-MM-dd hh:mm:ss') const endTime = bus.timeFormate(new Date(bus.computeTimezone(new Date().getTime())), 'YYYY-MM-DD HH:mm:ss')
this.$set(this.searchTime, 0, startTime) this.$set(this.searchTime, 0, startTime)
this.$set(this.searchTime, 1, endTime) this.$set(this.searchTime, 1, endTime)
this.$set(this.searchTime, 2, val + 'd') this.$set(this.searchTime, 2, val + 'd')
@@ -1658,12 +1658,12 @@ export default {
const self = this const self = this
let axiosArr = [] let axiosArr = []
this.$nextTick(() => { this.$nextTick(() => {
let startTime = bus.timeFormate(this.searchTime[0], 'yyyy-MM-dd hh:mm:ss') let startTime = bus.timeFormate(this.searchTime[0], 'YYYY-MM-DD HH:mm:ss')
let endTime = bus.timeFormate(this.searchTime[1], 'yyyy-MM-dd hh:mm:ss') let endTime = bus.timeFormate(this.searchTime[1], 'YYYY-MM-DD HH:mm:ss')
if (!startTime || !endTime) { // 如果时间为空则默认取最近1小时 if (!startTime || !endTime) { // 如果时间为空则默认取最近1小时
const now = new Date() const now = new Date()
startTime = bus.timeFormate(now, 'yyyy-MM-dd hh:mm:ss') startTime = bus.timeFormate(now, 'YYYY-MM-DD HH:mm:ss')
endTime = bus.timeFormate(now.setHours(now.getHours() - 1), 'yyyy-MM-dd hh:mm:ss') endTime = bus.timeFormate(now.setHours(now.getHours() - 1), 'YYYY-MM-DD HH:mm:ss')
this.searchTime[0] = startTime this.searchTime[0] = startTime
this.searchTime[1] = endTime this.searchTime[1] = endTime
} }
@@ -1680,8 +1680,8 @@ export default {
return this.$get('/prom/api/v1/query_range?query=' + query + '&start=' + this.$stringTimeParseToUnix(startTime) + '&end=' + this.$stringTimeParseToUnix(endTime) + '&step=' + step) return this.$get('/prom/api/v1/query_range?query=' + query + '&start=' + this.$stringTimeParseToUnix(startTime) + '&end=' + this.$stringTimeParseToUnix(endTime) + '&step=' + step)
}) })
if (this.$refs.pickTime.$refs.multipleTime && this.$refs.pickTime.$refs.multipleTime.searchTime.length) { // 判断是否需要添加比较 if (this.$refs.pickTime.$refs.multipleTime && this.$refs.pickTime.$refs.multipleTime.searchTime.length) { // 判断是否需要添加比较
startTime = bus.timeFormate(this.$refs.pickTime.$refs.multipleTime.searchTime[0], 'yyyy-MM-dd hh:mm:ss') startTime = bus.timeFormate(this.$refs.pickTime.$refs.multipleTime.searchTime[0], 'YYYY-MM-DD HH:mm:ss')
endTime = bus.timeFormate(this.$refs.pickTime.$refs.multipleTime.searchTime[1], 'yyyy-MM-dd hh:mm:ss') endTime = bus.timeFormate(this.$refs.pickTime.$refs.multipleTime.searchTime[1], 'YYYY-MM-DD HH:mm:ss')
this.data.elements.forEach((ele) => { this.data.elements.forEach((ele) => {
const filterItem = ele const filterItem = ele
let query = encodeURIComponent(filterItem.expression) let query = encodeURIComponent(filterItem.expression)

View File

@@ -674,8 +674,8 @@ export default {
}) })
}, },
dateChange (time) { dateChange (time) {
this.filter.start_time = bus.timeFormate(this.searchTime[0], 'yyyy-MM-dd hh:mm:ss') this.filter.start_time = bus.timeFormate(this.searchTime[0], 'YYYY-MM-DD HH:mm:ss')
this.filter.end_time = bus.timeFormate(this.searchTime[1], 'yyyy-MM-dd hh:mm:ss') this.filter.end_time = bus.timeFormate(this.searchTime[1], 'YYYY-MM-DD HH:mm:ss')
// this.echartModalStore.clear() // this.echartModalStore.clear()
this.showLegend = false this.showLegend = false
this.$refs['localLoadingScreen' + this.chartIndex].startLoading() this.$refs['localLoadingScreen' + this.chartIndex].startLoading()

View File

@@ -438,8 +438,8 @@ export default {
bottom: null bottom: null
}, },
filterTime: [ filterTime: [
bus.timeFormate(bus.getOffsetTimezoneData(-1), 'yyyy-MM-dd hh:mm:ss'), bus.timeFormate(bus.getOffsetTimezoneData(-1), 'YYYY-MM-DD HH:mm:ss'),
bus.timeFormate(bus.getOffsetTimezoneData(), 'yyyy-MM-dd hh:mm:ss') bus.timeFormate(bus.getOffsetTimezoneData(), 'YYYY-MM-DD HH:mm:ss')
], ],
topologyInfo: { topologyInfo: {
fontSize: 14, fontSize: 14,
@@ -755,26 +755,26 @@ export default {
// const nowTimeType = this.$refs.pickTime.$refs.timePicker.nowTimeType // const nowTimeType = this.$refs.pickTime.$refs.timePicker.nowTimeType
// this.setSearchTime(nowTimeType.type, nowTimeType.value) // this.setSearchTime(nowTimeType.type, nowTimeType.value)
this.searchTime = bus.getTimezontDateRange() this.searchTime = bus.getTimezontDateRange()
this.filterTime[0] = bus.timeFormate(this.searchTime[0], 'yyyy-MM-dd hh:mm:ss') this.filterTime[0] = bus.timeFormate(this.searchTime[0], 'YYYY-MM-DD HH:mm:ss')
this.filterTime[1] = bus.timeFormate(this.searchTime[1], 'yyyy-MM-dd hh:mm:ss') this.filterTime[1] = bus.timeFormate(this.searchTime[1], 'YYYY-MM-DD HH:mm:ss')
this.reload() this.reload()
}, },
setSearchTime (type, val) { // 设置searchTime setSearchTime (type, val) { // 设置searchTime
if (type === 'minute') { if (type === 'minute') {
const startTime = bus.timeFormate(new Date(bus.computeTimezone(new Date().getTime())).setMinutes(new Date(bus.computeTimezone(new Date().getTime())).getMinutes() - val), 'yyyy-MM-dd hh:mm:ss') const startTime = bus.timeFormate(new Date(bus.computeTimezone(new Date().getTime())).setMinutes(new Date(bus.computeTimezone(new Date().getTime())).getMinutes() - val), 'YYYY-MM-DD HH:mm:ss')
const endTime = bus.timeFormate(new Date(bus.computeTimezone(new Date().getTime())), 'yyyy-MM-dd hh:mm:ss') const endTime = bus.timeFormate(new Date(bus.computeTimezone(new Date().getTime())), 'YYYY-MM-DD HH:mm:ss')
this.$set(this.searchTime, 0, startTime) this.$set(this.searchTime, 0, startTime)
this.$set(this.searchTime, 1, endTime) this.$set(this.searchTime, 1, endTime)
this.$set(this.searchTime, 2, val + 'm') this.$set(this.searchTime, 2, val + 'm')
} else if (type === 'hour') { } else if (type === 'hour') {
const startTime = bus.timeFormate(new Date(bus.computeTimezone(new Date().getTime())).setHours(new Date(bus.computeTimezone(new Date().getTime())).getHours() - val), 'yyyy-MM-dd hh:mm:ss') const startTime = bus.timeFormate(new Date(bus.computeTimezone(new Date().getTime())).setHours(new Date(bus.computeTimezone(new Date().getTime())).getHours() - val), 'YYYY-MM-DD HH:mm:ss')
const endTime = bus.timeFormate(new Date(bus.computeTimezone(new Date().getTime())), 'yyyy-MM-dd hh:mm:ss') const endTime = bus.timeFormate(new Date(bus.computeTimezone(new Date().getTime())), 'YYYY-MM-DD HH:mm:ss')
this.$set(this.searchTime, 0, startTime) this.$set(this.searchTime, 0, startTime)
this.$set(this.searchTime, 1, endTime) this.$set(this.searchTime, 1, endTime)
this.$set(this.searchTime, 2, val + 'h') this.$set(this.searchTime, 2, val + 'h')
} else if (type === 'date') { } else if (type === 'date') {
const startTime = bus.timeFormate(new Date(bus.computeTimezone(new Date().getTime())).setDate(new Date(bus.computeTimezone(new Date().getTime())).getDate() - val), 'yyyy-MM-dd hh:mm:ss') const startTime = bus.timeFormate(new Date(bus.computeTimezone(new Date().getTime())).setDate(new Date(bus.computeTimezone(new Date().getTime())).getDate() - val), 'YYYY-MM-DD HH:mm:ss')
const endTime = bus.timeFormate(new Date(bus.computeTimezone(new Date().getTime())), 'yyyy-MM-dd hh:mm:ss') const endTime = bus.timeFormate(new Date(bus.computeTimezone(new Date().getTime())), 'YYYY-MM-DD HH:mm:ss')
this.$set(this.searchTime, 0, startTime) this.$set(this.searchTime, 0, startTime)
this.$set(this.searchTime, 1, endTime) this.$set(this.searchTime, 1, endTime)
this.$set(this.searchTime, 2, val + 'd') this.$set(this.searchTime, 2, val + 'd')

View File

@@ -127,7 +127,7 @@ export default {
timeout: null, timeout: null,
formatTime: '', formatTime: '',
hideSameLabels: true, hideSameLabels: true,
endpointQueryTime: localStorage.getItem('nz-default-dateFormat') ? localStorage.getItem('nz-default-dateFormat') : 'yyyy-MM-dd hh:mm:ss' endpointQueryTime: localStorage.getItem('nz-default-dateFormat') ? localStorage.getItem('nz-default-dateFormat') : 'YYYY-MM-DD HH:mm:ss'
} }
}, },
methods: { methods: {

View File

@@ -175,7 +175,7 @@ export default {
scrollTop: 0, scrollTop: 0,
scrollbarWrap: null, scrollbarWrap: null,
minusTime: 0, minusTime: 0,
endpointQueryTabTime: localStorage.getItem('nz-default-dateFormat') ? localStorage.getItem('nz-default-dateFormat') : 'yyyy-MM-dd hh:mm:ss' endpointQueryTabTime: localStorage.getItem('nz-default-dateFormat') ? localStorage.getItem('nz-default-dateFormat') : 'YYYY-MM-DD HH:mm:ss'
} }
}, },
methods: { methods: {
@@ -453,8 +453,8 @@ export default {
axiosArr.push(axios.get('/prom/api/v1/query_range?query=' + encodeURIComponent(endpoint.element) + '&start=' + this.$stringTimeParseToUnix(start) + '&end=' + this.$stringTimeParseToUnix(end) + '&step=' + step)) axiosArr.push(axios.get('/prom/api/v1/query_range?query=' + encodeURIComponent(endpoint.element) + '&start=' + this.$stringTimeParseToUnix(start) + '&end=' + this.$stringTimeParseToUnix(end) + '&step=' + step))
} }
if (this.$refs.pickTime && this.$refs.pickTime.$refs.multipleTime && this.$refs.pickTime.$refs.multipleTime.searchTime.length) { // 判断是否需要添加比较 if (this.$refs.pickTime && this.$refs.pickTime.$refs.multipleTime && this.$refs.pickTime.$refs.multipleTime.searchTime.length) { // 判断是否需要添加比较
const startTime = bus.timeFormate(this.$refs.pickTime.$refs.multipleTime.searchTime[0], 'yyyy-MM-dd hh:mm:ss') const startTime = bus.timeFormate(this.$refs.pickTime.$refs.multipleTime.searchTime[0], 'YYYY-MM-DD HH:mm:ss')
const endTime = bus.timeFormate(this.$refs.pickTime.$refs.multipleTime.searchTime[1], 'yyyy-MM-dd hh:mm:ss') const endTime = bus.timeFormate(this.$refs.pickTime.$refs.multipleTime.searchTime[1], 'YYYY-MM-DD HH:mm:ss')
for (const endpoint of this.selectedEndpoints) { for (const endpoint of this.selectedEndpoints) {
axiosArr.push(axios.get('/prom/api/v1/query_range?query=' + encodeURIComponent(endpoint.element) + '&start=' + this.$stringTimeParseToUnix(startTime) + '&end=' + this.$stringTimeParseToUnix(endTime) + '&step=' + step)) axiosArr.push(axios.get('/prom/api/v1/query_range?query=' + encodeURIComponent(endpoint.element) + '&start=' + this.$stringTimeParseToUnix(startTime) + '&end=' + this.$stringTimeParseToUnix(endTime) + '&step=' + step))
} }

View File

@@ -58,8 +58,8 @@ export default {
return { return {
logData: null, logData: null,
filterTime: [ filterTime: [
bus.timeFormate(bus.getOffsetTimezoneData(-1), 'yyyy-MM-dd hh:mm:ss'), bus.timeFormate(bus.getOffsetTimezoneData(-1), 'YYYY-MM-DD HH:mm:ss'),
bus.timeFormate(bus.getOffsetTimezoneData(), 'yyyy-MM-dd hh:mm:ss') bus.timeFormate(bus.getOffsetTimezoneData(), 'YYYY-MM-DD HH:mm:ss')
], ],
expressions: [''], expressions: [''],
matchSymbol: '|=', matchSymbol: '|=',

View File

@@ -453,8 +453,8 @@ export default {
this.chartListLoading = true this.chartListLoading = true
if (params.start_time === '' || params.end_time === '') { if (params.start_time === '' || params.end_time === '') {
const now = bus.getTimezontDateRange() const now = bus.getTimezontDateRange()
const endTimeTmp = bus.timeFormate(now[1].getTime(), 'yyyy-MM-dd hh:mm:ss') const endTimeTmp = bus.timeFormate(now[1].getTime(), 'YYYY-MM-DD HH:mm:ss')
const startTimeTmp = bus.timeFormate(now[0].getTime(), 'yyyy-MM-dd hh:mm:ss') const startTimeTmp = bus.timeFormate(now[0].getTime(), 'YYYY-MM-DD HH:mm:ss')
params.start_time = startTimeTmp params.start_time = startTimeTmp
params.end_time = endTimeTmp params.end_time = endTimeTmp
params.from = this.from params.from = this.from
@@ -487,8 +487,8 @@ export default {
const nowTimeType = this.$refs.pickTime.$refs.timePicker.nowTimeType const nowTimeType = this.$refs.pickTime.$refs.timePicker.nowTimeType
this.nowTimeType = this.$refs.pickTime.$refs.timePicker.nowTimeType this.nowTimeType = this.$refs.pickTime.$refs.timePicker.nowTimeType
this.setSearchTime(nowTimeType.type, nowTimeType.value) this.setSearchTime(nowTimeType.type, nowTimeType.value)
this.filter.start_time = bus.timeFormate(this.searchTime[0], 'yyyy-MM-dd hh:mm:ss') this.filter.start_time = bus.timeFormate(this.searchTime[0], 'YYYY-MM-DD HH:mm:ss')
this.filter.end_time = bus.timeFormate(this.searchTime[1], 'yyyy-MM-dd hh:mm:ss') this.filter.end_time = bus.timeFormate(this.searchTime[1], 'YYYY-MM-DD HH:mm:ss')
this.filter.panelId = this.showPanel.id this.filter.panelId = this.showPanel.id
this.getData(this.filter) this.getData(this.filter)
} }
@@ -496,20 +496,20 @@ export default {
/* 时间条件查询--end */ /* 时间条件查询--end */
setSearchTime (type, val) { // 设置searchTime setSearchTime (type, val) { // 设置searchTime
if (type === 'minute') { if (type === 'minute') {
const startTime = bus.timeFormate(new Date(bus.computeTimezone(new Date().getTime())).setMinutes(new Date(bus.computeTimezone(new Date().getTime())).getMinutes() - val), 'yyyy-MM-dd hh:mm:ss') const startTime = bus.timeFormate(new Date(bus.computeTimezone(new Date().getTime())).setMinutes(new Date(bus.computeTimezone(new Date().getTime())).getMinutes() - val), 'YYYY-MM-DD HH:mm:ss')
const endTime = bus.timeFormate(new Date(bus.computeTimezone(new Date().getTime())), 'yyyy-MM-dd hh:mm:ss') const endTime = bus.timeFormate(new Date(bus.computeTimezone(new Date().getTime())), 'YYYY-MM-DD HH:mm:ss')
this.$set(this.searchTime, 0, startTime) this.$set(this.searchTime, 0, startTime)
this.$set(this.searchTime, 1, endTime) this.$set(this.searchTime, 1, endTime)
this.$set(this.searchTime, 2, val + 'm') this.$set(this.searchTime, 2, val + 'm')
} else if (type === 'hour') { } else if (type === 'hour') {
const startTime = bus.timeFormate(new Date(bus.computeTimezone(new Date().getTime())).setHours(new Date(bus.computeTimezone(new Date().getTime())).getHours() - val), 'yyyy-MM-dd hh:mm:ss') const startTime = bus.timeFormate(new Date(bus.computeTimezone(new Date().getTime())).setHours(new Date(bus.computeTimezone(new Date().getTime())).getHours() - val), 'YYYY-MM-DD HH:mm:ss')
const endTime = bus.timeFormate(new Date(bus.computeTimezone(new Date().getTime())), 'yyyy-MM-dd hh:mm:ss') const endTime = bus.timeFormate(new Date(bus.computeTimezone(new Date().getTime())), 'YYYY-MM-DD HH:mm:ss')
this.$set(this.searchTime, 0, startTime) this.$set(this.searchTime, 0, startTime)
this.$set(this.searchTime, 1, endTime) this.$set(this.searchTime, 1, endTime)
this.$set(this.searchTime, 2, val + 'h') this.$set(this.searchTime, 2, val + 'h')
} else if (type === 'date') { } else if (type === 'date') {
const startTime = bus.timeFormate(new Date(bus.computeTimezone(new Date().getTime())).setDate(new Date(bus.computeTimezone(new Date().getTime())).getDate() - val), 'yyyy-MM-dd hh:mm:ss') const startTime = bus.timeFormate(new Date(bus.computeTimezone(new Date().getTime())).setDate(new Date(bus.computeTimezone(new Date().getTime())).getDate() - val), 'YYYY-MM-DD HH:mm:ss')
const endTime = bus.timeFormate(new Date(bus.computeTimezone(new Date().getTime())), 'yyyy-MM-dd hh:mm:ss') const endTime = bus.timeFormate(new Date(bus.computeTimezone(new Date().getTime())), 'YYYY-MM-DD HH:mm:ss')
this.$set(this.searchTime, 0, startTime) this.$set(this.searchTime, 0, startTime)
this.$set(this.searchTime, 1, endTime) this.$set(this.searchTime, 1, endTime)
this.$set(this.searchTime, 2, val + 'd') this.$set(this.searchTime, 2, val + 'd')

View File

@@ -392,7 +392,7 @@ export function calcDurationByStringTimeMs (startTime, endTime) {
return result return result
} }
export function unixTimeParseToString (unixTime, fmt = 'yyyy-MM-dd hh:mm:ss') { export function unixTimeParseToString (unixTime, fmt = 'YYYY-MM-DD HH:mm:ss') {
const date = new Date(unixTime * 1000) const date = new Date(unixTime * 1000)
const o = { const o = {
'M+': date.getMonth() + 1, // 月份 'M+': date.getMonth() + 1, // 月份

View File

@@ -245,8 +245,8 @@ export default {
localStorage.setItem('dataList-layout' + this.tableId, JSON.stringify(this.dataListLayout)) localStorage.setItem('dataList-layout' + this.tableId, JSON.stringify(this.dataListLayout))
}, },
addSilence (row, type) { addSilence (row, type) {
this.blankSilenceObject.startAt = bus.timeFormate(bus.getOffsetTimezoneData(), 'yyyy-MM-dd hh:mm:ss') this.blankSilenceObject.startAt = bus.timeFormate(bus.getOffsetTimezoneData(), 'YYYY-MM-DD HH:mm:ss')
this.blankSilenceObject.endAt = bus.timeFormate(bus.getOffsetTimezoneData(1), 'yyyy-MM-dd hh:mm:ss') this.blankSilenceObject.endAt = bus.timeFormate(bus.getOffsetTimezoneData(1), 'YYYY-MM-DD HH:mm:ss')
this.objectSilence = JSON.parse(JSON.stringify(this.blankSilenceObject)) this.objectSilence = JSON.parse(JSON.stringify(this.blankSilenceObject))
this.objectSilence.name = 'Quick silence' this.objectSilence.name = 'Quick silence'
if (type !== 'alertMessage' && type !== 'alertRule') { if (type !== 'alertMessage' && type !== 'alertRule') {

View File

@@ -160,7 +160,7 @@ export default {
isPopoverDisabled: false, isPopoverDisabled: false,
isCustom: false, isCustom: false,
valueArr: [], valueArr: [],
multipleTime: localStorage.getItem('nz-default-dateFormat') ? localStorage.getItem('nz-default-dateFormat') : 'yyyy-MM-dd hh:mm:ss' multipleTime: localStorage.getItem('nz-default-dateFormat') ? localStorage.getItem('nz-default-dateFormat') : 'YYYY-MM-DD HH:mm:ss'
} }
}, },
watch: { watch: {

View File

@@ -109,13 +109,13 @@ const NewPopper = {
const DEFAULT_FORMATS = { const DEFAULT_FORMATS = {
date: 'yyyy-MM-dd', date: 'yyyy-MM-dd',
month: 'yyyy-MM', month: 'yyyy-MM',
datetime: 'yyyy-MM-dd HH:mm:ss', datetime: 'YYYY-MM-DD HH:mm:ss',
time: 'HH:mm:ss', time: 'HH:mm:ss',
week: 'yyyywWW', week: 'yyyywWW',
timerange: 'HH:mm:ss', timerange: 'HH:mm:ss',
daterange: 'yyyy-MM-dd', daterange: 'yyyy-MM-dd',
monthrange: 'yyyy-MM', monthrange: 'yyyy-MM',
datetimerange: 'yyyy-MM-dd HH:mm:ss', datetimerange: 'YYYY-MM-DD HH:mm:ss',
year: 'yyyy' year: 'yyyy'
} }
const HAVE_TRIGGER_TYPES = [ const HAVE_TRIGGER_TYPES = [

View File

@@ -81,7 +81,7 @@ export default {
themeColor: '' themeColor: ''
}, },
timer: '', timer: '',
pickTimer: localStorage.getItem('nz-default-dateFormat') ? localStorage.getItem('nz-default-dateFormat') : 'yyyy-MM-dd hh:mm:ss', pickTimer: localStorage.getItem('nz-default-dateFormat') ? localStorage.getItem('nz-default-dateFormat') : 'YYYY-MM-DD HH:mm:ss',
} }
}, },
created () { created () {

View File

@@ -77,10 +77,10 @@ export default {
chartDataTemp: { id: 8832, prev: null, next: null, panelId: 0, title: '123', span: 12, height: 0, createAt: '2021-01-27 07:36:19', unit: 2, weight: 0, pid: null, buildIn: null, seq: null, param: { last: 0, legendValue: { total: 'off', min: 'off', avg: 'off', last: 'off', max: 'off' }, threshold: '', url: '', nullType: 'null' }, sync: null, asset: null, isLoaded: true, from: '__vue_devtool_undefined__', draggable: true, resizable: true, editable: true }, chartDataTemp: { id: 8832, prev: null, next: null, panelId: 0, title: '123', span: 12, height: 0, createAt: '2021-01-27 07:36:19', unit: 2, weight: 0, pid: null, buildIn: null, seq: null, param: { last: 0, legendValue: { total: 'off', min: 'off', avg: 'off', last: 'off', max: 'off' }, threshold: '', url: '', nullType: 'null' }, sync: null, asset: null, isLoaded: true, from: '__vue_devtool_undefined__', draggable: true, resizable: true, editable: true },
chartData: {}, chartData: {},
filter: { filter: {
end_time: bus.timeFormate(bus.getOffsetTimezoneData(), 'yyyy-MM-dd hh:mm:ss'), end_time: bus.timeFormate(bus.getOffsetTimezoneData(), 'YYYY-MM-DD HH:mm:ss'),
panelId: 0, panelId: 0,
searchName: '', searchName: '',
start_time: bus.timeFormate(bus.getOffsetTimezoneData(-1), 'yyyy-MM-dd hh:mm:ss') start_time: bus.timeFormate(bus.getOffsetTimezoneData(-1), 'YYYY-MM-DD HH:mm:ss')
} }
} }
}, },
@@ -131,8 +131,8 @@ export default {
}) })
} else { } else {
const panelTime = localStorage.getItem('panelTime') ? JSON.parse(localStorage.getItem('panelTime')) : ['', ''] const panelTime = localStorage.getItem('panelTime') ? JSON.parse(localStorage.getItem('panelTime')) : ['', '']
const endTime = panelTime[1] || bus.timeFormate(bus.getOffsetTimezoneData(), 'yyyy-MM-dd hh:mm:ss') const endTime = panelTime[1] || bus.timeFormate(bus.getOffsetTimezoneData(), 'YYYY-MM-DD HH:mm:ss')
const startTime = panelTime[0] || bus.timeFormate(bus.getOffsetTimezoneData(-1), 'yyyy-MM-dd hh:mm:ss') const startTime = panelTime[0] || bus.timeFormate(bus.getOffsetTimezoneData(-1), 'YYYY-MM-DD HH:mm:ss')
const step = bus.getStep(startTime, endTime) const step = bus.getStep(startTime, endTime)
this.$nextTick(() => { this.$nextTick(() => {
const axiosArr = chartItem.elements.map((ele) => { const axiosArr = chartItem.elements.map((ele) => {
@@ -322,7 +322,7 @@ export default {
} }
*/ */
// let t_date = new Date(dpsItem[0] * 1000); // let t_date = new Date(dpsItem[0] * 1000);
// let timeTmp = bus.timeFormate(t_date, 'yyyy-MM-dd hh:mm:ss'); // let timeTmp = bus.timeFormate(t_date, 'YYYY-MM-DD HH:mm:ss');
tableData.push({ // 表格数据 tableData.push({ // 表格数据
// label: host.slice(host.indexOf('{') + 1,host.indexOf('}')),//label // label: host.slice(host.indexOf('{') + 1,host.indexOf('}')),//label
// metric: queryItem.metric.__name__?queryItem.metric.__name__:'',//metric列 // metric: queryItem.metric.__name__?queryItem.metric.__name__:'',//metric列

View File

@@ -194,8 +194,8 @@ export default {
this.$set(this.searchLabel, 'pageSize', this.pageObj.pageSize) this.$set(this.searchLabel, 'pageSize', this.pageObj.pageSize)
this.$set(this.searchLabel, 'moduleIds', this.moduleId) this.$set(this.searchLabel, 'moduleIds', this.moduleId)
if (this.searchTime && this.searchTime.length > 1) { if (this.searchTime && this.searchTime.length > 1) {
this.$set(this.searchLabel, 'startAt', bus.timeFormate(this.searchTime[0], 'yyyy-MM-dd hh:mm:ss')) this.$set(this.searchLabel, 'startAt', bus.timeFormate(this.searchTime[0], 'YYYY-MM-DD HH:mm:ss'))
this.$set(this.searchLabel, 'endAt', bus.timeFormate(this.searchTime[1], 'yyyy-MM-dd hh:mm:ss')) this.$set(this.searchLabel, 'endAt', bus.timeFormate(this.searchTime[1], 'YYYY-MM-DD HH:mm:ss'))
} else { } else {
delete this.searchLabel.startAt delete this.searchLabel.startAt
delete this.searchLabel.endAt delete this.searchLabel.endAt

View File

@@ -396,8 +396,8 @@ export default {
bottom: null bottom: null
}, },
filterTime: [ filterTime: [
bus.timeFormate(bus.getOffsetTimezoneData(-1), 'yyyy-MM-dd hh:mm:ss'), bus.timeFormate(bus.getOffsetTimezoneData(-1), 'YYYY-MM-DD HH:mm:ss'),
bus.timeFormate(bus.getOffsetTimezoneData(), 'yyyy-MM-dd hh:mm:ss') bus.timeFormate(bus.getOffsetTimezoneData(), 'YYYY-MM-DD HH:mm:ss')
], ],
showNoData: false, showNoData: false,
topologyInfo: { topologyInfo: {
@@ -742,26 +742,26 @@ export default {
// const nowTimeType = this.$refs.pickTime.$refs.timePicker.nowTimeType // const nowTimeType = this.$refs.pickTime.$refs.timePicker.nowTimeType
// this.setSearchTime(nowTimeType.type, nowTimeType.value) // this.setSearchTime(nowTimeType.type, nowTimeType.value)
this.searchTime = bus.getTimezontDateRange() this.searchTime = bus.getTimezontDateRange()
this.filterTime[0] = bus.timeFormate(this.searchTime[0], 'yyyy-MM-dd hh:mm:ss') this.filterTime[0] = bus.timeFormate(this.searchTime[0], 'YYYY-MM-DD HH:mm:ss')
this.filterTime[1] = bus.timeFormate(this.searchTime[1], 'yyyy-MM-dd hh:mm:ss') this.filterTime[1] = bus.timeFormate(this.searchTime[1], 'YYYY-MM-DD HH:mm:ss')
this.reload() this.reload()
}, },
setSearchTime (type, val) { // 设置searchTime setSearchTime (type, val) { // 设置searchTime
if (type === 'minute') { if (type === 'minute') {
const startTime = bus.timeFormate(new Date(bus.computeTimezone(new Date().getTime())).setMinutes(new Date(bus.computeTimezone(new Date().getTime())).getMinutes() - val), 'yyyy-MM-dd hh:mm:ss') const startTime = bus.timeFormate(new Date(bus.computeTimezone(new Date().getTime())).setMinutes(new Date(bus.computeTimezone(new Date().getTime())).getMinutes() - val), 'YYYY-MM-DD HH:mm:ss')
const endTime = bus.timeFormate(new Date(bus.computeTimezone(new Date().getTime())), 'yyyy-MM-dd hh:mm:ss') const endTime = bus.timeFormate(new Date(bus.computeTimezone(new Date().getTime())), 'YYYY-MM-DD HH:mm:ss')
this.$set(this.searchTime, 0, startTime) this.$set(this.searchTime, 0, startTime)
this.$set(this.searchTime, 1, endTime) this.$set(this.searchTime, 1, endTime)
this.$set(this.searchTime, 2, val + 'm') this.$set(this.searchTime, 2, val + 'm')
} else if (type === 'hour') { } else if (type === 'hour') {
const startTime = bus.timeFormate(new Date(bus.computeTimezone(new Date().getTime())).setHours(new Date(bus.computeTimezone(new Date().getTime())).getHours() - val), 'yyyy-MM-dd hh:mm:ss') const startTime = bus.timeFormate(new Date(bus.computeTimezone(new Date().getTime())).setHours(new Date(bus.computeTimezone(new Date().getTime())).getHours() - val), 'YYYY-MM-DD HH:mm:ss')
const endTime = bus.timeFormate(new Date(bus.computeTimezone(new Date().getTime())), 'yyyy-MM-dd hh:mm:ss') const endTime = bus.timeFormate(new Date(bus.computeTimezone(new Date().getTime())), 'YYYY-MM-DD HH:mm:ss')
this.$set(this.searchTime, 0, startTime) this.$set(this.searchTime, 0, startTime)
this.$set(this.searchTime, 1, endTime) this.$set(this.searchTime, 1, endTime)
this.$set(this.searchTime, 2, val + 'h') this.$set(this.searchTime, 2, val + 'h')
} else if (type === 'date') { } else if (type === 'date') {
const startTime = bus.timeFormate(new Date(bus.computeTimezone(new Date().getTime())).setDate(new Date(bus.computeTimezone(new Date().getTime())).getDate() - val), 'yyyy-MM-dd hh:mm:ss') const startTime = bus.timeFormate(new Date(bus.computeTimezone(new Date().getTime())).setDate(new Date(bus.computeTimezone(new Date().getTime())).getDate() - val), 'YYYY-MM-DD HH:mm:ss')
const endTime = bus.timeFormate(new Date(bus.computeTimezone(new Date().getTime())), 'yyyy-MM-dd hh:mm:ss') const endTime = bus.timeFormate(new Date(bus.computeTimezone(new Date().getTime())), 'YYYY-MM-DD HH:mm:ss')
this.$set(this.searchTime, 0, startTime) this.$set(this.searchTime, 0, startTime)
this.$set(this.searchTime, 1, endTime) this.$set(this.searchTime, 1, endTime)
this.$set(this.searchTime, 2, val + 'd') this.$set(this.searchTime, 2, val + 'd')

View File

@@ -210,7 +210,7 @@ export default {
endpointData: null, endpointData: null,
startAtTamp: '', startAtTamp: '',
endAtTamp: '', endAtTamp: '',
alertSilenceTime: localStorage.getItem('nz-default-dateFormat') ? localStorage.getItem('nz-default-dateFormat') : 'yyyy-MM-dd hh:mm:ss' alertSilenceTime: localStorage.getItem('nz-default-dateFormat') ? localStorage.getItem('nz-default-dateFormat') : 'YYYY-MM-DD HH:mm:ss'
} }
}, },
mounted () { mounted () {
@@ -295,10 +295,10 @@ export default {
}, },
dateChange (val, type) { dateChange (val, type) {
if (type === 'startAt') { if (type === 'startAt') {
this.editAlertSilence.startAt = bus.timeFormate(new Date(val), localStorage.getItem('nz-default-dateFormat') ? localStorage.getItem('nz-default-dateFormat') : 'yyyy-MM-dd hh:mm:ss') this.editAlertSilence.startAt = bus.timeFormate(new Date(val), localStorage.getItem('nz-default-dateFormat') ? localStorage.getItem('nz-default-dateFormat') : 'YYYY-MM-DD HH:mm:ss')
this.startAtTamp = new Date(val).getTime() this.startAtTamp = new Date(val).getTime()
} else if (type === 'endAt') { } else if (type === 'endAt') {
this.editAlertSilence.endAt = bus.timeFormate(new Date(val), localStorage.getItem('nz-default-dateFormat') ? localStorage.getItem('nz-default-dateFormat') : 'yyyy-MM-dd hh:mm:ss') this.editAlertSilence.endAt = bus.timeFormate(new Date(val), localStorage.getItem('nz-default-dateFormat') ? localStorage.getItem('nz-default-dateFormat') : 'YYYY-MM-DD HH:mm:ss')
this.endAtTamp = new Date(val).getTime() this.endAtTamp = new Date(val).getTime()
} }
this.$forceUpdate() this.$forceUpdate()
@@ -313,7 +313,7 @@ export default {
} }
}, },
rangeTimeChange (val) { rangeTimeChange (val) {
const arr = [bus.timeFormate(bus.getOffsetTimezoneData(), localStorage.getItem('nz-default-dateFormat') ? localStorage.getItem('nz-default-dateFormat') : 'yyyy-MM-dd hh:mm:ss'), bus.timeFormate(bus.getOffsetTimezoneData(val * 1), localStorage.getItem('nz-default-dateFormat') ? localStorage.getItem('nz-default-dateFormat') : 'yyyy-MM-dd hh:mm:ss')] const arr = [bus.timeFormate(bus.getOffsetTimezoneData(), localStorage.getItem('nz-default-dateFormat') ? localStorage.getItem('nz-default-dateFormat') : 'YYYY-MM-DD HH:mm:ss'), bus.timeFormate(bus.getOffsetTimezoneData(val * 1), localStorage.getItem('nz-default-dateFormat') ? localStorage.getItem('nz-default-dateFormat') : 'YYYY-MM-DD HH:mm:ss')]
this.$set(this.editAlertSilence, 'startAt', arr[0]) this.$set(this.editAlertSilence, 'startAt', arr[0])
this.$set(this.editAlertSilence, 'endAt', arr[1]) this.$set(this.editAlertSilence, 'endAt', arr[1])
this.startAtTamp = new Date(this.editAlertSilence.startAt).getTime() this.startAtTamp = new Date(this.editAlertSilence.startAt).getTime()

View File

@@ -67,7 +67,7 @@ export default {
return { return {
isPopoverDisabled: false, isPopoverDisabled: false,
isCustom: false, isCustom: false,
timePicker: localStorage.getItem('nz-default-dateFormat') ? localStorage.getItem('nz-default-dateFormat') : 'yyyy-MM-dd hh:mm:ss', timePicker: localStorage.getItem('nz-default-dateFormat') ? localStorage.getItem('nz-default-dateFormat') : 'YYYY-MM-DD HH:mm:ss',
searchTime: [ searchTime: [
bus.timeFormate(bus.getOffsetTimezoneData(-1), this.timePicker), bus.timeFormate(bus.getOffsetTimezoneData(-1), this.timePicker),
bus.timeFormate(bus.getOffsetTimezoneData(), this.timePicker) bus.timeFormate(bus.getOffsetTimezoneData(), this.timePicker)

View File

@@ -190,8 +190,8 @@ export default {
}) })
}, },
add () { add () {
this.blankObject.startAt = bus.timeFormate(bus.getOffsetTimezoneData(), 'yyyy-MM-dd hh:mm:ss') this.blankObject.startAt = bus.timeFormate(bus.getOffsetTimezoneData(), 'YYYY-MM-DD HH:mm:ss')
this.blankObject.endAt = bus.timeFormate(bus.getOffsetTimezoneData(1), 'yyyy-MM-dd hh:mm:ss') this.blankObject.endAt = bus.timeFormate(bus.getOffsetTimezoneData(1), 'YYYY-MM-DD HH:mm:ss')
this.object = JSON.parse(JSON.stringify(this.blankObject)) this.object = JSON.parse(JSON.stringify(this.blankObject))
this.rightBox.show = true this.rightBox.show = true
}, },

View File

@@ -404,7 +404,7 @@ export default {
system_logo: '', system_logo: '',
current_site_url: '', current_site_url: '',
timezone: '', timezone: '',
date_format: 'yyyy-MM-dd HH:mm:ss', date_format: 'YYYY-MM-DD HH:mm:ss',
theme: 'Light', theme: 'Light',
default_cabinet_usize: '', default_cabinet_usize: '',
query_max_series: '', query_max_series: '',
@@ -586,9 +586,9 @@ export default {
{ value: 'dark', label: 'Dark' } { value: 'dark', label: 'Dark' }
], ],
dateFormatList: [ dateFormatList: [
{ value: 'dd/MM/yyyy HH:mm:ss', label: 'dd/MM/yyyy HH:mm:ss' }, { value: 'DD/MM/YYYY HH:mm:ss', label: 'DD/MM/YYYY HH:mm:ss' },
{ value: 'MM/dd/yyyy HH:mm:ss', label: 'MM/dd/yyyy HH:mm:ss' }, { value: 'MM/DD/YYYY HH:mm:ss', label: 'MM/DD/YYYY HH:mm:ss' },
{ value: 'yyyy-MM-dd HH:mm:ss', label: 'yyyy-MM-dd HH:mm:ss' } { value: 'YYYY-MM-DD HH:mm:ss', label: 'YYYY-MM-DD HH:mm:ss' }
] ]
} }
}, },

View File

@@ -166,7 +166,7 @@ export default {
return time.getTime() < Date.now() - 24 * 60 * 60 * 1000 return time.getTime() < Date.now() - 24 * 60 * 60 * 1000
} }
}, },
apiKeyTableTime: localStorage.getItem('nz-default-dateFormat') ? localStorage.getItem('nz-default-dateFormat') : 'yyyy-MM-dd hh:mm:ss' apiKeyTableTime: localStorage.getItem('nz-default-dateFormat') ? localStorage.getItem('nz-default-dateFormat') : 'YYYY-MM-DD HH:mm:ss'
} }
}, },
methods: { methods: {

View File

@@ -380,8 +380,8 @@ export default {
promqlKeys: [], promqlKeys: [],
expressions: [''], expressions: [''],
filterTime: [ filterTime: [
bus.timeFormate(bus.getOffsetTimezoneData(-1), 'yyyy-MM-dd hh:mm:ss'), bus.timeFormate(bus.getOffsetTimezoneData(-1), 'YYYY-MM-DD HH:mm:ss'),
bus.timeFormate(bus.getOffsetTimezoneData(), 'yyyy-MM-dd hh:mm:ss') bus.timeFormate(bus.getOffsetTimezoneData(), 'YYYY-MM-DD HH:mm:ss')
], ],
/* 工具参数 */ /* 工具参数 */
@@ -754,7 +754,7 @@ export default {
} }
this.$set(metrics, 'value#' + index, chartDataFormat.getUnit(this.chartUnit || 2).compute(result.value[1], null, 2)) this.$set(metrics, 'value#' + index, chartDataFormat.getUnit(this.chartUnit || 2).compute(result.value[1], null, 2))
this.$set(metrics, 'time', bus.timeFormate(bus.computeTimezone(result.value[0] * 1000), 'yyyy-MM-dd hh:mm:ss')) this.$set(metrics, 'time', bus.timeFormate(bus.computeTimezone(result.value[0] * 1000), 'YYYY-MM-DD HH:mm:ss'))
for (const key in metrics) { for (const key in metrics) {
const label = { const label = {
label: key, label: key,
@@ -824,20 +824,20 @@ export default {
}, },
setSearchTime (type, val) { // 设置searchTime setSearchTime (type, val) { // 设置searchTime
if (type === 'minute') { if (type === 'minute') {
const startTime = bus.timeFormate(new Date(bus.computeTimezone(new Date().getTime())).setMinutes(new Date(bus.computeTimezone(new Date().getTime())).getMinutes() - val), 'yyyy-MM-dd hh:mm:ss') const startTime = bus.timeFormate(new Date(bus.computeTimezone(new Date().getTime())).setMinutes(new Date(bus.computeTimezone(new Date().getTime())).getMinutes() - val), 'YYYY-MM-DD HH:mm:ss')
const endTime = bus.timeFormate(new Date(bus.computeTimezone(new Date().getTime())), 'yyyy-MM-dd hh:mm:ss') const endTime = bus.timeFormate(new Date(bus.computeTimezone(new Date().getTime())), 'YYYY-MM-DD HH:mm:ss')
this.$set(this.filterTime, 0, startTime) this.$set(this.filterTime, 0, startTime)
this.$set(this.filterTime, 1, endTime) this.$set(this.filterTime, 1, endTime)
this.$set(this.filterTime, 2, val + 'm') this.$set(this.filterTime, 2, val + 'm')
} else if (type === 'hour') { } else if (type === 'hour') {
const startTime = bus.timeFormate(new Date(bus.computeTimezone(new Date().getTime())).setHours(new Date(bus.computeTimezone(new Date().getTime())).getHours() - val), 'yyyy-MM-dd hh:mm:ss') const startTime = bus.timeFormate(new Date(bus.computeTimezone(new Date().getTime())).setHours(new Date(bus.computeTimezone(new Date().getTime())).getHours() - val), 'YYYY-MM-DD HH:mm:ss')
const endTime = bus.timeFormate(new Date(bus.computeTimezone(new Date().getTime())), 'yyyy-MM-dd hh:mm:ss') const endTime = bus.timeFormate(new Date(bus.computeTimezone(new Date().getTime())), 'YYYY-MM-DD HH:mm:ss')
this.$set(this.filterTime, 0, startTime) this.$set(this.filterTime, 0, startTime)
this.$set(this.filterTime, 1, endTime) this.$set(this.filterTime, 1, endTime)
this.$set(this.filterTime, 2, val + 'h') this.$set(this.filterTime, 2, val + 'h')
} else if (type === 'date') { } else if (type === 'date') {
const startTime = bus.timeFormate(new Date(bus.computeTimezone(new Date().getTime())).setDate(new Date(bus.computeTimezone(new Date().getTime())).getDate() - val), 'yyyy-MM-dd hh:mm:ss') const startTime = bus.timeFormate(new Date(bus.computeTimezone(new Date().getTime())).setDate(new Date(bus.computeTimezone(new Date().getTime())).getDate() - val), 'YYYY-MM-DD HH:mm:ss')
const endTime = bus.timeFormate(new Date(bus.computeTimezone(new Date().getTime())), 'yyyy-MM-dd hh:mm:ss') const endTime = bus.timeFormate(new Date(bus.computeTimezone(new Date().getTime())), 'YYYY-MM-DD HH:mm:ss')
this.$set(this.filterTime, 0, startTime) this.$set(this.filterTime, 0, startTime)
this.$set(this.filterTime, 1, endTime) this.$set(this.filterTime, 1, endTime)
this.$set(this.filterTime, 2, val + 'd') this.$set(this.filterTime, 2, val + 'd')

View File

@@ -758,13 +758,13 @@ export default {
} else { } else {
before = new Date() before = new Date()
before.setHours(new Date().getHours() - 1) before.setHours(new Date().getHours() - 1)
before = this.dateFormat('yyyy-mm-dd HH:MM:SS', before) before = this.dateFormat('YYYY-MM-DD HH:mm:ss', before)
} }
if (this.trendSearchParam.end) { if (this.trendSearchParam.end) {
end = this.trendSearchParam.end end = this.trendSearchParam.end
} else { } else {
end = new Date() end = new Date()
end = this.dateFormat('yyyy-mm-dd HH:MM:SS', end) end = this.dateFormat('YYYY-MM-DD HH:mm:ss', end)
} }
let metric let metric
let rule let rule

View File

@@ -277,7 +277,7 @@ export default {
scrollbarWrap: null, scrollbarWrap: null,
batchDeleteObjs: [], batchDeleteObjs: [],
nowTimeType: {}, nowTimeType: {},
panelDateFormatTime: localStorage.getItem('nz-default-dateFormat') ? localStorage.getItem('nz-default-dateFormat') : 'yyyy-MM-dd hh:mm:ss' panelDateFormatTime: localStorage.getItem('nz-default-dateFormat') ? localStorage.getItem('nz-default-dateFormat') : 'YYYY-MM-DD HH:mm:ss'
} }
}, },
components: { components: {

View File

@@ -39,8 +39,8 @@ export default new Vue({
end.setEnd() end.setEnd()
// let start = this.getHoursTime(-1); // let start = this.getHoursTime(-1);
// let end = this.getHoursTime(0); // let end = this.getHoursTime(0);
start = this.timeFormate(start, localStorage.getItem('nz-default-dateFormat') ? localStorage.getItem('nz-default-dateFormat') : 'yyyy-MM-dd hh:mm:ss') start = this.timeFormate(start, localStorage.getItem('nz-default-dateFormat') ? localStorage.getItem('nz-default-dateFormat') : 'YYYY-MM-DD HH:mm:ss')
end = this.timeFormate(end, localStorage.getItem('nz-default-dateFormat') ? localStorage.getItem('nz-default-dateFormat') : 'yyyy-MM-dd hh:mm:ss') end = this.timeFormate(end, localStorage.getItem('nz-default-dateFormat') ? localStorage.getItem('nz-default-dateFormat') : 'YYYY-MM-DD HH:mm:ss')
this.selectDate = [start, end] this.selectDate = [start, end]
}, },
getHoursTime (hours) { getHoursTime (hours) {
@@ -65,60 +65,66 @@ export default new Vue({
} }
return `${yy}${mm}${dd}` return `${yy}${mm}${dd}`
}, },
timeFormate (date, fmt = localStorage.getItem('nz-default-dateFormat') ? localStorage.getItem('nz-default-dateFormat') : 'yyyy-MM-dd hh:mm:ss') { timeFormate (date, fmt = localStorage.getItem('nz-default-dateFormat') ? localStorage.getItem('nz-default-dateFormat') : 'YYYY-MM-DD HH:mm:ss') {
const time = new Date(date) const time = new Date(date)
let fm = fmt let fm = fmt
// fmt 自定义格式,如yy-MM-dd console.log(time, fm)
let week = '' return moment(time).format(fm)
switch (time.getDay()) { // // fmt 自定义格式,如yy-MM-dd
case 0: // let week = ''
week = '周日' // switch (time.getDay()) {
break // case 0:
case 1: // week = '周日'
week = '周一' // break
break // case 1:
case 2: // week = '周一'
week = '周二' // break
break // case 2:
case 3: // week = '周二'
week = '周三' // break
break // case 3:
case 4: // week = '周三'
week = '周四' // break
break // case 4:
case 5: // week = '周四'
week = '周五' // break
break // case 5:
case 6: // week = '周五'
week = '周六' // break
break // case 6:
default: // week = '周六'
week = '' // break
break // default:
} // week = ''
const o = { // break
'M+': time.getMonth() + 1, // 月份 // }
'd+': time.getDate(), // 日 // const o = {
hh: time.getHours(), // 小时 // 'M+': time.getMonth() + 1, // 月份
HH: time.getHours(), // 小时 // 'd+': time.getDate(), //
'm+': time.getMinutes(), // // hh: time.getHours(), // 小时
's+': time.getSeconds(), // // HH: time.getHours(), // 小时
'q+': Math.floor((time.getMonth() + 3) / 3), // 季度 // 'm+': time.getMinutes(), //
S: time.getMilliseconds(), // // 's+': time.getSeconds(), // 秒
w: week // 'q+': Math.floor((time.getMonth() + 3) / 3), // 季度
} // S: time.getMilliseconds(), // 毫秒
if (/(y+)/.test(fm)) { // w: week
fm = fm.replace(RegExp.$1, (time.getFullYear().toString()).substr(4 - RegExp.$1.length)) // }
} // if (/(y+)/.test(fm)) {
Object.keys(o).forEach((k) => { // fm = fm.replace(RegExp.$1, (time.getFullYear().toString()).substr(4 - RegExp.$1.length))
if (new RegExp(`(${k})`).test(fm)) { // }
fm = fm.replace(RegExp.$1, (RegExp.$1.length === 1) // Object.keys(o).forEach((k) => {
? (o[k]) // if (new RegExp(`(${k})`).test(fm)) {
: ((`00${o[k]}`).substr((`${o[k]}`).length))) // fm = fm.replace(RegExp.$1, (RegExp.$1.length === 1)
} // ? (o[k])
}) // : ((`00${o[k]}`).substr((`${o[k]}`).length)))
// }
// })
return fm return fm
}, },
formateTimeToTime (date, fmt = localStorage.getItem('nz-default-dateFormat') ? localStorage.getItem('nz-default-dateFormat') : 'YYYY-MM-DD HH:mm:ss') {
const newDate = moment(date, fmt)
return newDate
},
// 格式化tag为字符串表达式 // 格式化tag为字符串表达式
tagsToString (metric, arr) { tagsToString (metric, arr) {
let str = metric let str = metric
@@ -294,7 +300,7 @@ export default new Vue({
getNewTime (time, num) { getNewTime (time, num) {
const date = new Date(time) const date = new Date(time)
const newDate = new Date(parseInt(date.getTime(), 10) + num) const newDate = new Date(parseInt(date.getTime(), 10) + num)
return this.timeFormate(newDate, localStorage.getItem('nz-default-dateFormat') ? localStorage.getItem('nz-default-dateFormat') : 'yyyy-MM-dd hh:mm:ss') return this.timeFormate(newDate, localStorage.getItem('nz-default-dateFormat') ? localStorage.getItem('nz-default-dateFormat') : 'YYYY-MM-DD HH:mm:ss')
}, },
getOffsetTimezoneData (offset = 0) { getOffsetTimezoneData (offset = 0) {
return new Date(this.computeTimezone(new Date().getTime())).setHours(new Date(this.computeTimezone(new Date().getTime())).getHours() + offset) return new Date(this.computeTimezone(new Date().getTime())).setHours(new Date(this.computeTimezone(new Date().getTime())).getHours() + offset)

View File

@@ -104,7 +104,7 @@ Vue.mixin({
}, },
utcTimeToTimezoneStr: function (time) { utcTimeToTimezoneStr: function (time) {
if (time) { if (time) {
return bus.timeFormate(bus.UTCTimeToConfigTimezone(time), localStorage.getItem('nz-default-dateFormat') ? localStorage.getItem('nz-default-dateFormat') : localStorage.getItem('nz-default-dateFormat') ? localStorage.getItem('nz-default-dateFormat') : 'yyyy-MM-dd hh:mm:ss') return bus.timeFormate(bus.UTCTimeToConfigTimezone(time), localStorage.getItem('nz-default-dateFormat') ? localStorage.getItem('nz-default-dateFormat') : localStorage.getItem('nz-default-dateFormat') ? localStorage.getItem('nz-default-dateFormat') : 'YYYY-MM-DD HH:mm:ss')
} else { } else {
return '-' return '-'
} }
@@ -116,7 +116,7 @@ Vue.mixin({
}, },
timezoneToUtcTimeStr: function (time) { timezoneToUtcTimeStr: function (time) {
if (time) { if (time) {
return bus.timeFormate(this.timezoneToUtcTime(time), localStorage.getItem('nz-default-dateFormat') ? localStorage.getItem('nz-default-dateFormat') : 'yyyy-MM-dd hh:mm:ss') return bus.timeFormate(this.timezoneToUtcTime(time), localStorage.getItem('nz-default-dateFormat') ? localStorage.getItem('nz-default-dateFormat') : 'YYYY-MM-DD HH:mm:ss')
} }
}, },
timestampStr: function (time) { timestampStr: function (time) {
@@ -124,7 +124,7 @@ Vue.mixin({
const localOffset = date.getTimezoneOffset() * 60 * 1000 // 默认 一分钟显示时区偏移的结果 const localOffset = date.getTimezoneOffset() * 60 * 1000 // 默认 一分钟显示时区偏移的结果
const dateStr = new Date(time).getTime() + localOffset const dateStr = new Date(time).getTime() + localOffset
if (time) { if (time) {
return bus.timeFormate(bus.UTCTimeToConfigTimezone(dateStr), localStorage.getItem('nz-default-dateFormat') ? localStorage.getItem('nz-default-dateFormat') : 'yyyy-MM-dd hh:mm:ss') return bus.timeFormate(bus.UTCTimeToConfigTimezone(dateStr), localStorage.getItem('nz-default-dateFormat') ? localStorage.getItem('nz-default-dateFormat') : 'YYYY-MM-DD HH:mm:ss')
} else { } else {
return '-' return '-'
} }