This commit is contained in:
Vinjor 2025-08-14 09:59:40 +08:00
parent cf46f9b5c1
commit 29159abfad
3 changed files with 166 additions and 5 deletions

View File

@ -65,21 +65,25 @@ public class StatisticsController extends BaseController
*/ */
@GetMapping("/countryChart") @GetMapping("/countryChart")
public AjaxResult countryChart(String tenantId,String startDate,String endDate){ public AjaxResult countryChart(String tenantId,String startDate,String endDate){
return success(busiThirdItemService.nationalData(tenantId,startDate,endDate,null)); return success(busiThirdItemService.nationalData(tenantId,startDate,endDate,10));
} }
/** /**
* 询盘国家列表--分页表格 * 询盘国家列表--分页表格
*/ */
@GetMapping("/inquiryCountryList") @GetMapping("/inquiryCountryList")
public AjaxResult inquiryCountryList(@RequestParam(name = "tenantId", defaultValue = "1") String tenantId, public AjaxResult inquiryCountryList(@RequestParam(name = "tenantId",required = true) String tenantId,
@RequestParam(name = "startDate", defaultValue = "1") String startDate, @RequestParam(name = "startDate", required = false) String startDate,
@RequestParam(name = "endDate", defaultValue = "1") String endDate, @RequestParam(name = "endDate", required = false) String endDate,
@RequestParam(name = "pageNum", defaultValue = "1") Integer pageNum, @RequestParam(name = "pageNum", defaultValue = "1") Integer pageNum,
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize){ @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize){
List<ChartDataVO> list = busiThirdItemService.nationalData(tenantId,startDate,endDate,null); List<ChartDataVO> list = busiThirdItemService.nationalData(tenantId,startDate,endDate,null);
int startIndex = (pageNum-1)*pageSize; int startIndex = (pageNum-1)*pageSize;
int endIndex = Math.min(startIndex+pageSize,list.size()); int endIndex = Math.min(startIndex+pageSize,list.size());
return success(list.subList(startIndex,endIndex)); Map<String,Object> rtnMap = new HashMap<>();
rtnMap.put("records",list.subList(startIndex,endIndex));
rtnMap.put("current",pageNum);
rtnMap.put("total",list.size());
return success(rtnMap);
} }
} }

View File

@ -25,4 +25,12 @@ export function countryChart(query) {
params: query params: query
}) })
} }
//国家分布---分页表格
export function inquiryCountryList(query) {
return request({
url: '/statistics/inquiryCountryList',
method: 'get',
params: query
})
}

View File

@ -0,0 +1,149 @@
<template>
<div class="app-container">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
<el-form-item label="时间范围" prop="dataRange">
<el-date-picker
v-model="queryParams.dataRange"
type="daterange"
align="right"
unlink-panels
range-separator="至"
start-placeholder="开始日期"
end-placeholder="结束日期"
:picker-options="pickerOptions"
>
</el-date-picker>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
</el-form-item>
</el-form>
<el-table v-loading="loading" :data="dataList" >
<el-table-column type="index" width="60" label="序号" align="center"/>
<el-table-column label="询盘数量" align="center" prop="value" />
<el-table-column label="国家" align="center" prop="name" />
</el-table>
<pagination
v-show="total>0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
</div>
</template>
<script>
import { inquiryCountryList } from "@/api/statistics/statistics";
export default {
name: "InquiryItem",
data() {
return {
//
loading: true,
//
ids: [],
//
single: true,
//
multiple: true,
//
showSearch: true,
//
total: 0,
// 线
dataList: [],
//
title: "",
//
open: false,
//
queryParams: {
pageNum: 1,
pageSize: 10,
dataRange: '',
startDate: '',
endDate: '',
tenantId: null,
},
//
form: {},
//
rules: {
},
pickerOptions: {
shortcuts: [{
text: '最近一周',
onClick(picker) {
const end = new Date()
const start = new Date()
start.setTime(start.getTime() - 3600 * 1000 * 24 * 7)
picker.$emit('pick', [start, end])
}
}, {
text: '最近一个月',
onClick(picker) {
const end = new Date()
const start = new Date()
start.setTime(start.getTime() - 3600 * 1000 * 24 * 30)
picker.$emit('pick', [start, end])
}
}, {
text: '最近三个月',
onClick(picker) {
const end = new Date()
const start = new Date()
start.setTime(start.getTime() - 3600 * 1000 * 24 * 90)
picker.$emit('pick', [start, end])
}
}]
},
};
},
created() {
this.getList();
},
methods: {
/** 查询在线询盘记录列表 */
getList() {
this.loading = true;
inquiryCountryList(this.queryParams).then(response => {
this.dataList = response.data.records;
this.total = response.data.total;
this.loading = false;
});
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
if (this.queryParams.dataRange && this.queryParams.dataRange.length > 1) {
this.queryParams.startDate = this.formatDate(this.queryParams.dataRange[0])
this.queryParams.endDate = this.formatDate(this.queryParams.dataRange[1])
}else{
this.queryParams.startDate = null
this.queryParams.endDate = null
}
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
this.handleQuery();
},
/**
* 格式化时间戳
*/
formatDate(timestamp) {
const date = new Date(timestamp)
const year = date.getFullYear()
// 01
const month = String(date.getMonth() + 1).padStart(2, '0')
const day = String(date.getDate()).padStart(2, '0')
return `${year}-${month}-${day}`
},
}
};
</script>