(function() { Vue.component('death-cause', { template: '
\

死亡原因

\ \
\
\ \
\
暂无数据!
\
\
\
\
\
\
\ \ \ \
\
\
\
\
', props: ["data","city","cityVal"], data: function() { return { causeData: [], hasData:true, newData:null } }, mounted: function() { }, watch:{ data:function(data){ if(data){ this.newData = data.successFlg?data.obj.viewInfos&&JSON.parse(data.obj.viewInfos[0].options[0].option):{}; if(this.newData.series&&this.newData.series[0].data&&this.newData.series[0].data.length>0){ this.hasData = true; this.initData(); }else{ this.hasData = false; } }else{ this.hasData = false; } } }, filters:{ formatData:function(index){ var colorArr = ["bgc-00e6f3","bgc-03fa6c","bgc-ff616f","bgc-0fa5f2","bgc-6576e0","bgc-da0ff2","bgc-f24a0f","bgc-ebff61","bgc-fea92f"]; return colorArr[index]; } }, methods: { detailClick:function(){ var vm = this; var width = (0.7604 * window.screen.width) + 'px'; var height = (0.41875 * window.screen.width) + 'px'; vm.cityVal = vm.cityVal=="0"?"":vm.cityVal; top.layer.open({ id: 'LAY_layuipro', //设定一个id,防止重复弹出 type: 2, title: false, closeBtn: 0, shade: 0.5, shadeClose: true, area: [width, height], content: httpRequest.alertUrl+'/page/bigData/html/alert5.html?town='+vm.city+"&cityVal="+vm.cityVal }); }, initData:function(){//死亡原因 this.causeData = this.newData.series[0].data; var myChart = echarts.init(document.getElementById('div-shiwang-echart')); var option = { // "title": { // "text": "性别分布", // "subtext": "性别分布", // "x": "center" // }, "tooltip": { "trigger": "item" }, color: ["#00e6f3","#03fa6c","#ff616f","#0fa5f2","#6576e0","#da0ff2","#f24a0f","#ebff61","#fea92f"], "series": [{ "center": [ "50%", "50%" ], radius: ['50%', '70%'], "name": "", "type": "pie", "itemStyle": { "normal": { "label": { "show": false }, "labelLine": { "show": false } } }, "data": this.causeData }] } if(myChart){ myChart.clear(); } myChart.setOption(option); } } }) })()