NEZ-920 fix: 增加语法错误提示

This commit is contained in:
chenjinsong
2021-08-21 17:34:01 +08:00
parent 25a04fa31e
commit ad9337c788
4 changed files with 45 additions and 28 deletions

View File

@@ -605,7 +605,8 @@ const cn = {
confirmCancel: '您所做的修改将不会被保存?',
copySuccess: '复制成功',
lnglatError: '经纬度格式错误',
tagError: '不符合正则 /^[a-zA-Z_][a-zA-Z0-9_]*/!'
tagError: '不符合正则 /^[a-zA-Z_][a-zA-Z0-9_]*/!',
syntaxError: '语法错误'
},
asset: {
asset: '资产',

View File

@@ -612,7 +612,9 @@ const en = {
confirmCancel: 'Changes you made are not saved?',
copySuccess: 'Copy success',
lnglatError: 'Wrong format of latitude and longitude',
tagError: 'Does not conform to regular expressions /^[a-zA-Z_][a-zA-Z0-9_]*/!'
tagError: 'Does not conform to regular expressions /^[a-zA-Z_][a-zA-Z0-9_]*/!',
syntaxError: 'Syntax error',
errorInRow: 'There are some syntax errors in rows'
},
asset: {
asset: 'Asset ',

View File

@@ -530,7 +530,7 @@ export default {
},
queryLogData (limit) { // log的chart和table是一个请求
if (!limit) {
limit = this.$refs.logDetail.getLimit()
limit = this.$refs.logDetail ? this.$refs.logDetail.getLimit() : 1000
}
if (this.expressions.length > 0) {
const requestArr = []
@@ -544,6 +544,17 @@ export default {
this.saveDisabled = false
}
axios.all(requestArr).then(res => {
const errorRowIndex = []
res.forEach((r, i) => {
if (typeof r === 'string') {
errorRowIndex.push(i)
}
})
if (errorRowIndex.length > 0) {
this.$message.error(this.$t('tip.errorInRow') + ': ' + errorRowIndex.map(e => e + 1).join(' ,'))
res = res.filter((r, i) => errorRowIndex.indexOf(i) === -1)
}
if (res.length > 0) {
this.logData = res.map(r => r.data)
const hasGraph = this.logData.some(d => d.resultType === 'matrix')
const hasLog = this.logData.some(d => d.resultType === 'streamsFormat')
@@ -570,6 +581,9 @@ export default {
this.$nextTick(() => {
hasGraph && this.loadLogGraph()
})
}
}).catch(e => {
this.$message.error(this.$t('terminallog.statusItem.unknownError'))
})
}
},

View File

@@ -222,7 +222,7 @@ export default {
axisLabel: {
rotate: 0,
fontSize: 13 * window.devicePixelRatio,
formatter: '{HH}:{mm}:{ss}'
formatter: '{HH}:{mm}'
},
boundaryGap: [0, '1%']
},