Browse Source

home dashboard.vue

old
wangqing 5 years ago
parent
commit
2a5ffec519
  1. 67
      src/components/echarts/BarChart.vue
  2. 118
      src/components/echarts/BoxCard.vue
  3. 139
      src/components/echarts/LineChart.vue
  4. 118
      src/components/echarts/MapChart.vue
  5. 181
      src/components/echarts/PanelGroup.vue
  6. 48
      src/components/echarts/PieChart.vue
  7. 55
      src/components/echarts/TransactionTable.vue
  8. 27
      src/components/echarts/china.js
  9. 12
      src/views/form/write.vue
  10. 233
      src/views/home/dashboard.vue

67
src/components/echarts/BarChart.vue

@ -1,5 +1,5 @@
<template>
<div :class="className" :style="{height:height,width:width}" />
<div :class="className" :style="{height:height,width:width}"/>
</template>
<script>
@ -23,6 +23,18 @@ export default {
height: {
type: String,
default: '300px'
},
chartOption: {
type: Object,
required: true
}
},
watch: {
chartOption: {
deep: true,
handler(val) {
this.setOptions(val)
}
}
},
data() {
@ -45,57 +57,10 @@ export default {
methods: {
initChart() {
this.chart = echarts.init(this.$el, 'macarons')
this.chart.setOption({
tooltip: {
trigger: 'axis',
axisPointer: { //
type: 'shadow' // 线'line' | 'shadow'
}
},
grid: {
top: 10,
left: '2%',
right: '2%',
bottom: '3%',
containLabel: true
this.setOptions(this.chartOption)
},
xAxis: [{
type: 'category',
data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'],
axisTick: {
alignWithLabel: true
}
}],
yAxis: [{
type: 'value',
axisTick: {
show: false
}
}],
series: [{
name: 'pageA',
type: 'bar',
stack: 'vistors',
barWidth: '60%',
data: [79, 52, 200, 334, 390, 330, 220],
animationDuration
}, {
name: 'pageB',
type: 'bar',
stack: 'vistors',
barWidth: '60%',
data: [80, 52, 200, 334, 390, 330, 220],
animationDuration
}, {
name: 'pageC',
type: 'bar',
stack: 'vistors',
barWidth: '60%',
data: [30, 52, 200, 334, 390, 330, 220],
animationDuration
}]
})
setOptions(chartOption) {
this.chart.setOption(chartOption)
}
}
}

118
src/components/echarts/BoxCard.vue

@ -1,118 +0,0 @@
<template>
<el-card class="box-card-component" style="margin-left:8px;">
<div slot="header" class="box-card-header">
<img src="https://wpimg.wallstcn.com/e7d23d71-cf19-4b90-a1cc-f56af8c0903d.png">
</div>
<div style="position:relative;">
<pan-thumb :image="avatar" class="panThumb" />
<mallki class-name="mallki-text" text="vue-element-admin" />
<div style="padding-top:35px;" class="progress-item">
<span>Vue</span>
<el-progress :percentage="70" />
</div>
<div class="progress-item">
<span>JavaScript</span>
<el-progress :percentage="18" />
</div>
<div class="progress-item">
<span>CSS</span>
<el-progress :percentage="12" />
</div>
<div class="progress-item">
<span>ESLint</span>
<el-progress :percentage="100" status="success" />
</div>
</div>
</el-card>
</template>
<script>
import { mapGetters } from 'vuex'
import PanThumb from '@/components/PanThumb'
import Mallki from '@/components/TextHoverEffect/Mallki'
export default {
components: { PanThumb, Mallki },
filters: {
statusFilter(status) {
const statusMap = {
success: 'success',
pending: 'danger'
}
return statusMap[status]
}
},
data() {
return {
statisticsData: {
article_count: 1024,
pageviews_count: 1024
}
}
},
computed: {
...mapGetters([
'name',
'avatar',
'roles'
])
}
}
</script>
<style lang="scss" >
.box-card-component{
.el-card__header {
padding: 0px!important;
}
}
</style>
<style lang="scss" scoped>
.box-card-component {
.box-card-header {
position: relative;
height: 220px;
img {
width: 100%;
height: 100%;
transition: all 0.2s linear;
&:hover {
transform: scale(1.1, 1.1);
filter: contrast(130%);
}
}
}
.mallki-text {
position: absolute;
top: 0px;
right: 0px;
font-size: 20px;
font-weight: bold;
}
.panThumb {
z-index: 100;
height: 70px!important;
width: 70px!important;
position: absolute!important;
top: -45px;
left: 0px;
border: 5px solid #ffffff;
background-color: #fff;
margin: auto;
box-shadow: none!important;
::v-deep .pan-info {
box-shadow: none!important;
}
}
.progress-item {
margin-bottom: 10px;
font-size: 14px;
}
@media only screen and (max-width: 1510px){
.mallki-text{
display: none;
}
}
}
</style>

139
src/components/echarts/LineChart.vue

@ -1,5 +1,5 @@
<template>
<div :class="className" :style="{height:height,width:width}" />
<div :class="className" :style="{height:height,width:width}"/>
</template>
<script>
@ -26,7 +26,7 @@ export default {
type: Boolean,
default: true
},
chartData: {
chartOption: {
type: Object,
required: true
}
@ -37,7 +37,7 @@ export default {
}
},
watch: {
chartData: {
chartOption: {
deep: true,
handler(val) {
this.setOptions(val)
@ -59,76 +59,69 @@ export default {
methods: {
initChart() {
this.chart = echarts.init(this.$el, 'macarons')
this.setOptions(this.chartData)
},
setOptions({ expectedData, actualData } = {}) {
this.chart.setOption({
xAxis: {
data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'],
boundaryGap: false,
axisTick: {
show: false
}
},
grid: {
left: 10,
right: 10,
bottom: 20,
top: 30,
containLabel: true
},
tooltip: {
trigger: 'axis',
axisPointer: {
type: 'cross'
},
padding: [5, 10]
},
yAxis: {
axisTick: {
show: false
}
},
legend: {
data: ['expected', 'actual']
},
series: [{
name: 'expected', itemStyle: {
normal: {
color: '#FF005A',
lineStyle: {
color: '#FF005A',
width: 2
}
}
},
smooth: true,
type: 'line',
data: expectedData,
animationDuration: 2800,
animationEasing: 'cubicInOut'
},
{
name: 'actual',
smooth: true,
type: 'line',
itemStyle: {
normal: {
color: '#3888fa',
lineStyle: {
color: '#3888fa',
width: 2
},
areaStyle: {
color: '#f3f8ff'
}
}
},
data: actualData,
animationDuration: 2800,
animationEasing: 'quadraticOut'
}]
})
this.setOptions(this.chartOption)
},
setOptions(chartOption) {
this.chart.setOption(chartOption)
// this.chart.setOption({
// xAxis: {
// data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'],
// boundaryGap: false,
// axisTick: {
// show: false
// }
// },
// grid: {
// left: 10,
// right: 10,
// bottom: 20,
// top: 30,
// containLabel: true
// },
// tooltip: {
// trigger: 'axis',
// axisPointer: {
// type: 'cross'
// },
// padding: [5, 10]
// },
// yAxis: {
// axisTick: {
// show: false
// }
// },
// legend: {
// data: ['expected', 'actual']
// },
// series: [{
// name: 'expected',
// smooth: true,
// type: 'line',
// data: expectedData,
// animationDuration: 2800,
// animationEasing: 'cubicInOut'
// },
// {
// name: 'actual',
// smooth: true,
// type: 'line',
// itemStyle: {
// normal: {
// color: '#3888fa',
// lineStyle: {
// color: '#3888fa',
// width: 2
// },
// areaStyle: {
// color: '#f3f8ff'
// }
// }
// },
// data: actualData,
// animationDuration: 2800,
// animationEasing: 'quadraticOut'
// }]
// })
}
}
}

118
src/components/echarts/MapChart.vue

@ -4,10 +4,10 @@
<script>
const echarts = require('echarts')
require('./china.js')
require('echarts/theme/macarons') // echarts theme
import resize from './mixins/resize'
export default {
mixins: [resize],
props: {
@ -22,6 +22,10 @@ export default {
height: {
type: String,
default: '300px'
},
chartOption: {
type: Object,
required: true
}
},
data() {
@ -29,6 +33,14 @@ export default {
chart: null
}
},
watch: {
chartOption: {
deep: true,
handler(val) {
this.setOptions(val)
}
}
},
mounted() {
this.$nextTick(() => {
this.initChart()
@ -43,105 +55,17 @@ export default {
},
methods: {
initChart() {
this.$api.get('https://unpkg.com/echarts@3.6.2/map/json/china.json').then(res=>{
echarts.registerMap('china', res);
this.chart = echarts.init(this.$el, 'macarons')
this.chart.setOption({
title: {
text: '订单量',
subtext: '纯属虚构',
left: 'center'
},
tooltip: {
trigger: 'item'
},
legend: {
orient: 'vertical',
left: 'left',
data: ['订单量']
},
visualMap: {
type: 'piecewise',
pieces: [
{min: 1500},
{min: 900, max: 1500},
{min: 310, max: 1000},
{min: 200, max: 300},
{min: 10, max: 200, label: '10 到 200(自定义label)'},
{value: 123, label: '123(自定义特殊颜色)', color: 'grey'},
{min: 5, max: 5, label: '5(自定义特殊颜色)', color: 'black'},
{max: 5}
],
color: ['#E0022B', '#E09107', '#A3E00B']
},
toolbox: {
show: true,
orient: 'vertical',
left: 'right',
top: 'center',
feature: {
mark: {show: true},
dataView: {show: true, readOnly: false},
restore: {show: true},
saveAsImage: {show: true}
}
},
roamController: {
show: true,
left: 'right',
mapTypeControl: {
'china': true
}
},
series: [
{
name: '订单量',
type: 'map',
mapType: 'china',
roam: false,
label: {
show: true,
color: 'rgb(249, 249, 249)'
this.setOptions(this.chartOption)
})
},
data: [
{name: '北京', value: 5},
{name: '天津', value: Math.round(Math.random() * 2000)},
{name: '上海', value: Math.round(Math.random() * 2000)},
{name: '重庆', value: Math.round(Math.random() * 2000)},
{name: '河北', value: 0},
{name: '河南', value: Math.round(Math.random() * 2000)},
{name: '云南', value: 123},
{name: '辽宁', value: 305},
{name: '黑龙江', value: Math.round(Math.random() * 2000)},
{name: '湖南', value: 200},
{name: '安徽', value: Math.round(Math.random() * 2000)},
{name: '山东', value: Math.round(Math.random() * 2000)},
{name: '新疆', value: Math.round(Math.random() * 2000)},
{name: '江苏', value: Math.round(Math.random() * 2000)},
{name: '浙江', value: Math.round(Math.random() * 2000)},
{name: '江西', value: Math.round(Math.random() * 2000)},
{name: '湖北', value: Math.round(Math.random() * 2000)},
{name: '广西', value: Math.round(Math.random() * 2000)},
{name: '甘肃', value: Math.round(Math.random() * 2000)},
{name: '山西', value: Math.round(Math.random() * 2000)},
{name: '内蒙古', value: Math.round(Math.random() * 2000)},
{name: '陕西', value: Math.round(Math.random() * 2000)},
{name: '吉林', value: Math.round(Math.random() * 2000)},
{name: '福建', value: Math.round(Math.random() * 2000)},
{name: '贵州', value: Math.round(Math.random() * 2000)},
{name: '广东', value: Math.round(Math.random() * 2000)},
{name: '青海', value: Math.round(Math.random() * 2000)},
{name: '西藏', value: Math.round(Math.random() * 2000)},
{name: '四川', value: Math.round(Math.random() * 2000)},
{name: '宁夏', value: Math.round(Math.random() * 2000)},
{name: '海南', value: Math.round(Math.random() * 2000)},
{name: '台湾', value: Math.round(Math.random() * 2000)},
{name: '香港', value: Math.round(Math.random() * 2000)},
{name: '澳门', value: Math.round(Math.random() * 2000)}
]
setOptions(chartOption) {
if (!this.chart) {
return
}
]
})
this.chart.setOption(chartOption)
}
}
}

181
src/components/echarts/PanelGroup.vue

@ -1,181 +0,0 @@
<template>
<el-row :gutter="40" class="panel-group">
<el-col :xs="12" :sm="12" :lg="6" class="card-panel-col">
<div class="card-panel" @click="handleSetLineChartData('newVisitis')">
<div class="card-panel-icon-wrapper icon-people">
<svg-icon icon-class="peoples" class-name="card-panel-icon" />
</div>
<div class="card-panel-description">
<div class="card-panel-text">
New Visits
</div>
<count-to :start-val="0" :end-val="102400" :duration="2600" class="card-panel-num" />
</div>
</div>
</el-col>
<el-col :xs="12" :sm="12" :lg="6" class="card-panel-col">
<div class="card-panel" @click="handleSetLineChartData('messages')">
<div class="card-panel-icon-wrapper icon-message">
<svg-icon icon-class="message" class-name="card-panel-icon" />
</div>
<div class="card-panel-description">
<div class="card-panel-text">
Messages
</div>
<count-to :start-val="0" :end-val="81212" :duration="3000" class="card-panel-num" />
</div>
</div>
</el-col>
<el-col :xs="12" :sm="12" :lg="6" class="card-panel-col">
<div class="card-panel" @click="handleSetLineChartData('purchases')">
<div class="card-panel-icon-wrapper icon-money">
<svg-icon icon-class="money" class-name="card-panel-icon" />
</div>
<div class="card-panel-description">
<div class="card-panel-text">
Purchases
</div>
<count-to :start-val="0" :end-val="9280" :duration="3200" class="card-panel-num" />
</div>
</div>
</el-col>
<el-col :xs="12" :sm="12" :lg="6" class="card-panel-col">
<div class="card-panel" @click="handleSetLineChartData('shoppings')">
<div class="card-panel-icon-wrapper icon-shopping">
<svg-icon icon-class="shopping" class-name="card-panel-icon" />
</div>
<div class="card-panel-description">
<div class="card-panel-text">
Shoppings
</div>
<count-to :start-val="0" :end-val="13600" :duration="3600" class="card-panel-num" />
</div>
</div>
</el-col>
</el-row>
</template>
<script>
import CountTo from 'CountTo'
export default {
components: {
CountTo
},
methods: {
handleSetLineChartData(type) {
this.$emit('handleSetLineChartData', type)
}
}
}
</script>
<style lang="scss" scoped>
.panel-group {
margin-top: 18px;
.card-panel-col {
margin-bottom: 32px;
}
.card-panel {
height: 108px;
cursor: pointer;
font-size: 12px;
position: relative;
overflow: hidden;
color: #666;
background: #fff;
box-shadow: 4px 4px 40px rgba(0, 0, 0, .05);
border-color: rgba(0, 0, 0, .05);
&:hover {
.card-panel-icon-wrapper {
color: #fff;
}
.icon-people {
background: #40c9c6;
}
.icon-message {
background: #36a3f7;
}
.icon-money {
background: #f4516c;
}
.icon-shopping {
background: #34bfa3
}
}
.icon-people {
color: #40c9c6;
}
.icon-message {
color: #36a3f7;
}
.icon-money {
color: #f4516c;
}
.icon-shopping {
color: #34bfa3
}
.card-panel-icon-wrapper {
float: left;
margin: 14px 0 0 14px;
padding: 16px;
transition: all 0.38s ease-out;
border-radius: 6px;
}
.card-panel-icon {
float: left;
font-size: 48px;
}
.card-panel-description {
float: right;
font-weight: bold;
margin: 26px;
margin-left: 0px;
.card-panel-text {
line-height: 18px;
color: rgba(0, 0, 0, 0.45);
font-size: 16px;
margin-bottom: 12px;
}
.card-panel-num {
font-size: 20px;
}
}
}
}
@media (max-width:550px) {
.card-panel-description {
display: none;
}
.card-panel-icon-wrapper {
float: none !important;
width: 100%;
height: 100%;
margin: 0 !important;
.svg-icon {
display: block;
margin: 14px auto !important;
float: none !important;
}
}
}
</style>

48
src/components/echarts/PieChart.vue

@ -1,5 +1,5 @@
<template>
<div :class="className" :style="{height:height,width:width}" />
<div :class="className" :style="{height:height,width:width}"/>
</template>
<script>
@ -7,8 +7,6 @@ const echarts = require('echarts')
require('echarts/theme/macarons') // echarts theme
import resize from './mixins/resize'
export default {
mixins: [resize],
props: {
@ -23,6 +21,18 @@ export default {
height: {
type: String,
default: '300px'
},
chartOption: {
type: Object,
required: true
}
},
watch: {
chartOption: {
deep: true,
handler(val) {
this.setOptions(val)
}
}
},
data() {
@ -45,36 +55,10 @@ export default {
methods: {
initChart() {
this.chart = echarts.init(this.$el, 'macarons')
this.chart.setOption({
tooltip: {
trigger: 'item',
formatter: '{a} <br/>{b} : {c} ({d}%)'
},
legend: {
left: 'center',
bottom: '10',
data: ['Industries', 'Technology', 'Forex', 'Gold', 'Forecasts']
this.setOptions(this.chartOption)
},
series: [
{
name: 'WEEKLY WRITE ARTICLES',
type: 'pie',
roseType: 'radius',
radius: [15, 95],
center: ['50%', '38%'],
data: [
{ value: 320, name: 'Industries' },
{ value: 240, name: 'Technology' },
{ value: 149, name: 'Forex' },
{ value: 100, name: 'Gold' },
{ value: 59, name: 'Forecasts' }
],
animationEasing: 'cubicInOut',
animationDuration: 2600
}
]
})
setOptions(chartOption) {
this.chart.setOption(chartOption)
}
}
}

55
src/components/echarts/TransactionTable.vue

@ -1,55 +0,0 @@
<template>
<el-table :data="list" style="width: 100%;padding-top: 15px;">
<el-table-column label="Order_No" min-width="200">
<template slot-scope="scope">
{{ scope.row.order_no | orderNoFilter }}
</template>
</el-table-column>
<el-table-column label="Price" width="195" align="center">
<template slot-scope="scope">
¥{{ scope.row.price | toThousandFilter }}
</template>
</el-table-column>
<el-table-column label="Status" width="100" align="center">
<template slot-scope="{row}">
<el-tag :type="row.status | statusFilter">
{{ row.status }}
</el-tag>
</template>
</el-table-column>
</el-table>
</template>
<script>
import { transactionList } from '@/api/remote-search'
export default {
filters: {
statusFilter(status) {
const statusMap = {
success: 'success',
pending: 'danger'
}
return statusMap[status]
},
orderNoFilter(str) {
return str.substring(0, 30)
}
},
data() {
return {
list: null
}
},
created() {
this.fetchData()
},
methods: {
fetchData() {
transactionList().then(response => {
this.list = response.data.items.slice(0, 8)
})
}
}
}
</script>

27
src/components/echarts/china.js

File diff suppressed because one or more lines are too long

12
src/views/form/write.vue

@ -39,6 +39,9 @@ import loadWXJs from '@/utils/loadWxSdk'
import defaultValue from '@/utils/defaultValue'
import {getCurrentDomain, getQueryString} from '@/utils'
const uaParser = require('ua-parser-js')
const ua = uaParser(navigator.userAgent)
require('@/utils/ut')
let wx
export default {
@ -76,7 +79,6 @@ export default {
this.projectConfig.projectKey = key
let wxCode = getQueryString('code')
if (wxCode) {
alert(wxCode)
this.wxAuthorizationCode = wxCode
this.getWxAuthorizationUserInfo()
}
@ -88,7 +90,7 @@ export default {
this.wxSignature = res.data
this.setWxConfig()
})
console.log(ua)
},
mounted() {
this.viewProjectHandle()
@ -209,10 +211,8 @@ export default {
})
},
onlyWxOpenHandle() {
let ua = navigator.userAgent.toLowerCase()
let isWeixin = ua.indexOf('micromessenger') != -1
let isAndroid = ua.indexOf('android') != -1
let isIos = (ua.indexOf('iphone') != -1) || (ua.indexOf('ipad') != -1)
let wxUa = navigator.userAgent.toLowerCase()
let isWeixin = wxUa.indexOf('micromessenger') != -1
if (!isWeixin) {
document.head.innerHTML = '<title>抱歉,出错了</title><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=0"><link rel="stylesheet" type="text/css" href="https://res.wx.qq.com/open/libs/weui/0.4.1/weui.css">'
document.body.innerHTML = '<div class="weui_msg"><div class="weui_icon_area"><i class="weui_icon_info weui_icon_msg"></i></div><div class="weui_text_area"><h4 class="weui_msg_title">请在微信客户端打开链接</h4></div></div>'

233
src/views/home/dashboard.vue

@ -12,6 +12,7 @@
@change="projectChangeHandle"
>
<el-option
v-for="item in projectListData"
:key="item.key"
:label="item.name"
@ -25,8 +26,8 @@
>
<el-row style="height: 50px;" />
<el-row>
<el-row type="flex" justify="space-around">
<el-col :offset="2" :span="5">
<el-row type="flex" justify="space-around" style="text-align: center;">
<el-col :span="5">
<span>有效回收量</span>
</el-col>
<el-col :span="5">
@ -39,9 +40,11 @@
<span>平均完成时间</span>
</el-col>
</el-row>
<el-row type="flex" justify="space-around">
<el-col :offset="2" :span="5">
<count-to :end-val="projectStats.completeCount" style="font-size: 20px; text-align: center;" />
<el-row type="flex" justify="space-around" style="text-align: center;">
<el-col :span="5">
<count-to :end-val="projectStats.completeCount"
style="font-size: 20px;"
/>
</el-col>
<el-col :span="5">
<count-to :end-val="projectStats.viewCount" style="font-size: 20px;" />
@ -58,7 +61,7 @@
</el-row>
</el-row>
<el-row>
<line-chart :chart-data="lineChartData" />
<line-chart :chart-option="lineChartOptionData" />
</el-row>
</el-row>
</el-col>
@ -70,7 +73,7 @@
</el-row>
<el-row>
<el-col :span="18">
<map-chart />
<map-chart :chart-option="mapChartOptionData" />
</el-col>
</el-row>
<el-row type="flex" justify="space-around">
@ -81,7 +84,7 @@
</el-col>
</el-row>
<el-row>
<bar-chart />
<bar-chart :chart-option="barChartOptionData" />
</el-row>
</el-col>
<el-col :span="12">
@ -91,7 +94,7 @@
</el-col>
</el-row>
<el-row>
<pie-chart />
<pie-chart :chart-option="pieChartOptionData" />
</el-row>
</el-col>
</el-row>
@ -107,24 +110,7 @@ import MapChart from '@/components/echarts/MapChart'
import CountTo from '@/components/CountTo'
import BarChart from '@/components/echarts/BarChart'
import {timeFormat} from '@/utils/index'
const lineChartData = {
newVisitis: {
expectedData: [100, 120, 161, 134, 105, 160, 165],
actualData: [120, 82, 91, 154, 162, 140, 145]
},
messages: {
expectedData: [200, 192, 120, 144, 160, 130, 140],
actualData: [180, 160, 151, 106, 145, 150, 130]
},
purchases: {
expectedData: [80, 100, 121, 104, 105, 90, 100],
actualData: [120, 90, 100, 138, 142, 130, 130]
},
shoppings: {
expectedData: [130, 140, 141, 142, 145, 150, 160],
actualData: [120, 82, 91, 154, 162, 140, 130]
}
}
export default {
name: 'HomeDashboard',
components: {
@ -144,9 +130,12 @@ export default {
completeCount: 0,
completeRate: 0
},
projectSituation: null,
activeProjectKey: null,
lineChartData: lineChartData.newVisitis
//
lineChartOptionData: {},
mapChartOptionData: {},
barChartOptionData: {},
pieChartOptionData: {}
}
},
created() {
@ -161,6 +150,9 @@ export default {
projectChangeHandle() {
this.getProjectStats()
this.getProjectSituation()
this.getProjectSubmitPosition()
this.getProjectSubmitDevice()
this.getProjectSubmitSource()
},
getProjectStats() {
this.$api.get('/user/project/report/stats', {params: {projectKey: this.activeProjectKey}}).then(res => {
@ -174,11 +166,189 @@ export default {
},
getProjectSituation() {
this.$api.get('/user/project/report/situation', {params: {projectKey: this.activeProjectKey}}).then(res => {
this.projectSituation = res.data
this.lineChartOptionData = {
xAxis: {
type: 'category',
boundaryGap: false,
axisTick: {
show: false
},
data: res.data.map(item => {
return item.createTime
})
},
tooltip: {
trigger: 'axis',
backgroundColor: 'rgba(255,255,255,0.8)', // rgba
color: 'black',
borderWidth: '1',
borderColor: 'rgb(156,209,255)',
textStyle: {
color: 'black'
}
},
yAxis: {
type: 'value',
minInterval: 1
},
grid: {
left: '3%',
right: '4%',
bottom: '3%',
containLabel: true
},
series: [{
data: res.data.map(item => {
return item.count
}),
name: '回收数',
stack: '总量',
type: 'line',
areaStyle: {}
}]
}
})
},
//
getProjectSubmitPosition() {
this.$api.get('/user/project/report/position', {params: {projectKey: this.activeProjectKey}}).then(res => {
this.mapChartOptionData = {
tooltip: {
trigger: 'item',
backgroundColor: 'rgba(255,255,255,0.8)', // rgba
color: 'black',
borderWidth: '1',
borderColor: 'rgb(156,209,255)',
textStyle: {
color: 'black'
}
},
visualMap: {
type: 'piecewise',
show: false,
pieces: [
{min: 1500},
{min: 900, max: 1500},
{min: 310, max: 1000},
{min: 1, max: 300}
],
color: ['#E0022B', '#E09107', '#A3E00B']
},
toolbox: {
show: false,
orient: 'vertical',
left: 'right',
top: 'center',
feature: {
restore: {},
saveAsImage: {}
}
},
series: [
{
name: '提交数',
type: 'map',
mapType: 'china',
zoom: 1.2,
roam: false,
label: {
show: true,
color: 'rgb(0,0,0)'
},
data: Object.keys(res.data).map(key => {
return {name: key.replace(/省(s?)|市(s?)|\//ig, ''), value: res.data[key]}
})
}
]
}
})
},
//
getProjectSubmitDevice() {
this.barChartOptionData = {
tooltip: {
trigger: 'axis',
backgroundColor: 'rgba(255,255,255,0.8)', // rgba
color: 'black',
borderWidth: '1',
borderColor: 'rgb(156,209,255)',
textStyle: {
color: 'black'
},
axisPointer: {
type: 'shadow'
}
},
grid: {
left: '3%',
right: '4%',
bottom: '3%',
containLabel: true
},
xAxis: {
type: 'value',
boundaryGap: [0, 0.01]
},
yAxis: {
type: 'category',
data: ['虾米', '印尼', '美国', '印度', '中国', '世界人口(万)']
},
series: [
{
name: '2011年',
type: 'bar',
data: [18203, 23489, 29034, 104970, 131744, 630230]
}
]
}
},
getProjectSubmitSource() {
this.pieChartOptionData = {
tooltip: {
trigger: 'item',
backgroundColor: 'rgba(255,255,255,0.8)', // rgba
color: 'black',
borderWidth: '1',
borderColor: 'rgb(156,209,255)',
textStyle: {
color: 'black'
}
},
series: [
{
name: '访问来源',
type: 'pie',
radius: ['50%', '70%'],
avoidLabelOverlap: false,
label: {
show: false,
position: 'center'
},
emphasis: {
label: {
show: true,
fontSize: '30',
fontWeight: 'bold'
}
},
labelLine: {
show: false
},
data: [
{value: 335, name: '直接访问'},
{value: 310, name: '邮件营销'},
{value: 234, name: '联盟广告'},
{value: 135, name: '视频广告'},
{value: 1548, name: '搜索引擎'}
]
}
]
}
}
}
}
</script>
@ -188,4 +358,7 @@ export default {
border-bottom: 3px solid rgba(68, 68, 68, 100);
line-height: 25px;
}
.el-select-dropdown__item {
width: 300px !important;
}
</style>

Loading…
Cancel
Save