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,6 +467,7 @@ export default {
} }
}, },
changeMode () { changeMode () {
if (this.metaList.length > 0) {
const parser = new Parser(this.columnList) const parser = new Parser(this.columnList)
const errorList = parser.validateMeta(this.metaList) const errorList = parser.validateMeta(this.metaList)
if (_.isEmpty(errorList)) { if (_.isEmpty(errorList)) {
@@ -478,6 +479,10 @@ export default {
this.reloadUrl({ mode: 'text' }) this.reloadUrl({ mode: 'text' })
this.$emit('changeMode', 'text', { metaList: [], str: '' }) this.$emit('changeMode', 'text', { metaList: [], str: '' })
} }
} else {
this.reloadUrl({ mode: 'text' })
this.$emit('changeMode', 'text', { metaList: [], str: '' })
}
}, },
// 处理value例如转换IN的值 // 处理value例如转换IN的值
handleValue (value, column, operator, flag) { handleValue (value, column, operator, flag) {

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,9 +103,11 @@ export default {
watch: { watch: {
timeFilter: { timeFilter: {
handler (n) { handler (n) {
if (n) {
this.initData() this.initData()
} }
} }
}
}, },
mounted () { mounted () {
this.initData() 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
if (!this.isNoData) {
res.data.result.forEach(e => { res.data.result.forEach(e => {
if (e.startTime) { if (e.startTime) {
e.startTime = dateFormatByAppearance(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)