mirror of
https://github.com/gotoeasy/glogcenter.git
synced 2025-09-15 12:58:34 +08:00
检索页面底部显示简要信息
This commit is contained in:
parent
0ae0d8b336
commit
3918d770d0
@ -11,7 +11,7 @@ func Test_all(t *testing.T) {
|
||||
|
||||
engine := NewDefaultEngine()
|
||||
for i := 1; i <= 100; i++ {
|
||||
engine.AddTextLog("date", fmt.Sprintf(` java.sql.SQLException: ddduse them aalav_%d`, i), "sssss_ssss")
|
||||
engine.AddTextLog("date", fmt.Sprintf(`java.sql.SQLException: ddduse them aalav_%d`, i), "sssss_ssss")
|
||||
}
|
||||
time.Sleep(time.Duration(5) * time.Second)
|
||||
|
||||
|
||||
@ -92,11 +92,11 @@ func SearchLogData(storeName string, pageSize int, currentDocId uint64, forward
|
||||
// 有关键词时走索引检索
|
||||
func SearchWordIndex(storeName string, word string, pageSize int, currentDocId uint64, forward bool) *SearchResult {
|
||||
|
||||
var rs = new(SearchResult) // 检索结果
|
||||
storeLogData := storage.NewLogDataStorageHandle(storeName) // 数据
|
||||
storeIndex := storage.NewWordIndexStorage(storeName, word) // 索引
|
||||
totalCount := storeIndex.TotalCount() // 总件数
|
||||
rs.Total = cmn.Uint64ToString(totalCount, 10) // 返回的总件数用10进制字符串形式以避免出现科学计数法
|
||||
var rs = new(SearchResult) // 检索结果
|
||||
storeLogData := storage.NewLogDataStorageHandle(storeName) // 数据
|
||||
storeIndex := storage.NewWordIndexStorage(storeName, word) // 索引
|
||||
totalCount := storeIndex.TotalCount() // 总件数
|
||||
rs.Total = cmn.Uint64ToString(storeLogData.TotalCount(), 10) // 返回的总件数用10进制字符串形式以避免出现科学计数法
|
||||
|
||||
if totalCount == 0 {
|
||||
return rs
|
||||
|
||||
@ -103,6 +103,6 @@ func findSame(pageSize int, currentDocId uint64, forward bool, storeLogData *sto
|
||||
}
|
||||
}
|
||||
|
||||
rs.Total = fmt.Sprintf("%d", rsCnt)
|
||||
rs.Total = fmt.Sprintf("%d", storeLogData.TotalCount())
|
||||
return rs
|
||||
}
|
||||
|
||||
@ -17,5 +17,5 @@ func LogSearchController(req *gweb.HttpRequest) *gweb.HttpResult {
|
||||
|
||||
eng := ldb.NewEngine(storeNmae)
|
||||
rs := eng.Search(searchKey, pageSize, currentId, forward)
|
||||
return gweb.Result(rs.Data)
|
||||
return gweb.Result(rs)
|
||||
}
|
||||
|
||||
@ -68,6 +68,9 @@
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
div.el-table th.el-table__cell{
|
||||
padding: 4px 0;
|
||||
}
|
||||
</style>
|
||||
<div id="app"></div>
|
||||
<script type="module" src="/src/main.js"></script>
|
||||
|
||||
@ -21,7 +21,7 @@
|
||||
</template>
|
||||
|
||||
|
||||
<el-table :stripe="true" v-loading="loading" :data="data" :height="tableHeight" ref="table" style="width: 100%">
|
||||
<el-table :stripe="true" v-loading="loading" :data="data" :height="tableHeight" style="width: 100%">
|
||||
|
||||
<el-table-column fixed type="expand" width="60">
|
||||
<template #default="scope">
|
||||
@ -43,6 +43,14 @@
|
||||
|
||||
</el-table>
|
||||
|
||||
|
||||
<div class="header">
|
||||
<div style="display:flex;justify-content:space-between;">
|
||||
<div v-html="info" class="x-info"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</el-card>
|
||||
</div>
|
||||
</el-main>
|
||||
@ -53,13 +61,15 @@
|
||||
import api from '../api'
|
||||
//import jsonViewer from 'vue-json-viewer'
|
||||
|
||||
const FixHeight = 215 // 177
|
||||
|
||||
export default {
|
||||
name: 'dashboard',
|
||||
components: { },
|
||||
data() {
|
||||
return {
|
||||
loading: false,
|
||||
tableHeight: (window.innerHeight - 177) + 'px',
|
||||
tableHeight: (window.innerHeight - FixHeight) + 'px',
|
||||
params: {
|
||||
storeName: '',
|
||||
searchKey: '',
|
||||
@ -68,6 +78,7 @@ export default {
|
||||
forward: true,
|
||||
},
|
||||
data: [],
|
||||
info: '',
|
||||
}
|
||||
},
|
||||
mounted(){
|
||||
@ -75,7 +86,7 @@ export default {
|
||||
// 自适应表格高度
|
||||
let that = this;
|
||||
window.onresize = () => {
|
||||
that.tableHeight = (window.innerHeight - 177) + 'px';
|
||||
that.tableHeight = (window.innerHeight - FixHeight) + 'px';
|
||||
};
|
||||
|
||||
//
|
||||
@ -104,7 +115,8 @@ export default {
|
||||
api.search(params).then(rs => {
|
||||
let res = rs.data
|
||||
if (res.success && res.result.length) {
|
||||
this.data.push(...res.result)
|
||||
this.data.push(...res.result.data)
|
||||
this.info = `日志总量 ${res.result.total} 条,当前匹配展示前 ${this.data.length} 条`
|
||||
}
|
||||
})
|
||||
},
|
||||
@ -116,18 +128,17 @@ export default {
|
||||
api.search(this.params).then(rs => {
|
||||
let res = rs.data
|
||||
if (res.success) {
|
||||
this.data = res.result;
|
||||
// console.info(res,"xxxxxxxxxxxxxxxxxxxxxxx")
|
||||
this.data = res.result.data;
|
||||
document.querySelector('.el-scrollbar__wrap').scrollTop = 0; // 滚动到顶部
|
||||
this.info = `日志总量 ${res.result.total} 条,当前匹配展示前 ${this.data.length} 条`
|
||||
}
|
||||
|
||||
}).finally(() => {
|
||||
this.loading = false
|
||||
})
|
||||
},
|
||||
getTableHeight() {
|
||||
let tableH = window.innerHeight - 142;
|
||||
},
|
||||
}
|
||||
,
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
@ -173,4 +184,12 @@ button.el-button.x-search{
|
||||
height:420px;
|
||||
}
|
||||
|
||||
.x-info{
|
||||
min-height:42px;
|
||||
line-height:42px;
|
||||
padding-top:5px;
|
||||
font-size: 14px;
|
||||
font-weight: 500;
|
||||
color: #909399;
|
||||
}
|
||||
</style>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user