rsbi 4 gadi atpakaļ
vecāks
revīzija
35ab1ba7ff

+ 6 - 0
src/router/index.js

@@ -16,6 +16,7 @@ import ReportDesign from '@/view/bireport/ReportDesign'
 import BireportPrint from '@/view/bireport/Print'
 import PortalPrint from '@/view/portal/Print'
 import PortalPushView from '@/view/portal/PortalPushView'
+import PortalShareView from '@/view/portal/PortalShareView'
 import NotFind from '@/view/NoFind'
 
 Vue.use(Router)
@@ -108,6 +109,11 @@ let router = new Router({
       path:"/portal/Print",
       name:"portalPrint",
       component:PortalPrint
+    },
+    {
+      path:"/portal/ShareView",
+      name:"portalShareView",
+      component:PortalShareView
     }
   ]
 })

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

@@ -89,7 +89,11 @@ export default {
       //处理多选参数
       $(this.pms).each((a, b)=>{
         if(b.inputType === 'mselect' && dt[b.id]){
-          dt[b.id] = dt[b.id].join(",");
+          if(dt[b.id]){
+           dt[b.id] = dt[b.id].join(",");
+          }else{
+            dt[b.id] = '';
+          }
         }
       });
       return dt;

+ 4 - 37
src/view/portal/PortalPushView.vue

@@ -63,7 +63,7 @@ export default {
           this.pageInfo = JSON.parse(resp.rows);
           this.getReport();
         }
-      });
+      }, this);
     },
     getReport(){
       let loadingInstance = Loading.service({fullscreen:false, target:document.querySelector('.wrapper-content-nomargin')});
@@ -79,46 +79,13 @@ export default {
       }, this, loadingInstance);
     },
     exportReport(tp){
-      let pageId = this.reportId;
-      let burl = baseUrl;
-      var ctx = `
-      <form name='expff' method='post' action="${burl}/portal/export.action" id='expff'>
-      <input type='hidden' name='type' id='type' value='${tp}'>
-      <input type='hidden' name='pageId' id='pageId' value='${pageId}'>
-      <input type='hidden' name='picinfo' id='picinfo'>
-      `;
-      let pms = this.$refs['paramViewForm'].getParamValues();
-      $(this.pageInfo.params).each((a, b)=>{
-        let v = pms[b.id];
-        ctx += `<input type='hidden' name='${b.id}' value="${v}">`;
-      });
-      ctx += `</form>`;
-      if($("#expff").length == 0 ){
-        $(ctx).appendTo("body");
-      }
-      //把图形转换成图片
-      var strs = "";
-      if(tp == "pdf" || tp == "excel" || tp == "word"){
-        let comps = utils.findAllComps(this.pageInfo).filter(m=>m.type ==='chart');
-        $(comps).each(function(index, element) {
-          var id = element.id;
-          var chart = echarts.getInstanceByDom(document.getElementById("ct_"+id));
-          var str = chart.getDataURL({type:'png', pixelRatio:1, backgroundColor: '#fff'});
-          str = str.split(",")[1]; //去除base64标记
-          str = element.id + "," + str+","+$("#ct_"+id).width(); //加上label标记,由于宽度是100%,需要加上宽度
-          strs = strs  +  str;
-          if(index != comps.length - 1){
-            strs = strs + "@";
-          }
-        });
-      }
-      $("#expff #picinfo").val(strs);
-      $("#expff").submit().remove();
+      let paramViewForm = this.$refs['paramViewForm'];;
+      utils.exportReport(tp, this.reportId, paramViewForm, this.pageInfo);
     }
   },
   mounted(){
     this.reportId = this.$route.query.id;
-    this.getCfg();
+    //this.getCfg();
   },
   computed:{
     getReportId:function(){

+ 9 - 1
src/view/portal/PortalShare.vue

@@ -7,7 +7,7 @@
           <el-tab-pane label="直接生成URL" name="url">
             <el-form-item label="有效期">
               <el-radio v-model="form.yxq" label="1" border>一小时</el-radio>
-              <el-radio v-model="form.yxq" label="2" border>一天</el-radio>
+              <el-radio v-model="form.yxq" label="24" border>一天</el-radio>
               <el-radio v-model="form.yxq" label="-1" border>永久有效</el-radio>
             </el-form-item>
           </el-tab-pane>
@@ -94,6 +94,14 @@ export default {
         }, this);
         this.show = false;
       }else if(this.activeName==='url'){  //推送URL
+        ajax({
+          type:"POST",
+          data:{yxq:this.form.yxq, reportId:this.reportId, islogin:0},
+          url:"portal/copyUrl.action",
+          success:(resp)=>{
+            this.$notify.success({ title: '分享成功。', offset: 50});
+          }
+        }, this);
         this.show = false;
       }
       

+ 75 - 0
src/view/portal/PortalShareView.vue

@@ -0,0 +1,75 @@
+<template>
+  <div class="wrapper-content-nomargin">
+     <!-- 参数区域 -->
+    <portal-param-view ref="paramViewForm" :showSearchBtn="true" :pms="pms"></portal-param-view>
+    <!-- 组件区域 -->
+    <layout-view ref="optarea" :pageInfo="pageInfo"></layout-view>
+   
+  </div>
+</template>
+<script>
+import {baseUrl, ajax} from '@/common/biConfig'
+import { Loading } from 'element-ui'
+import LayoutView from './LayoutView.vue'
+import PortalParamView from './PortalParamView.vue'
+import $ from 'jquery'
+import * as utils from '@/view/portal/Utils'
+
+export default {
+  name: "portalMain",
+  components: {
+    LayoutView,
+    PortalParamView
+  },
+  props: {
+
+  },
+  data() {
+    return {
+      token:null,
+      pageInfo:{},
+      pms:[]
+    }
+  },
+
+  methods: {
+    getCfg(){
+      ajax({
+        url:"portal/get.action",
+        data:{token:this.token},
+        type:"get",
+        success:(resp)=>{
+          this.pageInfo = JSON.parse(resp.rows);
+          this.getReport();
+        }
+      }, this);
+    },
+    getReport(){
+      let loadingInstance = Loading.service({fullscreen:false, target:document.querySelector('.wrapper-content-nomargin')});
+      ajax({
+        url:"portal/view.action",
+        type:"GET",
+        data:{token:this.token},
+        success:(resp)=>{
+          //渲染组件
+          this.$refs['optarea'].setCompData(resp.rows);
+          this.pms = resp.rows.pms;
+        }
+      }, this, loadingInstance);
+    }
+  },
+  mounted(){
+    this.token = this.$route.query.token;
+    this.getCfg();
+  },
+  /**
+  beforeRouteLeave: function(to, from, next) {
+    this.$destroy();
+    next();
+  }
+   */
+}
+</script>
+<style lang="less" scoped>
+
+</style>

+ 3 - 36
src/view/portal/PortalView.vue

@@ -69,7 +69,7 @@ export default {
           this.pageInfo = JSON.parse(resp.rows);
           this.getReport();
         }
-      });
+      }, this);
     },
     getReport(){
       let loadingInstance = Loading.service({fullscreen:false, target:document.querySelector('.wrapper-content-nomargin')});
@@ -85,41 +85,8 @@ export default {
       }, this, loadingInstance);
     },
     exportReport(tp){
-      let pageId = this.reportId;
-      let burl = baseUrl;
-      var ctx = `
-      <form name='expff' method='post' action="${burl}/portal/export.action" id='expff'>
-      <input type='hidden' name='type' id='type' value='${tp}'>
-      <input type='hidden' name='pageId' id='pageId' value='${pageId}'>
-      <input type='hidden' name='picinfo' id='picinfo'>
-      `;
-      let pms = this.$refs['paramViewForm'].getParamValues();
-      $(this.pageInfo.params).each((a, b)=>{
-        let v = pms[b.id];
-        ctx += `<input type='hidden' name='${b.id}' value="${v}">`;
-      });
-      ctx += `</form>`;
-      if($("#expff").length == 0 ){
-        $(ctx).appendTo("body");
-      }
-      //把图形转换成图片
-      var strs = "";
-      if(tp == "pdf" || tp == "excel" || tp == "word"){
-        let comps = utils.findAllComps(this.pageInfo).filter(m=>m.type ==='chart');
-        $(comps).each(function(index, element) {
-          var id = element.id;
-          var chart = echarts.getInstanceByDom(document.getElementById("ct_"+id));
-          var str = chart.getDataURL({type:'png', pixelRatio:1, backgroundColor: '#fff'});
-          str = str.split(",")[1]; //去除base64标记
-          str = element.id + "," + str+","+$("#ct_"+id).width(); //加上label标记,由于宽度是100%,需要加上宽度
-          strs = strs  +  str;
-          if(index != comps.length - 1){
-            strs = strs + "@";
-          }
-        });
-      }
-      $("#expff #picinfo").val(strs);
-      $("#expff").submit().remove();
+      let paramViewForm = this.$refs['paramViewForm'];;
+      utils.exportReport(tp, this.reportId, paramViewForm, this.pageInfo);
     }
   },
   mounted(){

+ 45 - 1
src/view/portal/Utils.js

@@ -260,4 +260,48 @@ export const compBackEvent = (link, ts)=>{
 		  }
 		}, ts, loadingInstance);
 	});
-}
+}
+/**
+ * 
+ * @param {报表导出} tp 
+ * @param {*} reportId 
+ * @param {*} paramViewForm 
+ * @param {*} pageInfo 
+ */
+export const exportReport = (tp, reportId, paramViewForm, pageInfo)=>{
+	let pageId = reportId;
+	let burl = baseUrl;
+	var ctx = `
+	<form name='expff' method='post' action="${burl}/portal/export.action" id='expff'>
+	<input type='hidden' name='type' id='type' value='${tp}'>
+	<input type='hidden' name='pageId' id='pageId' value='${pageId}'>
+	<input type='hidden' name='picinfo' id='picinfo'>
+	`;
+	let pms = paramViewForm.getParamValues();
+	$(pageInfo.params).each((a, b)=>{
+	  let v = pms[b.id];
+	  ctx += `<input type='hidden' name='${b.id}' value="${v}">`;
+	});
+	ctx += `</form>`;
+	if($("#expff").length == 0 ){
+	  $(ctx).appendTo("body");
+	}
+	//把图形转换成图片
+	var strs = "";
+	if(tp == "pdf" || tp == "excel" || tp == "word"){
+	  let comps = findAllComps(pageInfo).filter(m=>m.type ==='chart');
+	  $(comps).each(function(index, element) {
+		var id = element.id;
+		var chart = echarts.getInstanceByDom(document.getElementById("ct_"+id));
+		var str = chart.getDataURL({type:'png', pixelRatio:1, backgroundColor: '#fff'});
+		str = str.split(",")[1]; //去除base64标记
+		str = element.id + "," + str+","+$("#ct_"+id).width(); //加上label标记,由于宽度是100%,需要加上宽度
+		strs = strs  +  str;
+		if(index != comps.length - 1){
+		  strs = strs + "@";
+		}
+	  });
+	}
+	$("#expff #picinfo").val(strs);
+	$("#expff").submit().remove();
+  }