rsbi 4 년 전
부모
커밋
4363685c7b
5개의 변경된 파일50개의 추가작업 그리고 6개의 파일을 삭제
  1. 10 2
      src/view/portal/PortalCustomiz.vue
  2. 1 1
      src/view/portal/PortalParamView.vue
  3. 37 1
      src/view/portal/PortalView.vue
  4. 1 1
      src/view/portal/data/Grid.vue
  5. 1 1
      src/view/portal/view/Grid.vue

+ 10 - 2
src/view/portal/PortalCustomiz.vue

@@ -114,7 +114,13 @@ export default {
     },
     handleSelect(key, keyPath){
       if(key === 'back'){
-        this.$router.push("/portal/Index");
+        if(this.isupdate == true){
+          if(confirm("您还未保存报表,是否确认退出?")){
+            this.$router.push("/portal/Index");
+          }
+        }else{ //保存过了,直接退出
+          this.$router.push("/portal/Index");
+        }
       }
       if(key ==='layout'){
         this.$refs['layout'].setLayout();
@@ -170,6 +176,7 @@ export default {
                   });
                   ts.saveShow = false;
                   ts.pageInfo.id = resp.rows;
+                  ts.isupdate = false;
                }
              }, ts);
            }
@@ -184,6 +191,7 @@ export default {
               title: '更新成功!',
               offset: 50
             });
+            ts.isupdate = false;
           }
         }, ts);
       }
@@ -206,8 +214,8 @@ export default {
 </script>
 <style lang="less" scoped>
   .customizLayout {
-    height: 100%;
     width: 100%;
+    height: calc(100% - 32px);
   }
   .layout-center {
         position: inherit;

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

@@ -1,7 +1,7 @@
 <template>
     <div>
       <!-- 参数区域 -->
-      <template v-if="pms.length > 0 ">
+      <template v-if="pms.filter(m=>m.type != 'hidden').length > 0 ">
         <el-form :model="reportParam" ref="paramForm" size="small" label-position="left" >
           <div class="ibox reportParams" style="margin:5px;">
               <div class="row">

+ 37 - 1
src/view/portal/PortalView.vue

@@ -25,6 +25,8 @@ 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",
@@ -50,7 +52,9 @@ export default {
       }else if(key === '2'){  //定制
          this.$router.push({path:"/portal/Customiz", query:{id:this.reportId}});
       }else if(key === '4'){  //打印
-
+        
+      }else if(key === 'html' || key === 'csv' || key === 'excel' || key === 'pdf' || key === 'word'){  //导出
+        this.exportReport(key);
       }
     },
     getCfg(){
@@ -78,6 +82,38 @@ export default {
           this.pms = resp.rows.pms;
         }
       }, this, loadingInstance);
+    },
+    exportReport(tp){
+      //var pms = getPageParam();
+      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'>
+      </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();
     }
   },
   mounted(){

+ 1 - 1
src/view/portal/data/Grid.vue

@@ -201,7 +201,7 @@ export default {
     },
     delGridCol(comp, id){
       if(comp.cols.length == 1){
-        msginfo("表格至少需要含有一个字段。");
+        utils.msginfo("表格至少需要含有一个字段。");
         return;
       }
       //从json移除

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

@@ -158,7 +158,7 @@ export default {
       dt['id'] = this.comp.id;
       dt['pageSize'] = this.comp.pageSize;
 
-      let loadingInstance = Loading.service({fullscreen:false, target:document.querySelector('.wrapper-content-nomargin')});
+      let loadingInstance = Loading.service({fullscreen:false, target:document.querySelector('#c_'+this.comp.id+" div.ccctx")});
       ajax({
         url:"control/extControl",
         data:dt,