rsbi 4 年之前
父節點
當前提交
a317f80cd4

+ 1 - 0
src/view/Login.vue

@@ -27,6 +27,7 @@
 							<el-form-item>
 								<el-button type="primary" v-loading.fullscreen.lock="fullscreenLoading" @click="submitForm('loginForm')" class="submit_btn">登录</el-button>
 							</el-form-item>
+							<div>账号/密码: admin/123456</div>
 						</div>
 					</div>
 				</el-form>

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

@@ -119,13 +119,13 @@ export default {
       let title = h('div', {class:"ibox-title"}, [h('div', {class:"ctit"}, [h('h5', comp.name)]), h('div', {class:"ibox-tools"}, tools)]);
       let compctx = [];
       if(comp.type === 'box'){
-        compctx.push(h('box-view',{ref:'mv_'+comp.id, attrs:{comp:comp, editor:true}}));
+        compctx.push(h('box-view',{ref:'mv_'+comp.id, attrs:{comp:comp, portalParams:this.pageInfo.params, editor:true}}));
       }else if(comp.type ==='chart'){
-        compctx.push(h('chart-view',{ref:'mv_'+comp.id, attrs:{comp:comp, editor:true}}));
+        compctx.push(h('chart-view',{ref:'mv_'+comp.id, attrs:{comp:comp, portalParams:this.pageInfo.params,  editor:true}}));
       }else if(comp.type === 'grid'){
-        compctx.push(h('grid-view',{ref:'mv_'+comp.id, attrs:{comp:comp, editor:true}}));
+        compctx.push(h('grid-view',{ref:'mv_'+comp.id, attrs:{comp:comp, portalParams:this.pageInfo.params,  editor:true}}));
       }else if(comp.type === 'table'){
-        compctx.push(h('table-view',{ref:'mv_'+comp.id, attrs:{comp:comp, editor:true}}));
+        compctx.push(h('table-view',{ref:'mv_'+comp.id, attrs:{comp:comp, portalParams:this.pageInfo.params,  editor:true}}));
       }
       let style = {padding:"1px", width:"100%"};
       let bgcolor = comp.bgcolor;

+ 2 - 0
src/view/portal/LayoutParamAdd.vue

@@ -8,9 +8,11 @@
              <el-form-item label="显示名称" label-width="100px" prop="paramname">
               <el-input v-model="param.paramname"></el-input>
             </el-form-item>
+            <!--
             <el-form-item label="长度" label-width="100px">
               <el-input-number v-model="param.size" :min="5" :max="30" size="small"></el-input-number>
             </el-form-item>
+            -->
             <template v-if="datetype == 'dateselect' || datetype ==='monthselect' || datetype ==='yearselect'">
               <el-form-item label="时间格式" label-width="100px">
                 <el-select v-model="param.dtformat" placeholder="请选择" style="width:100%">

+ 17 - 11
src/view/portal/PortalCustomiz.vue

@@ -9,6 +9,7 @@
           <el-menu-item index="data-1">选择立方体</el-menu-item>
           <el-menu-item index="data-2">选择数据表</el-menu-item>
         </el-submenu>
+        <el-menu-item index="view"><i class="glyphicon glyphicon-file"></i> 预览</el-menu-item>
       </el-menu>
       <div class="report-layut">
         <layout-left :pageInfo="pageInfo" ref="layoutleftForm"></layout-left>
@@ -48,6 +49,7 @@ import layoutParam from "./LayoutParam.vue"
 import LayoutOptarea from './LayoutOptarea.vue'
 import LayoutParamAdd from './LayoutParamAdd.vue'
 import LayoutBottom from './LayoutBottom.vue'
+import * as utils from './Utils'
 import $ from 'jquery'
 import "jquery-contextmenu";
 import "jquery-contextmenu/dist/jquery.contextMenu.min.css";
@@ -123,21 +125,21 @@ export default {
       if(key === 'data-2'){
         this.$refs['selectDsetForm'].select();
       }
+      if(key === 'view'){
+        if(!this.pageInfo.id){
+          this.$notify.error({
+            title: '报表还未保存,不能预览!',
+            offset: 50
+          });
+          return;
+        }
+        this.$router.push({path:"/portal/View", query:{id:this.pageInfo.id}});
+      }
       if(key === 'save'){
         if(!this.pageInfo.id){
           this.saveShow = true;
         }else{
-           ajax({
-            url:"portal/save.action",
-            type:"POST",
-            data:{"pageInfo": JSON.stringify(this.pageInfo), pageId:this.pageInfo.id},
-            success:(resp)=>{
-              this.$notify.success({
-                title: '更新成功!',
-                offset: 50
-              });
-            }
-          }, this);
+           this.savePage();
         }
       }
     },
@@ -150,6 +152,10 @@ export default {
     savePage(){
       let ts = this;
       var pageId = this.pageInfo.id;
+      //删除组件分页信息
+      utils.findAllComps(this.pageInfo).forEach(element => {
+        delete element.curPage;
+      });
       if(!pageId){
         this.$refs['saveForm'].validate((valid) => {
            if(valid){

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

@@ -80,6 +80,13 @@ export default {
       dt['serviceid'] = "ext.sys.tab.ajax";
       dt['t_from_id'] = "mv_" + reportId;
       dt['mvid'] = "mv_" + reportId;
+      //处理多选参数
+      $(this.pms).each((a, b)=>{
+        if(b.type === 'mselect' && dt[b.id]){
+          dt[b.id] = dt[b.id].join(",");
+        }
+      });
+
       let loadingInstance = Loading.service({fullscreen:false, target:document.querySelector('.wrapper-content-nomargin')});
       ajax({
         url:"control/extControl",
@@ -98,7 +105,7 @@ export default {
     }
   },
   mounted(){
-    
+
   },
   watch: {
 

+ 5 - 0
src/view/portal/view/Box.vue

@@ -22,6 +22,10 @@ export default {
         type:Boolean,
         required:true,
         default:true
+      },
+      portalParams:{
+        type:Array,
+        required:false
       }
   },
   render(h){
@@ -64,6 +68,7 @@ export default {
       let comp = this.comp;
       if(comp.kpiJson){
           let json = JSON.parse(JSON.stringify(comp));
+          json.portalParams = ts.portalParams;
           let loadingInstance = Loading.service({fullscreen:false, target:document.querySelector('#c_'+comp.id+" div.ccctx")});
           ajax({
             url:"portal/BoxView.action",

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

@@ -23,6 +23,10 @@ export default {
         type:Boolean,
         required:true,
         default:true
+      },
+      portalParams:{
+        type:Array,
+        required:false
       }
   },
   render(h){
@@ -66,7 +70,7 @@ export default {
       }
 
       json = JSON.parse(JSON.stringify(json));
-	    //json.portalParams = pageInfo.params;
+      json.portalParams = ts.portalParams;
       let loadingInstance = Loading.service({fullscreen:false, target:document.querySelector('#c_'+json.id+" div.ccctx")});
       ajax({
         url:"portal/ChartView.action",

+ 68 - 23
src/view/portal/view/Grid.vue

@@ -22,6 +22,10 @@ export default {
         type:Boolean,
         required:true,
         default:true
+      },
+      portalParams:{
+        type:Array,
+        required:false
       }
   },
   render(h){
@@ -33,54 +37,71 @@ export default {
         ths.push(h('th', {class:"grid3-td"}, [h('div', {class:"dg-cell"}, element.desc)]));
       });
       let table1 = h('table', {class:"lockgrid"}, [h('thead', [h("tr", ths)])]);
-
-
-      
-
+    
       let trs = [];
-      data.datas.forEach((e, idx) => {
-        let tds = []
-        $(data.header).each((c, d)=>{
-          let hd = d;
-          let nd = e[d.name];
-          tds.push(h('td', {class:"lockgrid-td",attrs:{align:hd.align?hd.align:"center"}}, [h('div', {class:"dg-cell"}, nd.value)]));
+      if(data.datas){
+        data.datas.forEach((e, idx) => {
+          let tds = []
+          $(data.header).each((c, d)=>{
+            let hd = d;
+            let nd = e[d.name];
+            tds.push(h('td', {class:"lockgrid-td",attrs:{align:hd.align?hd.align:"center"}}, [h('div', {class:"dg-cell"}, nd.value)]));
+          });
+          trs.push(h('tr', tds));
         });
-        trs.push(h('tr', tds));
-      });
+      }else{
+        trs = [h('tr',{attrs:{colspan:data.header.length, align:"center"}}, '无数据')];
+      }
       let table2 = h('table', {class:"lockgrid"}, [h('thead', trs)]);
 
-        //分页信息
-        let allpage = 0;
-        if (data.total % data.pageSize === 0) {
-          allpage = data.total / data.pageSize;
-        } else {
-          allpage = Math.floor(data.total / data.pageSize) + 1;
-        }
+      //分页信息
+      let allpage = 0;
+      if (data.total % data.pageSize === 0) {
+        allpage = data.total / data.pageSize;
+      } else {
+        allpage = Math.floor(data.total / data.pageSize) + 1;
+      }
       let first = data.curPage <= 0;
       let end = data.curPage >= allpage - 1;
       let pg = [
         h('button', {class:"btn btn-link btn-xs",attrs:{disabled:first},on:{click:()=>{
           if(!first){
             this.comp.curPage = 0;
-            this.gridView();
+            if(this.editor === true){
+              this.gridView();
+            }else{
+              this.fy();
+            }
           }
         }},domProps:{innerHTML:"<i class='fa fa-angle-double-left'></i>"}}),
         h('button', {class:"btn btn-link btn-xs", on:{click:()=>{
           if(!first){
             this.comp.curPage = data.curPage - 1;
-            this.gridView();
+             if(this.editor === true){
+              this.gridView();
+            }else{
+              this.fy();
+            }
           }
         }},attrs:{disabled:first},domProps:{innerHTML:"<i class='fa fa-angle-left'></i>"}}),
         h('button', {class:"btn btn-link btn-xs",attrs:{disabled:end},on:{click:()=>{
           if(!end){
             this.comp.curPage = data.curPage + 1;
-            this.gridView();
+             if(this.editor === true){
+              this.gridView();
+            }else{
+              this.fy();
+            }
           }
         }},domProps:{innerHTML:"<i class='fa fa-angle-right'></i>"}}),
         h('button', {class:"btn btn-link btn-xs",attrs:{disabled:end}, on:{click:()=>{
           if(!end){
             this.comp.curPage = allpage - 1;
-            this.gridView();
+             if(this.editor === true){
+              this.gridView();
+            }else{
+              this.fy();
+            }
           }
         }},domProps:{innerHTML:"<i class='fa fa-angle-double-right'></i>"}})
       ];
@@ -127,9 +148,33 @@ export default {
         $("#"+comp.id+" .lock-dg-header").css("margin-left", "-"+left+"px");
       });
     },
+    //查看模式,分页方法
+    fy(){
+      let dt = {};
+      let reportId = this.$parent.pageInfo.id;
+      dt['serviceid'] = "ext.sys.fenye.ajax";
+      dt['t_from_id'] = "mv_" + reportId;
+      dt['currPage'] = this.comp.curPage;
+      dt['id'] = this.comp.id;
+      dt['pageSize'] = this.comp.pageSize;
+
+      let loadingInstance = Loading.service({fullscreen:false, target:document.querySelector('.wrapper-content-nomargin')});
+      ajax({
+        url:"control/extControl",
+        data:dt,
+        type:"POST",
+        success:(resp)=>{
+          console.log(resp.rows);
+          //重新渲染表格
+          this.data = resp.rows;
+        }
+      }, this, loadingInstance);
+    },
     gridView(){
       let ts = this;
       let comp = this.comp;
+      comp = JSON.parse(JSON.stringify(comp));
+      comp.portalParams = ts.portalParams;
       if(comp.cols && comp.cols.length > 0){
           let json = JSON.parse(JSON.stringify(comp));
           let loadingInstance = Loading.service({fullscreen:false, target:document.querySelector('#c_'+comp.id+" div.ccctx")});

+ 5 - 0
src/view/portal/view/Table.vue

@@ -22,6 +22,10 @@ export default {
         type:Boolean,
         required:true,
         default:true
+      },
+      portalParams:{
+        type:Array,
+        required:false
       }
   },
   render(h){
@@ -90,6 +94,7 @@ export default {
       let comp = this.comp;
       if(comp.kpiJson && comp.kpiJson.length > 0){
           let json = JSON.parse(JSON.stringify(comp));
+          json.portalParams = ts.portalParams;
           let loadingInstance = Loading.service({fullscreen:false, target:document.querySelector('#c_'+comp.id+" div.ccctx")});
           ajax({
             url:"portal/TableView.action",