瀏覽代碼

修改jstree问题及其他一些问题

rsbi 3 年之前
父節點
當前提交
d9a5b22c3c

+ 12 - 1
src/common/biConfig.js

@@ -35,6 +35,9 @@ export const ajax = (cfg, ts, loadingObj) => {
 			if(resp.result === 1){
 				cfg.success(resp);
 			}else if(resp.result === 2){
+				if(!ts){
+					return;
+				}
 				if(ts.$route.path === '/'){
 					return;
 				}
@@ -44,9 +47,14 @@ export const ajax = (cfg, ts, loadingObj) => {
 					offset: 50
 				});
 				ts.$router.push("/");
-			}else{
+			}else if(resp.result === 0){
 				const h = ts.$createElement;
 				Message.error({message:h('div',[h('h5','系统错误'), h('div', resp.msg)]), type:"error",showClose: true});
+			}else{
+				Message.error(baseUrl+cfg.url + " 接口返回格式错误,未包含 result 值。");
+				if(errorCallback){
+					errorCallback();
+				}
 			}
 		},
 		error: function(){
@@ -62,6 +70,9 @@ export const ajax = (cfg, ts, loadingObj) => {
 	if(!cfg.postJSON || cfg.postJSON === false){
 		delete o.contentType;
 	}
+	if(cfg.async === false){ //同步请求
+		o.async = cfg.async;
+	}
 	$.ajax(o);
 }
 

+ 10 - 3
src/view/bireport/ReportDesign.vue

@@ -59,7 +59,7 @@
 </template>
 
 <script>
-	import {baseUrl} from '@/common/biConfig'
+	import {baseUrl, ajax} from '@/common/biConfig'
 	import $ from 'jquery'
 	import selectCube from "@/view/bireport/SelectCube";
 	import reportParam from "@/view/bireport/ReportParam";
@@ -110,6 +110,7 @@
 				this.initdataset();
 			},
 			initdataset(){
+				const ts = this;
 				let ref = $("#datasettree").jstree(true);
 				if(ref){
 					ref.destroy();
@@ -151,8 +152,14 @@
 					}
 					$('#datasettree').jstree({
 						core: {
-							data: {
-								url: 'model/treeCube.action?cubeId=' + this.pageInfo.selectDs + '&t=' + Math.random()
+							data: function (obj, callback) {
+								ajax({
+									url:"model/treeCube.action",
+									data:{cubeId:ts.pageInfo.selectDs},
+									success:(resp)=>{
+										callback.call(this, resp.rows);
+									}
+								}, ts);
 							},
 							check_callback: false
 						},

+ 10 - 10
src/view/bireport/tableUtils.js

@@ -333,8 +333,8 @@ export function drill(oldDimId, dimId, comp, pos, val, vdesc, cb){
 		if(dims[i].id == oldDimId){
 			oldDimIndex = i;
 			if(dims[i].type == 'month'){
-				dims[i].startmt = val;
-				dims[i].endmt = val;
+				dims[i].st = val;
+				dims[i].end = val;
 				delete dims[i].vals;
 				oldDim = dims[i];
 			}else
@@ -345,14 +345,14 @@ export function drill(oldDimId, dimId, comp, pos, val, vdesc, cb){
 				//	tmpval = val.substring(0, 4) + "-" + val.substring(4, 6) + "-" + val.substring(6, 8);
 				//}else{
 				//}
-				dims[i].startdt = tmpval;
-				dims[i].enddt = dims[i].startdt;
+				dims[i].st = tmpval;
+				dims[i].end = dims[i].st;
 				delete dims[i].vals;
 				oldDim = dims[i];
 			}else{
 				var o = dims[i];
-				delete o.startdt;
-				delete o.enddt;
+				delete o.st;
+				delete o.end;
 				dims[i].vals = [val];   //只展开当前,设置值筛选
 			}
 			
@@ -386,12 +386,12 @@ export function goupDim(comp, pos, dimId, pageInfo, cb){
 		if(dims[i].id == dimId){
 			delete dims[i].vals;
 			if(dims[i].type == 'day'){
-				delete dims[i].startdt;
-				delete dims[i].enddt;
+				delete dims[i].st;
+				delete dims[i].end;
 			}
 			if(dims[i].type == 'month'){
-				delete dims[i].startmt;
-				delete dims[i].endmt;
+				delete dims[i].st;
+				delete dims[i].end;
 			}
 			idx = i;
 			break;

+ 9 - 2
src/view/portal/LayoutLeft.vue

@@ -248,6 +248,7 @@ export default {
         if(ref){
             ref.destroy();
         }
+        const ts = this;
         if (!cubeId) {
             $('#datasettree').jstree({
                 core: {
@@ -285,8 +286,14 @@ export default {
             }
             $('#datasettree').jstree({
                 core: {
-                    data: {
-                        url: 'model/treeCube.action?cubeId=' + cubeId + '&t=' + Math.random()
+                    data: function (obj, callback) {
+                        ajax({
+                            url:"model/treeCube.action",
+                            data:{cubeId:cubeId},
+                            success:(resp)=>{
+                                callback.call(this, resp.rows);
+                            }
+                        }, ts);
                     },
                     check_callback: false
                 },

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

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