优化
This commit is contained in:
parent
d4ad409b97
commit
cc66e4f298
@ -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({
|
||||||
|
|||||||
@ -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: '',
|
||||||
|
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: {
|
title: {
|
||||||
text: '个人成长曲线'
|
text: '个人成长曲线',
|
||||||
},
|
textStyle: { // 主标题文本样式{"fontSize": 18,"fontWeight": "bolder","color": "#333"}
|
||||||
color: ['#3398DB'],
|
fontFamily: 'Arial, Verdana, sans...',
|
||||||
tooltip: {
|
fontSize: 18,
|
||||||
trigger: 'axis',
|
fontStyle: 'normal',
|
||||||
axisPointer: { // 坐标轴指示器,坐标轴触发有效
|
fontWeight: 'normal'
|
||||||
type: 'shadow' // 默认为直线,可选为:'line' | 'shadow'
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
grid: {
|
grid: {
|
||||||
@ -34,54 +52,46 @@ export default {
|
|||||||
bottom: '3%',
|
bottom: '3%',
|
||||||
containLabel: true
|
containLabel: true
|
||||||
},
|
},
|
||||||
xAxis: [
|
xAxis: {
|
||||||
{
|
type: 'category',
|
||||||
type: 'category',
|
boundaryGap: false,
|
||||||
data: ['Mon', 'Tue'],
|
data: this.xAxis
|
||||||
axisTick: {
|
},
|
||||||
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'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
],
|
data: this.opinionData
|
||||||
series: [
|
}]
|
||||||
{
|
})
|
||||||
name: '直接访问',
|
|
||||||
type: 'bar',
|
|
||||||
barWidth: '60%',
|
|
||||||
data: [1, 3]
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
// 调用
|
||||||
mounted () {
|
mounted () {
|
||||||
this.drawLine()
|
this.$nextTick(function () {
|
||||||
},
|
this.drawLine('myChart')
|
||||||
methods: {
|
})
|
||||||
drawLine () {
|
|
||||||
// 基于准备好的dom,初始化echarts实例
|
|
||||||
let myChart = echarts.init(document.getElementById('myChart'))
|
|
||||||
// 绘制图表
|
|
||||||
myChart.setOption(this.option)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang='' scoped>
|
<style lang='' scoped>
|
||||||
|
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user