rsbi 4 years ago
parent
commit
b8b416b48d

+ 6 - 0
src/router/index.js

@@ -14,6 +14,7 @@ import PortalCustomiz from '@/view/portal/PortalCustomiz'
 import PortalView from '@/view/portal/PortalView'
 import ReportDesign from '@/view/bireport/ReportDesign'
 import BireportPrint from '@/view/bireport/Print'
+import PortalPrint from '@/view/portal/Print'
 import NotFind from '@/view/NoFind'
 
 Vue.use(Router)
@@ -96,6 +97,11 @@ let router = new Router({
       path: '/bireport/Print',
       name: 'bireportPrint',
       component: BireportPrint
+    },
+    {
+      path:"/portal/Print",
+      name:"portalPrint",
+      component:PortalPrint
     }
   ]
 })

+ 1 - 1
src/view/bireport/Print.vue

@@ -56,7 +56,7 @@
 						data:{pageInfo:JSON.stringify(this.pageInfo)},
 						type:"POST",
 						success:(resp)=>{
-							let option = loopChartJson(resp.rows);
+							let option = loopChartJson(resp.rows.comp);
 							let myChart = echarts.getInstanceByDom(document.getElementById('printChart'+this.chartId));
 							if(!myChart){
 								myChart = echarts.init(document.getElementById('printChart'+this.chartId), "default", {width:640, height:320});

+ 1 - 1
src/view/bireport/ReportTablePrint.vue

@@ -49,7 +49,7 @@ export default {
 				data:{pageInfo:JSON.stringify(pageInfo)},
 				type:"POST",
 				success:(resp)=>{
-					this.datas = resp.rows;
+					this.datas = resp.rows.comp;
 					if(cb){
 						cb();
 					}

+ 1 - 1
src/view/portal/LayoutOptarea.vue

@@ -514,7 +514,7 @@ export default {
           comp.height = Math.round(ui.size.height);  //更新组件高度
         },
         stop:function(event, ui){
-          
+          ts.setUpdate();
         }
       });
     }

+ 0 - 1
src/view/portal/PortalParamView.vue

@@ -108,7 +108,6 @@ export default {
     //初始化参数字段
     initReportParam(reportParam){
       let ts = this;
-      
     }
   },
   mounted(){

+ 5 - 2
src/view/portal/PortalView.vue

@@ -52,7 +52,10 @@ export default {
       }else if(key === '2'){  //定制
          this.$router.push({path:"/portal/Customiz", query:{id:this.reportId}});
       }else if(key === '4'){  //打印
-        
+          let p = this.$refs['paramViewForm'].getParamValues();
+          p.id = this.reportId;  //参数
+          let routeData = this.$router.resolve({path:"/portal/Print", query:p});
+          window.open(routeData.href, '_blank');
       }else if(key === 'html' || key === 'csv' || key === 'excel' || key === 'pdf' || key === 'word'){  //导出
         this.exportReport(key);
       }
@@ -65,7 +68,7 @@ export default {
         success:(resp)=>{
           this.pageInfo = JSON.parse(resp.rows);
           //初始化参数字段
-          this.$refs['paramViewForm'].initReportParam(this.pageInfo.params);
+          //this.$refs['paramViewForm'].initReportParam(this.pageInfo.params);
           this.getReport();
         }
       });

+ 78 - 0
src/view/portal/Print.vue

@@ -0,0 +1,78 @@
+<template>
+  <div>
+	<!-- 参数区域 -->
+    <portal-param-view ref="paramViewForm" :pms="pms"></portal-param-view>
+    <!-- 组件区域 -->
+    <layout-view ref="optarea" :pageInfo="pageInfo"></layout-view>
+  </div>
+</template>
+
+<script>
+	import {ajax, loopChartJson} from '@/common/biConfig'
+	import $ from 'jquery'
+	import { Loading } from "element-ui";
+	import LayoutView from './LayoutView.vue'
+	import PortalParamView from './PortalParamView.vue'
+
+	export default {
+	    data(){
+			return {
+				reportId:null,
+				pageInfo:{},
+      			pms:[]
+			}
+		},
+		components: {
+			 LayoutView,
+    		PortalParamView
+		},
+		mounted(){
+			window.document.title = "报表打印";
+			this.reportId = this.$route.query.id;
+			this.getCfg();
+		},
+		beforeDestroy(){
+			
+		},
+		computed: {
+		},
+		methods: {
+		
+			getCfg(){
+				ajax({
+					url:"portal/get.action",
+					data:{pageId:this.reportId},
+					type:"get",
+					success:(resp)=>{
+						this.pageInfo = JSON.parse(resp.rows);
+						//初始化参数字段
+						this.$refs['paramViewForm'].initReportParam(this.pageInfo.params);
+						this.getReport();
+					}
+				});
+			},
+			getReport(){
+				let loadingInstance = Loading.service({fullscreen:false, target:document.querySelector('.wrapper-content-nomargin')});
+				ajax({
+					url:"portal/view.action",
+					type:"GET",
+					data:{pageId:this.reportId},
+					success:(resp)=>{
+						//渲染组件
+						this.$refs['optarea'].setCompData(resp.rows);
+						this.pms = resp.rows.pms;
+						this.$nextTick(()=>{
+							window.print();
+						});
+					}
+				}, this, loadingInstance);
+			}
+		},
+		watch: {
+		}
+	}
+</script>
+
+<style lang="less" scoped>
+
+</style>