This commit is contained in:
熊成强 2020-11-17 14:55:29 +08:00
parent d4ad409b97
commit cc66e4f298
2 changed files with 72 additions and 53 deletions

View File

@ -27,6 +27,15 @@ export function getChartDetail (query) {
}) })
} }
// 获取绩效排名详情
export function apiOwnResult (query) {
return request({
url: '/lz_management/performance/own/result',
method: 'POST',
data: query
})
}
// 获取部门信息 // 获取部门信息
export function getDepList (query) { export function getDepList (query) {
return request({ return request({

View File

@ -6,26 +6,44 @@
</template> </template>
<script> <script>
// import echarts from 'echarts'
let echarts = require('echarts/lib/echarts') import {apiOwnResult} from '@/api/report'
//
require('echarts/lib/chart/bar')
// title
require('echarts/lib/component/tooltip')
require('echarts/lib/component/title')
export default { export default {
name: 'hello', name: '',
data () { data () {
return { return {
option: { charts: '',
title: { opinionData: ['3', '2', '4', '4', '5'],
text: '个人成长曲线' xAxis: [1, 2, 3, 4, 5]
}
}, },
color: ['#3398DB'], methods: {
tooltip: { async handleData () {
trigger: 'axis', let res = await apiOwnResult({})
axisPointer: { // if (res.code !== 200) {
type: 'shadow' // 线'line' | 'shadow' this.$message.error(res.msg)
return []
}
this.opinionData = res.data.map(i => {
i.value = i.allScore
return i
})
if (res.data.length > 4) {
this.xAxis = res.data.map((i, index) => index + 1)
}
return res.data
},
async drawLine (id) {
await this.handleData()
this.charts = echarts.init(document.getElementById(id))
this.charts.setOption({
title: {
text: '个人成长曲线',
textStyle: { // {"fontSize": 18,"fontWeight": "bolder","color": "#333"}
fontFamily: 'Arial, Verdana, sans...',
fontSize: 18,
fontStyle: 'normal',
fontWeight: 'normal'
} }
}, },
grid: { grid: {
@ -34,54 +52,46 @@ export default {
bottom: '3%', bottom: '3%',
containLabel: true containLabel: true
}, },
xAxis: [ xAxis: {
{
type: 'category', type: 'category',
data: ['Mon', 'Tue'], boundaryGap: false,
axisTick: { data: this.xAxis
alignWithLabel: true },
yAxis: {
minInterval: 1,
type: 'value'
},
tooltip: {
trigger: 'axis',
formatter (params) {
for (let x in params) {
return params[x].name + '<br/>绩效得分:' + params[x].value
} }
} }
], },
yAxis: [ series: [{
{ type: 'line',
type: 'value', itemStyle: {
axisLine: {show: false}, normal: {
splitNumber: 3, color: '#09f',
splitLine: {
show: true,
lineStyle: { lineStyle: {
type: 'dashed' color: '#09f'
}
}
}
],
series: [
{
name: '直接访问',
type: 'bar',
barWidth: '60%',
data: [1, 3]
}
]
} }
} }
}, },
data: this.opinionData
}]
})
}
},
//
mounted () { mounted () {
this.drawLine() this.$nextTick(function () {
}, this.drawLine('myChart')
methods: { })
drawLine () {
// domecharts
let myChart = echarts.init(document.getElementById('myChart'))
//
myChart.setOption(this.option)
} }
} }
}
</script> </script>
<style lang='' scoped> <style lang='' scoped>
</style> </style>