fix: 排查并修复对无数据未做处理的问题

This commit is contained in:
刘洪洪
2023-09-07 11:35:01 +08:00
parent 6072bd0479
commit 0b859bda88
3 changed files with 24 additions and 14 deletions

View File

@@ -467,13 +467,18 @@ export default {
} }
}, },
changeMode () { changeMode () {
const parser = new Parser(this.columnList) if (this.metaList.length > 0) {
const errorList = parser.validateMeta(this.metaList) const parser = new Parser(this.columnList)
if (_.isEmpty(errorList)) { const errorList = parser.validateMeta(this.metaList)
this.reloadUrl({ mode: 'text' }) if (_.isEmpty(errorList)) {
const strObj = handleMetaListToStr(this.metaList) this.reloadUrl({ mode: 'text' })
const str2 = strObj.str2 ? strObj.str2 : strObj const strObj = handleMetaListToStr(this.metaList)
this.$emit('changeMode', 'text', str2) const str2 = strObj.str2 ? strObj.str2 : strObj
this.$emit('changeMode', 'text', str2)
} else {
this.reloadUrl({ mode: 'text' })
this.$emit('changeMode', 'text', { metaList: [], str: '' })
}
} else { } else {
this.reloadUrl({ mode: 'text' }) this.reloadUrl({ mode: 'text' })
this.$emit('changeMode', 'text', { metaList: [], str: '' }) this.$emit('changeMode', 'text', { metaList: [], str: '' })

View File

@@ -23,7 +23,7 @@
<span class="data-column-ips">{{ $t(scope.row[item.prop]) }}</span> <span class="data-column-ips">{{ $t(scope.row[item.prop]) }}</span>
</template> </template>
<!--超过3个ip就省略号显示移动鼠标block块展示并换行--> <!--超过3个ip就省略号显示移动鼠标block块展示并换行-->
<pre style="max-height: 152px;margin: 0px -10px -15px 0;overflow: scroll;"><span style="height: 24px;line-height: 24px;color: #046ECA;">{{scope.row[item.prop].replace(/,/g, '\n')}}</span></pre> <pre style="max-height: 152px;margin: 0 -10px -15px 0;overflow: scroll;"><span style="height: 24px;line-height: 24px;color: #046ECA;">{{scope.row[item.prop].replace(/,/g, '\n')}}</span></pre>
</el-popover> </el-popover>
<span v-else class="data-column-ips">{{ $t(scope.row[item.prop]) }}</span> <span v-else class="data-column-ips">{{ $t(scope.row[item.prop]) }}</span>
</template> </template>
@@ -103,7 +103,9 @@ export default {
watch: { watch: {
timeFilter: { timeFilter: {
handler (n) { handler (n) {
this.initData() if (n) {
this.initData()
}
} }
} }
}, },
@@ -128,6 +130,7 @@ export default {
this.tableData = res.data.result this.tableData = res.data.result
} else { } else {
this.isNoData = true this.isNoData = true
this.tableData = []
} }
}).finally(() => { }).finally(() => {
this.toggleLoading(false) this.toggleLoading(false)

View File

@@ -114,11 +114,13 @@ export default {
if (response.status === 200) { if (response.status === 200) {
this.showError = false this.showError = false
this.isNoData = res.data.result.length === 0 this.isNoData = res.data.result.length === 0
res.data.result.forEach(e => { if (!this.isNoData) {
if (e.startTime) { res.data.result.forEach(e => {
e.startTime = dateFormatByAppearance(e.startTime) if (e.startTime) {
} e.startTime = dateFormatByAppearance(e.startTime)
}) }
})
}
this.tableData = res.data.result this.tableData = res.data.result
} else { } else {
this.httpError(res) this.httpError(res)