|
@@ -2,7 +2,9 @@
|
|
<div id="index">
|
|
<div id="index">
|
|
<el-row>
|
|
<el-row>
|
|
<el-col :span="24" class="main animate__animated animate__backInRight" v-loading="loading">
|
|
<el-col :span="24" class="main animate__animated animate__backInRight" v-loading="loading">
|
|
- <el-col :span="24" class="one">系统首页</el-col>
|
|
|
|
|
|
+ <el-col :span="24" class="one">
|
|
|
|
+ <div id="myChart" :style="{ width: '600px', height: '600px' }"></div>
|
|
|
|
+ </el-col>
|
|
</el-col>
|
|
</el-col>
|
|
</el-row>
|
|
</el-row>
|
|
</div>
|
|
</div>
|
|
@@ -11,28 +13,73 @@
|
|
<script setup lang="ts">
|
|
<script setup lang="ts">
|
|
// 基础
|
|
// 基础
|
|
import type { Ref } from 'vue';
|
|
import type { Ref } from 'vue';
|
|
-// reactive,
|
|
|
|
|
|
+import * as echarts from 'echarts';
|
|
import { onMounted, ref, getCurrentInstance } from 'vue';
|
|
import { onMounted, ref, getCurrentInstance } from 'vue';
|
|
// 接口
|
|
// 接口
|
|
-//import { TestStore } from '@common/src/stores/test';
|
|
|
|
-//import type { IQueryResult } from '@/util/types.util';
|
|
|
|
-//const testAxios = TestStore();
|
|
|
|
|
|
+import { StatisticsStore } from '@/stores/statistics/statistics';
|
|
|
|
+import type { IQueryResult } from '@/util/types.util';
|
|
|
|
+const statisticsAxios = StatisticsStore();
|
|
const { proxy } = getCurrentInstance() as any;
|
|
const { proxy } = getCurrentInstance() as any;
|
|
// 加载中
|
|
// 加载中
|
|
const loading: Ref<any> = ref(false);
|
|
const loading: Ref<any> = ref(false);
|
|
-// 分页数据
|
|
|
|
-// const skip = 0;
|
|
|
|
-// const limit = proxy.limit;;
|
|
|
|
|
|
+const option: Ref<any> = ref({
|
|
|
|
+ title: {
|
|
|
|
+ text: '每月订单数量统计',
|
|
|
|
+ left: 'center'
|
|
|
|
+ },
|
|
|
|
+ tooltip: {
|
|
|
|
+ trigger: 'item',
|
|
|
|
+ formatter: '{a} <br/>{b} : {c} ({d}%)'
|
|
|
|
+ },
|
|
|
|
+ legend: {
|
|
|
|
+ left: 'center',
|
|
|
|
+ top: 'bottom'
|
|
|
|
+ },
|
|
|
|
+ toolbox: {
|
|
|
|
+ show: true
|
|
|
|
+ },
|
|
|
|
+ series: [
|
|
|
|
+ {
|
|
|
|
+ name: '订单数',
|
|
|
|
+ type: 'pie',
|
|
|
|
+ radius: [20, 140],
|
|
|
|
+ roseType: 'area',
|
|
|
|
+ itemStyle: {
|
|
|
|
+ borderRadius: 5
|
|
|
|
+ },
|
|
|
|
+ data: []
|
|
|
|
+ }
|
|
|
|
+ ]
|
|
|
|
+});
|
|
|
|
+const list: Ref<any> = ref([
|
|
|
|
+ { value: 30, name: '1月' },
|
|
|
|
+ { value: 28, name: '2月' },
|
|
|
|
+ { value: 26, name: '3月' },
|
|
|
|
+ { value: 24, name: '4月' },
|
|
|
|
+ { value: 22, name: '5月' },
|
|
|
|
+ { value: 20, name: '6月' },
|
|
|
|
+ { value: 18, name: '7月' },
|
|
|
|
+ { value: 18, name: '8月' },
|
|
|
|
+ { value: 18, name: '9月' },
|
|
|
|
+ { value: 18, name: '10月' },
|
|
|
|
+ { value: 18, name: '11月' },
|
|
|
|
+ { value: 16, name: '12月' }
|
|
|
|
+]);
|
|
// 请求
|
|
// 请求
|
|
onMounted(async () => {
|
|
onMounted(async () => {
|
|
loading.value = true;
|
|
loading.value = true;
|
|
- // await search({ skip, limit });
|
|
|
|
|
|
+ await search();
|
|
|
|
+ await initeCharts();
|
|
loading.value = false;
|
|
loading.value = false;
|
|
});
|
|
});
|
|
-//const search = async (e: { skip: number; limit: number }) => {
|
|
|
|
-// const info = { skip: e.skip, limit: e.limit, ...searchInfo.value };
|
|
|
|
-// const res: IQueryResult = await testAxios.query(info);
|
|
|
|
-// console.log(res);
|
|
|
|
-//};
|
|
|
|
|
|
+const search = async () => {
|
|
|
|
+ let res: IQueryResult = await statisticsAxios.order();
|
|
|
|
+ if (res.errcode == 0) option.value.series[0].data = res.data;
|
|
|
|
+};
|
|
|
|
+const initeCharts = () => {
|
|
|
|
+ let myChart = echarts.init(document.getElementById('myChart'));
|
|
|
|
+ // 绘制图表
|
|
|
|
+ myChart.setOption(option.value);
|
|
|
|
+};
|
|
</script>
|
|
</script>
|
|
<style scoped lang="scss"></style>
|
|
<style scoped lang="scss"></style>
|