| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239 |
- <template>
- <div class="statisticsPage" :style="{width:width}">
- <div :id="id" :style="{height:height}"/>
- <!-- 打开详情弹窗-->
- <div v-if="dialogOff">
- <dialogView
- :dialogOff = "dialogOff"
- @close = "close"
- :title="title"
- :data="data"
- />
- </div>
- </div>
- </template>
- <script>
- import echarts from 'echarts'
- import dialogView from '../properties/s13shengWuPro.vue'
- import {GetPercent,GetMax} from '../js/config.js'
- export default {
- components:{
- dialogView
- },
- props: {
- data: {
- type: Object,
- },
- width:{
- type:String,
- default:"20%"
- },
- height:{
- type:String,
- default: window.screen.height/5+"px"
- },
- id:{
- type:String,
- default:"s13shengwu"
- },
- click:{
- type:String,
- default:'true'
- },
- },
- data () {
- return {
- title:'投诉回复及时率',
- dialogOff:false,
- measured:[]
- }
- },
- mounted(){
- this.drawLine();
- },
- methods: {
- close(){
- this.dialogOff = false
- },
- /* 跳转统计页面*/
- toDetailed(){
- if(this.click == "true"){
- this.dialogOff = true
- }
- },
- drawLine(){
- // let beginInof = Number(this.data.t_complaintBegin.number)
- // let endInof = Number(this.data.t_complaintEnd.number)
- let s13shengwu = echarts.init(document.getElementById(this.id))
- // let beingDate=this.data.t_complaintBegin.date
- // let endDate=this.data.t_complaintEnd.date
- var option;
- //v2
- // let that = this
- // for (let i = 0; i < that.data.t_complaintNum.date.length; i++) {
- // let result = 0
- // if(that.data.t_mjwtsqbNum.number[i] === 0){
- // result = Math.floor(that.data.t_complaintNum.number[i]/1 * 10000) / 100
- // }else{
- // result = Math.floor(that.data.t_complaintNum.number[i]/that.data.t_mjwtsqbNum.number[i] * 10000) / 100
- // }
- // that.measured.push(result)
- // // console.log(that.data.t_complaintNum.number[i], that.data.t_mjwtsqbNum.number[i], result, 'res')
- // }
- //v3
- let e=[this.data.t_complaintNum.number[0],this.data.t_complaintNum.num48[0]]
- option = {
- //v3
- legend: {},
- tooltip: {
- trigger: 'axis',
- axisPointer: {
- type: 'shadow'
- },
- // formatter: function (params) {
- // return params[0].data[0] + '<br/>满意份数:' + params[0].data[1] + '<br/>调查总份数: ' + params[0].data[2];
- // }
- },
- // dataset: {
- // source: barData
- // },
- xAxis: { type: 'category',data:['有效投诉总次数','投诉后48h内达成一致解决方案次数']},
- yAxis: [
- {
- type: 'value',
- scale: true,
- name: '数量',
- max: this.data.t_complaintNum.number[0]>this.data.t_complaintNum.num48[0]?this.data.t_complaintNum.number[0]+1:this.data.t_complaintNum.num48[0]+1,
- min: 0,
- boundaryGap: [0.2, 0.2]
- },
- // {
- // type: 'value',
- // scale: true,
- // name: '客户投诉率',
- // max: this.data.t_complaintNum.res[0],
- // min: 0,
- // axisLabel: {
- // formatter: '{value} %'
- // }
- // }
- ],
- // Declare several bar series, each will be mapped
- // to a column of dataset.source by default.
- // series: [{ type: 'bar' }],
- series: [
- {
- data: e,
- type: 'bar',
- barWidth: '20%',
- itemStyle: {
- color: '#cc6633'
- },
- label: {
- show: true,
- position: 'top'
- },
- }
- ],
- grid: {
- top: '30%',
- left: '3%',
- right: '4%',
- bottom: '10%',
- containLabel: true
- },
- title: {
- text: this.title,
- textStyle:{ fontSize:14 }
- // subtext: " "+beingDate+"-"+endDate
- },
- //v2
- // rotate: {
- // min: -90,
- // max: 90
- // },
- // grid: {
- // top: '20%',
- // left: '3%',
- // right: '4%',
- // bottom: '10%',
- // containLabel: true
- // },
- // title: {
- // text: this.title,
- // subtext: ' '+this.data.t_complaintNum.date[0]+'-'+this.data.t_complaintNum.date[this.data.t_complaintNum.date.length-1],
- // },
- // xAxis: {
- // type: 'category',
- // data: this.data.t_complaintNum.date
- // },
- // yAxis: {
- // // max:this.data.t_complaintBegin.number>this.data.t_complaintEnd.number?this.data.t_complaintBegin.number+1:this.data.t_complaintEnd.number+1,
- // // max: Math.max(...this.measured),
- // // min:0,
- // type: 'value',
- // axisLabel: {
- // show: true,
- // textStyle:{color:'#000'},
- // interval: 'auto',
- // formatter: '{value} %'
- // },
- // },
- // tooltip: {
- // trigger: 'axis',
- // axisPointer: {
- // type: 'shadow'
- // },
- // formatter: function (params) {
- // // console.log(params,'tousu ')
- // return params[0].axisValue + '<br/>客户投诉率:' + params[0].data;
- // }
- // // formatter:
- // // function (datas) {
- // // let year1 = datas[0].dataIndex==0||datas[0].dataIndex==2;
- // // var res=(year1?beingDate+':':endDate+':')+datas[0].name+':'+datas[0].value
- // // return res
- // // }
- // },
- // series: [
- // {
- // itemStyle: {
- // normal: {
- // color: function(params) {
- // var colorList = [
- // '#F0805A','#B5C334','#FCCE10','#E87C25','#27727B',
- // '#FE8463','#9BCA63','#FAD860','#F3A43B','#60C0DD',
- // '#D7504B','#C6E579','#F4E001','#F0805A','#26C0C0'
- // ];
- // return colorList[params.dataIndex]
- // },
- // }
- // },
- // data: this.measured,
- // type: 'bar',
- // barWidth:50
- // }
- // ]
- };
- option && s13shengwu.setOption(option);
- }
- }
- }
- </script>
- <style scoped>
- #s13shengwu:hover{
- transition: all 0.5s;
- transform:scale(1.03);
- }
- .statisticsPage{
- box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
- float: left;
- }
- </style>
|