123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117 |
- (function() {
- Vue.component('death-cause', {
- template: '<div style="height: 100%;">\
- <h4 class="c-b5e1fc c-f16 c-t-center div-common-title">死亡原因</h4>\
- <img src="../images/icon.png" class="icon-img" @click="detailClick">\
- <div v-show="!hasData" class="no-result-panel">\
- <div class="no-result-img">\
- <img src="../images/noData.png">\
- </div>\
- <div class="no-result-text">暂无数据!</div>\
- </div>\
- <div v-show="hasData" style="height: 85%;">\
- <div id="div-shiwang-echart" class="ml10"></div>\
- <div class="div-siwang-type" v-if="causeData.length>0">\
- <div class="div-webkit-box" v-for="(cause, idx) in causeData">\
- <div class="c-b5e1fc div-webkit-box-flex1 c-f14">\
- <label class="bar-a" v-bind:class="idx | formatData"></label>\
- <label class="ml10">{{cause.name}}</label>\
- <label class="ml20">{{cause.value}}</label>\
- </div>\
- </div>\
- </div>\
- </div>\
- </div>',
- 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);
- }
- }
-
- })
- })()
|