检索页面底部显示简要信息

This commit is contained in:
gotoeasy 2022-07-01 10:37:42 +08:00
parent 0ae0d8b336
commit 3918d770d0
6 changed files with 40 additions and 18 deletions

View File

@ -96,7 +96,7 @@ func SearchWordIndex(storeName string, word string, pageSize int, currentDocId u
storeLogData := storage.NewLogDataStorageHandle(storeName) // 数据
storeIndex := storage.NewWordIndexStorage(storeName, word) // 索引
totalCount := storeIndex.TotalCount() // 总件数
rs.Total = cmn.Uint64ToString(totalCount, 10) // 返回的总件数用10进制字符串形式以避免出现科学计数法
rs.Total = cmn.Uint64ToString(storeLogData.TotalCount(), 10) // 返回的总件数用10进制字符串形式以避免出现科学计数法
if totalCount == 0 {
return rs

View File

@ -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
}

View File

@ -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)
}

View File

@ -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>

View File

@ -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,19 +128,18 @@ 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>
<style scoped>
@ -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>