(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-6a30c24a"],{"5b24":function(t,e,n){"use strict";n("800b")},"800b":function(t,e,n){},d9e9:function(t,e,n){"use strict";n.r(e);var a=function(){var t=this,e=t._self._c;return e("div",{staticClass:"ids-comp-tenants-contract-avg-distance"},[e("div",{staticStyle:{"margin-top":"10px","border-top":"1px solid #CCCCCC"}}),e("div",{staticClass:"contentText",staticStyle:{height:"25px"}},[e("div",{staticClass:"thisYear",attrs:{id:"tenantsContractAvgDistance_thisYear"},on:{click:t.tenantsContractAvgDistanceThisYear}},[t._v("今年")]),e("div",{staticClass:"lastYear",attrs:{id:"tenantsContractAvgDistance_lastYear"},on:{click:t.tenantsContractAvgDistanceLastYear}},[t._v("去年")])]),e("div",{staticStyle:{height:"160px"},attrs:{id:"tenantsContractAvgDistance"}}),e("div",{staticStyle:{"font-family":"PingFangSC-Medium","font-size":"16px",color:"#1F1F1F","text-align":"center"}},[t._v(t._s(t.title))])])},s=[],i=n("313e"),r=n.n(i),o=n("4532"),c=n("aed0"),l={name:"IDS-CompTenantsContractAvgDistance",props:{title:String,default:"厂商服务半径趋势(单位:公里)"},data:function(){return{tenantsList:[],chart:null,timeLimit:"thisYear",legend:[],series:[],months:["1月","2月","3月","4月","5月","6月","7月","8月","9月","10月","11月","12月"]}},created:function(){console.log("调试代码"),this.tenantsList=o["a"].vm.getBossAllTenants()},mounted:function(){$("#tenantsContractAvgDistance_thisYear").css({"border-bottom":"2px solid deepskyblue"}),$("#tenantsContractAvgDistance_lastYear").css({"border-bottom":"none"}),this.initChart()},beforeDestroy:function(){this.chart.dispose(),this.chart=null},methods:{tenantsContractAvgDistanceThisYear:function(){$("#tenantsContractAvgDistance_thisYear").css({"border-bottom":"2px solid deepskyblue"}),$("#tenantsContractAvgDistance_lastYear").css({"border-bottom":"none"}),this.timeLimit="thisYear",this.refreshData()},tenantsContractAvgDistanceLastYear:function(){$("#tenantsContractAvgDistance_thisYear").css({"border-bottom":"none"}),$("#tenantsContractAvgDistance_lastYear").css({"border-bottom":"2px solid deepskyblue"}),this.timeLimit="lastYear",this.refreshData()},initChart:function(){this.chart=r.a.init(document.getElementById("tenantsContractAvgDistance"),"macarons"),this.refreshData()},refreshData:function(){var t=this,e=this.tenantsList.map((function(t){return t.tenant_id})),n={tenants:e.join(","),timeLimit:this.timeLimit};o["a"].vm.fetchBossTenantsContractAvgDistance({authorization:{Authorization:"Bearer "+o["a"].vm.getUserToken()},data:n,vm:o["a"].vm}).then((function(){var e,n,a,s,i,r,c=o["a"].vm.getBossTenantsContractAvgDistance();for("thisYear"===t.timeLimit?e=(new Date).getMonth():"lastYear"===t.timeLimit&&(e=11),t.series=[],t.legend=[],n=0;n<c.length;n++){r=[];var l=t.tenantsList.find((function(t){return t.tenant_id===c[n].tenant_id}));for(c[n].tenant_name=l.tenant_name,a=0;a<=e;a++)r[a]=0;for(a=0;a<c[n].value.length;a++)i=c[n].value[a].date,s=parseInt(i.substr(i.length-2,2)),r[s-1]=c[n].value[a].value;t.legend[n]=c[n].tenant_name,t.series[n]={name:c[n].tenant_name,type:"line",smooth:!1,stock:c[n].tenant_id,data:r}}t.setOptions()})).catch((function(t){t.type="error",t.prefix="boss:",c["a"].showTips(n.vm,t)}))},setOptions:function(){this.chart.clear(),this.chart.setOption({tooltip:{trigger:"axis",formatter:function(t,e,n){for(var a="",s=0;s<t.length;s++){var i=t[s],r=i.name,o=i.value,c=i.seriesName,l='<i style="display:inline-block;width:10px;height:10px;background:'+i.color+';margin-right: 5px;border-radius: 50%;}"></i> ';0===s&&(a+=r+"<br/>"),a+=l+c+"："+o.toFixed(2)+"公里<br/>"}return a}},legend:{top:"7%",data:this.legend},grid:{top:"30%",left:"4%",right:"4%",bottom:"3%",containLabel:!0},xAxis:{type:"category",boundaryGap:!1,data:this.months},yAxis:{type:"value"},series:this.series})}}},h=l,d=(n("5b24"),n("2877")),m=Object(d["a"])(h,a,s,!1,null,"1e5aa576",null);e["default"]=m.exports}}]);