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) {
return request({

View File

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