|
@@ -101,7 +101,7 @@
|
101
|
101
|
<div>
|
102
|
102
|
<!--<line-chart :options="options2"></line-chart>-->
|
103
|
103
|
<line-chart v-if="this.$route.query.range_type == 1" :options="options"></line-chart>
|
104
|
|
- <line-chart v-if="this.$route.query.range_type == 2" :options="options2"></line-chart>
|
|
104
|
+ <line-chart1 v-if="this.$route.query.range_type == 2" :options="options2"></line-chart1>
|
105
|
105
|
|
106
|
106
|
|
107
|
107
|
|
|
@@ -118,6 +118,7 @@
|
118
|
118
|
const moment = require('moment')
|
119
|
119
|
import echarts from 'echarts'
|
120
|
120
|
import LineChart from '../../qcd/components/LineChart'
|
|
121
|
+ import LineChart1 from '../../qcd/components/LineChart1'
|
121
|
122
|
import { uParseTime } from '@/utils/tools'
|
122
|
123
|
import BreadCrumb from '@/xt_pages/components/bread-crumb'
|
123
|
124
|
import { getCurrentOrgPatients } from '@/api/common/common'
|
|
@@ -136,6 +137,7 @@
|
136
|
137
|
name: 'dialysisTotal',
|
137
|
138
|
components: {
|
138
|
139
|
LineChart,
|
|
140
|
+ LineChart1,
|
139
|
141
|
BreadCrumb
|
140
|
142
|
},
|
141
|
143
|
data() {
|
|
@@ -200,12 +202,19 @@
|
200
|
202
|
name: '',
|
201
|
203
|
type: 'line',
|
202
|
204
|
data: [],
|
|
205
|
+ symbol: 'circle',//折线点设置为实心点
|
|
206
|
+ symbolSize: 15, //折线点的大小
|
203
|
207
|
barWidth: 30,
|
204
|
208
|
label: {
|
205
|
209
|
normal: {
|
206
|
210
|
show: true,
|
207
|
|
- position: 'top',
|
208
|
|
- formatter: '{c}'
|
|
211
|
+ position: "top",
|
|
212
|
+ formatter: (params) => {
|
|
213
|
+ let str = ''
|
|
214
|
+ str = this.otherData[params.dataIndex]
|
|
215
|
+ return str
|
|
216
|
+
|
|
217
|
+ }
|
209
|
218
|
}
|
210
|
219
|
},
|
211
|
220
|
//配置样式
|
|
@@ -214,24 +223,33 @@
|
214
|
223
|
|
215
|
224
|
//每个柱子的颜色即为colorList数组里的每一项,如果柱子数目多于colorList的长度,则柱子颜色循环使用该数组
|
216
|
225
|
normal: {
|
217
|
|
- color: function(params) {
|
|
226
|
+ color: (params) => {
|
218
|
227
|
//我这边就两个柱子,大体就两个柱子颜色渐变,所以数组只有两个值,多个颜色就多个值
|
219
|
|
- var colorList = [
|
220
|
|
- ['#A9E0F3', '#9FBDFC'],
|
221
|
|
-
|
222
|
|
- ['#FFD7C0', '#FF9994']
|
223
|
|
- ]
|
224
|
|
-
|
225
|
|
- var index = params.dataIndex
|
226
|
|
- if (params.dataIndex >= colorList.length) {
|
227
|
|
- index = params.dataIndex % colorList.length
|
228
|
|
- }
|
229
|
|
-
|
230
|
|
- return new echarts.graphic.LinearGradient(0, 0, 0, 1, [
|
231
|
|
- { offset: 0, color: colorList[index][0] },
|
232
|
|
- // { offset: 0.5, color: colorList[index][1] },
|
233
|
|
- { offset: 1, color: colorList[index][1] }
|
234
|
|
- ])
|
|
228
|
+ var colorList = [
|
|
229
|
+ ['#409EFF','#409EFF'],
|
|
230
|
+ ['#f56c6c','#f56c6c']
|
|
231
|
+ ];
|
|
232
|
+ if(params.seriesName == this.otherData[params.dataIndex]){
|
|
233
|
+ var index = 0
|
|
234
|
+ }else {
|
|
235
|
+ var index = 1
|
|
236
|
+ }
|
|
237
|
+
|
|
238
|
+
|
|
239
|
+ // var index = params.dataIndex;
|
|
240
|
+ // if (params.dataIndex >= colorList.length) {
|
|
241
|
+ // index = params.dataIndex % colorList.length;
|
|
242
|
+ // }
|
|
243
|
+
|
|
244
|
+ return new echarts.graphic.LinearGradient(0, 0, 0, 1, [
|
|
245
|
+ {offset: 0, color: colorList[index][0]},
|
|
246
|
+ // { offset: 0.5, color: colorList[index][1] },
|
|
247
|
+ {offset: 1, color: colorList[index][1]}
|
|
248
|
+ ]);
|
|
249
|
+ },
|
|
250
|
+ lineStyle: {
|
|
251
|
+ width:2,
|
|
252
|
+ color: "#cccccc"//折线的颜色
|
235
|
253
|
},
|
236
|
254
|
barBorderRadius: [5, 5, 0, 0] //柱状角成椭圆形
|
237
|
255
|
},
|
|
@@ -449,7 +467,8 @@
|
449
|
467
|
{ value: 4, label: '近一年', state: 4 },
|
450
|
468
|
{ value: 5, label: '自定义', state: 5 }
|
451
|
469
|
],
|
452
|
|
- search_value: ''
|
|
470
|
+ search_value: '',
|
|
471
|
+ otherData:[]
|
453
|
472
|
}
|
454
|
473
|
},
|
455
|
474
|
methods: {
|
|
@@ -599,9 +618,15 @@
|
599
|
618
|
this.options2.xAxis.data.push(resp.data.data[i].date)
|
600
|
619
|
tempData.push(resp.data.data[i].value)
|
601
|
620
|
otherData.push(resp.data.data[i].value)
|
|
621
|
+ this.options2.series[0].name = resp.data.references.range_value
|
602
|
622
|
}
|
603
|
623
|
}
|
604
|
|
-
|
|
624
|
+ this.otherData = otherData
|
|
625
|
+ if(this.$route.query.range_type == 1){
|
|
626
|
+ this.getArrLength(this.options.xAxis.data,1)
|
|
627
|
+ }else{
|
|
628
|
+ this.getArrLength(this.options2.xAxis.data,this.$route.query.range_type)
|
|
629
|
+ }
|
605
|
630
|
console.log(this.options.xAxis.data)
|
606
|
631
|
|
607
|
632
|
console.log(this.options.series[0].data)
|
|
@@ -641,6 +666,26 @@
|
641
|
666
|
}, getTimestamp(time) {
|
642
|
667
|
// 把时间日期转成时间戳
|
643
|
668
|
return new Date(time).getTime() / 1000
|
|
669
|
+ },
|
|
670
|
+ getArrLength(result,type){
|
|
671
|
+ if(type == 1){
|
|
672
|
+ if(result.length > 10){
|
|
673
|
+ var dataZoom_end = (10/result.length)*100;
|
|
674
|
+ this.options.dataZoom[0].end = dataZoom_end
|
|
675
|
+ }else{
|
|
676
|
+ var dataZoom_end = 100;
|
|
677
|
+ this.options.dataZoom[0].end = dataZoom_end
|
|
678
|
+ }
|
|
679
|
+ }else{
|
|
680
|
+ if(result.length > 10){
|
|
681
|
+ var dataZoom_end = (10/result.length)*100;
|
|
682
|
+ this.options2.dataZoom[0].end = dataZoom_end
|
|
683
|
+ }else{
|
|
684
|
+ var dataZoom_end = 100;
|
|
685
|
+ this.options2.dataZoom[0].end = dataZoom_end
|
|
686
|
+ }
|
|
687
|
+ }
|
|
688
|
+
|
644
|
689
|
}
|
645
|
690
|
|
646
|
691
|
},
|