diff --git a/docs/zh/conf/base.md b/docs/zh/conf/base.md index 3398eab..1d9df77 100644 --- a/docs/zh/conf/base.md +++ b/docs/zh/conf/base.md @@ -192,4 +192,102 @@ if(_this.crisMobile) console.info(_this) //d打印_this的内容到控制台。这仅仅是测试,生产期间最好不要执行 ``` +::: warning +如果在pc_form或mobile_form中也需要script,那么将form内的script改为dyn_script。否则正则匹配script将会匹配不正确从而导致脚本失效。 +::: +## 前端动态模板 +- 在页面上添加的动态模板,内部脚本是经过简化的vue格式。主要区别是:script中定义的data、methods、computed会直接注入当前模板中,其他vue属性暂时不支持。 +- 由于是内置脚本模式,所以不支持import语句,不支持data使用函数返回(但和data函数的作用是一样的,都是只对实例模式,定义的属性不会被共享)。 +- style 将是scoped的,style的处理是将每个css前动态加上 了id名称,所以对模板外的其他网页部分没有影响。 +- 为避免data、methods中的名字和系统内部定义的名字冲突,最好将data、methods中的名字加上一个固定前缀,如: my_ 。 +- export default 用return替代 + +``` html + + + +``` diff --git a/end/reportWeb/Controllers/DesignController.cs b/end/reportWeb/Controllers/DesignController.cs index b75e195..aedcefb 100644 --- a/end/reportWeb/Controllers/DesignController.cs +++ b/end/reportWeb/Controllers/DesignController.cs @@ -45,7 +45,7 @@ public DesignController(IConfiguration configuration, this.hubContext = hubContext; this.rpt_group = reportGrp.rpt_group; this.reportDb = reportDb; - + json_option = new JsonSerializerOptions() { DefaultIgnoreCondition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingNull, @@ -74,12 +74,12 @@ private String getQueryValue(string name) else return null; } - public async Task Preview(String _content, String _ConnectionId, string reportName, - String _fresh_ds, String _fresh_params, bool _createFormParam, String _param_name) + public async Task Preview(String _content,String _ConnectionId,string reportName, + String _fresh_ds,String _fresh_params,bool _createFormParam,String _param_name) { List calcDsNames = null; List calcGridNames = null; - + if (!String.IsNullOrEmpty(_fresh_ds)) { foreach (var item in JsonDocument.Parse(_fresh_ds).RootElement.EnumerateArray()) @@ -117,25 +117,25 @@ public async Task Preview(String _content, String _ConnectionId, long start = DateTime.Now.Ticks; System.Xml.XmlDocument xmlDoc = new System.Xml.XmlDocument(); xmlDoc.LoadXml(_content); - if (reportName != null && reportName.Contains(":")) + if (reportName!=null && reportName.Contains(":")) reportName = reportName.Split(":")[1]; - var reportDefine = XmlReport.loadReportFromXmlDoc(xmlDoc, this.rpt_group.report_path, reportName ?? "temp.cr"); + var reportDefine = XmlReport.loadReportFromXmlDoc(xmlDoc, this.rpt_group.report_path, reportName??"temp.cr"); if (!String.IsNullOrEmpty(_fresh_ds)) { reportDefine.getEnv().getExprFaced().addVariable("_fresh_ds", _fresh_ds); } - reportDefine.getEnv().logger = + reportDefine.getEnv().logger = new Logger(x => MessageQueueBlock - .Add(new DemoMessage() - { - hubContext = hubContext, - User = this.HttpContext.User, + .Add(new DemoMessage() + { + hubContext= hubContext, + User=this.HttpContext.User, ConnectionId = _ConnectionId, - Body = x - } + Body = x + } ) ); - + foreach (var one in this.rpt_group.db_connection_list) { reportDefine.getEnv().addDataSource(one.name, one.conn_str, one.db_type, "0"); @@ -159,21 +159,21 @@ public async Task Preview(String _content, String _ConnectionId, foreach (var item in JsonDocument.Parse(_fresh_params).RootElement.EnumerateArray()) { reportDefine.getEnv().addParam(item.GetProperty("name").GetString(), - item.GetProperty("value").ValueKind == JsonValueKind.Number + item.GetProperty("value").ValueKind== JsonValueKind.Number ? item.GetProperty("value").GetDecimal() : item.GetProperty("value").GetString()); } } reportDefine.calcGridNames = calcGridNames?.ToArray(); - if (calcDsNames != null) - reportDefine.calcDsNames = new HashSet(calcDsNames); - var exprFaced = reportDefine.getEnv().getExprFaced(); - exprFaced.getVariableDefine("_user_").value = null; - exprFaced.getVariableDefine("_zb_url_").value = configuration["zb_url"]; + if(calcDsNames!=null) + reportDefine.calcDsNames = new HashSet( calcDsNames ); + var exprFaced=reportDefine.getEnv().getExprFaced(); + exprFaced.getVariableDefine("_user_").value= null; + exprFaced.getVariableDefine("_zb_url_").value=configuration["zb_url"]; exprFaced.getVariableDefine("_zb_user_").value = rpt_group.zb_user; exprFaced.getVariableDefine("_zb_password_").value = rpt_group.zb_password; exprFaced.getVariableDefine("_rpt_group_").value = rpt_group; - exprFaced.getVariableDefine("_need_dataset_").value = (_createFormParam != true); + exprFaced.getVariableDefine("_need_dataset_").value = (_createFormParam!=true); if (_createFormParam == true) { @@ -190,9 +190,11 @@ public async Task Preview(String _content, String _ConnectionId, if (cur_exception != null) { while (cur_exception.InnerException != null) + { + reportDefine.getEnv().logger.Error(cur_exception.Message); cur_exception = cur_exception.InnerException; - reportDefine.getEnv().logger.Error(cur_exception.Message); - + } + } using (var Report = engine.getResult()) { @@ -204,12 +206,11 @@ public async Task Preview(String _content, String _ConnectionId, try { await Report.exportJson(jsonWriter); - } - catch (Exception ex) + }catch(Exception ex) { cur_exception = ex; } - + if (cur_exception != null) { reportWeb.Pages.ReportModel.output_expection(cur_exception, Report.getEnv().logger, Report.getEnv()); @@ -222,9 +223,9 @@ public async Task Preview(String _content, String _ConnectionId, jsonWriter.Write(",\"error\":"); jsonWriter.Write(JsonSerializer.Serialize(sb.ToString(), json_option)); } - + jsonWriter.Write("\n}"); - await jsonWriter.FlushAsync(); + await jsonWriter.FlushAsync(); jsonStream.Position = 0; await jsonStream.CopyToAsync(Response.Body); } @@ -239,7 +240,7 @@ public async Task Preview(String _content, String _ConnectionId, catch (Exception ex) { cur_exception = ex; - } + } await my_out_act(); reportDefine.getEnv().logger.Debug($"输出用时:{(DateTime.Now.Ticks - start) / 10000000.0}秒"); //if (String.IsNullOrEmpty(fresh_ds)) @@ -260,13 +261,12 @@ public async Task Preview(String _content, String _ConnectionId, // await Response.Body.FlushAsync(); //} return new EmptyResult(); - } - catch (Exception ex) + }catch(Exception ex) { - return Json(new { errcode = 1, message = ex.Message, stacktrace = ex.StackTrace }); + return Json(new { errcode = 1, message = ex.Message,stacktrace=ex.StackTrace }); } } - + public IActionResult test_expr(String expr) { try @@ -276,20 +276,20 @@ public IActionResult test_expr(String expr) CommonTokenStream tokens = new CommonTokenStream(lex); tokens.GetTokens(); var parser = new ExprParser(tokens); - var exprNodes = expr.StartsWith("=") ? parser.assignExpr().Tree : parser.statement_block().Tree; + var exprNodes = expr.StartsWith("=")?parser.assignExpr().Tree: parser.statement_block().Tree; return Json(new { errcode = 0, message = "" }); } - catch (Exception ex) + catch(Exception ex) { return Json(new { errcode = 1, message = ex.Message }); } } - + public IActionResult exec_expr(String expr) { try { - var exprFaced = new ExprFaced2(); + var exprFaced=new ExprFaced2(); exprFaced.addNewScopeForScript(); exprFaced.addVariable("env", new Env()); exprFaced.addVariable("__env__", new Env()); @@ -297,15 +297,16 @@ public IActionResult exec_expr(String expr) exprFaced.addVariable("_zb_url_", configuration["zb_url"]); exprFaced.addVariable("_zb_user_", rpt_group.zb_user); exprFaced.addVariable("_zb_password_", rpt_group.zb_password); + exprFaced.addVariable("_zb_var_", new Dictionary()); exprFaced.addVariable("_rpt_group_", rpt_group); var exec_result = exprFaced.calculate("{\n" + expr + "\n}", null); - - return Json(new { errcode = 0, message = "", result = exec_result }, json_option); + + return Json(new { errcode = 0, message = "",result= exec_result }, json_option); } catch (Exception ex) { - return Json(new { errcode = 1, message = ex.Message }, json_option); + return Json(new { errcode = 1, message = ex.Message },json_option); } } public IActionResult exec_cmd(String cmd, string from, string to) @@ -317,7 +318,7 @@ string getReal_path(string target, String file_type) if (String.IsNullOrEmpty(target)) throw new Exception("非法路径:" + file_type); var where_id = target.Split(":")[0]; - var grp = reportDb.Rpt_group.Where(x => x.Id == where_id).FirstOrDefault().report_path; + var grp = reportDb.Rpt_group.Where(x=>x.Id == where_id).FirstOrDefault().report_path; target = target.Split(":")[1]; if (target.StartsWith("/")) target = target.Substring(1); @@ -382,31 +383,34 @@ string getReal_path(string target, String file_type) } [HttpPost] - public IActionResult Open(String reportName, string zb_dict_str, string zb_param) + public IActionResult Open(String reportName,string zb_dict_str,string zb_param) { if (reportName.StartsWith("/")) reportName = reportName.Substring(1); var file_path = Path.Combine(this.rpt_group.report_path, reportName); - if (file_path.StartsWith(this.rpt_group.report_path) + if (file_path.StartsWith(this.rpt_group.report_path) && System.IO.File.Exists(file_path)) { - var xmlDoc = XmlReport.getReportXmlDoc(this.rpt_group.report_path, reportName); + Env parent_env = new Env(); + XmlReport.templateValue2Env(this.rpt_group.report_path, reportName, parent_env); + var xmlDoc =XmlReport.getReportXmlDoc(this.rpt_group.report_path, reportName); //var ret = XmlReport.reportToXmlDocumnt(XmlReport.loadReport(file_path), false).OuterXml; //var report_content = await System.IO.File.ReadAllTextAsync(file_path, System.Text.Encoding.UTF8); - var conn_list = from x in this.rpt_group.db_connection_list select x.name; + var conn_list =from x in this.rpt_group.db_connection_list select x.name; var ttt = range_level(xmlDoc.OuterXml); return Json(new { report_content = xmlDoc.OuterXml, conn_list, range_level = ttt.range_level, - defaultsetting = ttt.defaultsetting + defaultsetting = ttt.defaultsetting, + parent_defaultsetting=new Dictionary((from x in parent_env.TemplateGet("out_keys").Split(",") select new KeyValuePair(x, parent_env.TemplateGet(x)))) } - ); + ); } return Json(new { errcode = 1, message = "路径错误" }); } - private void insert_ds_param(string reportName, string zb_dict_str, string zb_param) + private void insert_ds_param(string reportName, string zb_dict_str,string zb_param) { var file_path = Path.Combine(this.rpt_group.report_path, reportName); var xmlDoc = XmlReport.getReportXmlDoc(this.rpt_group.report_path, reportName); @@ -474,7 +478,7 @@ private void insert_ds_param(string reportName, string zb_dict_str, string zb_pa } xmlDoc.SelectSingleNode("//zb_var").InnerText = JsonSerializer.Serialize(zb_var, json_option); - + } if (!String.IsNullOrEmpty(zb_param)) @@ -536,24 +540,23 @@ public async Task Save(String reportName, String content, string if (!Directory.Exists(this.rpt_group.report_path)) Directory.CreateDirectory(this.rpt_group.report_path); var file_path = Path.Combine(this.rpt_group.report_path, reportName); - if (file_path.StartsWith(this.rpt_group.report_path)) - { + if (file_path.StartsWith(this.rpt_group.report_path)){ var fileInfo = new FileInfo(file_path); if (!Directory.Exists(fileInfo.DirectoryName)) Directory.CreateDirectory(fileInfo.DirectoryName); if (!fileInfo.Exists || (fileInfo.Exists && String.IsNullOrEmpty(zb_dict_str))) { - await System.IO.File.WriteAllTextAsync(file_path, content.Replace("><", ">\n<"), System.Text.Encoding.UTF8); + await System.IO.File.WriteAllTextAsync(file_path, content.Replace("><",">\n<"), System.Text.Encoding.UTF8); } if (!String.IsNullOrEmpty(zb_dict_str)) { - insert_ds_param(reportName, zb_dict_str, zb_param); + insert_ds_param( reportName, zb_dict_str, zb_param); } return Json(new { errcode = 0, message = "保存成功" }); } return Json(new { errcode = 1, message = "路径错误" }); } - + public async Task open_template(String path) { if (!Directory.Exists(this.rpt_group.report_path)) @@ -561,14 +564,19 @@ public async Task open_template(String path) if (string.IsNullOrEmpty(path)) path = "template.xml"; else if (path.StartsWith("/")) - path = path.Substring(1) + "/template.xml"; + path = path.Substring(1)+ "/template.xml"; else path = path + "/template.xml"; var file_path = Path.Combine(this.rpt_group.report_path, path); + Env parent_env = new Env(); + XmlReport.templateValue2Env(this.rpt_group.report_path, path, parent_env); + if (file_path.StartsWith(this.rpt_group.report_path) && System.IO.File.Exists(file_path)) { var content = await System.IO.File.ReadAllTextAsync(file_path, System.Text.Encoding.UTF8); - return Json(new { content }); + return Json(new { content, + parent_defaultsetting = new Dictionary((from x in parent_env.TemplateGet("out_keys").Split(",") select new KeyValuePair(x, parent_env.TemplateGet(x)))) + }); } return Json(new { errcode = 1, message = "路径错误" }); } @@ -598,9 +606,9 @@ public async Task Save_template(String path, String content) engine.prepareCalcLevelForCell(); var b_l = from x in engine.getResult().getAllCell() where x.getExtendDirection() != CellReport.cell.Direction.none - select new { band = ((CellReport.cell.ExtendCell)x).getRangeOfGroup(), level = x.getCalcLevel(), gridName = x.getGrid().Name }; - var env = report.getEnv(); - + select new { band = ((CellReport.cell.ExtendCell)x).getRangeOfGroup(), level = x.getCalcLevel(),gridName=x.getGrid().Name }; + var env=report.getEnv(); + return (( from x in b_l select new @@ -614,9 +622,9 @@ from x in b_l } ).ToList(), new Dictionary((from x in env.TemplateGet("out_keys").Split(",") select new KeyValuePair(x, env.TemplateGet(x)))) - ); + ); } - + public IActionResult grid_range_level(String content) { return Json(range_level(content).range_level); @@ -632,10 +640,10 @@ class MyFileInfo public long Length { get; set; } public List children { get; set; } } - public IActionResult List(String loc_path = ".") + public IActionResult List(String loc_path=".") { - loc_path = Path.Combine(this.rpt_group.report_path, loc_path); - if (!loc_path.StartsWith(this.rpt_group.report_path)) + loc_path=Path.Combine(this.rpt_group.report_path, loc_path); + if(!loc_path.StartsWith(this.rpt_group.report_path)) return Json(new { errcode = 1, message = "路径错误" }); //List ret = new List(); @@ -644,7 +652,7 @@ public IActionResult List(String loc_path = ".") var ret = new MyFileInfo(); ret.Directory = parent.FullName.Substring(len); ret.children = new List(); - if (!parent.Exists) + if(!parent.Exists) return Json(ret); //遍历文件夹 foreach (DirectoryInfo NextFolder in parent.GetDirectories()) @@ -652,7 +660,7 @@ public IActionResult List(String loc_path = ".") ret.children.Add(new MyFileInfo() { FileName = NextFolder.Name, - FullPathFileName = NextFolder.FullName.Substring(len + 1).Replace("\\", "/"), + FullPathFileName = NextFolder.FullName.Substring(len + 1).Replace("\\","/"), isFile = false }); } @@ -664,12 +672,12 @@ public IActionResult List(String loc_path = ".") FullPathFileName = NextFile.FullName.Substring(len + 1).Replace("\\", "/"), LastAccessTime = NextFile.LastAccessTime.ToString("s"), LastWriteTime = NextFile.LastWriteTime.ToString("s"), - Length = NextFile.Length, + Length=NextFile.Length, isFile = true }); var options = new JsonSerializerOptions(); options.DefaultIgnoreCondition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingNull; - + return Json(ret, options); } public IActionResult ListForAllGroup() @@ -677,9 +685,31 @@ public IActionResult ListForAllGroup() //Request.HttpContext.Connection.RemoteIpAddress.ToString(); //HttpContext.RequestServices.GetService(typeof(Pages._Pages_Default)); HttpContext.GetEndpoint(); - var userid = HttpContext.User.Claims.FirstOrDefault(x => x.Type == "userid").Value; - var ret = (from x1 in this.reportDb.Rpt_group where x1.owner == userid || x1.members.Contains(userid) select x1); + var userid=HttpContext.User.Claims.FirstOrDefault(x => x.Type == "userid").Value; + var ret = (from x1 in this.reportDb.Rpt_group where x1.owner==userid || x1.members.Contains(userid) select x1); return Json(ret, json_option); } + public IActionResult getAllWidget(string action) + { + var userid = HttpContext.User.Claims.FirstOrDefault(x => x.Type == "userid").Value; + var file_path = Path.Combine(Environment.CurrentDirectory, "widgets", userid+".json"); + String admin_txt = "[]"; + if (System.IO.File.Exists(file_path)) + admin_txt = System.IO.File.ReadAllText(file_path,encoding:Encoding.UTF8); + file_path = Path.Combine(Environment.CurrentDirectory, "widgets", "admin.json"); + if (action=="design_rpt" && userid!="admin") + if (System.IO.File.Exists(file_path)) + admin_txt +=".concat(\n"+ + System.IO.File.ReadAllText(file_path, encoding: Encoding.UTF8) + +"\n)"; + return Json(new { txt = admin_txt }, json_option); + } + public IActionResult saveWidget(string txt) + { + var userid = HttpContext.User.Claims.FirstOrDefault(x => x.Type == "userid").Value; + var file_path = Path.Combine(Environment.CurrentDirectory, "widgets", userid + ".json"); + System.IO.File.WriteAllText(file_path, txt, encoding: Encoding.UTF8); + return Json(new { errcode = 0, message = "" }); + } } } diff --git a/end/reportWeb/Controllers/UserController.cs b/end/reportWeb/Controllers/UserController.cs index 4b4673e..75c26ec 100644 --- a/end/reportWeb/Controllers/UserController.cs +++ b/end/reportWeb/Controllers/UserController.cs @@ -213,13 +213,18 @@ public JsonResult getMenu(string parentId) new{ path = "/rpt-list/index", icon = "el-icon-document", - component = "views/zhanbao/zb_index", + component = "", label = "报表目录" },new{ path = "/manger/index", icon = "el-icon-document", - component = "views/zhanbao/zb_index", + component = "", label = "报表组管理" + },new{ + path = "/widget/index", + icon = "el-icon-document", + component = "", + label = "组件管理" } } } diff --git a/end/reportWeb/GridOutput.cs b/end/reportWeb/GridOutput.cs index 212eb39..f8f3355 100644 --- a/end/reportWeb/GridOutput.cs +++ b/end/reportWeb/GridOutput.cs @@ -70,9 +70,11 @@ internal ReportDefine ensureReportDefine() if (reportDefine == null && reportName != null && reportName != "" && gobal_reportDefinePath != null && gobal_reportDefinePath != "") { - if (!gobal_reportDefinePath.EndsWith(Path.DirectorySeparatorChar)) + if (!gobal_reportDefinePath.EndsWith(Path.DirectorySeparatorChar)) gobal_reportDefinePath = gobal_reportDefinePath + Path.DirectorySeparatorChar; + { reportDefine = XmlReport.loadReport(gobal_reportDefinePath, reportName); + } reportDefine.getEnv().logger = logger; //reportDefinePath = gobal_reportDefinePath + reportName; } diff --git a/end/reportWeb/Pages/ReportModel.cs b/end/reportWeb/Pages/ReportModel.cs index 6afa074..5ba6d18 100644 --- a/end/reportWeb/Pages/ReportModel.cs +++ b/end/reportWeb/Pages/ReportModel.cs @@ -23,11 +23,11 @@ namespace reportWeb.Pages public class MyLogger : CellReport.running.Logger { ILogger _logger; - public MyLogger(ILogger _logger) : base(null) + public MyLogger(ILogger _logger):base(null) { this._logger = _logger; } - + public override void Info(String info) { _logger.LogInformation(info); @@ -57,7 +57,7 @@ public class ReportModel : PageModel, IDisposable public ReportModel(IConfiguration configuration, ILogger logger, ScopedObj scopedObj) { this.configuration = configuration; - this.rpt_group = scopedObj.rpt_group; + this.rpt_group= scopedObj.rpt_group ; this.WebHostEnvironment = scopedObj.WebHostEnvironment; ReportDefinePath = this.rpt_group.report_path; this.logger = new MyLogger(logger); @@ -73,24 +73,24 @@ public void OnPost() private String mc_report_id; private String tmpFileName; public string tips = ""; - protected virtual bool pre_page_load(IDictionary before_exec_result = null) + protected virtual bool pre_page_load(IDictionary before_exec_result=null) { return true; } - public CellReport.BaseCache myCache { get; protected set; } = null; - + public CellReport.BaseCache myCache { get;protected set;} = null; + protected CellReport.running.Env report_env; public async Task Page_Load() { - if (rpt_group == null) + if(rpt_group==null) throw new Exception("没有定义rpt_group"); - if (rpt_group.default_page.Split(",").Contains(Request.Path.Value.Substring(1)) == false) - throw new Exception("不被允许的调用:" + Request.Path.Value); + if(rpt_group.default_page.Split(",").Contains(Request.Path.Value.Substring(1))==false) + throw new Exception("不被允许的调用:"+ Request.Path.Value); string UserAgent = Request.Headers["User-Agent"]; if (String.IsNullOrEmpty(UserAgent)) UserAgent = ""; Regex regex = new Regex("(iPhone|iPod|Android|ios|SymbianOS)", RegexOptions.IgnoreCase); - var isPhone = regex.IsMatch(UserAgent); + var isPhone=regex.IsMatch(UserAgent); string needType = Request.Headers["needType"]; if (Request.HasFormContentType && ( Request.Form.Keys.Contains("__updated") || @@ -104,12 +104,12 @@ public async Task Page_Load() } else { - - var file_path = Path.Combine(this.WebHostEnvironment.WebRootPath, "run.html"); + + var file_path=Path.Combine(this.WebHostEnvironment.WebRootPath,"run.html"); var report_content = await System.IO.File.ReadAllTextAsync(file_path, System.Text.Encoding.UTF8); string Referer = Request.Headers["Referer"]; string Authorization = Request.Headers["Authorization"]; - report_content = report_content.Replace("", $""); + report_content=report_content.Replace("", $""); if (isPhone) { await Response.WriteAsync(report_content);//.Replace("", "") @@ -117,7 +117,7 @@ public async Task Page_Load() else { await Response.WriteAsync(report_content); - } + } return; } try @@ -126,7 +126,7 @@ public async Task Page_Load() { ReportDefinePath = this.ReportDefinePath, httpRequest = HttpContext.Request, - logger = logger + logger= logger }; //if(Request.Path != "/" + rpt_group.default_page) @@ -134,28 +134,28 @@ public async Task Page_Load() // throw new Exception("非法路径!请使用run模式。当前:"+ Request.Path); //} - report_env = reportDefineForWeb.CurrentReportDefine.getEnv(); + report_env = reportDefineForWeb.CurrentReportDefine.getEnv(); Dictionary user_dict = new Dictionary(); foreach (var one in HttpContext?.User?.Claims) { user_dict.TryAdd(one.Type, one.Value); } - + foreach (var one in this.rpt_group.db_connection_list) { - report_env.addDataSource(one.name, one.conn_str, one.db_type, "0"); + report_env.addDataSource(one.name,one.conn_str,one.db_type,"0"); } var exprFaced = report_env.getExprFaced(); exprFaced.addVariable("isPhone", isPhone); - int grid_cnt = reportDefineForWeb.CurrentReportDefine.getGridList().FindAll(x => x.XmlElementName == "grid").Count; + int grid_cnt=reportDefineForWeb.CurrentReportDefine.getGridList().FindAll(x=>x.XmlElementName=="grid").Count; exprFaced.addVariable("use_luckysheet", 1); - + exprFaced.getVariableDefine("_zb_url_").value = configuration["zb_url"]; exprFaced.getVariableDefine("_zb_user_").value = rpt_group.zb_user; exprFaced.getVariableDefine("_zb_password_").value = rpt_group.zb_password; exprFaced.getVariableDefine("_rpt_group_").value = rpt_group; - exprFaced.addVariable("__page__", HttpContext.Request); - exprFaced.getVariableDefine("_user_").value = user_dict; + exprFaced.addVariable("__page__",HttpContext.Request); + exprFaced.getVariableDefine("_user_").value = user_dict; exprFaced.getVariableDefine("_user_").value = reportWeb.Controllers.UserController.ValidateJwtToken(HttpContext, HttpContext.Request.Cookies["access_token"]); //exprFaced.addVariable("_cache_", RedisHelper.Instance); parse_fresh_ds(); @@ -164,10 +164,10 @@ public async Task Page_Load() var start_time = DateTime.Now; reportDefineForWeb.putRequestParamForForm(); - IDictionary before_exec_result = null; + IDictionary before_exec_result=null; if (exprFaced.hasVariable("before_exec")) { - before_exec_result = exprFaced.calculate("=before_exec()", report_env.getDataSetResultMap()) + before_exec_result =exprFaced.calculate("=before_exec()", report_env.getDataSetResultMap()) as IDictionary; if (before_exec_result != null) { @@ -175,14 +175,14 @@ public async Task Page_Load() if (before_exec_result.TryGetValue("continue", out var my_continue)) { if (my_continue is Boolean && (Boolean)my_continue == false) - throw new Exception("不能继续执行,原因:" + before_exec_result["tips"]?.ToString()); + throw new Exception("不能继续执行,原因:"+before_exec_result["tips"]?.ToString()); } if (before_exec_result.TryGetValue("cache_id", out Object cache_id) && cache_id != null) { myCache = new CellReport.Redis_Cache(cache_id.ToString(), report_env.logger);//*/myCache = null; myCache.getFreshFlag = () => before_exec_result["fresh_flag"].ToString(); } - this.tips = before_exec_result["tips"]?.ToString()?.Replace("\\n", "\n"); + this.tips = before_exec_result["tips"]?.ToString()? .Replace("\\n", "\n"); } } //Console.WriteLine("before_exec:" + (DateTime.Now - start_time) / 10000 + "秒"); @@ -192,20 +192,20 @@ public async Task Page_Load() mc_report_id = reportDefineForWeb.getParamSortedString(); if (Request.Query["reportName"] == "") { - + } else { - await output(); + await output(); } //report_env.logger.Info(mc_report_id); - // Console.WriteLine("output:" + (DateTime.Now - start_time) / 10000 + "秒"); + // Console.WriteLine("output:" + (DateTime.Now - start_time) / 10000 + "秒"); Response.Body.Flush(); this.HttpContext.Response.RegisterForDispose(reportDefineForWeb); } catch (System.Exception e) { - output_expection(e, logger, report_env); + output_expection(e, logger,report_env); throw; } finally @@ -245,16 +245,16 @@ internal static void output_expection(Exception e, CellReport.running.Logger log if (inner_e.StackTrace != null) break; inner_e = inner_e.InnerException; - } + } } private void parse_fresh_ds() { if (!Request.HasFormContentType) return; - if (!Request.Form.TryGetValue("_fresh_ds", out var _fresh_ds)) + if(!Request.Form.TryGetValue("_fresh_ds",out var _fresh_ds)) return; - + List calcDsNames = null; List calcGridNames = null; @@ -288,22 +288,22 @@ private void parse_fresh_ds() } } reportDefineForWeb.CurrentReportDefine.calcGridNames = calcGridNames?.ToArray(); - if (calcDsNames != null) - reportDefineForWeb.CurrentReportDefine.calcDsNames = new HashSet(calcDsNames); - } + if(calcDsNames!=null) + reportDefineForWeb.CurrentReportDefine.calcDsNames = new HashSet( calcDsNames ); + } protected internal ReportDefineForWeb reportDefineForWeb; public async Task output() { - var aaa = Regex.Replace(mc_report_id, @"[:|\|""|\?|/|<|>]", "_"); - - tmpFileName = rpt_group.Id + ":" + mc_report_id.Replace('/', '.').Replace(':', '_').Replace('\\', '_') + var aaa=Regex.Replace(mc_report_id, @"[:|\|""|\?|/|<|>]", "_"); + + tmpFileName = rpt_group.Id+":"+mc_report_id.Replace('/', '.').Replace(':', '_').Replace('\\', '_') .Replace('"', '_').Replace('?', '_').Replace('/', '_').Replace('<', '_') .Replace('>', '_').Replace('|', '_'); //if (tmpFileName.Length > 150) // tmpFileName = UserMd5(tmpFileName); //HttpContext.Request.Form["_param_name_"] - if (myCache == null || (Request.HasFormContentType - && (Request.Form.ContainsKey("__updated") + if (myCache == null || (Request.HasFormContentType + &&( Request.Form.ContainsKey("__updated") || Request.Form.ContainsKey("__inserted") || Request.Form.ContainsKey("__deleted") || Request.Form.ContainsKey("_fresh_ds") @@ -322,8 +322,8 @@ public async Task output() exprFaced.addVariable("_createFormParam_", true); exprFaced.addVariable("_param_name_", Request.Form["_param_name_"].ToString()); } - if (Request.HasFormContentType && (Request.Form.ContainsKey("__updated") || - Request.Form.ContainsKey("__inserted") || Request.Form.ContainsKey("__deleted"))) + if(Request.HasFormContentType && (Request.Form.ContainsKey("__updated") || + Request.Form.ContainsKey("__inserted") || Request.Form.ContainsKey("__deleted") )) { string grid_name = Request.Query["_g"]; this.reportDefineForWeb.CurrentReportDefine.getGrid(grid_name).getAllCell(); @@ -346,16 +346,16 @@ public async Task output() } else { - await myCache.OutputOrCalcAndCache(tmpFileName, Response, - async (jsonWrite) => await calc_output(jsonWrite)); - + await myCache.OutputOrCalcAndCache(tmpFileName, Response, + async(jsonWrite) => await calc_output(jsonWrite)); + await Response.Body.FlushAsync(); await Response.WriteAsync(",\"notebook\":"); await Response.WriteAsync(System.Text.Json.JsonSerializer.Serialize(report_env.TemplateGet("notebook"), report_env.getJsonOption())); await Response.WriteAsync(",\"footer2\":"); await Response.WriteAsync(System.Text.Json.JsonSerializer.Serialize(report_env.TemplateGet("footer2"), report_env.getJsonOption())); - if (this.myCache != null) + if (this.myCache != null ) { this.tips = this.tips + "\n刷新标记是:" + this.myCache.fresh_flag diff --git a/end/reportWeb/ReportDb.cs b/end/reportWeb/ReportDb.cs index 783b0a0..69e4b14 100644 --- a/end/reportWeb/ReportDb.cs +++ b/end/reportWeb/ReportDb.cs @@ -28,6 +28,7 @@ public ReportDbContext(DbContextOptions options) public DbSet Rpt_group { get; set; } public DbSet Rpt_db_connection { get; set; } public DbSet Rpt_config { get; set; } + } public class Rpt_group { diff --git a/end/reportWeb/reportWeb.csproj b/end/reportWeb/reportWeb.csproj index 185f869..854d6b0 100644 --- a/end/reportWeb/reportWeb.csproj +++ b/end/reportWeb/reportWeb.csproj @@ -12,7 +12,7 @@ - + diff --git a/end/reportWeb/template.xml b/end/reportWeb/template.xml index 9287b68..145398c 100644 --- a/end/reportWeb/template.xml +++ b/end/reportWeb/template.xml @@ -10,12 +10,12 @@ div true - 30 + 20 24 10 100% 10 - + BACKGROUND-COLOR,COLOR,FONT,FONT-SIZE,border_box,layout_mode,show_form,layout_row_height,layout_colNum,layout_margin,layout_pan_height,row_col_gutter @@ -28,14 +28,14 @@ window.luckysheet_conditionformat=[ //{column_match:".*(累计)" ,val:'{"type":"dataBar","cellrange":[{"left":283,"width":88,"top":117,"height":25,"left_move":283,"width_move":88,"top_move":117,"height_move":25,"row":[4,4],"column":[3,3],"row_focus":4,"column_focus":3}],"format":["red","#ffffff"]}' }, ] -if (localStorage.luckysheet_conditionformat==undefined || localStorage.luckysheet_conditionformat=="[object Object]") +//if (localStorage.luckysheet_conditionformat==undefined || localStorage.luckysheet_conditionformat=="[object Object]") localStorage.luckysheet_conditionformat=JSON.stringify(window.luckysheet_conditionformat) //luckysheet_alternateformat_save='{"cellrange":{"row":[0,8],"column":[0,19]},"format":{"head":{"fc":"#ffffff","bc":"#f2711c"},"one":{"fc":"#000","bc":"#ffffff"},"two":{"fc":"#000","bc":"#fef0d7"},"foot":{"fc":"#000","bc":"#fbb335"}},"hasRowHeader":true,"hasRowFooter":false}' window.luckysheet_alternateformat_save={"cellrange":{"row":[0,8],"column":[-1,-1]},"format":{"head":{"fc":"#000","bc":"#dff0d8"},"one":{"fc":"#000","bc":"#ffffff"},"two":{"fc":"#000","bc":"#dff0d8"},"foot":{"fc":"#000","bc":"#cef3bf"}},"hasRowHeader":true,"hasRowFooter":false} -if (localStorage.luckysheet_alternateformat_save==undefined) +//if (localStorage.luckysheet_alternateformat_save==undefined) localStorage.luckysheet_alternateformat_save=JSON.stringify(window.luckysheet_alternateformat_save) ]]> diff --git a/end/reportWeb/widgets/admin.json b/end/reportWeb/widgets/admin.json new file mode 100644 index 0000000..e6f61a6 --- /dev/null +++ b/end/reportWeb/widgets/admin.json @@ -0,0 +1,658 @@ +[ + { + "title": "DATAV", + "list": [ + { + "type": "装饰1", + "label": "装饰1", + "gridName": "_random_", + "h": 4, + "span": 6, + "icon": "icon-table", + "color": "#fff", + "display": true, + "component": "dync-template", + "style": { + "height": "100%" + }, + "content": "" + }, + { + "type": "装饰2", + "label": "装饰2", + "gridName": "_random_", + "h": 4, + "span": 6, + "icon": "icon-table", + "color": "#fff", + "display": true, + "component": "dync-template", + "style": { + "height": "100%" + }, + "content": "" + }, + { + "type": "装饰3", + "label": "装饰3", + "gridName": "_random_", + "h": 4, + "span": 6, + "icon": "icon-table", + "color": "#fff", + "display": true, + "component": "dync-template", + "style": { + "height": "100%" + }, + "content": "" + }, + { + "type": "装饰4", + "label": "装饰4", + "gridName": "_random_", + "h": 4, + "span": 6, + "icon": "icon-table", + "color": "#fff", + "display": true, + "component": "dync-template", + "style": { + "height": "100%" + }, + "content": "" + }, + { + "type": "装饰5", + "label": "装饰5", + "gridName": "_random_", + "h": 4, + "span": 6, + "icon": "icon-table", + "color": "#fff", + "display": true, + "component": "dync-template", + "style": { + "height": "100%" + }, + "content": "" + }, + { + "type": "装饰6", + "label": "装饰6", + "gridName": "_random_", + "h": 4, + "span": 6, + "icon": "icon-table", + "color": "#fff", + "display": true, + "component": "dync-template", + "style": { + "height": "100%" + }, + "content": "" + }, + { + "type": "装饰7", + "label": "装饰7", + "gridName": "_random_", + "h": 4, + "span": 6, + "icon": "icon-table", + "color": "#fff", + "display": true, + "component": "dync-template", + "style": { + "height": "100%" + }, + "content": "Decoration" + }, + { + "type": "装饰8", + "label": "装饰8", + "gridName": "_random_", + "h": 4, + "span": 6, + "icon": "icon-table", + "color": "#fff", + "display": true, + "component": "dync-template", + "style": { + "height": "100%" + }, + "content": "" + }, + { + "type": "装饰9", + "label": "装饰9", + "gridName": "_random_", + "h": 4, + "span": 6, + "icon": "icon-table", + "color": "#fff", + "display": true, + "component": "dync-template", + "style": { + "height": "100%" + }, + "content": "66%" + }, + { + "type": "装饰10", + "label": "装饰10", + "gridName": "_random_", + "h": 4, + "span": 6, + "icon": "icon-table", + "color": "#fff", + "display": true, + "component": "dync-template", + "style": { + "height": "100%" + }, + "content": "" + }, + { + "type": "装饰11", + "label": "装饰11", + "gridName": "_random_", + "h": 4, + "span": 6, + "icon": "icon-table", + "color": "#fff", + "display": true, + "component": "dync-template", + "style": { + "height": "100%" + }, + "content": "dv-decoration-11" + }, + { + "type": "装饰12", + "label": "装饰12", + "gridName": "_random_", + "h": 4, + "span": 6, + "icon": "icon-table", + "color": "#fff", + "display": true, + "component": "dync-template", + "style": { + "height": "100%" + }, + "content": "" + }, + { + "type": "动态环图", + "label": "动态环图", + "gridName": "_random_", + "h": 4, + "span": 6, + "icon": "icon-table", + "color": "#fff", + "display": true, + "component": "dync-template", + "style": { + "height": "100%" + }, + "content": " { \n return {'name':x[0],value:x[1]} \n }).toArray()\n }\" style=\"width:100%;height:100%\" /> " + }, + { + "type": "胶囊柱图", + "label": "胶囊柱图", + "gridName": "_random_", + "h": 4, + "span": 6, + "icon": "icon-table", + "color": "#fff", + "display": true, + "component": "dync-template", + "style": { + "height": "100%" + }, + "content": " { \n return {'name':x[0],value:x[1]} \n }).toArray()\n }\" style=\"width:100%;height:100%;color:black\" />" + }, + { + "type": "水位图", + "label": "水位图", + "gridName": "_random_", + "h": 4, + "span": 6, + "icon": "icon-table", + "color": "#fff", + "display": true, + "component": "dync-template", + "style": { + "height": "100%" + }, + "content": "" + }, + { + "type": "进度池", + "label": "进度池", + "gridName": "_random_", + "h": 4, + "span": 6, + "icon": "icon-table", + "color": "#fff", + "display": true, + "component": "dync-template", + "style": { + "height": "100%" + }, + "content": "" + }, + { + "type": "飞线图", + "label": "飞线图", + "gridName": "_random_", + "h": 4, + "span": 6, + "icon": "icon-table", + "color": "#fff", + "display": true, + "component": "dync-template", + "style": { + "height": "100%" + }, + "content": "" + }, + { + "type": "飞线图增强版", + "label": "飞线图增强版", + "gridName": "_random_", + "h": 4, + "span": 6, + "icon": "icon-table", + "color": "#fff", + "display": true, + "component": "dync-template", + "style": { + "height": "100%" + }, + "content": "" + }, + { + "type": "锥形柱图", + "label": "锥形柱图", + "gridName": "_random_", + "h": 4, + "span": 6, + "icon": "icon-table", + "color": "#fff", + "display": true, + "component": "dync-template", + "style": { + "height": "100%" + }, + "content": " { \n return {'name':x[0],value:x[1]} \n }).toArray(),\n img: [\n '/img/conicalColumnChart/1st.png',\n '/img/conicalColumnChart/2st.png',\n '/img/conicalColumnChart/3st.png',\n '/img/conicalColumnChart/4st.png',\n '/img/conicalColumnChart/5st.png',\n '/img/conicalColumnChart/6st.png',\n '/img/conicalColumnChart/7st.png'\n ]\n }\" style=\"width:100%;height:100%;\" />" + }, + { + "type": "数字翻牌器", + "label": "数字翻牌器", + "gridName": "_random_", + "h": 4, + "span": 6, + "icon": "icon-table", + "color": "#fff", + "display": true, + "component": "dync-template", + "style": { + "height": "100%" + }, + "content": "\n \n " + }, + { + "type": "轮播表", + "label": "轮播表", + "gridName": "_random_", + "h": 4, + "span": 6, + "icon": "icon-table", + "color": "#fff", + "display": true, + "component": "dync-template", + "style": { + "height": "100%" + }, + "content": "" + }, + { + "type": "排名轮播表", + "label": "排名轮播表", + "gridName": "_random_", + "h": 4, + "span": 6, + "icon": "icon-table", + "color": "#fff", + "display": true, + "component": "dync-template", + "style": { + "height": "100%" + }, + "content": " { \n return {'name':x[0],value:x[1]} \n }).toArray()\n }\" style=\"width:100%;height:100%;color:black\" />" + } + ] + }, + { + "title": "数据展示", + "list": [ + { + "type": "DataTabs", + "label": "DataTabs", + "gridName": "_random_", + "h": 4, + "span": 24, + "icon": "icon-table", + "color": "#fff", + "display": true, + "component": "dync-template", + "style": { + "height": "100px" + }, + "content": "" + }, + { + "type": "DataBox", + "label": "DataBox", + "gridName": "_random_", + "h": 4, + "span": 24, + "icon": "icon-table", + "color": "#fff", + "display": true, + "component": "dync-template", + "style": { + "height": "100px" + }, + "content": "\n\n" + }, + { + "type": "DataDisplay", + "label": "DataDisplay", + "gridName": "_random_", + "h": 4, + "span": 24, + "icon": "icon-table", + "color": "#fff", + "display": true, + "component": "dync-template", + "style": { + "height": "100px" + }, + "content": "
\n\n\n 100.00\n \n\n\n
日活跃数
\n\n
" + }, + { + "type": "DataIcons", + "label": "DataIcons", + "gridName": "_random_", + "h": 4, + "span": 24, + "icon": "icon-table", + "color": "#fff", + "display": true, + "component": "dync-template", + "style": { + "height": "100px" + }, + "content": "" + }, + { + "type": "DataOperatext", + "label": "DataOperatext", + "gridName": "_random_", + "h": 4, + "span": 24, + "icon": "icon-table", + "color": "#fff", + "display": true, + "component": "dync-template", + "style": { + "height": "100px" + }, + "content": "" + }, + { + "type": "DataProgress", + "label": "DataProgress", + "gridName": "_random_", + "h": 4, + "span": 24, + "icon": "icon-table", + "color": "#fff", + "display": true, + "component": "dync-template", + "style": { + "height": "100px", + "overflow": "hidden" + }, + "content": "
\n \t
\n 32.00\n
转化率(日同比 28%)
\n\t
\n\t\n \n
" + }, + { + "type": "DataRotate", + "label": "DataRotate", + "gridName": "_random_", + "h": 4, + "span": 24, + "icon": "icon-table", + "color": "#fff", + "display": true, + "component": "dync-template", + "style": { + "height": "100px" + }, + "content": "
\n
\n \n 150.00\n \n \n 新订单\n \n \n
\n\n\n

\n \t更多\n \n

\n
\n\n
" + }, + { + "type": "DataPanel", + "label": "DataPanel", + "gridName": "_random_", + "h": 4, + "span": 24, + "icon": "icon-table", + "color": "#fff", + "display": true, + "component": "dync-template", + "style": { + "height": "100px" + }, + "content": "
\n
\n\n
\n
\n
最新拜访
\n102,400\n
\n
" + } + ] + }, + { + "title": "图", + "list": [ + { + "type": "echart", + "label": "柱状图", + "gridName": "_random_", + "icon": "icon-table", + "color": "#fff", + "display": true, + "component": "echarts", + "style": { + "height": "100%" + }, + "series_type": "{\"type\":\"bar\"}", + "fresh_ds": [], + "fresh_params": [], + "fields": [], + "datasource": "示例", + "data": [], + "content": "option = {\n //backgroundColor: '#fff',\n legend: {selectedMode:'single'},//单选模式\n tooltip: {},\n dataset: {\n // 提供一份数据。__valid_data__为自动生成,如果全自定义,就不要使用\n source: __valid_data__\n },\n grid:{left :30,right:10,top:10,bottom:30},\n // 声明一个 X 轴,类目轴(category)。默认情况下,类目轴对应到 dataset 第一列。\n yAxis: {},\n // 声明一个 Y 轴,数值轴。\n xAxis: {type: 'category',\"axisLabel\": {\n \"margin\": 8,\n \"interval\":0,//解决代码,坐标轴上的刻度是否全显示\n \"textStyle\": {\n \"color\": \"#676767\"\n }}},\n // 声明多个 bar 系列,默认情况下,每个系列会自动对应到 dataset 的每一列。\n series:function(){\n let series_type=[]\n __valid_data__[0].slice(1).forEach(ele=>{\n series_type.push({\"type\":\"bar\"})\n }); return series_type\n }() \n}" + }, + { + "type": "echart", + "label": "极坐标堆叠图", + "gridName": "_random_", + "icon": "icon-table", + "color": "#fff", + "display": true, + "component": "echarts", + "style": { + "height": "100%" + }, + "series_type": "{\"type\": \"bar\", \"coordinateSystem\": \"polar\",\"stack\": \"a\"}", + "fresh_ds": [], + "fresh_params": [], + "fields": [], + "datasource": "示例", + "data": [], + "content": "option = {\n //backgroundColor: '#fff',\n legend: {},\n tooltip: {},\n \"polar\": {},\"angleAxis\":{},\n dataset: {\n // 提供一份数据。__valid_data__为自动生成,如果全自定义,就不要使用\n source: __valid_data__\n },\n // 声明一个 X 轴,类目轴(category)。默认情况下,类目轴对应到 dataset 第一列。\n \n // 声明一个 Y 轴,数值轴。\n radiusAxis: {type: 'category'},\n // 声明多个 bar 系列,默认情况下,每个系列会自动对应到 dataset 的每一列。\n series:function(){\n let series_type=[]\n __valid_data__[0].slice(1).forEach(ele=>{\n series_type.push({\"type\": \"bar\", \"coordinateSystem\": \"polar\",\"stack\": \"a\"})\n }); return series_type\n }() \n }" + }, + { + "type": "echart", + "label": "堆叠图", + "gridName": "_random_", + "icon": "icon-table", + "color": "#fff", + "display": true, + "component": "echarts", + "style": { + "height": "100%" + }, + "series_type": "{\"type\": \"bar\", \"stack\": \"one\"}", + "fresh_ds": [], + "fresh_params": [], + "fields": [], + "datasource": "示例", + "data": [], + "content": "option = {\n //backgroundColor: '#fff',\n legend: {selectedMode:'single'},//单选模式\n tooltip: {},\n dataset: {\n // 提供一份数据。__valid_data__为自动生成,如果全自定义,就不要使用\n source: __valid_data__\n },\n grid:{left :30,right:10,top:10,bottom:30},\n // 声明一个 X 轴,类目轴(category)。默认情况下,类目轴对应到 dataset 第一列。\n yAxis: {},\n // 声明一个 Y 轴,数值轴。\n xAxis: {type: 'category',\"axisLabel\": {\n \"margin\": 8,\n \"interval\":0,//解决代码,坐标轴上的刻度是否全显示\n \"textStyle\": {\n \"color\": \"#676767\"\n }}},\n // 声明多个 bar 系列,默认情况下,每个系列会自动对应到 dataset 的每一列。\n series:function(){\n let series_type=[]\n __valid_data__[0].slice(1).forEach(ele=>{\n series_type.push({\"type\": \"bar\", \"stack\": \"one\"})\n }); return series_type\n }() \n}" + }, + { + "type": "echart", + "label": "面积图", + "gridName": "_random_", + "icon": "icon-table", + "color": "#fff", + "display": true, + "component": "echarts", + "style": { + "height": "100%" + }, + "series_type": "{\"type\":\"line\",\"stack\":\"z\",\"areaStyle\": {}}", + "fresh_ds": [], + "fresh_params": [], + "fields": [], + "datasource": "示例", + "data": [], + "content": "option = {\n //backgroundColor: '#fff',\n legend: {selectedMode:'single'},//单选模式\n tooltip: {},\n dataset: {\n // 提供一份数据。__valid_data__为自动生成,如果全自定义,就不要使用\n source: __valid_data__\n },\n grid:{left :30,right:10,top:10,bottom:30},\n // 声明一个 X 轴,类目轴(category)。默认情况下,类目轴对应到 dataset 第一列。\n yAxis: {},\n // 声明一个 Y 轴,数值轴。\n xAxis: {type: 'category',\"axisLabel\": {\n \"margin\": 8,\n \"interval\":0,//解决代码,坐标轴上的刻度是否全显示\n \"textStyle\": {\n \"color\": \"#676767\"\n }}},\n // 声明多个 bar 系列,默认情况下,每个系列会自动对应到 dataset 的每一列。\n series:function(){\n let series_type=[]\n __valid_data__[0].slice(1).forEach(ele=>{\n series_type.push({\"type\":\"line\",\"stack\":\"z\",\"areaStyle\": {}})\n }); return series_type\n }() \n}" + }, + { + "type": "echart", + "label": "line_symbol", + "gridName": "_random_", + "icon": "icon-table", + "color": "#fff", + "display": true, + "component": "echarts", + "style": { + "height": "100%" + }, + "series_type": "{\n \"type\": \"line\",\n \"smooth\": true,\n \"showAllSymbol\": true,\n \"symbol\": \"emptyCircle\",\n \"symbolSize\": 5\n }", + "fresh_ds": [], + "fresh_params": [], + "fields": [], + "datasource": "示例", + "data": [], + "content": "option = {\n //backgroundColor: '#fff',\n legend: {selectedMode:'single'},//单选模式\n tooltip: {},\n dataset: {\n // 提供一份数据。__valid_data__为自动生成,如果全自定义,就不要使用\n source: __valid_data__\n },\n grid:{left :30,right:10,top:10,bottom:30},\n // 声明一个 X 轴,类目轴(category)。默认情况下,类目轴对应到 dataset 第一列。\n yAxis: {},\n // 声明一个 Y 轴,数值轴。\n xAxis: {type: 'category',\"axisLabel\": {\n \"margin\": 8,\n \"interval\":0,//解决代码,坐标轴上的刻度是否全显示\n \"textStyle\": {\n \"color\": \"#676767\"\n }}},\n // 声明多个 bar 系列,默认情况下,每个系列会自动对应到 dataset 的每一列。\n series:function(){\n let series_type=[]\n __valid_data__[0].slice(1).forEach(ele=>{\n series_type.push({\n \"type\": \"line\",\n \"smooth\": true,\n \"showAllSymbol\": true,\n \"symbol\": \"emptyCircle\",\n \"symbolSize\": 5\n })\n }); return series_type\n }() \n}" + }, + { + "type": "echart", + "label": "线型图", + "gridName": "_random_", + "icon": "icon-table", + "color": "#fff", + "display": true, + "component": "echarts", + "style": { + "height": "100%" + }, + "series_type": "{\"type\":\"line\"}", + "fresh_ds": [], + "fresh_params": [], + "fields": [], + "datasource": "示例", + "data": [], + "content": "option = {\n //backgroundColor: '#fff',\n legend: {selectedMode:'single'},//单选模式\n tooltip: {},\n dataset: {\n // 提供一份数据。__valid_data__为自动生成,如果全自定义,就不要使用\n source: __valid_data__\n },\n grid:{left :30,right:10,top:10,bottom:30},\n // 声明一个 X 轴,类目轴(category)。默认情况下,类目轴对应到 dataset 第一列。\n yAxis: {},\n // 声明一个 Y 轴,数值轴。\n xAxis: {type: 'category',\"axisLabel\": {\n \"margin\": 8,\n \"interval\":0,//解决代码,坐标轴上的刻度是否全显示\n \"textStyle\": {\n \"color\": \"#676767\"\n }}},\n // 声明多个 bar 系列,默认情况下,每个系列会自动对应到 dataset 的每一列。\n series:function(){\n let series_type=[]\n __valid_data__[0].slice(1).forEach(ele=>{\n series_type.push({\"type\":\"line\"})\n }); return series_type\n }() \n}" + }, + { + "type": "echart", + "label": "多饼图", + "gridName": "_random_", + "icon": "icon-table", + "color": "#fff", + "display": true, + "component": "echarts", + "style": { + "height": "100%" + }, + "series_type": "{\"type\":\"pie\"}", + "fresh_ds": [], + "fresh_params": [], + "fields": [], + "datasource": "示例", + "data": [], + "content": "option = {\n //backgroundColor: '#fff',\n legend: {},\n tooltip: {},\n \n dataset: {\n // 提供一份数据。__valid_data__为自动生成,如果全自定义,就不要使用\n source: __valid_data__\n }, \n series:function(){\n let series_type=[]\n __valid_data__[0].slice(1).forEach(ele=>{\n series_type.push({\"type\":\"pie\"})\n }); return series_type\n }() \n }" + }, + { + "type": "echart", + "label": "上饼下线", + "gridName": "_random_", + "icon": "icon-table", + "color": "#fff", + "display": true, + "component": "echarts", + "style": { + "height": "100%" + }, + "series_type": "{\"type\": \"line\", \"smooth\": true, \"seriesLayoutBy\": \"row\"}", + "fresh_ds": [], + "fresh_params": [], + "fields": [], + "datasource": "示例", + "data": [], + "content": "option = {\n //backgroundColor: '#fff',\n legend: {},\n tooltip: {\n trigger: 'axis',\n showContent: false\n },\n xAxis: {type: 'category'},\n yAxis: {gridIndex: 0},\n grid: {top: '55%'}, \n dataset: {\n // 提供一份数据。__valid_data__为自动生成,如果全自定义,就不要使用\n source: __valid_data__\n }, \n series:\n function(){\n let series_type=[]\n __valid_data__[0].slice(1).forEach(ele=>{\n series_type.push({\"type\": \"line\", \"smooth\": true, \"seriesLayoutBy\": \"row\"})\n }); \n series_type=series_type.concat([{\n type: 'pie',\n id: 'pie',\n radius: '30%',\n center: ['50%', '25%'],\n label: {\n formatter: '{b}: {@2012} ({d}%)'\n },\n encode: {\n itemName: __valid_data__[0][0],\n value: __valid_data__[0][1],\n tooltip: __valid_data__[0][1]\n }\n }])\n return series_type\n }() \n \n }\n myChart.on('updateAxisPointer', function (event) {\n var xAxisInfo = event.axesInfo[0];\n if (xAxisInfo) {\n var dimension = xAxisInfo.value + 1;\n myChart.setOption({\n series: {\n id: 'pie',\n label: {\n formatter: '{b}: {@[' + dimension + ']} ({d}%)'\n },\n encode: {\n value: dimension,\n tooltip: dimension\n }\n }\n });\n }\n });\n " + }, + { + "type": "echart", + "label": "仪表盘", + "gridName": "_random_", + "icon": "icon-table", + "color": "#fff", + "display": true, + "component": "echarts", + "style": { + "height": "100%" + }, + "series_type": "{\"type\": \"gauge\"}", + "fresh_ds": [], + "fresh_params": [], + "fields": [], + "datasource": "示例", + "data": [], + "content": "option = \n {\n //backgroundColor: '#fff',\n legend: {selectedMode:'single'},//单选模式\n tooltip: {},\n dataset: {\n // 提供一份数据。__valid_data__为自动生成,如果全自定义,就不要使用\n source: __valid_data__\n },\n grid:{left :0,right:0,top:0,bottom:0},\n // 声明一个 X 轴,类目轴(category)。默认情况下,类目轴对应到 dataset 第一列。\n yAxis: {},\n // 声明一个 Y 轴,数值轴。\n xAxis: {type: 'category',\"axisLabel\": {\n \"margin\": 8,\n \"interval\":0,//解决代码,坐标轴上的刻度是否全显示\n \"textStyle\": {\n \"color\": \"#676767\"\n }}},\n // 声明多个 bar 系列,默认情况下,每个系列会自动对应到 dataset 的每一列。\n series:function(){\n let series_type=[]\n __valid_data__.slice(1).forEach(ele=>{\n series_type.push({\"type\": \"gauge\" ,\n data: [{\n value: ele[1],\n name: ele[0]\n }] \n })\n }); return series_type\n }() \n } \n " + }, + { + "type": "echart", + "label": "漏斗图", + "gridName": "_random_", + "icon": "icon-table", + "color": "#fff", + "display": true, + "component": "echarts", + "style": { + "height": "100%" + }, + "series_type": "{\"type\": \"funnel\"}", + "fresh_ds": [], + "fresh_params": [], + "fields": [], + "datasource": "示例", + "data": [], + "content": "option = {\n //backgroundColor: '#fff',\n legend: {},\n tooltip: {},\n dataset: {\n // 提供一份数据。__valid_data__为自动生成,如果全自定义,就不要使用\n source: __valid_data__\n },\n grid:{left :30,right:10,top:10,bottom:30},\n // 声明一个 X 轴,类目轴(category)。默认情况下,类目轴对应到 dataset 第一列。\n yAxis: {},\n // 声明一个 Y 轴,数值轴。\n xAxis: {type: 'category' },\n // 声明多个 bar 系列,默认情况下,每个系列会自动对应到 dataset 的每一列。\n series:function(){\n let series_type=[]\n __valid_data__[0].slice(1).forEach(ele=>{\n series_type.push({\"type\": \"funnel\"})\n }); return series_type\n }() \n }" + } + ] + } +] \ No newline at end of file diff --git a/front/src/App.vue b/front/src/App.vue index bb83d4f..4351a41 100644 --- a/front/src/App.vue +++ b/front/src/App.vue @@ -21,6 +21,7 @@ export default { height: 100%; overflow: hidden; } +.cr_run_title { line-height: 28px; border-bottom: 1px solid gray;font-weight: 500; margin-bottom: 5px; } .vue-codemirror{border: 1px solid black;} .el-table td, .el-table th { padding: 1px 0; diff --git a/front/src/main.js b/front/src/main.js index b8b17fc..e1a9a58 100644 --- a/front/src/main.js +++ b/front/src/main.js @@ -19,6 +19,11 @@ import './styles/common.scss'; import basicBlock from './components/basic-block/main' import basicContainer from './components/basic-container/main' import Contextmenu from "vue-contextmenujs" +import install_component from './views/rpt_design/install_component' +//import Config from './views/rpt_design/Config' +//Vue.use(Config); +Vue.use(install_component); + Vue.use(Contextmenu); Vue.use(router) Vue.use(VueAxios, axios) diff --git a/front/src/router/views/index.js b/front/src/router/views/index.js index 7849e1e..f864104 100644 --- a/front/src/router/views/index.js +++ b/front/src/router/views/index.js @@ -57,6 +57,18 @@ export default [{ component: () => import( /* webpackChunkName: "views_rpt_desgin" */ '@/views/rpt_design/manger') }] +},{ + path: '/widget', + component: Layout, + children: [{ + path: 'index', + name: '组件管理', + meta: { + keepAlive: false, + }, + component: () => + import( /* webpackChunkName: "views_rpt_desgin" */ '@/views/rpt_design/widgetManger') + }] },{ path: '/rpt-design', component: Layout, diff --git a/front/src/views/rpt_design/api/report_api.js b/front/src/views/rpt_design/api/report_api.js index 5e35c6e..8919eff 100644 --- a/front/src/views/rpt_design/api/report_api.js +++ b/front/src/views/rpt_design/api/report_api.js @@ -88,6 +88,27 @@ export function save_one(report,zb_data) { }) } +export async function getAllWidget(action) { + let data=new FormData(); + data.append('action',action) + return request({ + method: 'post', + data, + url: `${baseUrl}/design/getAllWidget` , + withCredentials: true + }) +} +export async function saveWidget(txt) { + let data=new FormData(); + data.append('txt',txt) + return request({ + method: 'post', + data, + url: `${baseUrl}/design/saveWidget` , + withCredentials: true + }) +} + export async function preview_one(_this,createFormParam=false,query_data={},param_name=null) { _this.context.report.params.param?.forEach(ele=>{ diff --git a/front/src/views/rpt_design/config/cr_echarts.vue b/front/src/views/rpt_design/config/cr_echarts.vue index 2bc4920..c01e810 100644 --- a/front/src/views/rpt_design/config/cr_echarts.vue +++ b/front/src/views/rpt_design/config/cr_echarts.vue @@ -58,10 +58,9 @@ import codemirror from '../element/vue-codemirror.vue' import cr_set_fresh from "./cr_set_fresh.vue" -import Draggable from 'vuedraggable' export default { name: 'config-echart', - components: { codemirror,Draggable,cr_set_fresh}, + components: { codemirror,cr_set_fresh}, inject: ["context"], props: ['data'], mounted(){ diff --git a/front/src/views/rpt_design/config/select.vue b/front/src/views/rpt_design/config/select.vue index 07e3942..1d56f7d 100644 --- a/front/src/views/rpt_design/config/select.vue +++ b/front/src/views/rpt_design/config/select.vue @@ -202,12 +202,11 @@ diff --git a/front/src/views/rpt_design/element/WidgetFormGroup.vue b/front/src/views/rpt_design/element/WidgetFormGroup.vue index a8a3454..ced97f8 100644 --- a/front/src/views/rpt_design/element/WidgetFormGroup.vue +++ b/front/src/views/rpt_design/element/WidgetFormGroup.vue @@ -64,12 +64,11 @@ diff --git a/front/src/views/rpt_design/element/WidgetFormTabs.vue b/front/src/views/rpt_design/element/WidgetFormTabs.vue index 1085624..317be02 100644 --- a/front/src/views/rpt_design/element/WidgetFormTabs.vue +++ b/front/src/views/rpt_design/element/WidgetFormTabs.vue @@ -15,17 +15,17 @@ > - + + - - \ No newline at end of file diff --git a/front/src/views/rpt_design/element/vvvDyncTemplate.js b/front/src/views/rpt_design/element/vvvDyncTemplate.js deleted file mode 100644 index 3498797..0000000 --- a/front/src/views/rpt_design/element/vvvDyncTemplate.js +++ /dev/null @@ -1,110 +0,0 @@ -const defineDescriptor = (src, dest, name) => { - if (!dest.hasOwnProperty(name)) { - const descriptor = Object.getOwnPropertyDescriptor(src, name); - Object.defineProperty(dest, name, descriptor); - } - }; - - const merge = objs => { - const res = {}; - objs.forEach(obj => { - obj && - Object.getOwnPropertyNames(obj).forEach(name => - defineDescriptor(obj, res, name) - ); - }); - return res; - }; - - const buildFromProps = (obj, props) => { - const res = {}; - props.forEach(prop => defineDescriptor(obj, res, prop)); - return res; - }; - - export default { - props: { - template: String, - parent: Object, - templateProps: { - type: Object, - default: () => ({}) - } - }, - render(h) { - if (this.template) { - const parent = this.parent || this.$parent - const { - $data: parentData = {}, - $props: parentProps = {}, - $options: parentOptions = {} - } = parent; - const { - components: parentComponents = {}, - computed: parentComputed = {}, - methods: parentMethods = {} - } = parentOptions; - const { - $data = {}, - $props = {}, - $options: { methods = {}, computed = {}, components = {} } = {} - } = this; - const passthrough = { - $data: {}, - $props: {}, - $options: {}, - components: {}, - computed: {}, - methods: {} - }; - - //build new objects by removing keys if already exists (e.g. created by mixins) - Object.keys(parentData).forEach(e => { - if (typeof $data[e] === "undefined") - passthrough.$data[e] = parentData[e]; - }); - Object.keys(parentProps).forEach(e => { - if (typeof $props[e] === "undefined") - passthrough.$props[e] = parentProps[e]; - }); - Object.keys(parentMethods).forEach(e => { - if (typeof methods[e] === "undefined") - passthrough.methods[e] = parentMethods[e]; - }); - Object.keys(parentComputed).forEach(e => { - if (typeof computed[e] === "undefined") - passthrough.computed[e] = parentComputed[e]; - }); - Object.keys(parentComponents).forEach(e => { - if (typeof components[e] === "undefined") - passthrough.components[e] = parentComponents[e]; - }); - - const methodKeys = Object.keys(passthrough.methods || {}); - const dataKeys = Object.keys(passthrough.$data || {}); - const propKeys = Object.keys(passthrough.$props || {}); - const templatePropKeys = Object.keys(this.templateProps); - const allKeys = dataKeys.concat(propKeys).concat(methodKeys).concat(templatePropKeys); - const methodsFromProps = buildFromProps(parent, methodKeys); - const finalProps = merge([ - passthrough.$data, - passthrough.$props, - methodsFromProps, - this.templateProps - ]); - const provide = this.$parent._provided; - - - const dynamic = { - template: this.template || "
", - props: allKeys, - computed: passthrough.computed, - components: passthrough.components, - provide: provide - }; - - return h(dynamic, { props: finalProps }); - } - } - }; - \ No newline at end of file diff --git a/front/src/views/rpt_design/fieldsConfig.js b/front/src/views/rpt_design/fieldsConfig.js index 100b0fa..c28b8d2 100644 --- a/front/src/views/rpt_design/fieldsConfig.js +++ b/front/src/views/rpt_design/fieldsConfig.js @@ -1,5 +1,3 @@ -import {deepClone} from "./utils/util" - export const widget_row_col_layout=function(item){ let column=[] if(item) @@ -32,71 +30,15 @@ export const widget_div_layout=function(item){ } } } -function default_chart(chart_name,series_type,chart_option=`{ - //backgroundColor: '#fff', - legend: {selectedMode:'single'},//单选模式 - tooltip: {}, - dataset: { - // 提供一份数据。__valid_data__为自动生成,如果全自定义,就不要使用 - source: __valid_data__ - }, - grid:{left :30,right:10,top:10,bottom:30}, - // 声明一个 X 轴,类目轴(category)。默认情况下,类目轴对应到 dataset 第一列。 - yAxis: {}, - // 声明一个 Y 轴,数值轴。 - xAxis: {type: 'category',"axisLabel": { - "margin": 8, - "interval":0,//解决代码,坐标轴上的刻度是否全显示 - "textStyle": { - "color": "#676767" - }}}, - // 声明多个 bar 系列,默认情况下,每个系列会自动对应到 dataset 的每一列。 - series:function(){ - let series_type=[] - __valid_data__[0].slice(1).forEach(ele=>{ - series_type.push(__series_type__) - }); return series_type - }() -}`){ - chart_option=chart_option.replace("__series_type__",series_type) - return { - "type":"echart",'label':chart_name,gridName:"_random_",icon: - 'icon-table','color':'#fff',display: true, - 'component':'echarts',style:{height:'100%'}, - "series_type":series_type, - fresh_ds:[],fresh_params:[], - fields:[ - ], - datasource:'示例', - data:[ - ] - ,content:`option = `+chart_option - - } -} export default [ - { - title: '布局字段', - list: [widget_row_col_layout(), - widget_div_layout(), - { - type: 'tabs', - label: 'tab面板', - icon: 'icon-table', - span: 24, - display: true,style:{height:'100%'}, - component:'widget-form-tabs', - children: { - align: 'center', - headerAlign: 'center', - column: [widget_div_layout() - ] - } - } - ] - }, - { title: '元素', - list: [ + { title: '核心元素', + list: [ + {"type":"luckySheetProxy",'label':'自由格式报表',h:12, span:12,icon: 'icon-table',display: true,style:{height:'100%'}, + gridName:"_random_",'component':'luckySheetProxy',fit:true, + page_size:20,no_use_parent_css:false, + page_sizes:"[20, 50, 100, 200]" + }, + {"type":"dync_template",'label':'动态模板',gridName:"_random_",icon: 'icon-table','color':'#fff',display: true,style:{height:'100px'}, 'content':`
@@ -109,8 +51,7 @@ export default [ pageSize:20, gridName:'_random_', datasource:"示例",fresh_ds:[],fresh_params:[], - fields:[ - ],style:{height:'100%'}, + fields:[],style:{height:'100%'}, content:`
哈==哈哈"}, + ] }, - { - title: 'DATAV', - list: [ - {"type":"装饰1",'label':'装饰1',gridName:"_random_",h:4, span:6,icon: 'icon-table','color':'#fff', - display: true, 'component':'dync-template',style:{height:'100%'},'content':``}, - {"type":"装饰2",'label':'装饰2',gridName:"_random_",h:4, span:6,icon: 'icon-table','color':'#fff', - display: true, 'component':'dync-template',style:{height:'100%'},'content':``}, - {"type":"装饰3",'label':'装饰3',gridName:"_random_",h:4, span:6,icon: 'icon-table','color':'#fff', - display: true, 'component':'dync-template',style:{height:'100%'},'content':``}, - {"type":"装饰4",'label':'装饰4',gridName:"_random_",h:4, span:6,icon: 'icon-table','color':'#fff', - display: true, 'component':'dync-template',style:{height:'100%'},'content':``}, - {"type":"装饰5",'label':'装饰5',gridName:"_random_",h:4, span:6,icon: 'icon-table','color':'#fff', - display: true, 'component':'dync-template',style:{height:'100%'},'content':``}, - {"type":"装饰6",'label':'装饰6',gridName:"_random_",h:4, span:6,icon: 'icon-table','color':'#fff', - display: true, 'component':'dync-template',style:{height:'100%'},'content':``}, - - {"type":"装饰7",'label':'装饰7',gridName:"_random_",h:4, span:6,icon: 'icon-table','color':'#fff', - display: true, 'component':'dync-template',style:{height:'100%'},'content':`Decoration`}, - {"type":"装饰8",'label':'装饰8',gridName:"_random_",h:4, span:6,icon: 'icon-table','color':'#fff', - display: true, 'component':'dync-template',style:{height:'100%'},'content':``}, - {"type":"装饰9",'label':'装饰9',gridName:"_random_",h:4, span:6,icon: 'icon-table','color':'#fff', - display: true, 'component':'dync-template',style:{height:'100%'},'content':`66%`}, - - {"type":"装饰10",'label':'装饰10',gridName:"_random_",h:4, span:6,icon: 'icon-table','color':'#fff', - display: true, 'component':'dync-template',style:{height:'100%'},'content':``}, - {"type":"装饰11",'label':'装饰11',gridName:"_random_",h:4, span:6,icon: 'icon-table','color':'#fff', - display: true, 'component':'dync-template',style:{height:'100%'},'content':`dv-decoration-11`}, - {"type":"装饰12",'label':'装饰12',gridName:"_random_",h:4, span:6,icon: 'icon-table','color':'#fff', - display: true, 'component':'dync-template',style:{height:'100%'},'content':``}, - - {"type":"动态环图",'label':'动态环图',gridName:"_random_",h:4, span:6,icon: 'icon-table','color':'#fff', - display: true, 'component':'dync-template',style:{height:'100%'},'content':` `}, - - {"type":"胶囊柱图",'label':'胶囊柱图',gridName:"_random_",h:4, span:6,icon: 'icon-table','color':'#fff', - display: true, 'component':'dync-template',style:{height:'100%'},'content':``}, - {"type":"水位图",'label':'水位图',gridName:"_random_",h:4, span:6,icon: 'icon-table','color':'#fff', - display: true, 'component':'dync-template',style:{height:'100%'},'content':``}, - {"type":"进度池",'label':'进度池',gridName:"_random_",h:4, span:6,icon: 'icon-table','color':'#fff', - display: true, 'component':'dync-template',style:{height:'100%'},'content':``}, - {"type":"飞线图",'label':'飞线图',gridName:"_random_",h:4, span:6,icon: 'icon-table','color':'#fff', - display: true, 'component':'dync-template',style:{height:'100%'},'content':``}, - {"type":"飞线图增强版",'label':'飞线图增强版',gridName:"_random_",h:4, span:6,icon: 'icon-table','color':'#fff', - display: true, 'component':'dync-template',style:{height:'100%'},'content':``}, - - {"type":"锥形柱图",'label':'锥形柱图',gridName:"_random_",h:4, span:6,icon: 'icon-table','color':'#fff', - display: true, 'component':'dync-template',style:{height:'100%'},'content':``}, - {"type":"数字翻牌器",'label':'数字翻牌器',gridName:"_random_",h:4, span:6,icon: 'icon-table','color':'#fff', - display: true, 'component':'dync-template',style:{height:'100%'},'content':` - - `}, - {"type":"轮播表",'label':'轮播表',gridName:"_random_",h:4, span:6,icon: 'icon-table','color':'#fff', - display: true, 'component':'dync-template',style:{height:'100%'},'content':``}, - {"type":"排名轮播表",'label':'排名轮播表',gridName:"_random_",h:4, span:6,icon: 'icon-table','color':'#fff', - display: true, 'component':'dync-template',style:{height:'100%'},'content':``}, - - ] - }, - { title: '数据展示', - list: [ - - {"type":"DataPay",'label':'DataPay',gridName:"_random_",h:4, span:24,icon: 'icon-table','color':'#fff', - display: true, 'component':'dync-template',style:{height:'100px',overflow:'hidden'}, - 'content':` - `}, - - {"type":"DataTabs",'label':'DataTabs',gridName:"_random_",h:4, span:24,icon: 'icon-table','color':'#fff', - display: true, 'component':'dync-template',style:{height:'100px'}, - 'content':``}, - - {"type":"DataBox",'label':'DataBox',gridName:"_random_",h:4, span:24,icon: 'icon-table','color':'#fff', - display: true, 'component':'dync-template',style:{height:'100px'}, - 'content':``}, - - {"type":"DataCard",'label':'DataCard',gridName:"_random_",h:4, span:24,icon: 'icon-table','color':'#fff', - display: true, 'component':'dync-template',style:{height:'100px'}, - 'content':``}, - - {"type":"DataCardtext",'label':'DataCardtext',gridName:"_random_",h:4, span:24,icon: 'icon-table','color':'#fff', - display: true, 'component':'dync-template',style:{height:'100px'}, - 'content':``}, - - {"type":"DataDisplay",'label':'DataDisplay',gridName:"_random_",h:4, span:24,icon: 'icon-table','color':'#fff', - display: true, 'component':'dync-template',style:{height:'100px'}, - 'content':``}, - - {"type":"DataIcons",'label':'DataIcons',gridName:"_random_",h:4, span:24,icon: 'icon-table','color':'#fff', - display: true, 'component':'dync-template',style:{height:'100px'}, - 'content':``}, - - {"type":"DataOperatext",'label':'DataOperatext',gridName:"_random_",h:4, span:24,icon: 'icon-table','color':'#fff', - display: true, 'component':'dync-template',style:{height:'100px'}, - 'content':``}, - - {"type":"DataProgress",'label':'DataProgress',gridName:"_random_",h:4, span:24,icon: 'icon-table','color':'#fff', - display: true, 'component':'dync-template',style:{height:'100px',overflow:'hidden'}, - 'content':``}, - - {"type":"DataRotate",'label':'DataRotate',gridName:"_random_",h:4, span:24,icon: 'icon-table','color':'#fff', - display: true, 'component':'dync-template',style:{height:'100px'}, - 'content':``}, - - {"type":"DataImgtext",'label':'DataImgtext',gridName:"_random_",h:4, span:24,icon: 'icon-table','color':'#fff', - display: true, 'component':'dync-template',style:{height:'100px'}, - 'content':``}, - - {"type":"DataPanel",'label':'DataPanel',gridName:"_random_",h:4, span:24,icon: 'icon-table','color':'#fff', - display: true, 'component':'dync-template',style:{height:'100px'}, - 'content':``}, - - ] - }, - { title: '图', - list: [ - default_chart('柱状图','{"type":"bar"}') , - default_chart('极坐标堆叠图', - '{"type": "bar", "coordinateSystem": "polar","stack": "a"}' - ,`{ - //backgroundColor: '#fff', - legend: {}, - tooltip: {}, - "polar": {},"angleAxis":{}, - dataset: { - // 提供一份数据。__valid_data__为自动生成,如果全自定义,就不要使用 - source: __valid_data__ - }, - // 声明一个 X 轴,类目轴(category)。默认情况下,类目轴对应到 dataset 第一列。 - - // 声明一个 Y 轴,数值轴。 - radiusAxis: {type: 'category'}, - // 声明多个 bar 系列,默认情况下,每个系列会自动对应到 dataset 的每一列。 - series:function(){ - let series_type=[] - __valid_data__[0].slice(1).forEach(ele=>{ - series_type.push(__series_type__) - }); return series_type - }() - }` - ) , - default_chart('堆叠图','{"type": "bar", "stack": "one"}') , - default_chart('面积图','{"type":"line","stack":"z","areaStyle": {}}') , - default_chart('line_symbol',`{ - "type": "line", - "smooth": true, - "showAllSymbol": true, - "symbol": "emptyCircle", - "symbolSize": 5 - }`) , - default_chart('线型图','{"type":"line"}') , - default_chart('多饼图','{"type":"pie"}',`{ - //backgroundColor: '#fff', - legend: {}, - tooltip: {}, - - dataset: { - // 提供一份数据。__valid_data__为自动生成,如果全自定义,就不要使用 - source: __valid_data__ - }, - series:function(){ - let series_type=[] - __valid_data__[0].slice(1).forEach(ele=>{ - series_type.push(__series_type__) - }); return series_type - }() - }`) , - default_chart('上饼下线','{"type": "line", "smooth": true, "seriesLayoutBy": "row"}', - `{ - //backgroundColor: '#fff', - legend: {}, - tooltip: { - trigger: 'axis', - showContent: false - }, - xAxis: {type: 'category'}, - yAxis: {gridIndex: 0}, - grid: {top: '55%'}, - dataset: { - // 提供一份数据。__valid_data__为自动生成,如果全自定义,就不要使用 - source: __valid_data__ - }, - series: - function(){ - let series_type=[] - __valid_data__[0].slice(1).forEach(ele=>{ - series_type.push(__series_type__) - }); - series_type=series_type.concat([{ - type: 'pie', - id: 'pie', - radius: '30%', - center: ['50%', '25%'], - label: { - formatter: '{b}: {@2012} ({d}%)' - }, - encode: { - itemName: __valid_data__[0][0], - value: __valid_data__[0][1], - tooltip: __valid_data__[0][1] - } - }]) - return series_type - }() - - } - myChart.on('updateAxisPointer', function (event) { - var xAxisInfo = event.axesInfo[0]; - if (xAxisInfo) { - var dimension = xAxisInfo.value + 1; - myChart.setOption({ - series: { - id: 'pie', - label: { - formatter: '{b}: {@[' + dimension + ']} ({d}%)' - }, - encode: { - value: dimension, - tooltip: dimension - } - } - }); - } - }); - `) , - - default_chart('仪表盘', '{"type": "gauge"}',` - { - //backgroundColor: '#fff', - legend: {selectedMode:'single'},//单选模式 - tooltip: {}, - dataset: { - // 提供一份数据。__valid_data__为自动生成,如果全自定义,就不要使用 - source: __valid_data__ - }, - grid:{left :0,right:0,top:0,bottom:0}, - // 声明一个 X 轴,类目轴(category)。默认情况下,类目轴对应到 dataset 第一列。 - yAxis: {}, - // 声明一个 Y 轴,数值轴。 - xAxis: {type: 'category',"axisLabel": { - "margin": 8, - "interval":0,//解决代码,坐标轴上的刻度是否全显示 - "textStyle": { - "color": "#676767" - }}}, - // 声明多个 bar 系列,默认情况下,每个系列会自动对应到 dataset 的每一列。 - series:function(){ - let series_type=[] - __valid_data__.slice(1).forEach(ele=>{ - series_type.push({"type": "gauge" , - data: [{ - value: ele[1], - name: ele[0] - }] - }) - }); return series_type - }() - } - `), - default_chart('漏斗图', `{"type": "funnel"}`,`{ - //backgroundColor: '#fff', - legend: {}, - tooltip: {}, - dataset: { - // 提供一份数据。__valid_data__为自动生成,如果全自定义,就不要使用 - source: __valid_data__ - }, - grid:{left :30,right:10,top:10,bottom:30}, - // 声明一个 X 轴,类目轴(category)。默认情况下,类目轴对应到 dataset 第一列。 - yAxis: {}, - // 声明一个 Y 轴,数值轴。 - xAxis: {type: 'category' }, - // 声明多个 bar 系列,默认情况下,每个系列会自动对应到 dataset 的每一列。 - series:function(){ - let series_type=[] - __valid_data__[0].slice(1).forEach(ele=>{ - series_type.push(__series_type__) - }); return series_type - }() - }`), - - ] - } ] \ No newline at end of file diff --git a/front/src/views/rpt_design/gridLayoutForm.vue b/front/src/views/rpt_design/gridLayoutForm.vue index 33772af..df78fef 100644 --- a/front/src/views/rpt_design/gridLayoutForm.vue +++ b/front/src/views/rpt_design/gridLayoutForm.vue @@ -1,16 +1,7 @@