From ceb92a8c09e5bb8e2b6642d530beac32cea25f22 Mon Sep 17 00:00:00 2001 From: ezreal Date: Mon, 12 Jun 2023 15:10:37 +0800 Subject: [PATCH] init --- build.xml | 130 +++++++++++ plugin.xml | 32 +++ .../bi/fusion/web/DecisionWebBridge.java | 39 ++++ .../bi/fusion/web/EditReportWebBridge.java | 31 +++ .../web/FrontControllerRegisterProvider.java | 18 ++ .../bi/fusion/web/ShowReportWebBridge.java | 33 +++ .../bi/fusion/web/SubjectWebBridge.java | 37 ++++ .../web/handler/SubjectReportResouce.java | 51 +++++ .../web/handler/bean/ReportItemBean.java | 45 ++++ .../com/fr/plugin/bi/web/css/iconfont.css | 30 +++ .../com/fr/plugin/bi/web/css/iconfont.ttf | Bin 0 -> 1808 bytes .../com/fr/plugin/bi/web/img/fanruanCpt.svg | 1 + .../com/fr/plugin/bi/web/img/fanruanFrm.svg | 1 + .../com/fr/plugin/bi/web/js/bi.subject.js | 191 ++++++++++++++++ .../plugin/bi/web/js/core/front.branch_map.js | 33 +++ .../js/core/front.conf.pack.table.usage.js | 86 ++++++++ .../fr/plugin/bi/web/js/core/front.subject.js | 16 ++ .../front.subject.relationship.map.button.js | 40 ++++ .../front.subject.relationship.pane.header.js | 142 ++++++++++++ .../core/front.subject.relationship.pane.js | 93 ++++++++ .../front.subject.relationship.pane.map.js | 21 ++ .../bi/web/js/core/front.subject.tab.js | 35 +++ .../bi/web/js/core/front.subject.view.js | 117 ++++++++++ .../com/fr/plugin/bi/web/js/decision.index.js | 25 +++ .../com/fr/plugin/bi/web/js/edit.report.js | 3 + .../web/js/report/subject.report.service.js | 32 +++ .../bi/web/js/report/subject.report.tab.js | 203 ++++++++++++++++++ .../web/js/report/subject.report.tab.model.js | 61 ++++++ .../bi/web/js/report/subject.report.view.js | 123 +++++++++++ .../js/report/subject.report.view.model.js | 58 +++++ .../com/fr/plugin/bi/web/js/show.report.js | 3 + .../com/fr/plugin/bi/web/js/utils/bi.front.js | 106 +++++++++ 32 files changed, 1836 insertions(+) create mode 100644 build.xml create mode 100644 plugin.xml create mode 100644 src/main/java/com/fr/plugin/bi/fusion/web/DecisionWebBridge.java create mode 100644 src/main/java/com/fr/plugin/bi/fusion/web/EditReportWebBridge.java create mode 100644 src/main/java/com/fr/plugin/bi/fusion/web/FrontControllerRegisterProvider.java create mode 100644 src/main/java/com/fr/plugin/bi/fusion/web/ShowReportWebBridge.java create mode 100644 src/main/java/com/fr/plugin/bi/fusion/web/SubjectWebBridge.java create mode 100644 src/main/java/com/fr/plugin/bi/fusion/web/handler/SubjectReportResouce.java create mode 100644 src/main/java/com/fr/plugin/bi/fusion/web/handler/bean/ReportItemBean.java create mode 100644 src/main/resources/com/fr/plugin/bi/web/css/iconfont.css create mode 100644 src/main/resources/com/fr/plugin/bi/web/css/iconfont.ttf create mode 100644 src/main/resources/com/fr/plugin/bi/web/img/fanruanCpt.svg create mode 100644 src/main/resources/com/fr/plugin/bi/web/img/fanruanFrm.svg create mode 100644 src/main/resources/com/fr/plugin/bi/web/js/bi.subject.js create mode 100644 src/main/resources/com/fr/plugin/bi/web/js/core/front.branch_map.js create mode 100644 src/main/resources/com/fr/plugin/bi/web/js/core/front.conf.pack.table.usage.js create mode 100644 src/main/resources/com/fr/plugin/bi/web/js/core/front.subject.js create mode 100644 src/main/resources/com/fr/plugin/bi/web/js/core/front.subject.relationship.map.button.js create mode 100644 src/main/resources/com/fr/plugin/bi/web/js/core/front.subject.relationship.pane.header.js create mode 100644 src/main/resources/com/fr/plugin/bi/web/js/core/front.subject.relationship.pane.js create mode 100644 src/main/resources/com/fr/plugin/bi/web/js/core/front.subject.relationship.pane.map.js create mode 100644 src/main/resources/com/fr/plugin/bi/web/js/core/front.subject.tab.js create mode 100644 src/main/resources/com/fr/plugin/bi/web/js/core/front.subject.view.js create mode 100644 src/main/resources/com/fr/plugin/bi/web/js/decision.index.js create mode 100644 src/main/resources/com/fr/plugin/bi/web/js/edit.report.js create mode 100644 src/main/resources/com/fr/plugin/bi/web/js/report/subject.report.service.js create mode 100644 src/main/resources/com/fr/plugin/bi/web/js/report/subject.report.tab.js create mode 100644 src/main/resources/com/fr/plugin/bi/web/js/report/subject.report.tab.model.js create mode 100644 src/main/resources/com/fr/plugin/bi/web/js/report/subject.report.view.js create mode 100644 src/main/resources/com/fr/plugin/bi/web/js/report/subject.report.view.model.js create mode 100644 src/main/resources/com/fr/plugin/bi/web/js/show.report.js create mode 100644 src/main/resources/com/fr/plugin/bi/web/js/utils/bi.front.js diff --git a/build.xml b/build.xml new file mode 100644 index 0000000..d63556f --- /dev/null +++ b/build.xml @@ -0,0 +1,130 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/plugin.xml b/plugin.xml new file mode 100644 index 0000000..9d0171c --- /dev/null +++ b/plugin.xml @@ -0,0 +1,32 @@ + + + com.fr.plugin.BI.fusion.front + + yes + 0.0.5 + 11.0~11.0 + bi + 6.0~6.0 + 2023-01-10 + ezreal + + + ]]> + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/main/java/com/fr/plugin/bi/fusion/web/DecisionWebBridge.java b/src/main/java/com/fr/plugin/bi/fusion/web/DecisionWebBridge.java new file mode 100644 index 0000000..ea3f672 --- /dev/null +++ b/src/main/java/com/fr/plugin/bi/fusion/web/DecisionWebBridge.java @@ -0,0 +1,39 @@ +package com.fr.plugin.bi.fusion.web; + +import com.finebi.foundation.api.web.component.AssembleComponentFactory; +import com.fr.decision.fun.impl.AbstractWebResourceProvider; +import com.fr.decision.webservice.v10.user.UserService; +import com.fr.plugin.transform.FunctionRecorder; +import com.fr.web.struct.Atom; +import com.fr.web.struct.Component; +import com.fr.web.struct.browser.RequestClient; +import com.fr.web.struct.category.ParserType; +import com.fr.web.struct.category.ScriptPath; +import com.fr.web.struct.category.StylePath; + +/** + * @Author ezreal + * @Date 2023/5/8 11:17 + * @Version 10.0 + */ +@FunctionRecorder +public class DecisionWebBridge extends AbstractWebResourceProvider { + @Override + public Atom attach() { + return AssembleComponentFactory.getBusinessConfigureComponent(); + } + + @Override + public Atom client() { + return new Component() { + @Override + public ScriptPath script(RequestClient req) { + return ScriptPath.build("com/fr/plugin/bi/web/js/decision.index.js", ParserType.DYNAMIC); + } + @Override + public StylePath style(RequestClient req) { + return StylePath.build("com/fr/plugin/bi/web/css/iconfont.css",ParserType.DYNAMIC); + } + }; + } +} diff --git a/src/main/java/com/fr/plugin/bi/fusion/web/EditReportWebBridge.java b/src/main/java/com/fr/plugin/bi/fusion/web/EditReportWebBridge.java new file mode 100644 index 0000000..b2c21c7 --- /dev/null +++ b/src/main/java/com/fr/plugin/bi/fusion/web/EditReportWebBridge.java @@ -0,0 +1,31 @@ +package com.fr.plugin.bi.fusion.web; + +import com.finebi.foundation.api.web.component.AssembleComponentFactory; +import com.fr.decision.fun.impl.AbstractWebResourceProvider; +import com.fr.web.struct.Atom; +import com.fr.web.struct.Component; +import com.fr.web.struct.browser.RequestClient; +import com.fr.web.struct.category.ParserType; +import com.fr.web.struct.category.ScriptPath; + +/** + * @Author ezreal + * @Date 2023/5/8 11:12 + * @Version 10.0 + */ +public class EditReportWebBridge extends AbstractWebResourceProvider { + @Override + public Atom attach() { + return AssembleComponentFactory.getReportComponent(); + } + + @Override + public Atom client() { + return new Component() { + @Override + public ScriptPath script(RequestClient req) { + return ScriptPath.build("com/fr/plugin/bi/web/js/edit.report.js", ParserType.DYNAMIC); + } + }; + } +} diff --git a/src/main/java/com/fr/plugin/bi/fusion/web/FrontControllerRegisterProvider.java b/src/main/java/com/fr/plugin/bi/fusion/web/FrontControllerRegisterProvider.java new file mode 100644 index 0000000..fbfefa7 --- /dev/null +++ b/src/main/java/com/fr/plugin/bi/fusion/web/FrontControllerRegisterProvider.java @@ -0,0 +1,18 @@ +package com.fr.plugin.bi.fusion.web; + +import com.fr.decision.fun.impl.AbstractControllerRegisterProvider; +import com.fr.plugin.bi.fusion.web.handler.SubjectReportResouce; + +/** + * @Author ezreal + * @Date 2023/5/22 21:28 + * @Version 10.0 + */ +public class FrontControllerRegisterProvider extends AbstractControllerRegisterProvider { + @Override + public Class[] getControllers() { + return new Class[]{ + SubjectReportResouce.class + }; + } +} diff --git a/src/main/java/com/fr/plugin/bi/fusion/web/ShowReportWebBridge.java b/src/main/java/com/fr/plugin/bi/fusion/web/ShowReportWebBridge.java new file mode 100644 index 0000000..d58cdf9 --- /dev/null +++ b/src/main/java/com/fr/plugin/bi/fusion/web/ShowReportWebBridge.java @@ -0,0 +1,33 @@ +package com.fr.plugin.bi.fusion.web; + +import com.finebi.foundation.api.web.component.AssembleComponentFactory; +import com.fr.decision.fun.impl.AbstractWebResourceProvider; +import com.fr.web.struct.Atom; +import com.fr.web.struct.Component; +import com.fr.web.struct.Filter; +import com.fr.web.struct.browser.RequestClient; +import com.fr.web.struct.category.ParserType; +import com.fr.web.struct.category.ScriptPath; +import com.fr.web.struct.category.StylePath; + +/** + * @Author ezreal + * @Date 2023/5/8 11:05 + * @Version 10.0 + */ +public class ShowReportWebBridge extends AbstractWebResourceProvider { + @Override + public Atom attach() { + return AssembleComponentFactory.getShowComponent(); + } + + @Override + public Atom client() { + return new Component() { + @Override + public ScriptPath script(RequestClient req) { + return ScriptPath.build("com/fr/plugin/bi/web/js/show.report.js", ParserType.DYNAMIC); + } + }; + } +} diff --git a/src/main/java/com/fr/plugin/bi/fusion/web/SubjectWebBridge.java b/src/main/java/com/fr/plugin/bi/fusion/web/SubjectWebBridge.java new file mode 100644 index 0000000..80c9873 --- /dev/null +++ b/src/main/java/com/fr/plugin/bi/fusion/web/SubjectWebBridge.java @@ -0,0 +1,37 @@ +package com.fr.plugin.bi.fusion.web; + +import com.finebi.foundation.api.web.component.AssembleComponentFactory; +import com.fr.decision.fun.impl.AbstractWebResourceProvider; +import com.fr.web.struct.Atom; +import com.fr.web.struct.Component; +import com.fr.web.struct.browser.RequestClient; +import com.fr.web.struct.category.ParserType; +import com.fr.web.struct.category.ScriptPath; +import com.fr.web.struct.category.StylePath; + +/** + * @Author ezreal + * @Date 2023/5/8 11:15 + * @Version 10.0 + */ +public class SubjectWebBridge extends AbstractWebResourceProvider { + @Override + public Atom attach() { + return AssembleComponentFactory.getSubjectComponent(); + } + + @Override + public Atom client() { + return new Component() { + @Override + public ScriptPath script(RequestClient req) { + return ScriptPath.build("com/fr/plugin/bi/web/js/bi.subject.js", ParserType.DYNAMIC); + } + + @Override + public StylePath style(RequestClient req) { + return StylePath.build("com/fr/plugin/bi/web/css/iconfont.css",ParserType.DYNAMIC); + } + }; + } +} diff --git a/src/main/java/com/fr/plugin/bi/fusion/web/handler/SubjectReportResouce.java b/src/main/java/com/fr/plugin/bi/fusion/web/handler/SubjectReportResouce.java new file mode 100644 index 0000000..6b271f1 --- /dev/null +++ b/src/main/java/com/fr/plugin/bi/fusion/web/handler/SubjectReportResouce.java @@ -0,0 +1,51 @@ +package com.fr.plugin.bi.fusion.web.handler; + +import com.fr.decision.webservice.Response; +import com.fr.decision.webservice.annotation.LoginStatusChecker; +import com.fr.decision.webservice.v10.login.TokenResource; +import com.fr.io.repository.FineFileEntry; +import com.fr.io.utils.ResourceIOUtils; +import com.fr.plugin.bi.fusion.web.handler.bean.ReportItemBean; +import com.fr.third.springframework.stereotype.Controller; +import com.fr.third.springframework.web.bind.annotation.RequestMapping; +import com.fr.third.springframework.web.bind.annotation.RequestMethod; +import com.fr.third.springframework.web.bind.annotation.RequestParam; +import com.fr.third.springframework.web.bind.annotation.ResponseBody; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.util.ArrayList; +import java.util.List; + +/** + * @Author ezreal + * @Date 2023/5/22 21:29 + * @Version 10.0 + */ + +@Controller +@LoginStatusChecker(required = true, + tokenResource = TokenResource.COOKIE +) +@RequestMapping("/front/subject") +public class SubjectReportResouce { + @RequestMapping(value = "/report", + method = {RequestMethod.GET}) + @ResponseBody + public Response getSubjectCpt(HttpServletRequest req, HttpServletResponse res, @RequestParam(value = "subjectid") String subjectid) throws Exception { + List itemBeans = new ArrayList<>(); + FineFileEntry[] fineFileEntries = ResourceIOUtils.listEntry("/reportlets/" + subjectid); + for (FineFileEntry fineFileEntry : fineFileEntries) { + if (fineFileEntry.isDirectory()) { + continue; + } + String name = fineFileEntry.getName(); + if (name.endsWith(".cpt")) { + itemBeans.add(new ReportItemBean(name, name.substring(0, name.lastIndexOf(".")), "cpt")); + } else if (name.endsWith(".frm")) { + itemBeans.add(new ReportItemBean(name, name.substring(0, name.lastIndexOf(".")), "frm")); + } + } + return Response.ok(itemBeans); + } +} diff --git a/src/main/java/com/fr/plugin/bi/fusion/web/handler/bean/ReportItemBean.java b/src/main/java/com/fr/plugin/bi/fusion/web/handler/bean/ReportItemBean.java new file mode 100644 index 0000000..fb4fece --- /dev/null +++ b/src/main/java/com/fr/plugin/bi/fusion/web/handler/bean/ReportItemBean.java @@ -0,0 +1,45 @@ +package com.fr.plugin.bi.fusion.web.handler.bean; + +/** + * @Author ezreal + * @Date 2023/6/1 13:57 + * @Version 10.0 + */ +public class ReportItemBean { + public ReportItemBean() { + } + + private String id; + private String name; + private String type; + + public ReportItemBean(String id, String name, String type) { + this.id = id; + this.name = name; + this.type = type; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } +} diff --git a/src/main/resources/com/fr/plugin/bi/web/css/iconfont.css b/src/main/resources/com/fr/plugin/bi/web/css/iconfont.css new file mode 100644 index 0000000..0a6636d --- /dev/null +++ b/src/main/resources/com/fr/plugin/bi/web/css/iconfont.css @@ -0,0 +1,30 @@ +@font-face { + font-family: "iconfontBIFront"; /* Project id */ + src: url("${fineServletURL}/resources?path=/com/fr/plugin/bi/web/css/iconfont.ttf") format('truetype'); +} + +.iconfontBIFront { + font-family: "iconfontBIFront" !important; + font-size: 16px; + font-style: normal; + text-align: center; + color: red; + -webkit-font-smoothing: antialiased; + -moz-osx-font-smoothing: grayscale; +} + +.icon-fanruan-cpt:before { + content: "\e642"; +} + +.fanruan-cpt-logo { + background: url("${fineServletURL}/resources?path=/com/fr/plugin/bi/web/img/fanruanCpt.svg") no-repeat 50%;; + background-size: contain; + display: block +} +.fanruan-frm-logo { + background: url("${fineServletURL}/resources?path=/com/fr/plugin/bi/web/img/fanruanFrm.svg") no-repeat 50%;; + background-size: contain; + display: block +} + diff --git a/src/main/resources/com/fr/plugin/bi/web/css/iconfont.ttf b/src/main/resources/com/fr/plugin/bi/web/css/iconfont.ttf new file mode 100644 index 0000000000000000000000000000000000000000..c39c85f613fc2214cf32d17151d622e665fba0ad GIT binary patch literal 1808 zcmd^9&u<$=7=5$5u|rJTILX>hiqlP8%#Rc&apSm3lL{qmq9O!Q8d3>Wl#RW%6Z}i- zP1V39QhKRCD&oME11D}=TB)M^5LHDL6)qgOq*akna)2XTKyG-uI|h;VKVU{P^S(Fl z`{tW(?STLg!Uj}~%$<8<+IaujcL8yN?BeU^hSQVh&vw!NfcD$Dido-Xy-}zAJ4d}( zUN3z7!p=27Ez@otxabD;5YWL6?0L3-QU^wG z3d-r(R~K=xY&uo+Nxi@C`}$avSBfU%ON%;pSCA11NLJGzK13T2zN*|Kcg!9plQ|lGiZk zX_y+YGrh?cLP(8I^mk+_HihJ@Y|NIaK5DKcZ+$xxaJ2ZC-Fgkxcsq4W6hfpkO< z_jo%ho%Jwdof4Vw!1amv5h29$Bj!M_c39tvL`6)$t@myz$}K(i?N&_h?t3K>7s^~$ z^iH3y$Hevi`04DM!9#!2jGP^cMIS9>kHmlO4hnNV^KxfE=zWiVh(^BGqhH1J6JPe~ zH|UfR+JRJZs#%QbqvEQi_uh-?@&4u~R`#Wk5Xz?B*Zf6kPxNGyO5Uqb7aqvE0Nwx8 z$o)5TOI|?`hb30Y4@#^NzbJ7VU#_&o0rFE4cVGx-Bn~lR-ThT-Pw|{2HYFD5#AgyK zIEb4PtK`3vSR?*P;x4w$>%fZmiU*#%OA!Ma@}N%Wj2fTq>p=r(hK9TE&=UJgZ!;8Fjn1YUP|%$#Lov z!^7@5E}zQPDwu%{3nm=Sc^Fv6I_DMSP(u|3Z+0HD7pN{`4P|=TkL~XFUZUDYgE}{+ z!RI)|=WxGjj;gAs+@DPYmv~y5IXcY9;IJ8~LNqJ$vzSSl*x(0r_f{DvM|BD%&#R6J j470cH)6%EBdsf^B({Jv({iLP{MW_fC%&NU+Rz1bvP}= \ No newline at end of file diff --git a/src/main/resources/com/fr/plugin/bi/web/img/fanruanFrm.svg b/src/main/resources/com/fr/plugin/bi/web/img/fanruanFrm.svg new file mode 100644 index 0000000..e2a6da1 --- /dev/null +++ b/src/main/resources/com/fr/plugin/bi/web/img/fanruanFrm.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/main/resources/com/fr/plugin/bi/web/js/bi.subject.js b/src/main/resources/com/fr/plugin/bi/web/js/bi.subject.js new file mode 100644 index 0000000..972c404 --- /dev/null +++ b/src/main/resources/com/fr/plugin/bi/web/js/bi.subject.js @@ -0,0 +1,191 @@ +;!(function () { + BI.Front = BI.Front || {}; + BI.Front = BI.extend(BI.Front, { + SUPPORT_REPORT: [ + { + typeValue: 101, + type: "cpt", + name: "cpt", + suffix: ".cpt", + iconCls: "fanruan-cpt-logo", + text: "CPT报表", + showPage: function (id) { + const {params} = BI.Router.$router.history.current; + BI.Router.$router.push({ + name: "finereport_cpt", + params: Object.assign(Object.assign({}, params), {id: id}) + }); + }, + route: + { + edit: { + name: "finereport_cpt", + // path: "/:subjectId/cpt/:id", + path: "cpt/:id", + // path: "/:cpt", + // parent: parentRoute, + children: [], + components: { + analysis: { + type: "bi.subject.view.extend.report", + reportType: "cpt" + } + }, + beforeEnter: (to, _from, next) => { + next(); + }, + }, + view: { + name: "finereport_cpt", + path: "cpt/:id", + // path: "/:cpt", + // parent: parentRoute, + children: [], + components: { + analysis: { + type: "bi.subject.view.extend.report", + reportType: "cpt" + } + } + } + }, + addAction: function () { + BI.Msg.prompt("新增cpt报表", "输入名称", function (value) { + if (BI.isNotNull(value)) { + BI.Front.subject_view.store.addExtendReport(value, 101); + } else { + BI.Msg.toast("名称为空", {level: "error"}); + } + }) + }, + paneType: { + tab: "bi.subject.tab.extend.report.item", + } + }, + { + type: "frm", + typeValue: 102, + name: "frm", + suffix: ".frm", + iconCls: "fanruan-frm-logo", + text: "决策报表", + showPage: function (id) { + const {params} = BI.Router.$router.history.current; + BI.Router.$router.push({ + name: "finereport_frm", + params: Object.assign(Object.assign({}, params), {id: id}) + + }); + }, + addAction: function () { + BI.Msg.prompt("新增决策报表", "输入名称", function (value) { + if (BI.isNotNull(value)) { + BI.Front.subject_view.store.addExtendReport(value, 102); + } else { + BI.Msg.toast("名称为空", {level: "error"}); + } + }) + }, + route: { + edit: { + name: "finereport_frm", + // path: "/:subjectId/frm/:id", + path: "frm/:id", + // path: "/:cpt", + // parent: parentRoute, + children: [], + components: { + analysis: { + type: "bi.subject.view.extend.report", + reportType: "frm" + } + }, + beforeEnter: (to, _from, next) => { + next(); + } + }, + view: { + name: "finereport_frm", + path: "frm/:id", + // path: "/:cpt", + // parent: parentRoute, + children: [], + components: { + analysis: { + type: "bi.subject.view.extend.report", + reportType: "frm" + } + } + } + }, + paneType: { + tab: "bi.subject.tab.extend.report.item", + } + } + ], + showReportPage: function (reportId, reportType) { + var find = BI.find(BI.Front.SUPPORT_REPORT, function (index, o) { + return o.type === reportType || o.typeValue === reportType; + }) + if (find) { + find.showPage(reportId); + } + } + }); + /** + * 处理路径会被编码问题,cpt就不编码了 + * @type {BI.Utils.multiUpdateDashboardShareAuthorityQueue} + */ + BI.Utils.oldMultiUpdateDashboardShareAuthorityQueue = BI.Utils.multiUpdateDashboardShareAuthorityQueue; + BI.Utils.multiUpdateDashboardShareAuthorityQueue = function (e, t, i) { + function filter(path) { + var x = BI.find(BI.Front.SUPPORT_REPORT, function (index, item) { + return path.endWith(item.suffix); + }); + return x ? true : false; + } + + if (BI.isKey(e) && filter(e)) { + Dec.reqPut("/v10/dashboard/share?entityId=" + e, t, i) + } else { + BI.Utils.oldMultiUpdateDashboardShareAuthorityQueue(e, t, i); + } + } + /** + * 公共链接更新问题,调用的产品方案,这个时候的id和创建id不一样,兼容一下 + * @type {BI.Utils.updatePublicLink} + */ + BI.Utils.oldUpdatePublicLink = BI.Utils.updatePublicLink; + BI.Utils.updatePublicLink = function (e, t, i, n) { + t.reportId = t.reportId.replaceAll("_@_", "/"); + BI.Utils.oldUpdatePublicLink(e, t, i, n); + } + + function importResource(path, type) { + var url = Dec.fineServletURL + "/file?path=" + path; + BI.$import(url, type); + } + + importResource("com/fr/plugin/bi/web/js/utils/bi.front.js", "js"); + importResource("com/fr/plugin/bi/web/js/report/subject.report.tab.js", "js"); + importResource("com/fr/plugin/bi/web/js/report/subject.report.view.js", "js"); + importResource("com/fr/plugin/bi/web/js/report/subject.report.view.model.js", "js"); + importResource("com/fr/plugin/bi/web/js/report/subject.report.service.js", "js"); + importResource("com/fr/plugin/bi/web/js/report/subject.report.tab.model.js", "js"); + importResource("com/fr/plugin/bi/web/js/core/front.subject.js", "js"); + importResource("com/fr/plugin/bi/web/js/core/front.subject.tab.js", "js"); + importResource("com/fr/plugin/bi/web/js/core/front.subject.view.js", "js"); + importResource("com/fr/plugin/bi/web/js/core/front.subject.relationship.pane.js", "js"); + importResource("com/fr/plugin/bi/web/js/core/front.subject.relationship.pane.map.js", "js"); + importResource("com/fr/plugin/bi/web/js/core/front.subject.relationship.map.button.js", "js"); + importResource("com/fr/plugin/bi/web/js/core/front.subject.relationship.pane.header.js", "js"); + importResource("com/fr/plugin/bi/web/js/core/front.conf.pack.table.usage.js","js"); + importResource("com/fr/plugin/bi/web/js/core/front.branch_map.js","js"); + + + //ezreal:协助开发的,后续删 + BI.Plugin.config(function (type, options) { + }, function (type, object) { + object.element.attr("shortcut", object.options.type); + }); +})(); \ No newline at end of file diff --git a/src/main/resources/com/fr/plugin/bi/web/js/core/front.branch_map.js b/src/main/resources/com/fr/plugin/bi/web/js/core/front.branch_map.js new file mode 100644 index 0000000..f1ebb6e --- /dev/null +++ b/src/main/resources/com/fr/plugin/bi/web/js/core/front.branch_map.js @@ -0,0 +1,33 @@ +;!(function () { + BI.Plugin.registerWidget("bi.branch_map", function (widget) { + if (BI.isFunction(widget.contentGetter)) { + var oldcontentGetter = widget.contentGetter; + widget.contentGetter = function (ob) { + var result = oldcontentGetter.apply(this, arguments); + var itemType = ob.itemType; + var find = BI.find(BI.Front.SUPPORT_REPORT, function (index, item) { + return itemType === item.typeValue; + }); + if (find && result.listeners) { + var jumpAction = BI.find(result.listeners, function (i, o) { + return o.eventName === "EVENT_JUMP" + }); + if (jumpAction) { + jumpAction.action = function () { + //ezreal:当前路由的方式判断下是怎么打开吧。 + var currentRoute = BI.Router.$router.currentRoute; + if (currentRoute && currentRoute.name == "subject_table") { + BI.Front.showReportPage(ob.value.id, find.type) + } else { + var url = Dec.fineServletURL + "/v5/conf/subject/page/edit/" + ob.value.parentId + "/" + find.type + "/" + ob.value.id; + window.open(url); + } + } + } + } + return result; + } + } + return widget; + }) +})(); \ No newline at end of file diff --git a/src/main/resources/com/fr/plugin/bi/web/js/core/front.conf.pack.table.usage.js b/src/main/resources/com/fr/plugin/bi/web/js/core/front.conf.pack.table.usage.js new file mode 100644 index 0000000..e86f12c --- /dev/null +++ b/src/main/resources/com/fr/plugin/bi/web/js/core/front.conf.pack.table.usage.js @@ -0,0 +1,86 @@ +;!(function () { + BI.Plugin.registerWidget("bi.conf.pack.table.usage", function (widget) { + widget.beforeInit = function (callback) { + var self = this; + self.store.cptMap = {}; + self.store.frmMap = {}; + /** + * 初始化一些数据的 + * @type {self.store.buildItemMap} + */ + self.store.oldBuildItemMap = self.store.buildItemMap; + self.store.buildItemMap = function (usageInfo) { + self.store.oldBuildItemMap(usageInfo); + BI.each(usageInfo.cptMap, (key, value) => { + self.store.cptMap[key] = value; + }); + BI.each(usageInfo.frmMap, (key, value) => { + self.store.frmMap[key] = value; + }); + } + /** + * 创建节点 + * @type {function(*=, *=, *=): (*|null)} + */ + self.store.oldGetNodeByItem = self.store.getNodeByItem; + self.store.getNodeByItem = function (pId, item, direction) { + var find = BI.find(BI.Front.SUPPORT_REPORT, function (index, o) { + return item.type === o.typeValue; + }) + if (find) { + var info = { + isParent: item.knots > 0, + count: item.knots, + childrenItems: item.usageItemBeans, + direction, + }; + var reportMap = {}; + if (find.typeValue === 101) { + reportMap = self.store.cptMap + } else if (find.typeValue === 102) { + reportMap = self.store.frmMap + } + if (reportMap[item.id]) { + return BI.extend(self.store.createExtendReportNode(pId, reportMap[item.id], find.typeValue), info) + } + return null; + } + return self.store.oldGetNodeByItem(pId, item, direction); + } + self.store.createExtendReportNode = function (pId, report, itemType) { + return { + text: report.name, + title: function () { + return report.name + }, + value: Object.assign(Object.assign({}, report), {moduleType: 2}), + id: BI.UUID(), + pId: pId, + itemType: itemType, + } + } + /** + * 图标 + * @type {function(*=): (*)} + */ + self.oldGetIconCls = self.getIconCls; + self.getIconCls = function (ob) { + var find = BI.find(BI.Front.SUPPORT_REPORT, function (index, o) { + return ob.itemType === o.typeValue; + }); + if (find) { + return find.iconCls; + } + return self.oldGetIconCls(ob) + } + + + BI.isFunction(callback) && callback(); + + }; + return widget; + }); + BI.Plugin.configRender("bi.conf.pack.table.usage", function (renderObject) { + return renderObject; + }) +})(); \ No newline at end of file diff --git a/src/main/resources/com/fr/plugin/bi/web/js/core/front.subject.js b/src/main/resources/com/fr/plugin/bi/web/js/core/front.subject.js new file mode 100644 index 0000000..d9c88b5 --- /dev/null +++ b/src/main/resources/com/fr/plugin/bi/web/js/core/front.subject.js @@ -0,0 +1,16 @@ +/** + * bi.subject的魔改 + */ +;!(function () { + /** + * 新增路由,可以切换在当前的组件 + * important + */ + BI.Plugin.configRender("bi.subject", function (renderObject) { + var childrenItems = ((renderObject.routes)[0]).children; + BI.each(BI.Front.SUPPORT_REPORT,function (index,item){ + childrenItems.push(item.route.edit); + }) + return renderObject; + }); +})(); \ No newline at end of file diff --git a/src/main/resources/com/fr/plugin/bi/web/js/core/front.subject.relationship.map.button.js b/src/main/resources/com/fr/plugin/bi/web/js/core/front.subject.relationship.map.button.js new file mode 100644 index 0000000..7e14926 --- /dev/null +++ b/src/main/resources/com/fr/plugin/bi/web/js/core/front.subject.relationship.map.button.js @@ -0,0 +1,40 @@ +;!(function () { + BI.Plugin.registerWidget("bi.subject.relationship.map.button", function (widget) { + widget.beforeCreate = function () { + var self = this; + /** + * 修改图标 + * @type {function(): (*)} + */ + self.oldGetIconCls = self.getIconCls; + self.getIconCls = function () { + const {itemType, nodeInfo} = this.options; + var find = BI.find(BI.Front.SUPPORT_REPORT, function (index, item) { + return itemType === item.typeValue; + }) + if (find) { + return find.iconCls; + } + return self.oldGetIconCls(); + } + /** + * 修改title + * @type {function(*=, *=): (*)} + */ + self.store.oldGetTitle = self.store.getTitle; + self.store.getTitle = function (itemType, nodeInfo) { + var find = BI.find(BI.Front.SUPPORT_REPORT, function (index, item) { + return itemType === item.typeValue; + }) + if (find) { + var result = []; + result.push("报表名称:" + nodeInfo.name); + result.push("创建用户:" + nodeInfo.createBy); + return result.join('\n'); + } + return self.store.oldGetTitle(itemType, nodeInfo); + + } + } + }) +})(); \ No newline at end of file diff --git a/src/main/resources/com/fr/plugin/bi/web/js/core/front.subject.relationship.pane.header.js b/src/main/resources/com/fr/plugin/bi/web/js/core/front.subject.relationship.pane.header.js new file mode 100644 index 0000000..4af4bc9 --- /dev/null +++ b/src/main/resources/com/fr/plugin/bi/web/js/core/front.subject.relationship.pane.header.js @@ -0,0 +1,142 @@ +;!(function () { + BI.Front = BI.Front || {}; + BI.Front = BI.extend(BI.Front, { + relation_pane_header: { + widget: null + } + }) + BI.Plugin.registerWidget("bi.subject.relationship.pane.header", function (widget) { + widget.beforeCreate = function () { + BI.Front.relation_pane_header.widget = this; + var self = this; + /** + * 搜索结果 + * @type {function(*=, *=): *} + */ + self.store.oldBuildSearchResult = self.store.buildSearchResult; + self.store.buildSearchResult = function (keywords, originData) { + BI.Front.relation_pane.widget.store._computedWatchers.shownList.value = BI.Front.relation_pane.widget.store._computedWatchers.shownList.getter.call(BI.Front.relation_pane.widget.store); + originData = self.model.shownList; + var result = self.store.oldBuildSearchResult(keywords, originData); + BI.each(BI.Front.SUPPORT_REPORT, function (index, item) { + var x = originData[item.type] && BI.Func.getSearchResult(Object.values(originData[item.type]), keywords, 'name'); + result[item.type] = x || {}; + }) + return result; + } + /** + * 处理搜索结果 + */ + self.oldCreatItems = self.creatItems; + self.creatItems = function (source) { + var result = self.oldCreatItems(source); + BI.each(BI.Front.SUPPORT_REPORT, function (index, item) { + var x = source[item.type]; + result = BI.concat(result, self.creatCptOrFrmItems(x, item)); + }) + return result; + } + self.creatCptOrFrmItems = function (items, o) { + var finds = items.find || []; + var match = items.match || []; + finds = BI.concat(finds, match); + if (finds.length > 0) { + var label = { + type: "bi.label", + cls: 'bi-secondary-text bi-font-bold', + height: 30, + id: BI.UUID(), + key: BI.UUID(), + text: o.text, + textAlign: 'left', + lgap: 12 + } + var x = BI.map(finds, function (index, item) { + return { + type: "bi.basic_button", + cls: 'bi-list-item-text', + forceNotSelected: true, + id: BI.UUID(), + key: BI.UUID(), + render: function () { + return { + type: "bi.vertical_adapt", + columnSize: [24, 'fill'], + items: [ + { + type: "bi.icon_label", + cls: o.iconCls, + height: 16, + iconWidth: 16, + iconHeight: 16, + _lgap: 8 + }, + { + type: "bi.label", + cls: 'item-name', + text: item.name, + keyword: self.model.keywords, + height: 30, + textHeight: 30, + textAlign: 'left' + } + ] + } + + }, + handler: function () { + self.fireEvent("EVENT_CHANGE", item.id, o.typeValue); + self.combo.hideView(); + } + } + }); + x.unshift(label); + return x; + } + return []; + } + + } + }) + BI.Plugin.configRender("bi.subject.relationship.pane.header", function (renderObject) { + var self = renderObject; + + function findObject(value) { + if (BI.isNotEmptyArray(value)) { + BI.each(value, function (index, item) { + if (BI.isObject(item) && item.value === "table" && item.text === BI.i18nText('BI-Basic_Data')) { + self.result = value; + return false; + } + findObject(item); + }) + } else if (BI.isObject(value)) { + BI.each(value, function (k, v) { + findObject(v); + }) + } + } + + self.result = []; + findObject(renderObject,); + if (BI.isNotEmptyArray(self.result)) { + BI.each(BI.Front.SUPPORT_REPORT, function (index, item) { + self.result.push({ + type: "bi.multi_select_item", + value: item.type, + text: item.text, + handler: function () { + BI.Front.relation_pane_header.widget.fireEvent("EVENT_FILTER", item.type, this.isSelected()); + BI.Front.relation_pane.widget.store.setLayout(true);//传递一个参数,刷新的时候需要单独处理下 + BI.Front.relation_pane.widget.map.populate(); + }, + selected: function () { + return (BI.Front.relation_pane_header.widget.model.shownTypeMap)[item.type] + } + }) + }) + } + + return renderObject; + }) +})(); \ No newline at end of file diff --git a/src/main/resources/com/fr/plugin/bi/web/js/core/front.subject.relationship.pane.js b/src/main/resources/com/fr/plugin/bi/web/js/core/front.subject.relationship.pane.js new file mode 100644 index 0000000..2d3e299 --- /dev/null +++ b/src/main/resources/com/fr/plugin/bi/web/js/core/front.subject.relationship.pane.js @@ -0,0 +1,93 @@ +/** + * 对bi.subject.relationship.pane魔改 + */ +;!(function () { + BI.Front = BI.Front || {}; + BI.Front = BI.extend(BI.Front, { + relation_pane: { + widget: null + } + }); + BI.Plugin.registerWidget("bi.subject.relationship.pane", function (widget) { + widget.beforeCreate = function () { + var self = this; + BI.Front.relation_pane.widget = self; + BI.each(BI.Front.SUPPORT_REPORT, function (index, item) { + (self.model.shownTypeMap)[item.type] = true; + }) + self.store.oldSetLayout = self.store.setLayout; + self.store.setLayout = function (v) { + if (v) { + self.store._computedWatchers.shownIdsMap.value = self.store._computedWatchers.shownIdsMap.getter.call(self.store); + } + self.store.oldSetLayout(); + } + } + + }) + + BI.Plugin.registerObject("bi.subject.relationship.pane", function (object) { + var self = object; + object.populate = function () { + self.loading(); + return self.store.initData().then(function () { + BI.each(BI.Front.SUPPORT_REPORT, function (index, item) { + var reportInfo = {}; + var reportType = item.type; + var reportItems = []; + if (reportType === "cpt") { + reportItems = self.model.subjectInfo.cptItems.availableReports + } else if (reportType === "frm") { + reportItems = self.model.subjectInfo.frmItems.availableReports + } else { + return + } + BI.each(reportItems, function (i, o) { + reportInfo[o.id] = BI.extend({ + available:true + },o); + var find = BI.find(self.model.itemBeans, function (a, b) { + return b.id === o.id; + }) + if (!find) {//甘老师后台接口没有返回无血缘的数据,所以找不到就也要装进去,父节点为空 + self.model.itemBeans.push({ + id: o.id, + type: item.typeValue, + fatherItemIds: [] + }) + } + }); + (self.model.resourceMap)[reportType] = reportInfo; + }); + self.store._computedWatchers.shownIdsMap.value = self.store._computedWatchers.shownIdsMap.getter.call(self.store); + self.store._computedWatchers.shownList.value = self.store._computedWatchers.shownList.getter.call(self.store); + self.store._computedWatchers.shownEdges.value = self.store._computedWatchers.shownEdges.getter.call(self.store); + self.store.setLayout(); + }).then(function () { + self.loaded(); + if (BI.isNotEmptyArray(self.model.relationMapLayout)) { + self.map.initMap(); + } + }); + + } + + /** + * 血缘关系视图 点击切换tab的方法 + * @type {object.store.showSelect} + */ + self.store.oldShowSelect = self.store.showSelect; + self.store.showSelect = function (id, type) { + var find = BI.find(BI.Front.SUPPORT_REPORT, function (index, item) { + return item.typeValue === type; + }); + if (find) { + BI.isFunction(find.showPage) && find.showPage(id); + return; + } + self.store.oldShowSelect(id, type); + } + return object; + }) + +})(); \ No newline at end of file diff --git a/src/main/resources/com/fr/plugin/bi/web/js/core/front.subject.relationship.pane.map.js b/src/main/resources/com/fr/plugin/bi/web/js/core/front.subject.relationship.pane.map.js new file mode 100644 index 0000000..4090982 --- /dev/null +++ b/src/main/resources/com/fr/plugin/bi/web/js/core/front.subject.relationship.pane.map.js @@ -0,0 +1,21 @@ +;!(function () { + + BI.Plugin.registerObject("bi.subject.relationship.pane.map", function (object) { + var self = object; + + self.oldGetSourceType = self.getSourceType; + self.getSourceType = function (id) { + var find = BI.find(BI.Front.SUPPORT_REPORT, function (index, item) { + var x = (self.model.resourceMap)[item.type]; + if (x && x[id]) { + return true; + } + return false; + }) + if (find) { + return find.typeValue; + } + return self.oldGetSourceType(id); + } + }) +})(); \ No newline at end of file diff --git a/src/main/resources/com/fr/plugin/bi/web/js/core/front.subject.tab.js b/src/main/resources/com/fr/plugin/bi/web/js/core/front.subject.tab.js new file mode 100644 index 0000000..baa5dba --- /dev/null +++ b/src/main/resources/com/fr/plugin/bi/web/js/core/front.subject.tab.js @@ -0,0 +1,35 @@ +/** + * 对bi.subject.tab的魔改 + */ +;!(function () { + + /** + * 新增下面tab栏的图标 + * important + */ + BI.Plugin.configRender("bi.subject.tab", function (renderObj) { + /** + * 可以修改render方法返回的json对象 + * important + */ + var items = ((((renderObj.items)[1]).items)[2]).items; + /*var x = BI.deepClone(items[1]); + x.title = "新增复杂报表";*/ + BI.each(BI.Front.SUPPORT_REPORT, function (index, item) { + items.push({ + type: "bi.icon_button", + cls: item.iconCls, + forceNotSelected: true, + height: 16, + iconHeight: 16, + iconWidth: 16, + title: "新增"+item.text, + width: 32, + handler: function () { + BI.isFunction(item.addAction) && item.addAction(); + } + }) + }) + return renderObj; + }); +})(); \ No newline at end of file diff --git a/src/main/resources/com/fr/plugin/bi/web/js/core/front.subject.view.js b/src/main/resources/com/fr/plugin/bi/web/js/core/front.subject.view.js new file mode 100644 index 0000000..89dee46 --- /dev/null +++ b/src/main/resources/com/fr/plugin/bi/web/js/core/front.subject.view.js @@ -0,0 +1,117 @@ +/** + * 对bi.subject.view组件的一些魔改 + */ +;!(function () { + BI.Front = BI.Front || {}; + BI.Front = BI.extend(BI.Front, { + subject_view: { + store: null, + model: null, + } + }); + BI.Plugin.registerWidget("bi.subject.view", function (widget) { + widget.beforeCreate = function () { + var self = this; + var service = BI.Services.getService("subject.report.service"); + BI.Front.subject_view.store = self.store; + BI.Front.subject_view.model = self.model; + self.store.getExtendReportItem = function (item, type) { + var find = BI.find(BI.Front.SUPPORT_REPORT, function (index, o) { + return o.type === type || o.typeValue === type; + }) + if (find) { + return { + type: find.paneType.tab, + id: item.id, + name: item.name, + report: item, + reportType: find.type, + iconCls: find.iconCls, + onSelect: function () { + BI.Front.showReportPage(item.id, find.type) + }, + listeners: [ + { + eventName: "DELETE", + action: function (id) { + self.store.deleteExtendReport(id); + } + } + ], + editable: self.options.subjectEntryType == 0 + } + } + return { + type: "bi.label", + text: item.name + } + } + self.store.addExtendReport = function (name, typeValue) { + service.subjectAddReport(BI.Router.$router.history.current.params.subjectId, { + name: name, + type: typeValue + }, function (res) { + if (res.data) { + const order = self.model.customOrder.slice(); + order.push(res.data.id); + self.store.sortLabels(order).then(function () { + self.store.refreshTab().then(function () { + BI.Front.showReportPage(res.data.id, typeValue); + }) + }); + } + }) + } + self.store.deleteExtendReport = function (id) { + service.deleteSubjectReport(self.model.subjectInfo.id, id, function () { + self.store.refreshTab(id); + + }) + } + /** + * 初始化 + */ + BI.each(self.model.subjectInfo.cptItems.availableReports, function (index, o) { + self.model.labels.push(self.store.getExtendReportItem(o, "cpt")); + }); + BI.each(self.model.subjectInfo.frmItems.availableReports, function (index, o) { + self.model.labels.push(self.store.getExtendReportItem(o, "frm")); + }); + const order = self.model.customOrder; + if (BI.isEmptyArray(order)) { + self.model.sortLabels = self.model.labels; + } else { + self.model.sortLabels = self.model.labels.sort(function (a, b) { + return order.indexOf(a.id) - order.indexOf(b.id); + }) + } + BI.Front.utils.injectionFunc(self.store._computedWatchers.labels, [ + { + functionName: "getter", + returnValue: true, + afterFunc: function (oldLabel) { + BI.each(self.model.subjectInfo.cptItems.availableReports, function (index, o) { + oldLabel.push(self.store.getExtendReportItem(o, "cpt")); + }); + BI.each(self.model.subjectInfo.frmItems.availableReports, function (index, o) { + oldLabel.push(self.store.getExtendReportItem(o, "frm")); + }); + return oldLabel; + } + } + ]) + BI.Front.utils.injectionFunc(self.store, [ + { + functionName: "refreshTab", + afterFunc: function (value, id) { + if (BI.isNotNull(id)) { + return this.updateSubjectInfo(); + } + return value; + }, + returnValue: true + } + ]) + } + }); +})(); \ No newline at end of file diff --git a/src/main/resources/com/fr/plugin/bi/web/js/decision.index.js b/src/main/resources/com/fr/plugin/bi/web/js/decision.index.js new file mode 100644 index 0000000..eb0e832 --- /dev/null +++ b/src/main/resources/com/fr/plugin/bi/web/js/decision.index.js @@ -0,0 +1,25 @@ +;!(function () { + function importResource(path, type) { + var url = Dec.fineServletURL + "/file?path=" + path; + BI.$import(url, type); + } + + importResource("com/fr/plugin/bi/web/js/bi.subject.js", "js"); + var perentRoute = BI.find(BI.AnalysisRoutes, function (index, item) { + return item.name === "analysis_subject"; + }); + + if (perentRoute.children) { + BI.each(BI.Front.SUPPORT_REPORT, function (index, item) { + perentRoute.children.push(item.route.view); + }) + } + + + //ezreal:协助开发的,后续删 + BI.Plugin.config(function (type, options) { + + }, function (type, object) { + object.element.attr("shortcut", object.options.type); + }); +})(); \ No newline at end of file diff --git a/src/main/resources/com/fr/plugin/bi/web/js/edit.report.js b/src/main/resources/com/fr/plugin/bi/web/js/edit.report.js new file mode 100644 index 0000000..117ac8c --- /dev/null +++ b/src/main/resources/com/fr/plugin/bi/web/js/edit.report.js @@ -0,0 +1,3 @@ +;!(function () { +console.log("report edit ....") +})(); \ No newline at end of file diff --git a/src/main/resources/com/fr/plugin/bi/web/js/report/subject.report.service.js b/src/main/resources/com/fr/plugin/bi/web/js/report/subject.report.service.js new file mode 100644 index 0000000..da1af56 --- /dev/null +++ b/src/main/resources/com/fr/plugin/bi/web/js/report/subject.report.service.js @@ -0,0 +1,32 @@ +;!(function () { + var CLIENTID = "e43e37dd7794460f8f81731eda84b2d8"; + var SECRET = "3429e051e025412d8426bcf30d60b2cb"; + var Service = BI.inherit(BI.OB, { + /** + * 增加主题的报表 + * @param subjectId + * @param data + * @param callback + */ + subjectAddReport: function (subjectId, data, callback) { + BI.CLI.template.add(subjectId, data, callback); + }, + getSubjectReport: function (subjectid) { + var url = "/front/subject/report?subjectid=" + subjectid; + var result = {}; + Dec.syncAjax({ + type: "GET", + url: url, + success: function (res) { + result = res; + } + }) + return Promise.resolve(result); + }, + deleteSubjectReport: function (subjectId, reportId, callback) { + BI.CLI.template.delete(subjectId, reportId, callback); + } + }); + BI.service("subject.report.service", Service); + +})(); \ No newline at end of file diff --git a/src/main/resources/com/fr/plugin/bi/web/js/report/subject.report.tab.js b/src/main/resources/com/fr/plugin/bi/web/js/report/subject.report.tab.js new file mode 100644 index 0000000..736fb29 --- /dev/null +++ b/src/main/resources/com/fr/plugin/bi/web/js/report/subject.report.tab.js @@ -0,0 +1,203 @@ +/** + * finereport的tab组件 + */ +;!(function () { + var widget = BI.inherit(BI.BasicButton, { + props: { + baseCls: 'bi-subject-tab-report-item', + report: {}, + height: 30, + editable: true, + showCombo: true, + allowRename: true, + reportType: "cpt", + forceSelected: true, + showChecker: function () { + return false; + }, + showValueItems: [1, 7, 21, 22, 445] + }, + watch: { + name: function (v) { + this.textEditor.setValue(v); + } + }, + _store: function () { + return BI.Models.getModel("bi.subject.tab.extend.report.item.model", { + id: this.options.id, + name: this.options.name, + reportType: this.options.reportType, + report: this.options.report + }); + }, + beforeInit: function (callback) { + this.store.initData(callback); + }, + render: function () { + var self = this, o = this.options; + return { + type: "bi.vertical_adapt", + cls: "bi-hover-visible-container", + columnSize: [16, "fill", ""], + items: [ + { + el: { + type: "bi.icon_label", + cls: o.iconCls, + height: 16, + iconHeight: 16, + iconWidth: 16, + }, + lgap: 6 + + }, + self._createShowTextWidget(), + self._createToolCombo() + ] + } + + }, + _createShowTextWidget: function () { + const {height, editable, allowRename, id, name} = this.options; + var self = this; + if (editable && allowRename) { + return { + type: "bi.shelter_editor", + hgap: 2, + // stopPropagation: true, + height: 20, + textAlign: "left", + allowBlank: false, + cls: "label-text", + errorText: function (e) { + return "" === e ? "报表名称不能为空" : "报表名称不能重复"; + // return BI.i18nText("" === e ? "BI-Conf_Widget_Name_Cannot_Empty" : "BI-Conf_Widget_Name_Cannot_Repeat") + }, + validationChecker: function (v) { + var id = (self.model.namesMap)[v]; + if (!id) { + return true; + } + return false; + }, + ref: function (_ref) { + self.textEditor = _ref; + }, + value: name, + listeners: [ + { + eventName: "EVENT_CONFIRM", + action: function () { + const text = self.textEditor.getValue(); + if (self.model.name !== text) { + self.store.reNameReport(text); + } + } + } + ] + } + } + return { + type: "bi.label", + text: name, height: 20, + _hgap: 4, + textAlign: 'left', + cls: "tab-item-text" + } + }, + _createToolCombo: function () { + const {editable, showChecker, showCombo, id} = this.options; + var self = this; + if (editable && showCombo) { + return { + el: { + type: "bi.down_list_combo", + stopPropagation: true, + invisible: false, + cls: "tab-item-hover-active bi-hover-visible-item", + iconCls: "vertical-more-item-font", + el: { + type: "bi.icon_trigger" + }, + height: 24, + width: 24, + ref: function (_ref) { + self.setting = _ref; + }, + listeners: [ + { + eventName: "EVENT_BEFORE_POPUPVIEW", + action: function () { + self.setting.populate(self.createItems()); + self.setting.adjustWidth(); + self.setting.adjustHeight(); + } + }, + { + eventName: "EVENT_CHANGE", + action: BI.bind(self.operator, self) + } + + ] + }, + rgap: 6 + } + } + return { + el: { + type: "bi.label", + text: "" + }, + rgap: 8 + } + + }, + createItems: function () { + var self = this; + var items = BI.Providers.getProvider("bi.provider.conf.list.report.item").getItems(); + const toolItems = []; + var showValueItems = this.options.showValueItems; + BI.each(items, function (i, groupItems) { + const itemArr = []; + BI.each(groupItems, function (index, groupItem) { + if (showValueItems.indexOf(groupItem.value) >= 0) { + + itemArr.push(BI.extend(groupItem, { + invisible: function () { + return false; + }, + reportInfoGetter: function () { + return { + id: self.model.id, + name: self.model.name + } + }, isOwn: true, + refresh: function () { + } + })) + } + }) + if (itemArr.length > 0) { + toolItems.push(itemArr); + } + }) + return toolItems; + }, + focus: function () { + this.textEditor.focus() + }, + operator: function (v) { + debugger; + if (v == 7) { + this.fireEvent("DELETE", this.options.id); + } + if (v == 1) { + this.focus(); + } + }, + mounted: function () { + + }, + }); + BI.shortcut("bi.subject.tab.extend.report.item", widget); +})(); \ No newline at end of file diff --git a/src/main/resources/com/fr/plugin/bi/web/js/report/subject.report.tab.model.js b/src/main/resources/com/fr/plugin/bi/web/js/report/subject.report.tab.model.js new file mode 100644 index 0000000..d8fb783 --- /dev/null +++ b/src/main/resources/com/fr/plugin/bi/web/js/report/subject.report.tab.model.js @@ -0,0 +1,61 @@ +;!(function () { + var store = BI.inherit(Fix.Model, { + state: function () { + // const {params} = BI.Router.$router.history.current; + return { + id: this.options.id, + name: this.options.name, + reportType: this.options.reportType, + report: this.options.report + } + }, + context: ['subjectInfo', 'tables', 'resourceOperationInfo'], + childContext: [], + computed: { + reportItems: function () { + var self = this; + var reportItems = []; + if (self.model.reportType === "cpt") { + reportItems = self.model.subjectInfo.cptItems.availableReports + } else if (self.model.reportType === "frm") { + reportItems = self.model.subjectInfo.frmItems.availableReports + } + return reportItems; + }, + namesMap: function () { + var self = this; + var namesMap = {}; + BI.each(self.model.reportItems, function (index, item) { + if (item.id != self.model.id) { + namesMap[item.name] = item.id; + } + }) + return namesMap; + } + }, + actions: { + initData: function (callback) { + var self = this; + BI.isFunction(callback) && callback() + }, + reNameReport: function (newName) { + var self = this; + var oldName = self.model.name; + self.model.name = newName; + BI.CLI.template.rename(self.model.subjectInfo.id, + { + id: self.model.id, + name: newName + }, function (res) { + if (res.errorCode) { + BI.Msg.toast(res.errorMsg, {level: "error"}); + self.model.name = oldName; + return + } + self.model.report.name = newName; + }) + } + } + }); + BI.model("bi.subject.tab.extend.report.item.model", store); +})(); \ No newline at end of file diff --git a/src/main/resources/com/fr/plugin/bi/web/js/report/subject.report.view.js b/src/main/resources/com/fr/plugin/bi/web/js/report/subject.report.view.js new file mode 100644 index 0000000..f6d3c26 --- /dev/null +++ b/src/main/resources/com/fr/plugin/bi/web/js/report/subject.report.view.js @@ -0,0 +1,123 @@ +/** + * 展示cpt模板 + */ +;!(function () { + var RGAP = 15; + BI.CPTVIEW = BI.inherit(BI.Widget, { + props: { + reportType: "cpt" + }, + watch: {}, + _store: function () { + return BI.Models.getModel("bi.subject.view.extend.report.model", { + reportType: this.options.reportType + }); + }, + beforeInit: function (callback) { + this.store.initData(callback); + }, + render: function () { + var self = this; + var o = this.options; + return { + type: "bi.absolute", + items: [ + { + el: { + type: "bi.left_right_vertical_adapt", + cls: "bi-border-bottom", + height: 25, + items: { + left: [ + { + type: "bi.label", + text: "", + // css: {"font-size": "large"}, + height: 25 + } + ], + right: self._createRightItem() + } + }, left: 10, right: 10, top: 5, height: 25 + }, + { + el: { + type: "bi.iframe", + src: self.model.src, + ref: function (_ref) { + self.iframe = _ref; + } + /*type: "bi.label", + text: self.model.newId*/ + }, left: 10, right: 10, top: 30, bottom: 0 + } + ] + } + + + }, + mounted: function () { + + }, + _createRightItem: function () { + var self = this; + let rightItems = BI.Providers.getProvider("bi.provider.dashboard_toolbar").getRightItems(self.model.id); + rightItems = BI.map(rightItems, function (index, item) { + /*var cptId = self.model.subjectInfo.id + "/" + self.model.id; + if (item.text === "公共链接") { + cptId = self.model.subjectInfo.id + "_@_" + self.model.id; + }*/ + return { + el: BI.extend(item, { + type: "bi.icon_text_item", + height: 25, + extraCls: "bi-list-item", + invisible: function () { + return false; + }, + reportInfoGetter: function () { + return { + id: self.model.id, + name: self.model.name + } + }, + isOwn: true, + refresh: function () { + } + }), rgap: RGAP + } + }); + return BI.concat(rightItems, [ + { + el: { + type: "bi.icon_text_item", + cls: "refresh-font", + extraCls: "bi-list-item", + height: 25, + text: "刷新", + handler: function () { + self.iframe.setSrc(self.model.src); + // self.iframe.reset(); + } + }, rgap: RGAP + }, + { + el: { + type: "bi.icon_text_item", + cls: "widget-edit-liner-font", + extraCls: "bi-list-item", + height: 25, + text: "打开设计器编辑", + handler: function () { + var url = "fanruan://" + window.location.origin + Dec.fineServletURL + "?" + Dec.personal.username + "?" + Dec.personal.username + "?reportlets/" + self.model.subjectInfo.id + "/" + self.model.id; + console.log(url); + window.open(url); + } + }, rgap: RGAP + } + ]) + } + }); + BI.shortcut("bi.subject.view.extend.report", BI.CPTVIEW); + +})(); \ No newline at end of file diff --git a/src/main/resources/com/fr/plugin/bi/web/js/report/subject.report.view.model.js b/src/main/resources/com/fr/plugin/bi/web/js/report/subject.report.view.model.js new file mode 100644 index 0000000..19b95e6 --- /dev/null +++ b/src/main/resources/com/fr/plugin/bi/web/js/report/subject.report.view.model.js @@ -0,0 +1,58 @@ +;!(function () { + var store = BI.inherit(Fix.Model, { + state: function () { + const {params} = BI.Router.$router.history.current; + return { + id: params.id, + op: "page", + reportType: this.options.reportType + } + }, + context: ['subjectInfo', 'tables', 'resourceOperationInfo'], + childContext: [], + computed: { + reportItem: function () { + var self = this; + var result = {}; + var reportItems = []; + if (self.model.reportType === "cpt") { + reportItems = self.model.subjectInfo.cptItems.availableReports + } else if (self.model.reportType === "frm") { + reportItems = self.model.subjectInfo.frmItems.availableReports + } + return BI.find(reportItems, function (index, item) { + return item.id === self.model.id; + }); + }, + name: function () { + if (this.model.reportItem) { + return this.model.reportItem.name; + } + return ""; + }, + src: function () { + var self = this; + var config = BI.find(BI.Front.SUPPORT_REPORT, function (index, item) { + return item.type === self.model.reportType + }) + if (config) { + if (self.model.reportType === "cpt") { + return Dec.fineServletURL + "/view/report?op=" + self.model.op + "&viewlet=" + self.model.subjectInfo.id + "/" + self.model.name + config.suffix; + } else if (self.model.reportType === "frm") { + return Dec.fineServletURL + "/view/form?" + "viewlet=" + self.model.subjectInfo.id + "/" + self.model.name + config.suffix; + } + } + return Dec.fineServletURL; + + } + }, + actions: { + initData: function (callback) { + var self = this; + + BI.isFunction(callback) && callback() + } + } + }); + BI.model("bi.subject.view.extend.report.model", store); +})(); \ No newline at end of file diff --git a/src/main/resources/com/fr/plugin/bi/web/js/show.report.js b/src/main/resources/com/fr/plugin/bi/web/js/show.report.js new file mode 100644 index 0000000..18e5501 --- /dev/null +++ b/src/main/resources/com/fr/plugin/bi/web/js/show.report.js @@ -0,0 +1,3 @@ +;!(function () { + console.log("report show .......") +})(); \ No newline at end of file diff --git a/src/main/resources/com/fr/plugin/bi/web/js/utils/bi.front.js b/src/main/resources/com/fr/plugin/bi/web/js/utils/bi.front.js new file mode 100644 index 0000000..ce5cbb8 --- /dev/null +++ b/src/main/resources/com/fr/plugin/bi/web/js/utils/bi.front.js @@ -0,0 +1,106 @@ +;!(function () { + BI.Front = BI.Front || {}; + BI.Front = BI.extend(BI.Front, { + utils: { + injectionFunc: function (o, configs) { + if (BI.isNotEmptyArray(configs)) { + BI.each(configs, function (index, item) { + let functionName = item.functionName; + if (functionName) { + let oldFunction = o[functionName]; + let beforeFunc = item.beforeFunc;//执行前的函数 + let afterFunc = item.afterFunc;//执行后函数 + let returnValue = item.returnValue;//是否返回值 + let replaceFunc = item.replaceFunc;//替换函数,如果不传递那么就会执行下默认的 + + o[functionName] = function () { + let para = []; + let len = arguments.length; + for (let i = 0; i < len; i++) { + para.push(arguments[i]); + } + if (BI.isFunction(beforeFunc)) { + beforeFunc.apply(o, para); + } + if (returnValue) { + let value = null; + if (BI.isFunction(replaceFunc)) { + value = replaceFunc.apply(o, para); + } else { + value = oldFunction.apply(o, para); + } + if (BI.isFunction(afterFunc)) { + para.unshift(value) + value = afterFunc.apply(o, para); + } + return value; + } else { + if (BI.isFunction(replaceFunc)) { + replaceFunc.apply(o, para); + } else { + oldFunction.apply(o, para); + } + if (BI.isFunction(afterFunc)) { + afterFunc.apply(o, para); + } + } + } + } + + }) + } + } + } + }); + $.extend(BI.Msg, { + /** + * 弹出框然后有个输入,确认返回输入的值 + * @param title 标题 + * @param content 标签 + * @param callback 回调函数 + * @param validationChecker 文本框的校验 + */ + prompt: function (title, content, callback, config) { + BI.Popovers.removeAll(); + var id = BI.UUID(); + var textEditor = { + type: "bi.text_editor", + ref: function (_ref) { + BI[id] = _ref; + }, + width: 200, + } + textEditor = BI.extend(textEditor, config ? config : {}); + + var widget = BI.Popovers.create(id, { + type: "bi.bar_popover", + // String或者是json都行 + header: title, + size: "small", + body: { + type: "bi.horizontal", + horizontalAlign: "center", + verticalAlign: "middle", + hgap: 10, + items: [{ + type: "bi.label", + text: content, + }, textEditor] + }, + listeners: [{ + eventName: "EVENT_CANCEL", + action: function () { + + } + }, { + eventName: "EVENT_CONFIRM", + action: function () { + BI.isFunction(callback) && callback(BI[id].getValue()); + } + }] + }); + widget.show(id); + } + }) + +})(); \ No newline at end of file