var reqList = []; var util = {}; util.treeTableXcode = function(data, xcode) { xcode = xcode || ""; for(var i = 0; i < data.length; i++) { var item = data[i]; item.xcode = xcode + i; if(item.children && item.children.length > 0) { util.treeTableXcode(item.children, item.xcode + "-"); } } }; Vue.use(Vuedals.default); new Vue({ el: "#main", data: { tableData: [], valueArea: "350203", optionsArea: [{code:"350203",name:"思明区"}], valueType:'', optionsType:[{name:'全部',code:''},{name:'家医代预约',code:'3'},{name:'居民自主预约',code:'1'}],//发起类型(1本人发起 2家人待预约 3家医代预约) dateValue: [], pickerOptions: { disabledDate: function(d) { return d > new Date(); } }, isloading:false, //加载中 }, components: { vuedals: Vuedals.Component }, mounted: function() { var vm = this //初始化时间 var end = new Date(); var start = new Date(); start.setDate(1) // start.setFullYear(start.getFullYear() - 1); vm.dateValue = [start.format("yyyy-MM-dd"), end.format("yyyy-MM-dd")] //初始化数据 vm.initData() // vm.getDistrict() $("#main").removeClass("c-hide"); //监听后退按钮的操作 EventBus.$on("back-click", function(arg) { history.go(-1); }); //监听页面刷新 EventBus.$on("refresh-click", function(arg) { // alert("刷新") vm.initData() }); window.onresize = function() { } }, methods: { initData: function() { var vm=this var startDate,endDate if(vm.dateValue[0]>vm.dateValue[1]){ vm.$message.warning("开始时间应小于结束时间") return false } vm.isloading=true startDate=vm.dateValue[0] endDate=vm.dateValue[1] var params={ userAgent:localStorage.getItem('wlyyAgentForDoc'), area:vm.valueArea,startDate:startDate,endDate:endDate, type:vm.valueType } statisticAPI.doorServiceOrderAnalyze(params).then(function(res) { vm.isloading=false if(res.status == 200) { vm.tableData=res.data util.treeTableXcode(vm.tableData); } else { vm.$message.error(res.msg) } }) }, seleType:function(){ // this.initData() }, changeDateValue: function() { alert(JSON.stringify(this.dateValue)) }, getDistrict: function() { var vm=this var params={ type:3,code:"350200" } homeAPI.getDistrict(params).then(function(res) { if(res.status == 200) { vm.optionsArea=res.list vm.valueArea=vm.optionsArea[0].code vm.initData() } else { vm.$message.error(res.msg) } }) }, exportData: function() { var vm=this var startDate,endDate if(typeof(vm.dateValue[0])!="string"){ startDate=vm.dateValue[0].format("yyyy-MM-dd") endDate=vm.dateValue[1].format("yyyy-MM-dd") }else{ startDate=vm.dateValue[0] endDate=vm.dateValue[1] } var params={ userAgent:localStorage.getItem('wlyyAgentForDoc'), area:vm.valueArea,startDate:startDate,endDate:endDate, type:vm.valueType } var str = statisticAPI.doorServiceOrderAnalyzeExport+"?area="+vm.valueArea+"&startDate="+startDate+"&endDate="+endDate; window.open(str, "接收包数据导出")//导出数据 }, treeClick: function(item, index) { if(item.open) { this.collapse(item, index); } else { this.expand(item, index); } }, expand: function(item, index) { if(!item.children) { return index; } //展开 for(var i = 0; item.children && i < item.children.length; i++) { var child = item.children[i]; this.tableData.splice(++index, 0, child); if(child.children && child.children.length > 0 && child.open) { index = this.expand(child, index); } } item.open = true; return index; }, collapse: function(item, index) { if(!item.children) { return index; } //收缩 item.open = false; var len = this.tableData[index].children.length; this.tableData.splice(index + 1, len); }, customFieldColumn: function (h, { column, $index }) { return h('span', {style:'height:23px;line-height:28px;'}, [ h('el-popover', { props: { placement: 'top', width: '200',trigger: 'hover', content: '评价均分=“已完成”工单总评分/“已完成”工单数量' }}, [ h('span', {slot: 'reference',class:'font-normal'}, ['评价均分(分)',h('span',{class:'wenhao'},'....')]) ]) ]) }, } });