调试分页,并调试大屏模拟数据

This commit is contained in:
samwaf
2022-10-06 08:15:48 +08:00
parent ef7627bd03
commit 119258ff04
4 changed files with 48 additions and 39 deletions
+1 -1
View File
@@ -48,7 +48,7 @@ func StartLocalServer() {
var total int64 = 0
var weblogs []innerbean.WebLog
global.GWAF_LOCAL_DB.Debug().Limit(waf_attack.PageSize).Offset(waf_attack.PageSize * (waf_attack.PageIndex - 1)).Find(&weblogs)
global.GWAF_LOCAL_DB.Debug().Count(&total)
global.GWAF_LOCAL_DB.Debug().Model(&innerbean.WebLog{}).Count(&total)
c.JSON(http.StatusOK, response.Response{
Code: 200,
@@ -1,7 +1,7 @@
<template>
<t-row :gutter="[16, 16]">
<t-col :xs="12" :xl="9">
<t-card title="统计数据" subtitle="(万元)" class="dashboard-chart-card">
<t-card title="月度攻击情况" subtitle="(次)" class="dashboard-chart-card">
<template #actions>
<div class="dashboard-chart-title-container">
<t-date-range-picker
+40 -31
View File
@@ -147,9 +147,9 @@ export default Vue.extend({
rowClassName: (rowKey: string) => `${rowKey}-class`,
// 与pagination对齐
pagination: {
defaultPageSize: 20,
total: 0,
defaultCurrent: 1,
current: 1,
pageSize:10
},
searchValue: '',
confirmVisible: false,
@@ -169,43 +169,52 @@ export default Vue.extend({
},
},
mounted() {
let that = this
this.$request
.get('/waflog/attack/list', {
params: {
pageSize: that.pagination.defaultPageSize,
pageIndex: that.pagination.defaultCurrent,
}
})
.then((res) => {
let resdata = res.data
console.log(resdata)
if (resdata.code === 200) {
//const { list = [] } = resdata.data.list;
this.data = resdata.data.list;
this.pagination = {
...this.pagination,
total: resdata.data.total,
};
}
})
.catch((e: Error) => {
console.log(e);
})
.finally(() => {
this.dataLoading = false;
});
this.dataLoading = true;
this.getList("")
},
methods: {
getList(keyword){
let that = this
this.$request
.get('/waflog/attack/list', {
params: {
pageSize: that.pagination.pageSize,
pageIndex: that.pagination.current,
}
})
.then((res) => {
let resdata = res.data
console.log(resdata)
if (resdata.code === 200) {
//const { list = [] } = resdata.data.list;
this.data = resdata.data.list;
this.pagination = {
...this.pagination,
total: resdata.data.total,
};
}
})
.catch((e: Error) => {
console.log(e);
})
.finally(() => {
this.dataLoading = false;
});
this.dataLoading = true;
},
getContainer() {
return document.querySelector('.tdesign-starter-layout');
},
rehandlePageChange(curr, pageInfo) {
console.log('分页变化', curr, pageInfo);
this.pagination.current = curr.current
if(this.pagination.pageSize != curr.pageSize){
this.pagination.current = 1
this.pagination.pageSize = curr.pageSize
}
this.getList("")
},
rehandleSelectChange(selectedRowKeys: number[]) {
this.selectedRowKeys = selectedRowKeys;
+6 -6
View File
@@ -17,25 +17,25 @@ interface TendItem {
export const PANE_LIST: Array<DashboardPanel> = [
{
title: '总收入',
number: '¥ 28,425.00',
title: '今日攻击数',
number: '11100334',
upTrend: '20.5%',
leftType: 'echarts-line',
},
{
title: '总退款',
number: '¥ 768.00',
title: '今天总访问量',
number: '1111768',
downTrend: '20.5%',
leftType: 'echarts-bar',
},
{
title: '活跃用户(个)',
title: '活跃IP(个)',
number: '1126',
downTrend: '20.5%',
leftType: 'icon-usergroup',
},
{
title: '订单(个)',
title: '分布地区(个)',
number: 527,
downTrend: '20.5%',
leftType: 'icon-file-paste',