You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
145 lines
3.8 KiB
145 lines
3.8 KiB
<template>
|
|
<div class="chart-wrap">
|
|
<div id="mychart" :style="myChartStyle"></div>
|
|
</div>
|
|
</template>
|
|
<script>
|
|
import {enterpriseInfo,getScoreAMount,getScoreThreeMount} from "../../../api/enterpriseInformation";
|
|
|
|
export default {
|
|
props:['enterpriseId','qualificationCategory','month'],
|
|
data() {
|
|
return {
|
|
queryForm: {
|
|
enterpriseId: "",
|
|
qualificationCategory: ""
|
|
},
|
|
myChartStyle: { float: "left", width: "90%", height: "400px" }, //图表样式
|
|
enterpriseInfo:null,
|
|
dates:null,
|
|
values:null,
|
|
interval:0
|
|
};
|
|
},
|
|
created() {
|
|
if (this.month==1) {
|
|
this.scoreAMount()
|
|
}
|
|
if (this.month==3||this.month==6) {
|
|
this.scoreThreeMount()
|
|
}
|
|
},
|
|
mounted() {
|
|
|
|
this.$nextTick(() => {
|
|
this.getEnterpriseInfo()
|
|
});
|
|
},
|
|
methods: {
|
|
scoreAMount(){
|
|
getScoreAMount({enterpriseId:this.enterpriseId,qualificationCategory:this.qualificationCategory}).then(res=>{
|
|
console.log(4444, Object.keys(res.data.data))
|
|
this.dates=Object.keys(res.data.data)
|
|
this.values=Object.values(res.data.data)
|
|
})
|
|
},
|
|
scoreThreeMount(){
|
|
getScoreThreeMount({enterpriseId:this.enterpriseId,qualificationCategory:this.qualificationCategory,month:this.month}).then(res=>{
|
|
this.dates=Object.keys(res.data.data)
|
|
this.values=Object.values(res.data.data)
|
|
})
|
|
},
|
|
getEnterpriseInfo(){
|
|
enterpriseInfo(this.enterpriseId).then(res=>{
|
|
this.enterpriseInfo=res.data.data
|
|
console.log(111,this.enterpriseInfo)
|
|
this.initEcharts()
|
|
})
|
|
},
|
|
initEcharts() {
|
|
console.log(333,this.qualificationCategory)
|
|
if (this.month==1){
|
|
this.interval=4
|
|
}
|
|
if (this.month==3||this.month==6){
|
|
this.interval=0
|
|
}
|
|
const option = {
|
|
// title: {
|
|
// text: this.enterpriseInfo.enterpriseName
|
|
// },
|
|
grid: {
|
|
top: "5%",
|
|
left: "10%",
|
|
right: "0%",
|
|
bottom: "8%"
|
|
},
|
|
xAxis: {
|
|
type: "category",
|
|
data: this.dates,
|
|
boundaryGap: false,
|
|
nameTextStyle: {
|
|
color: "#fff"
|
|
},
|
|
axisLabel: {
|
|
interval: this.interval,
|
|
textStyle: {
|
|
color: "#ccc",
|
|
fontSize: "10"
|
|
}
|
|
},
|
|
// axisTick: {
|
|
// interval: this.interval, // 每五个刻度显示一次 (interval = 4 表示每五个刻度显示一次)
|
|
// }
|
|
},
|
|
// toolbox: { //工具栏
|
|
// show: true,
|
|
// feature: {
|
|
// mark: { show: true },
|
|
// dataView: { show: true, readOnly: false },
|
|
// magicType: { show: true, type: ["line", "bar"] },
|
|
// restore: { show: true },
|
|
// saveAsImage: { show: true }
|
|
// }
|
|
// },
|
|
tooltip: {
|
|
trigger: "axis" //显示当前列的所有信息
|
|
},
|
|
yAxis: {
|
|
type: "value",
|
|
max:100
|
|
// axisLabel: {
|
|
// interval: 0,
|
|
// textStyle: {
|
|
// color: 'rgba(255, 255, 255, 1)',
|
|
// fontSize: '12',
|
|
// },
|
|
// },
|
|
},
|
|
lineStyle: {
|
|
color: "red"
|
|
},
|
|
series: [
|
|
{
|
|
symbol: "none",
|
|
data: this.values,
|
|
type: "line"
|
|
// smooth: true,
|
|
}
|
|
]
|
|
};
|
|
const myChart = this.$echarts.init(document.getElementById("mychart"));
|
|
myChart.setOption(option);
|
|
//随着屏幕大小调节图表
|
|
window.addEventListener("resize", () => {
|
|
myChart.resize();
|
|
});
|
|
}
|
|
}
|
|
};
|
|
</script>
|
|
<style lang="less" scoped>
|
|
.chart-wrap {
|
|
// padding: 20px;
|
|
}
|
|
</style>
|
|
|