This commit is contained in:
hh 2024-03-27 17:08:37 +08:00
parent 0ef20f7d29
commit a3a14d4ccc
2 changed files with 258 additions and 264 deletions

View File

@ -1,146 +1,143 @@
<template> <template>
<div> <div style="background: #ececec; padding: 25px">
<p class="title">中英足球联赛上座情况</p> <a-card title="按学院分析" :bordered="false">
<template #extra>
<!-- <a-select v-model:value="college" style="width: 300px" :options="collegeOptions"></a-select> -->
<a-select v-model:value="batch" style="margin-left: 10px;width: 120px" :options="batchOptions"></a-select>
<!-- <a-select v-model:value="level" style="margin-left: 10px;width: 120px" :options="levelOptions"></a-select> -->
<a-button style="margin-left: 10px;" type="primary" @click="query">查询</a-button>
</template>
<a-row :gutter="24"> <a-row :gutter="24">
<a-col :xl="12" :style="{ marginBottom: '24px' }"> <a-col :xl="24" :style="{ marginBottom: '24px' }">
<div class="container"> <div class="container">
<div id="map1" style="width: 660px; height: 400px"></div> <div id="map1" style="width: 660px; height: 400px;"></div>
</div>
</a-col>
<a-col :xl="12" :style="{ marginBottom: '24px' }">
<div class="container">
<div id="map2" style="width: 660px; height: 400px"></div>
</div> </div>
</a-col> </a-col>
</a-row> </a-row>
</div> </a-card>
</template> </div>
</template>
<script>
import * as echarts from 'echarts'; <script>
import { defHttp } from '/@/utils/http/axios';
export default { import * as echarts from 'echarts';
methods: {
map1Chart() { export default {
// domecharts main name: "Analysis",
let myChart = echarts.init(document.getElementById("map1")); data() {
// return {
let option = { Url: {
title: { getBatch: '/cet/getBatch',
text: "总上座人数对比", getCollege: '/cet/getCollege',
}, getRate: '/cet/getRateByBatch'
tooltip: {
trigger: 'axis',
axisPointer: {
type: 'shadow'
}
},
legend: {
data: ["英国", "中国"],//
},
xAxis: {
data: ["一级", "二级", "三级", "四级"],
axisLabel: {
interval: 0,
// rotate: 30
}
},
yAxis: {
name: '总上座人数(万)',
},
series: [
{
name: "英国",
type: "bar",
data: [1450, 1100, 450, 300],
label: {
formatter: '{@value}'
}
},
{
name: "中国",
type: "bar",
data: [552, 180, 200, 0],
label: {
formatter: '{@value}'
}
},
],
};
// 使
myChart.setOption(option);
}, },
map2Chart() { collegeOptions: [],
// domecharts main batchOptions: [],
let myChart = echarts.init(document.getElementById("map2")); levelOptions: [
// { value: 'cet4', label: '英语四级' },
let option = { { value: 'cet6', label: '英语六级' }
title: { ],
text: "平均上座人数对比", level: null,
}, college: null,
tooltip: { batch: null
trigger: 'axis', };
axisPointer: { },
type: 'shadow' methods: {
map1Chart() {
// domecharts main
let myChart = echarts.init(document.getElementById("map1"));
//
let option = {
title: {
text: "总上座人数对比",
},
tooltip: {
trigger: 'axis',
axisPointer: {
type: 'shadow'
}
},
legend: {
data: ["英国", "中国"],//
},
xAxis: {
data: ["一级", "二级", "三级", "四级"],
axisLabel: {
interval: 0,
// rotate: 30
}
},
yAxis: {
name: '总上座人数(万)',
},
series: [
{
name: "英国",
type: "bar",
data: [1450, 1100, 450, 300],
label: {
formatter: '{@value}'
} }
}, },
legend: { {
data: ["英国", "中国"],// name: "中国",
}, type: "bar",
xAxis: { data: [552, 180, 200, 0],
data: ["一级", "二级", "三级", "四级"], label: {
axisLabel: { formatter: '{@value}'
interval: 0,
// rotate: 30
} }
}, },
yAxis: { ],
name: '平均上座人数(千)', };
}, // 使
series: [ myChart.setOption(option);
{
name: "英国",
type: "bar",
data: [38, 21, 8, 5],
label: {
formatter: '{@value}'
}
},
{
name: "中国",
type: "bar",
data: [23, 7, 2, 0],
label: {
formatter: '{@value}'
}
},
],
};
// 使
myChart.setOption(option);
},
}, },
mounted() { //
this.map1Chart(); async getBatch() {
this.map2Chart(); const getBatch = await defHttp.get({ url: this.Url.getBatch });
// const getCollege = await defHttp.get({ url: this.Url.getCollege });
// this.collegeOptions = getCollege.colleges;
//
// this.collegeOptions.unshift({ value: '', label: '' });
// this.college = this.collegeOptions[0].value;
this.batchOptions = getBatch.batches;
this.batch = this.batchOptions[0].value;
this.level = this.levelOptions[0].value;
// this.query();
},
//
async query() {
let params = {
batch: this.batch,
level: 'cet4'
}
const data = await defHttp.get({ url: this.Url.getRate, params });
this.$message.info(`查询结果:${JSON.stringify(data)}`);
} }
},
mounted() {
this.getBatch();
this.map1Chart();
} }
</script>
}
<style lang="less" scoped> </script>
.container {
display: flex; <style lang="less" scoped>
background-color: #fff; .container {
padding: 15px; display: flex;
border-radius: 4px; background-color: #fff;
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.09); padding: 15px;
} border-radius: 4px;
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.09);
.title { }
font-size: 34px;
color: rgb(8, 8, 8); .title {
font-weight: bold; font-size: 34px;
} color: rgb(8, 8, 8);
font-weight: bold;
</style> }
</style>

View File

@ -1,146 +1,143 @@
<template> <template>
<div> <div style="background: #ececec; padding: 25px">
<p class="title">中英足球联赛上座情况</p> <a-card title="按学院分析" :bordered="false">
<template #extra>
<!-- <a-select v-model:value="college" style="width: 300px" :options="collegeOptions"></a-select> -->
<a-select v-model:value="batch" style="margin-left: 10px;width: 120px" :options="batchOptions"></a-select>
<!-- <a-select v-model:value="level" style="margin-left: 10px;width: 120px" :options="levelOptions"></a-select> -->
<a-button style="margin-left: 10px;" type="primary" @click="query">查询</a-button>
</template>
<a-row :gutter="24"> <a-row :gutter="24">
<a-col :xl="12" :style="{ marginBottom: '24px' }"> <a-col :xl="24" :style="{ marginBottom: '24px' }">
<div class="container"> <div class="container">
<div id="map1" style="width: 660px; height: 400px"></div> <div id="map1" style="width: 660px; height: 400px;"></div>
</div>
</a-col>
<a-col :xl="12" :style="{ marginBottom: '24px' }">
<div class="container">
<div id="map2" style="width: 660px; height: 400px"></div>
</div> </div>
</a-col> </a-col>
</a-row> </a-row>
</div> </a-card>
</template> </div>
</template>
<script>
import * as echarts from 'echarts'; <script>
import { defHttp } from '/@/utils/http/axios';
export default { import * as echarts from 'echarts';
methods: {
map1Chart() { export default {
// domecharts main name: "Analysis",
let myChart = echarts.init(document.getElementById("map1")); data() {
// return {
let option = { Url: {
title: { getBatch: '/cet/getBatch',
text: "总上座人数对比", getCollege: '/cet/getCollege',
}, getRate: '/cet/getRateByBatch'
tooltip: {
trigger: 'axis',
axisPointer: {
type: 'shadow'
}
},
legend: {
data: ["英国", "中国"],//
},
xAxis: {
data: ["一级", "二级", "三级", "四级"],
axisLabel: {
interval: 0,
// rotate: 30
}
},
yAxis: {
name: '总上座人数(万)',
},
series: [
{
name: "英国",
type: "bar",
data: [1450, 1100, 450, 300],
label: {
formatter: '{@value}'
}
},
{
name: "中国",
type: "bar",
data: [552, 180, 200, 0],
label: {
formatter: '{@value}'
}
},
],
};
// 使
myChart.setOption(option);
}, },
map2Chart() { collegeOptions: [],
// domecharts main batchOptions: [],
let myChart = echarts.init(document.getElementById("map2")); levelOptions: [
// { value: 'cet4', label: '英语四级' },
let option = { { value: 'cet6', label: '英语六级' }
title: { ],
text: "平均上座人数对比", level: null,
}, college: null,
tooltip: { batch: null
trigger: 'axis', };
axisPointer: { },
type: 'shadow' methods: {
map1Chart() {
// domecharts main
let myChart = echarts.init(document.getElementById("map1"));
//
let option = {
title: {
text: "总上座人数对比",
},
tooltip: {
trigger: 'axis',
axisPointer: {
type: 'shadow'
}
},
legend: {
data: ["英国", "中国"],//
},
xAxis: {
data: ["一级", "二级", "三级", "四级"],
axisLabel: {
interval: 0,
// rotate: 30
}
},
yAxis: {
name: '总上座人数(万)',
},
series: [
{
name: "英国",
type: "bar",
data: [1450, 1100, 450, 300],
label: {
formatter: '{@value}'
} }
}, },
legend: { {
data: ["英国", "中国"],// name: "中国",
}, type: "bar",
xAxis: { data: [552, 180, 200, 0],
data: ["一级", "二级", "三级", "四级"], label: {
axisLabel: { formatter: '{@value}'
interval: 0,
// rotate: 30
} }
}, },
yAxis: { ],
name: '平均上座人数(千)', };
}, // 使
series: [ myChart.setOption(option);
{
name: "英国",
type: "bar",
data: [38, 21, 8, 5],
label: {
formatter: '{@value}'
}
},
{
name: "中国",
type: "bar",
data: [23, 7, 2, 0],
label: {
formatter: '{@value}'
}
},
],
};
// 使
myChart.setOption(option);
},
}, },
mounted() { //
this.map1Chart(); async getBatch() {
this.map2Chart(); const getBatch = await defHttp.get({ url: this.Url.getBatch });
// const getCollege = await defHttp.get({ url: this.Url.getCollege });
// this.collegeOptions = getCollege.colleges;
//
// this.collegeOptions.unshift({ value: '', label: '' });
// this.college = this.collegeOptions[0].value;
this.batchOptions = getBatch.batches;
this.batch = this.batchOptions[0].value;
this.level = this.levelOptions[0].value;
this.query();
},
//
async query() {
let params = {
batch: this.batch,
level: 'cet4'
}
const data = await defHttp.get({ url: this.Url.getRate, params });
this.$message.info(`查询结果:${JSON.stringify(data)}`);
} }
},
mounted() {
this.getBatch();
this.map1Chart();
} }
</script>
}
<style lang="less" scoped> </script>
.container {
display: flex; <style lang="less" scoped>
background-color: #fff; .container {
padding: 15px; display: flex;
border-radius: 4px; background-color: #fff;
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.09); padding: 15px;
} border-radius: 4px;
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.09);
.title { }
font-size: 34px;
color: rgb(8, 8, 8); .title {
font-weight: bold; font-size: 34px;
} color: rgb(8, 8, 8);
font-weight: bold;
</style> }
</style>