Bläddra i källkod

双轴图形不显示y2的问题

rsbi 4 år sedan
förälder
incheckning
cfd856c0b7

+ 4 - 3
src/common/biConfig.js

@@ -35,14 +35,15 @@ export const ajax = (cfg, ts, loadingObj) => {
 			if(resp.result === 1){
 				cfg.success(resp);
 			}else if(resp.result === 2){
+				if(ts.$route.path === '/'){
+					return;
+				}
 				ts.$notify.error({
 					title: '登录信息失效',
 					message:resp.msg,
 					offset: 50
 				});
-				//if(ts.$route.path === '/'){
-					ts.$router.push("/");
-				//}
+				ts.$router.push("/");
 			}else{
 				const h = ts.$createElement;
 				Message.error({message:h('div',[h('h5','系统错误'), h('div', resp.msg)]), type:"error",showClose: true});

+ 2 - 1
src/common/echartsUtils.js

@@ -33,7 +33,8 @@ export const toolTips = (params, fmt, unit, ydesc, fmt2, unit2, y2desc, thb, cha
                 }
             }else{
                 if (fmt2) { //双指标
-                    var chart = echarts.getInstanceByDom(document.getElementById(chartId));
+                    var cid = "ct_" + chartId; //图形以ct_开头
+                    var chart = echarts.getInstanceByDom(document.getElementById(cid));
                     var opts = chart.getOption();
                     $(opts.series).each(function(c, d){
                         if(d.name === b.seriesName){

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

@@ -100,7 +100,6 @@
 					}
 				}
 				this.comps = ccomps || [];
-				console.log(this.comps);
 				var clink;
 				var linkaccept;
 				if(comp.type == "chart" && comp.chartJson){

+ 24 - 5
src/view/portal/data/Chart.vue

@@ -100,10 +100,27 @@ export default {
 				let scolobj = h('div', {class:"ts_h"}, [h('div', '图例'), h('div', {attrs:{class:"h_ctx", id:"scol"}},scol)]);
 				leftCols.push(scolobj);
 			}
+			let typeIndex = comp.chartJson.typeIndex;
+			//第二纵轴
+			if((tp==='column' || tp === 'line') && (typeIndex == 2 || typeIndex == 4) ){
+				let y2col = null;
+				if(comp.kpiJson && comp.kpiJson.length > 1 && comp.kpiJson[1] != null){
+					let o = comp.kpiJson[1];
+					y2col = [h('span', {class:"charttxt", attrs:{ title:o.kpi_name}}, o.kpi_name), h('a', {attrs:{class:"charticon"},domProps:{innerHTML:`<i class="fa fa-gear"></i>`},on:{click:()=>this.chartmenu(o, 'y2col')}})]
+				}else{
+					y2col = [h('span', {class:"charttip"}, '将度量拖到这里')]
+				}
+				let y2obj = h('div', {class:"ts_h"}, [h('div', '第二纵轴'), h('div', {attrs:{class:"h_ctx", id:"y2col"}},y2col)]);
+				leftCols.push(y2obj);
+			}
+			//更新拖拽事件
+			this.$nextTick(()=>{
+				this.initChartKpiDrop();
+			});
 			return h('div', {class:"tsbd", attrs:{id:"chartData"}}, leftCols);
 		},
   mounted(){
-    this.initChartKpiDrop();
+
   },
   computed: {
      
@@ -148,7 +165,7 @@ export default {
 	},
     initChartKpiDrop(){
         const ts = this;
-        let comp = this.comp;
+		let comp = this.comp;
 				$("#chartData #xcol, #chartData #ycol, #chartData #y2col, #chartData #y3col, #chartData #ycols, #chartData #scol").droppable({
 					accept:"#datasettree .jstree-node",
 					tolerance:"pointer",
@@ -290,21 +307,23 @@ export default {
   span.charttip {
     color:#999999;
     padding:3px;
-    display:block;
+	display:block;
   }
   span.charttxt {
     display:inline-block;
     width:99px;
     white-space:nowrap;
     overflow:hidden;
-    margin-left:3px;
+	margin-left:3px;
+	margin-top:3px;
   }
   a.charticon {
     display:inline-block;
     width:16px;
     height:16px;
     cursor:pointer;
-    font-size: 14px;
+	font-size: 14px;
+	position: absolute;
   }
 
 </style>