|
@@ -210,22 +210,8 @@ export default {
|
|
|
},
|
|
|
data () {
|
|
|
return {
|
|
|
- equipmentData: [
|
|
|
- { item: '事例一', count: 40, percent: 0.4 },
|
|
|
- { item: '事例二', count: 21, percent: 0.21 },
|
|
|
- { item: '事例三', count: 17, percent: 0.17 },
|
|
|
- { item: '事例四', count: 13, percent: 0.13 },
|
|
|
- { item: '事例五', count: 9, percent: 0.09 }
|
|
|
- ],
|
|
|
- lineData: [
|
|
|
- { week: '周一', value: 3 },
|
|
|
- { week: '周二', value: 4 },
|
|
|
- { week: '周三', value: 7.5 },
|
|
|
- { week: '周四', value: 5 },
|
|
|
- { week: '周五', value: 4.9 },
|
|
|
- { week: '周六', value: 6 },
|
|
|
- { week: '周日', value: 7 }
|
|
|
- ],
|
|
|
+ equipmentData: [],
|
|
|
+ lineData: [],
|
|
|
allCount: 100,
|
|
|
chartPie: null,
|
|
|
chartLine: null,
|
|
@@ -356,12 +342,17 @@ export default {
|
|
|
this.getdate()
|
|
|
console.log(this.date)
|
|
|
this.getDict()
|
|
|
- // this.getInfo()
|
|
|
+ this.getInfo()
|
|
|
},
|
|
|
mounted () {
|
|
|
- this.$nextTick(function () {
|
|
|
- this.getInfo()
|
|
|
- })
|
|
|
+ },
|
|
|
+ updated () {
|
|
|
+ if (this.lineData.length > 0 && this.equipmentData.length > 0) {
|
|
|
+ this.$nextTick(function () {
|
|
|
+ this.getPieCharts('container-pie')
|
|
|
+ this.getLineCharts('container-line')
|
|
|
+ })
|
|
|
+ }
|
|
|
},
|
|
|
methods: {
|
|
|
getdate () {
|
|
@@ -379,9 +370,6 @@ export default {
|
|
|
getDict () {
|
|
|
this.typeDict = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.WORKPLACE_BACKLOG_TYPE)
|
|
|
this.typeDetailDict = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.WORKPLACE_BACKLOG_DETAIL_TYPE)
|
|
|
- getWorkplaceBacklogTopData(this.role).then(res => {
|
|
|
- this.topData = res.data
|
|
|
- })
|
|
|
},
|
|
|
getInfo () {
|
|
|
getWorkplaceBacklogWeekData(this.role).then(res => {
|
|
@@ -392,7 +380,7 @@ export default {
|
|
|
})
|
|
|
return pre
|
|
|
}, [])
|
|
|
- this.getLineCharts('container-line', data)
|
|
|
+ this.lineData = data
|
|
|
})
|
|
|
getWorkplaceBacklogPie(this.role).then(res => {
|
|
|
const data = res.data.reduce((pre, item) => {
|
|
@@ -403,17 +391,20 @@ export default {
|
|
|
})
|
|
|
return pre
|
|
|
}, [])
|
|
|
- this.getPieCharts('container-pie', data)
|
|
|
+ this.equipmentData = data
|
|
|
+ })
|
|
|
+ getWorkplaceBacklogTopData(this.role).then(res => {
|
|
|
+ this.topData = res.data
|
|
|
})
|
|
|
},
|
|
|
- getPieCharts (id, data) {
|
|
|
+ getPieCharts (id) {
|
|
|
this.chartPie && this.chartPie.destroy()// 防止点击搜索按钮新增一个
|
|
|
this.chartPie = new Chart({
|
|
|
container: id,
|
|
|
autoFit: true,
|
|
|
height: 400
|
|
|
})
|
|
|
- this.chartPie.data(data)
|
|
|
+ this.chartPie.data(this.equipmentData)
|
|
|
this.chartPie.scale('count', {
|
|
|
nice: true
|
|
|
})
|
|
@@ -455,14 +446,14 @@ export default {
|
|
|
|
|
|
this.chartPie.render()
|
|
|
},
|
|
|
- getLineCharts (id, data) {
|
|
|
+ getLineCharts (id) {
|
|
|
this.chartLine = new Chart({
|
|
|
container: id,
|
|
|
autoFit: true,
|
|
|
height: 300
|
|
|
})
|
|
|
|
|
|
- this.chartLine.data(data)
|
|
|
+ this.chartLine.data(this.lineData)
|
|
|
this.chartLine.scale({
|
|
|
week: {
|
|
|
range: [0, 1]
|