Merge remote-tracking branch 'origin/master'

master
chaiyapeng 2024-09-03 20:54:06 +08:00
commit 65b5614ea6
1 changed files with 117 additions and 2 deletions

View File

@ -73,17 +73,31 @@
:total="total"
@pagination="getList"
/>
<el-card style="margin-top: 50px">
<div>
<!-- 装ECharts的容器 -->
<div id="main" style="width: 100%; height: 520px; background: #fff">
</div>
</div>
</el-card>
</div>
</template>
<script>
import * as echarts from 'echarts' //echarts
import { userloginfo } from "@/api/system/user";
import PanelGroup from "@/views/dashboard/PanelGroup.vue";
export default {
components: {PanelGroup},
data() {
return {
charts: "",
opinionData: [], //
b: [],
dateRange: [],
listDate: [],
total: 0,
@ -96,6 +110,9 @@ export default {
created() {
this.getList();
},
mounted() {
this.drawLine();
},
methods: {
/** 搜索按钮操作 */
handleQuery() {
@ -112,8 +129,106 @@ export default {
userloginfo(this.addDateRange(this.queryParams,this.dateRange)).then(response => {
this.listDate = response.data.rows;
this.total = response.data.total;
this.drawLine();
}
);}
}
);},
drawLine() {
// 线
this.charts = echarts.init(document.getElementById('main'));
this.b = this.listDate.map(item => item.dataName);
this.opinionData = this.listDate.map(item => item.amount);
// 线
this.charts.setOption({
title: {
left: "3%",
top: "5%",
text: "各个产品消费的总金额", //
},
tooltip: {
trigger: "axis",
},
legend: {
align: "right",
left: "3%",
top: "15%",
data: ["消费金额"], //
},
grid: {
top: "30%",
left: "5%",
right: "5%",
bottom: "5%",
containLabel: true,
},
toolbox: {
feature: {
saveAsImage: {},
},
},
// x
xAxis: {
type: "category",
boundaryGap: true,
axisTick: {
alignWithLabel: true,
},
//
data:this.b
// data: ["1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12"],
},
// y
yAxis: {
type: "value",
boundaryGap: true,
splitNumber: 4,
interval: 250,
},
//
series: [
{
name: "消费金额", //
type: "line",
stack: "总量", //
data: this.opinionData, //
areaStyle: {
color: {
type: "linear",
x: 0,
y: 0,
x2: 0,
y2: 1,
colorStops: [
{
offset: 0,
color: "rgb(255,200,213)",
},
{
offset: 1,
color: "#ffffff",
},
],
global: false,
},
},
itemStyle: {
color: "rgb(255,96,64)",
lineStyle: {
color: "rgb(255,96,64)",
},
},
},
],
});
},
},
}
</script>