首页统计

This commit is contained in:
曹磊 2025-07-16 16:21:06 +08:00
parent e476ec2647
commit d69b863361
3 changed files with 472 additions and 19 deletions

View File

@ -3,6 +3,13 @@ import { defHttp } from '/@/utils/http/axios';
enum Api {
loginfo = '/sys/loginfo',
visitInfo = '/sys/visitInfo',
totalInfo = '/zh/home/totalInfo',
todayInfo = '/zh/home/todayInfo',
orderTypeCn = '/zh/home/getOrderTypeCn',
xqtd = '/zh/home/getXqtd',
sbtd = '/zh/home/getSbtd',
hytd = '/zh/home/getHytd',
sstd = '/zh/home/getSstd',
}
/**
*
@ -14,3 +21,46 @@ export const getLoginfo = (params) => defHttp.get({ url: Api.loginfo, params },
* @param params
*/
export const getVisitInfo = (params) => defHttp.get({ url: Api.visitInfo, params }, { isTransformResponse: false });
/**
*
* @param params
*/
export const getTotalInfo = (params) => defHttp.get({ url: Api.totalInfo, params }, { isTransformResponse: false });
/**
*
* @param params
*/
export const getTodayInfo = (params) => defHttp.get({ url: Api.todayInfo, params }, { isTransformResponse: false });
/**
*
* @param params
*/
export const getOrderTypeCn = (params) => defHttp.get({ url: Api.orderTypeCn, params }, { isTransformResponse: false });
/**
*
* @param params
*/
export const getXqtd = (params) => defHttp.get({ url: Api.xqtd, params }, { isTransformResponse: false });
/**
*
* @param params
*/
export const getSbtd = (params) => defHttp.get({ url: Api.sbtd, params }, { isTransformResponse: false });
/**
*
* @param params
*/
export const getHytd = (params) => defHttp.get({ url: Api.hytd, params }, { isTransformResponse: false });
/**
*
* @param params
*/
export const getSstd = (params) => defHttp.get({ url: Api.sstd, params });

View File

@ -1,3 +1,5 @@
import {BasicColumn} from "@/components/Table";
export interface GrowCardItem {
icon: string;
title: string;
@ -217,3 +219,31 @@ export const table1 = {
total: 0,
},
};
export const orderColumns : BasicColumn[] =[
{
title: '会员手机号',
dataIndex: 'phone',
align: 'center'
},
{
title: '投递时间',
dataIndex: 'addTime',
align: 'center'
},
{
title: '小区名称',
dataIndex: 'housingestateName',
align: 'center'
},
{
title: '设备地点',
dataIndex: 'content',
align: 'center'
},
{
title: '重量KG',
dataIndex: 'weight',
align: 'center'
},
];

View File

@ -1,24 +1,397 @@
<template>
<IndexChart v-if="indexStyle === 0"></IndexChart>
<IndexDef v-if="indexStyle === 1"></IndexDef>
<IndexBdc v-if="indexStyle == 2"></IndexBdc>
<IndexTask v-if="indexStyle == 3"></IndexTask>
<div style="width: 100%; text-align: right; margin-top: 20px">
首页主题
<a-radio-group v-model:value="indexStyle">
<a-radio :value="0">默认</a-radio>
<a-radio :value="1">销量统计</a-radio>
<a-radio :value="2">业务统计</a-radio>
<a-radio :value="3">我的任务</a-radio>
</a-radio-group>
</div>
<a-row :gutter="16" style="padding:16px 0px 0px 16px;width: 100%">
<a-col :span="4">
<a-card>
<div>总投递重量T</div>
<div class="card-title">{{formData.tdzlA}}</div>
</a-card>
</a-col>
<a-col :span="4">
<a-card>
<div>总投递次数</div>
<div class="card-title">{{formData.tdcsA}}</div>
</a-card>
</a-col>
<a-col :span="4">
<a-card>
<div>总清运重量T</div>
<div class="card-title">{{formData.qyzlA}}</div>
</a-card>
</a-col>
<a-col :span="4">
<a-card>
<div>总会员</div>
<div class="card-title">{{formData.hyrsA}}</div>
</a-card>
</a-col>
<a-col :span="4">
<a-card>
<div>总区域</div>
<div class="card-title">{{formData.qysA}}</div>
</a-card>
</a-col>
<a-col :span="4">
<a-card>
<div>总设备</div>
<div style="display: flex">
<span class="card-title">{{formData.sbsA}}</span>
<span style="margin-left: 20px;font-weight: bold;">
<div style="color: #1890ff">在线 {{formData.zxsbsA}}</div>
<div style="color: #ff3333">离线 {{formData.lxsbsA}}</div>
</span>
</div>
</a-card>
</a-col>
</a-row>
<a-row :gutter="16" style="padding:16px 0px 0px 16px;width: 100%">
<a-col :span="6">
<a-card>
<div>
<div class="space-between"><span>今日投递重量T</span><span>昨日</span></div>
<div class="space-between"><span class="card-title">{{formData.tdzlT}}</span><span>{{formData.tdzlY}}</span></div>
<div>
<span>较昨日</span>
<span v-if="formData.tdzlR<0" class="down">{{formData.tdzlR}}%</span>
<span v-else class="up">{{formData.tdzlR}}%</span>
</div>
</div>
</a-card>
</a-col>
<a-col :span="6">
<a-card>
<div class="space-between"><span>今日投递次数</span><span>昨日</span></div>
<div class="space-between"><span class="card-title">{{formData.tdcsT}}</span><span>{{formData.tdcsY}}</span></div>
<div>
<span>较昨日</span>
<span v-if="formData.tdcsR<0" class="down">{{formData.tdcsR}}%</span>
<span v-else class="up">{{formData.tdcsR}}%</span>
</div>
</a-card>
</a-col>
<a-col :span="6">
<a-card>
<div class="space-between"><span>今日清运重量T</span><span>昨日</span></div>
<div class="space-between"><span class="card-title">{{formData.qyzlT}}</span><span>{{formData.qyzlY}}</span></div>
<div>
<span>较昨日</span>
<span v-if="formData.qyzlR<0" class="down">{{formData.qyzlR}}%</span>
<span v-else class="up">{{formData.qyzlR}}%</span>
</div>
</a-card>
</a-col>
<a-col :span="6">
<a-card>
<div class="space-between"><span>今日新增会员</span><span>昨日</span></div>
<div class="space-between"><span class="card-title">{{formData.hyrsT}}</span><span>{{formData.hyrsY}}</span></div>
<div>
<span>较昨日</span>
<span v-if="formData.hyrsR<0" class="down">{{formData.hyrsR}}%</span>
<span v-else class="up">{{formData.hyrsR}}%</span>
</div>
</a-card>
</a-col>
</a-row>
<a-row :gutter="16" style="padding:16px 0px 0px 16px;width: 100%">
<a-col :span="8">
<div style="background: #ffffff;border-radius: 4px;border: 1px solid #f0f0f0;padding: 5px;">
<BarAndLine
:chartData="xqtdSource" height="400px"
:option="{ title: { text: '小区投递次排行', left: 'left' } }"
:yAxis="xqtdYAxis"
:axisLabel="{ rotate: 45}"
></BarAndLine>
</div>
</a-col>
<a-col :span="8">
<div style="background: #ffffff;border-radius: 4px;border: 1px solid #f0f0f0;padding: 5px;">
<BarAndLine
:chartData="sbtdSource" height="400px"
:option="{ title: { text: '设备投递次排行', left: 'left' } }"
:yAxis="xqtdYAxis"
:axisLabel="{ rotate: 45}"
></BarAndLine>
</div>
</a-col>
<a-col :span="8">
<div style="background: #ffffff;border-radius: 4px;border: 1px solid #f0f0f0;padding: 5px;">
<BarAndLine
:chartData="hytdSource" height="400px"
:option="{ title: { text: '会员投递次排行', left: 'left' } }"
:yAxis="hytdYAxis"
:axisLabel="{ rotate: 45}"
></BarAndLine>
</div>
</a-col>
</a-row>
<a-row :gutter="16" style="padding:16px 0px 16px 16px;width: 100%">
<a-col :span="10">
<div style="background: #ffffff;border-radius: 4px;border: 1px solid #f0f0f0;padding: 5px;">
<Pie :chartData="pieDataSource" height="400px"
:option="{ title: { text: '订单类型分布', left: 'left' } }"
:radius="['30%','70%']"
:legend="{ orient: 'vertical',left: 'right'}"
:itemStyle="{borderRadius: 8}"
></Pie>
</div>
</a-col>
<a-col :span="14">
<div style="background: #ffffff;border-radius: 4px;border: 1px solid #f0f0f0;padding: 5px;">
<!-- <a-table :dataSource="dataSource" :columns="orderColumns">
</a-table>-->
<!--引用表格-->
<BasicTable @register="registerTable">
<!--插槽:table标题-->
<template #tableTitle>
</template>
<!--操作栏-->
<template #action="{ record }">
<TableAction :actions="getTableAction(record)"/>
</template>
<template v-slot:bodyCell="{ column, record, index, text }">
</template>
</BasicTable>
</div>
</a-col>
</a-row>
</template>
<script lang="ts" setup>
import { ref } from 'vue';
import IndexDef from './homePage/IndexDef.vue';
import IndexChart from './homePage/IndexChart.vue';
import IndexBdc from './homePage/IndexBdc.vue';
import IndexTask from './homePage/IndexTask.vue';
import {onMounted, reactive, ref} from 'vue';
import { BasicTable, useTable, TableAction } from '/@/components/Table';
import { useListPage } from '/@/hooks/system/useListPage';
import Pie from '/@/components/chart/Pie.vue';
import BarAndLine from '/@/components/chart/BarAndLine.vue';
import {getTotalInfo, getTodayInfo, getOrderTypeCn, getXqtd, getSbtd, getHytd, getSstd} from './api';
import {orderColumns} from './data';
const queryParam = reactive<any>({});
//table
const { prefixCls, tableContext, onExportXls, onImportXls } = useListPage({
tableProps: {
title: '实时投递信息',
api: getSstd,
pagination: true,
columns: orderColumns,
showIndexColumn: true,
canResize: true,
//
showTableSetting: false,
showActionColumn: false,
size: 'small',
striped: true,
minHeight: 272,
maxHeight: 272,
formConfig: {
compact: true,
},
beforeFetch: async (params) => {
return Object.assign(params, queryParam);
},
},
});
const [registerTable, { reload, collapseAll, updateTableDataRecord, findTableDataRecord, getDataSource }, { rowSelection, selectedRowKeys }] = tableContext;
const labelCol = reactive({
xs:24,
sm:4,
xl:6,
xxl:4
});
const wrapperCol = reactive({
xs: 24,
sm: 20,
});
const formData = reactive<any>({
tdzlA: '',//
tdcsA: '',//
qyzlA: '',//
hyrsA: '',//
qysA: '',//
sbsA: '',//
zxsbsA: '',//线
lxsbsA: '',//线
tdzlT: '',//
tdcsT: '',//
qyzlT: '',//
hyrsT: '',//
tdzlY: '',//
tdcsY: '',//
qyzlY: '',//
hyrsY: '',//
tdzlR: '',//
tdcsR: '',//
qyzlR: '',//
hyrsR: '',//
});
const dataSource = ref([]);
const pieDataSource = ref([]);
const xqtdSource = ref([]);
const sbtdSource = ref([]);
const hytdSource = ref([]);
const xqtdYAxis = ref([{type: 'value', name: '投递重量',axisLabel: {formatter: '{value} T'}},{type: 'value',name: '投递次数',axisLabel: {formatter: '{value} 次'}}]);
const hytdYAxis = ref([{type: 'value', name: '投递重量',axisLabel: {formatter: '{value} KG'}},{type: 'value',name: '投递次数',axisLabel: {formatter: '{value} 次'}}]);
async function loadTotalData() {
const resData = await getTotalInfo({});
const res = resData.result;
formData.tdzlA = res.tdzlA;
formData.tdcsA = res.tdcsA;
formData.qyzlA = res.qyzlA;
formData.hyrsA = res.hyrsA;
formData.qysA = res.qysA;
formData.sbsA = res.sbsA;
formData.zxsbsA = res.zxsbsA;
formData.lxsbsA = res.lxsbsA;
}
async function loadTodayData() {
const resData = await getTodayInfo({});
const res = resData.result;
formData.tdzlT = res.tdzlT;
formData.tdcsT = res.tdcsT;
formData.qyzlT = res.qyzlT;
formData.hyrsT = res.hyrsT;
formData.tdzlY = res.tdzlY;
formData.tdcsY = res.tdcsY;
formData.qyzlY = res.qyzlY;
formData.hyrsY = res.hyrsY;
formData.tdzlR = res.tdzlR;
formData.tdcsR = res.tdcsR;
formData.qyzlR = res.qyzlR;
formData.hyrsR = res.hyrsR;
}
async function loadOrderTypeCn() {
const resData = await getOrderTypeCn({});
const res = resData.result;
pieDataSource.value = [];
for (let i = 0; i < res.length; i++) {
pieDataSource.value.push({
name: `${res[i].type}`,
value: res[i].cn,
});
}
}
async function loadXqtd() {
const resData = await getXqtd({});
const res = resData.result;
xqtdSource.value = [];
for (let i = 0; i < res.length; i++) {
xqtdSource.value.push({
name: `${res[i].housingestateName}`,
value: res[i].weight,
type: '投递重量',
seriesType: 'bar',
});
xqtdSource.value.push({
name: `${res[i].housingestateName}`,
value: res[i].cn,
type: '投递次数',
seriesType: 'line',
});
}
}
async function loadSbtd() {
const resData = await getSbtd({});
const res = resData.result;
sbtdSource.value = [];
for (let i = 0; i < res.length; i++) {
let name = res[i].imei;
if(res[i].housingestateName!=null&&res[i].content!=null){
name = res[i].housingestateName+'-'+res[i].content;
}
sbtdSource.value.push({
name: `${name}`,
value: res[i].weight,
type: '投递重量',
seriesType: 'bar',
});
sbtdSource.value.push({
name: `${name}`,
value: res[i].cn,
type: '投递次数',
seriesType: 'line',
});
}
}
async function loadHytd() {
const resData = await getHytd({});
const res = resData.result;
hytdSource.value = [];
for (let i = 0; i < res.length; i++) {
hytdSource.value.push({
name: `${res[i].phone}`,
value: res[i].weight,
type: '投递重量',
seriesType: 'bar',
});
hytdSource.value.push({
name: `${res[i].phone}`,
value: res[i].cn,
type: '投递次数',
seriesType: 'line',
});
}
}
//
async function loadSstd(){
try {
dataSource.value = [];
const res = await getSstd({});
console.log(res);
dataSource.value = res.result;
} catch (error) {
}
}
onMounted(() => {
loadTotalData();
loadTodayData();
loadOrderTypeCn();
loadXqtd();
loadSbtd();
loadHytd();
// loadSstd();
})
const indexStyle = ref(0);
</script>
<style lang="less" scoped>
.card-title{
font-size: 30px;
font-weight: bold;
}
.space-between {
display:flex;
justify-content: space-between;
}
.up{
margin-left:10px;
color: #ff3333;
}
.down{
margin-left:10px;
color: #21cc71;
}
:deep(.ant-table-title) {
display: none !important;
}
</style>