rsbi hace 4 años
padre
commit
938163ced4
Se han modificado 4 ficheros con 72 adiciones y 3 borrados
  1. 31 0
      package-lock.json
  2. 1 0
      package.json
  3. 0 2
      src/main.js
  4. 40 1
      src/view/bireport/ReportChart.vue

+ 31 - 0
package-lock.json

@@ -4747,6 +4747,22 @@
         "safer-buffer": "^2.1.0"
       }
     },
+    "echarts": {
+      "version": "5.0.0",
+      "resolved": "https://registry.npmjs.org/echarts/-/echarts-5.0.0.tgz",
+      "integrity": "sha512-6SDcJbLVOcfQyjPg+spNU1+JVrkU1B9fzUa5tpbP/mMNUPyigCOJwcEIQAJSbp9jt5UP3EXvQR0vtYXIo9AjyA==",
+      "requires": {
+        "tslib": "1.10.0",
+        "zrender": "5.0.1"
+      },
+      "dependencies": {
+        "tslib": {
+          "version": "1.10.0",
+          "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.10.0.tgz",
+          "integrity": "sha512-qOebF53frne81cf0S9B41ByenJ3/IuH8yJKngAX35CmiZySA0khhkovshKK+jGCaMnVomla7gVlIcc3EvKPbTQ=="
+        }
+      }
+    },
     "editorconfig": {
       "version": "0.15.3",
       "resolved": "https://registry.npmjs.org/editorconfig/-/editorconfig-0.15.3.tgz",
@@ -17126,6 +17142,21 @@
         "buffer-crc32": "~0.2.3",
         "fd-slicer": "~1.1.0"
       }
+    },
+    "zrender": {
+      "version": "5.0.1",
+      "resolved": "https://registry.npmjs.org/zrender/-/zrender-5.0.1.tgz",
+      "integrity": "sha512-i8FNCKAKfF0EfZFJ6w2p30umBrCyy481/PePFQqPdtNgCl5Hp5z7/dovqb7soEoFkhNvhjJ/J4W9zFALeae6yA==",
+      "requires": {
+        "tslib": "1.10.0"
+      },
+      "dependencies": {
+        "tslib": {
+          "version": "1.10.0",
+          "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.10.0.tgz",
+          "integrity": "sha512-qOebF53frne81cf0S9B41ByenJ3/IuH8yJKngAX35CmiZySA0khhkovshKK+jGCaMnVomla7gVlIcc3EvKPbTQ=="
+        }
+      }
     }
   }
 }

+ 1 - 0
package.json

@@ -21,6 +21,7 @@
     "@fortawesome/vue-fontawesome": "^2.0.0",
     "bootstrap-table": "^1.18.0",
     "bootstrap3": "^3.3.5",
+    "echarts": "^5.0.0",
     "element-ui": "^2.13.2",
     "font-awesome": "^4.7.0",
     "jquery": "^3.5.1",

+ 0 - 2
src/main.js

@@ -11,8 +11,6 @@ import 'font-awesome/css/font-awesome.css'
 import {globalMixins,globalPlugin} from "./common/globalMixins.js"
 import {store} from "./store/index.js";
 
-
-
 Vue.use(ElementUI);
 Vue.use(globalPlugin);
 Vue.mixin(globalMixins);

+ 40 - 1
src/view/bireport/ReportChart.vue

@@ -2,6 +2,7 @@
 <script>
 	import {ajax} from '@/common/biConfig'
 	import $ from 'jquery'
+	import { Loading } from "element-ui";
 	import * as tools from '@/view/bireport/bireportUtils'
 	import * as chartUtils from '@/view/bireport/chartUtils'
 
@@ -64,7 +65,7 @@
 				h('a',{attrs:{href:"javascript:;"}, on:{click:()=>{this.exchangexs();}}}, [h("img", {attrs:{src:require("../../assets/image/reload.png")}})]),
 				h("img", {attrs:{src:require("../../assets/image/exchangexs2.gif")}})
 			];
-			let r = h('div', {attrs:{class:"ctx", id:"T"+this.chartId}}, [h('div', {class:"tsbd"}, [cgbtn, xcolobj, ycolobj, scolobj]), h('div', {class:"exchangexs"}, exchange), h("div", {class:"chartctx"}, "图表预览区域")]);
+			let r = h('div', {attrs:{class:"ctx", id:"T"+this.chartId}}, [h('div', {class:"tsbd"}, [cgbtn, xcolobj, ycolobj, scolobj]), h('div', {class:"exchangexs"}, exchange), h("div", {attrs:{class:"chartctx", id:"chart"+this.chartId}}, "图表预览区域")]);
 			return h('div', [r]);
 		},
 		mounted(){
@@ -191,6 +192,44 @@
 				this.$parent.$parent.$parent.setIsUpdate();
 			},
 			chartView(){
+				let json = tools.findCompById(this.chartId, this.pageInfo);
+				if(!json.kpiJson || json.kpiJson.length == 0){
+					return;
+				}
+				if(json.chartJson.type == "scatter" && (json.kpiJson.length < 2 || json.kpiJson[1] == null)  ){
+					return;
+				}
+				if(json.chartJson.type == "bubble" && (json.kpiJson.length < 3 || json.kpiJson[2] == null ) ){
+					return;
+				}
+				var kpiType = json.ttype;
+				json = {"chartJson":json.chartJson, "kpiJson":json.kpiJson, "params":this.pageInfo.params, dsid:json.dsid, dsetId:json.dsetId};
+				let load = Loading.service({ fullscreen: true });
+				ajax({
+					type: "POST",
+					url: "bireport/ChartView.action",
+					postJSON:true,
+					data: JSON.stringify(json),
+					success: (resp)=>{
+						 //try{
+							let option = JSON.parse(resp.rows,function(k,v){
+								if(!v){
+									return v;
+								}else if(v.indexOf&&v.indexOf('f$')>-1){
+									return eval("("+v.replace("f$", "")+")");
+								}
+								return v;
+							});
+							console.log(option);
+							var echarts = require('echarts');
+							const myChart = echarts.init(document.getElementById('chart'+this.chartId));
+							myChart.setOption(option);
+						//}catch(ex){
+						//	tools.msginfo(resp.rows);
+						//}
+						
+					}
+				}, this, load);
 				this.$forceUpdate();
 			},
 			chartmenu(o, pos){