diff --git a/nezha-fronted/src/components/common/bottomBox/tabs/alertRuleEvalLog.vue b/nezha-fronted/src/components/common/bottomBox/tabs/alertRuleEvalLog.vue
index 0fff33092..6a1b3ba95 100644
--- a/nezha-fronted/src/components/common/bottomBox/tabs/alertRuleEvalLog.vue
+++ b/nezha-fronted/src/components/common/bottomBox/tabs/alertRuleEvalLog.vue
@@ -98,35 +98,11 @@ export default {
if (this.obj) {
this.$set(this.searchLabel, 'id', this.obj.id)
}
- this.$get(this.url, { ...this.searchLabel, ...this.searchCheckBox }).then(response => {
+ this.$get('alert/rule/' + this.obj.id + '/evalLog').then(response => {
this.tools.loading = false
this.nowTime = this.utcTimeToTimezoneStr(response.time)
- // response = {
- // code: 200,
- // msg: 'success',
- // data: {
- // list: [{
- // ruleId: 1,
- // state: 200,
- // msg: 'success',
- // stts: 1634215095277,
- // etts: 1634215095377
- // }, {
- // ruleId: 1,
- // state: 201,
- // msg: 'success',
- // stts: 1634215095477,
- // etts: 1634215095577
- // }
- // ]
- // }
- // }
if (response.code === 200) {
- for (let i = 0; i < response.data.list.length; i++) {
- response.data.list[i].status = response.data.list[i].status + ''
- }
- this.tableData = response.data.list
- this.pageObj.total = response.data.total
+ this.tableData = response.data
if (!this.scrollbarWrap) {
this.$nextTick(() => {
this.scrollbarWrap = this.$refs.dataTable.$refs.dataTable.bodyWrapper
diff --git a/nezha-fronted/src/components/common/detailView/detailViewTopSearch.vue b/nezha-fronted/src/components/common/detailView/detailViewTopSearch.vue
index c0582540b..820237a00 100644
--- a/nezha-fronted/src/components/common/detailView/detailViewTopSearch.vue
+++ b/nezha-fronted/src/components/common/detailView/detailViewTopSearch.vue
@@ -27,7 +27,7 @@
@@ -61,7 +61,7 @@
@@ -96,7 +96,7 @@
{{item3.name}}
diff --git a/nezha-fronted/src/components/common/js/tools.js b/nezha-fronted/src/components/common/js/tools.js
index 6e464c329..4bc8a57cf 100644
--- a/nezha-fronted/src/components/common/js/tools.js
+++ b/nezha-fronted/src/components/common/js/tools.js
@@ -294,6 +294,15 @@ export function stringTimeParseToUnix (stringTime) {
time = time + localOffset - offset * 60 * 60 * 1000
return parseInt(time / 1000)
}
+export function stringTimeParseToUnixMs (stringTime) {
+ let time = new Date(stringTime).getTime()
+ let offset = localStorage.getItem('nz-sys-timezone')
+ offset = moment.tz(offset).format('Z')
+ offset = Number.parseInt(offset)
+ const localOffset = new Date().getTimezoneOffset() * 60 * 1000 * -1 // 默认 一分钟显示时区偏移的结果
+ time = time + localOffset - offset * 60 * 60 * 1000
+ return parseInt(time)
+}
export function getTime (size, unit) { // 计算时间
const now = new Date(bus.computeTimezone(new Date().getTime()))
if (unit) {
@@ -361,6 +370,28 @@ export function calcDurationByStringTimeB (startTime, endTime) {
return result
}
+export function calcDurationByStringTimeMs (startTime, endTime) {
+ let durationSecond = stringTimeParseToUnixMs(endTime) - stringTimeParseToUnixMs(startTime)
+ let result = ''
+ if (durationSecond < 1000) {
+ result = `${durationSecond % 1000}ms`
+ return result
+ } else {
+ durationSecond = durationSecond / 1000
+ }
+ result = `${durationSecond % 60}s`
+ if (durationSecond >= 60 * 60 * 24) {
+ result = `${(Math.floor(durationSecond / 3600)) % 24}h`
+ result = `${Math.floor(durationSecond / (60 * 60 * 24))}d ${result}`
+ } else if (durationSecond >= 60 * 60) {
+ result = `${(Math.floor(durationSecond / 60)) % 60}m`
+ result = `${Math.floor(durationSecond / (60 * 60))}h ${result}`
+ } else if (durationSecond >= 60) {
+ result = `${(Math.floor(durationSecond / 60)) % 60}m ${result}`
+ }
+
+ return result
+}
export function unixTimeParseToString (unixTime, fmt = 'yyyy-MM-dd hh:mm:ss') {
const date = new Date(unixTime * 1000)
const o = {
diff --git a/nezha-fronted/src/components/common/js/validate.js b/nezha-fronted/src/components/common/js/validate.js
index a7c73d715..c58066919 100644
--- a/nezha-fronted/src/components/common/js/validate.js
+++ b/nezha-fronted/src/components/common/js/validate.js
@@ -76,7 +76,7 @@ export function nzNumber (rule, value, callback) {
}
export function noSpecialChar (rule, value, callback) {
- const charReg = /^[\u4e00-\u9fa5a-z0-9A-Z-_.]+$/
+ const charReg = /[\u0000-\uFFFF]/
setTimeout(() => {
if (charReg.test(value)) {
callback()
diff --git a/nezha-fronted/src/components/common/labelFilter/dropdown.vue b/nezha-fronted/src/components/common/labelFilter/dropdown.vue
index eb60d35a6..7d2adc613 100644
--- a/nezha-fronted/src/components/common/labelFilter/dropdown.vue
+++ b/nezha-fronted/src/components/common/labelFilter/dropdown.vue
@@ -20,7 +20,7 @@
>
{{ data.name }}
- ({{data.num}})
+ ({{data.num || 0 }})
diff --git a/nezha-fronted/src/components/common/table/alert/alertRuleEvalLogTable.vue b/nezha-fronted/src/components/common/table/alert/alertRuleEvalLogTable.vue
index 150e5f6aa..f45bcb526 100644
--- a/nezha-fronted/src/components/common/table/alert/alertRuleEvalLogTable.vue
+++ b/nezha-fronted/src/components/common/table/alert/alertRuleEvalLogTable.vue
@@ -41,6 +41,7 @@
+
{{scope.row.state == 200?'Ok':'Error'}}
@@ -73,7 +74,7 @@