刘翔宇-旅管家 3 years ago
parent c307a8a74c
commit a8217344f6

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

@ -0,0 +1,137 @@
<template>
<div :class="className" :style="{height:height,width:width}" />
</template>
<script>
import echarts from 'echarts'
require('echarts/theme/macarons') // echarts theme
import resize from './mixins/resize'
import geoJson from '@/assets/china.json'
const animationDuration = 6000
export default {
mixins: [resize],
props: {
className: {
type: String,
default: 'chart'
},
width: {
type: String,
default: '100%'
},
height: {
type: String,
default: '500px'
},
chartData: {
type: Object
}
},
data() {
return {
chart: null,
statusArr: {
"1": "待投档",
"2": "录取中",
"3": "录取结束",
"4": "已邮寄通知书"
}
}
},
mounted() {
console.log(geoJson)
this.$nextTick(() => {
this.initChart()
})
},
watch: {
chartData: {
deep: true,
handler(val) {
this.setOptions(val)
}
}
},
beforeDestroy() {
if (!this.chart) {
return
}
this.chart.dispose()
this.chart = null
},
methods: {
initChart() {
this.chart = echarts.init(this.$el, 'macarons');
this.setOptions(this.chartData);
},
setOptions(chartdata) {
echarts.registerMap('CHINA', geoJson);
let statusArr=this.statusArr;
//
this.chart.setOption({
backgroundColor: "#c3e2ee",
zoom: 5,
tooltip: {
trigger: "item",
formatter: function(val) {
return "省份:"+val.name+"<br>当前进度: " + statusArr[val.data.itemStyle.status]; //
},
},
toolbox: {
show: true,
orient: "vertical",
left: "right",
top: "center",
feature: {
dataView: {
readOnly: false
},
restore: {},
saveAsImage: {},
},
},
series: [{
type: "map",
map: "CHINA", //,
//
itemStyle: {
normal: {
areaColor: "#e0e0e0",
borderColor: "#fff",
label: {
show: false,
color: "blue",
},
},
emphasis: {
areaColor: "#fd5d02",
label: {
show: true,
color: "white",
},
},
},
roam: true,
top: 70,
label: {
show: true, //
},
data: chartdata
}],
});
this.chart.on("click", function(params) { //params.name...
alert(params.data.code);
console.log(JSON.stringify(params));
});
}
}
}
</script>

@ -1,275 +1,206 @@
<template> <template>
<div> <div>
<div class="statistics"> <div class="statistics">
<panel-group :totaldata="list" />
</div>
</div>
<div class="chart">
<el-row :gutter="20">
</div> <el-col :span="12">
</div> <Map :chartData="chartData" />
</template> </el-col>
<el-col :span="12">
<script> <div class="grid-content bg-purple"></div>
import echarts from "echarts" </el-col>
import PanelGroup from './components/PanelGroup' </el-row>
import {
getChartsHome <div class="chart">
} from "../../api/dashboard.js"
</div>
export default { </div>
components: { </template>
PanelGroup
}, <script>
data() { import echarts from "echarts"
return { import PanelGroup from './components/PanelGroup'
col: '', import Map from './components/Map'
line: '', import {
business_data: [], getChartsHome
collect_data: [], } from "../../api/dashboard.js"
list: {},
customerArr: [], import {
orderArr: [], index as indexprogress
chartData: {}, } from "../../api/unifiedRecruitment/progress"
} export default {
}, components: {
watch: { PanelGroup,
Map
}, },
methods: { data() {
async loadData() { return {
col: '',
}, line: '',
init() { business_data: [],
this.col = echarts.init(document.getElementById('col-chart')) collect_data: [],
this.col.setOption({ list: {},
title: { customerArr: [],
text: '' orderArr: [],
}, chartData: {},
tooltip: { colorArr: {
trigger: 'axis', "1": "#dbebf8",
axisPointer: { "2": "#89badf",
type: 'shadow' "3": "#a1c7e6",
}, "4": "#559acf"
position: 'bottom' }
}, }
legend: {}, },
grid: { watch: {
left: '3%',
right: '4%', },
bottom: '3%', methods: {
containLabel: true async loadData() {
}, this.loadPress()
yAxis: { },
type: 'value', loadPress() {
boundaryGap: [0, 0.01] indexprogress({
}, year: this.year,
xAxis: { page_size: 999
type: 'category', }).then(res => {
data: ['第一周', '第二周', '第三周', '第四周'] var arr = [];
}, for (var mod of res.data) {
series: [{ arr.push({
name: '服务金额', name: mod.province.name,
type: 'bar', itemStyle: {
data: this.business_data, areaColor: this.colorArr[mod.status_id],
itemStyle: { status:mod.status_id
normal: { }
color: 'rgb(42,182,252)' })
}, }
},
}, this.chartData = arr;
{ })
name: '收款', },
type: 'bar', init() {}
data: this.collect_data, },
itemStyle: { created() {
normal: {
color: 'rgb(34,228,255)' this.loadData();
}, },
}, mounted() {
}
]
})
},
this.line = echarts.init(document.getElementById('line-chart')) destroyed() {
this.line.setOption({ window.onresize = null
title: { }
text: '' }
}, </script>
tooltip: {
trigger: 'axis' <style lang="scss" scoped>
}, .statistics {
legend: { display: flex;
data: ['活跃客户', '服务订单']
}, margin-top: 20px;
grid: {
left: '3%', &-title {
right: '6%',
bottom: '3%', padding-left: 6px;
containLabel: true }
},
toolbox: { &-content {
text-align: center;
}, font-size: 13px;
xAxis: {
type: 'category', &-top {
boundaryGap: false,
data: ['第一周', '第二周', '第三周', '第四周'] &__num {
}, font-weight: 600;
yAxis: { }
type: 'value',
}, &__name {
series: [{ font-size: 10px;
name: '活跃客户', color: rgb(140, 140, 140);
type: 'line', }
stack: 'Total', }
data: this.customerArr,
itemStyle: { &-bottom {
normal: { display: flex;
color: 'rgb(42,182,252)' justify-content: space-between;
},
}, &-left {
},
{ &__num {
name: '服务订单', font-weight: 600;
type: 'line', }
stack: 'Total',
data: this.orderArr, &__name {
itemStyle: { font-size: 10px;
normal: { color: rgb(140, 140, 140);
color: 'rgb(34,228,255)' }
}, }
},
} &-right {
]
}) &__num {
} font-weight: 600;
}, }
created() {
&__name {
this.loadData(); font-size: 10px;
}, color: rgb(140, 140, 140);
mounted() { }
}
}
//this.init() }
window.onresize = () => { &>div {
this.col.resize() flex: 1;
this.line.resize() margin-right: 20px;
}
&:last-child {
}, margin-right: 0;
destroyed() { }
window.onresize = null }
} }
}
</script> .chart {
display: flex;
<style lang="scss" scoped>
.statistics { margin-top: 20px;
display: flex;
margin-top: 20px; .chartItem {
&-title { width: 49%;
padding-left: 6px; .chartItemTitle {
} font-size: 16px;
margin-bottom: 20px;
&-content { }
text-align: center;
font-size: 13px; #col-chart {
background: #fff;
&-top { border-radius: 10px;
flex: 1;
&__num { margin-right: 20px;
font-weight: 600; padding: 20px;
} box-sizing: border-box;
min-height: 400px;
&__name { width: 100%;
font-size: 10px; }
color: rgb(140, 140, 140);
} #line-chart {
} background: #fff;
border-radius: 10px;
&-bottom { flex: 1;
display: flex; padding: 20px;
justify-content: space-between; box-sizing: border-box;
min-height: 400px;
&-left { }
}
&__num {
font-weight: 600;
} }
&__name {
font-size: 10px;
color: rgb(140, 140, 140);
}
}
&-right {
&__num {
font-weight: 600;
}
&__name {
font-size: 10px;
color: rgb(140, 140, 140);
}
}
}
}
&>div {
flex: 1;
margin-right: 20px;
&:last-child {
margin-right: 0;
}
}
}
.chart {
display: flex;
margin-top: 20px;
.chartItem {
width: 49%;
.chartItemTitle {
font-size: 16px;
margin-bottom: 20px;
}
#col-chart {
background: #fff;
border-radius: 10px;
flex: 1;
margin-right: 20px;
padding: 20px;
box-sizing: border-box;
min-height: 400px;
width: 100%;
}
#line-chart {
background: #fff;
border-radius: 10px;
flex: 1;
padding: 20px;
box-sizing: border-box;
min-height: 400px;
}
}
}
</style> </style>

Loading…
Cancel
Save