Browse Source

init

master
ezreal 11 months ago
parent
commit
ceb92a8c09
  1. 130
      build.xml
  2. 32
      plugin.xml
  3. 39
      src/main/java/com/fr/plugin/bi/fusion/web/DecisionWebBridge.java
  4. 31
      src/main/java/com/fr/plugin/bi/fusion/web/EditReportWebBridge.java
  5. 18
      src/main/java/com/fr/plugin/bi/fusion/web/FrontControllerRegisterProvider.java
  6. 33
      src/main/java/com/fr/plugin/bi/fusion/web/ShowReportWebBridge.java
  7. 37
      src/main/java/com/fr/plugin/bi/fusion/web/SubjectWebBridge.java
  8. 51
      src/main/java/com/fr/plugin/bi/fusion/web/handler/SubjectReportResouce.java
  9. 45
      src/main/java/com/fr/plugin/bi/fusion/web/handler/bean/ReportItemBean.java
  10. 30
      src/main/resources/com/fr/plugin/bi/web/css/iconfont.css
  11. BIN
      src/main/resources/com/fr/plugin/bi/web/css/iconfont.ttf
  12. 1
      src/main/resources/com/fr/plugin/bi/web/img/fanruanCpt.svg
  13. 1
      src/main/resources/com/fr/plugin/bi/web/img/fanruanFrm.svg
  14. 191
      src/main/resources/com/fr/plugin/bi/web/js/bi.subject.js
  15. 33
      src/main/resources/com/fr/plugin/bi/web/js/core/front.branch_map.js
  16. 86
      src/main/resources/com/fr/plugin/bi/web/js/core/front.conf.pack.table.usage.js
  17. 16
      src/main/resources/com/fr/plugin/bi/web/js/core/front.subject.js
  18. 40
      src/main/resources/com/fr/plugin/bi/web/js/core/front.subject.relationship.map.button.js
  19. 142
      src/main/resources/com/fr/plugin/bi/web/js/core/front.subject.relationship.pane.header.js
  20. 93
      src/main/resources/com/fr/plugin/bi/web/js/core/front.subject.relationship.pane.js
  21. 21
      src/main/resources/com/fr/plugin/bi/web/js/core/front.subject.relationship.pane.map.js
  22. 35
      src/main/resources/com/fr/plugin/bi/web/js/core/front.subject.tab.js
  23. 117
      src/main/resources/com/fr/plugin/bi/web/js/core/front.subject.view.js
  24. 25
      src/main/resources/com/fr/plugin/bi/web/js/decision.index.js
  25. 3
      src/main/resources/com/fr/plugin/bi/web/js/edit.report.js
  26. 32
      src/main/resources/com/fr/plugin/bi/web/js/report/subject.report.service.js
  27. 203
      src/main/resources/com/fr/plugin/bi/web/js/report/subject.report.tab.js
  28. 61
      src/main/resources/com/fr/plugin/bi/web/js/report/subject.report.tab.model.js
  29. 123
      src/main/resources/com/fr/plugin/bi/web/js/report/subject.report.view.js
  30. 58
      src/main/resources/com/fr/plugin/bi/web/js/report/subject.report.view.model.js
  31. 3
      src/main/resources/com/fr/plugin/bi/web/js/show.report.js
  32. 106
      src/main/resources/com/fr/plugin/bi/web/js/utils/bi.front.js

130
build.xml

@ -0,0 +1,130 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<project basedir="." default="jar" name="plugin">
<!-- JDK路径,根据自己机器上实际位置修改-->
<property name="jdk.home" value="/Library/Java/JavaVirtualMachines/jdk1.8.0_321.jdk/Contents/Home"/>
<property name="libs" value="${basedir}/lib"/>
<property name="publicLibs" value=""/>
<property name="reportLibs" value="${basedir}/lib/report"/>
<property name="destLoc" value="."/>
<property name="classes" value="classes"/>
<xmlproperty file="${basedir}/plugin.xml"/>
<property name="current-version" value="${plugin.version}"/>
<!-- 插件版本-->
<property name="plugin-version" value="${current-version}"/>
<!-- 插件名字-->
<property name="plugin-name" value="BI-Front"/>
<property name="plugin-jar" value="fr-plugin-${plugin-name}-${plugin-version}.jar"/>
<target name="prepare">
<delete dir="${classes}"/>
<delete dir="fr-plugin-${plugin-name}-${plugin-version}"/>
<xmlproperty file="${basedir}/plugin.xml"/>
<delete dir="${destLoc}/${plugin.name}"/>
</target>
<path id="compile.classpath">
<fileset dir="${libs}">
<include name="**/*.jar"/>
</fileset>
<fileset dir="${publicLibs}">
<include name="**/*.jar"/>
</fileset>
<fileset dir="${reportLibs}">
<include name="**/*.jar"/>
</fileset>
</path>
<patternset id="resources4Jar">
<exclude name="**/.settings/**"/>
<exclude name=".classpath"/>
<exclude name=".project"/>
<exclude name="**/*.java"/>
<exclude name="**/*.db"/>
<exclude name="**/*.g"/>
<exclude name="**/package.html"/>
</patternset>
<target name="copy_resources">
<echo message="从${resources_from}拷贝图片,JS,CSS等资源文件"/>
<delete dir="tmp"/>
<copy todir="tmp">
<fileset dir="${resources_from}/src/main/resources">
<patternset refid="resources4Jar"/>
</fileset>
</copy>
<copy todir="${classes}">
<fileset dir="tmp"/>
</copy>
<delete dir="tmp"/>
</target>
<target name="compile_javas">
<echo message="编译${compile_files}下的Java文件"/>
<javac destdir="${classes}" debug="false" optimize="on" source="${source_jdk_version}"
target="${target_jdk_version}"
fork="true" memoryMaximumSize="512m" listfiles="false" srcdir="${basedir}"
executable="${compile_jdk_version}/bin/javac">
<src path="${basedir}/src/main/java"/>
<exclude name="**/.svn/**"/>
<compilerarg line="-encoding UTF8 "/>
<classpath refid="compile.classpath"/>
</javac>
<!-- <taskdef name="pretreatment" classname="com.fr.plugin.pack.PluginPretreatmentTask">
<classpath refid="compile.classpath"/>
</taskdef>
<pretreatment baseDir="${basedir}"/>-->
</target>
<target name="jar_classes">
<echo message="打Jar包:${jar_name}"/>
<delete file="${basedir}/${jar_name}"/>
<jar jarfile="${basedir}/${jar_name}">
<fileset dir="${classes}">
</fileset>
</jar>
</target>
<target name="super_jar" depends="prepare">
<antcall target="copy_resources">
<param name="resources_from" value="${basedir}"/>
</antcall>
<antcall target="compile_javas">
<param name="source_jdk_version" value="1.8"/>
<param name="target_jdk_version" value="1.8"/>
<param name="compile_jdk_version" value="${jdk.home}"/>
<param name="compile_files" value="${basedir}/src"/>
</antcall>
<echo message="compile plugin success!"/>
<antcall target="jar_classes">
<param name="jar_name" value="${plugin-jar}"/>
</antcall>
<delete dir="${classes}"/>
</target>
<target name="jar" depends="super_jar">
<antcall target="zip"/>
</target>
<target name="zip">
<property name="plugin-folder" value="fr-plugin-${plugin-name}-${plugin-version}"/>
<echo message="----------zip files----------"/>
<mkdir dir="${plugin-folder}"/>
<copy todir="${plugin-folder}">
<fileset dir=".">
<include name="${plugin-jar}"/>
<include name="plugin.xml"/>
</fileset>
<fileset dir="${libs}">
<include name="*.jar"/>
<include name="*.dll"/>
</fileset>
</copy>
<zip destfile="${basedir}/${plugin-folder}.zip" basedir=".">
<include name="${plugin-folder}/*.jar"/>
<include name="${plugin-folder}/*.dll"/>
<include name="${plugin-folder}/plugin.xml"/>
</zip>
<move file="${plugin-folder}.zip" todir="${destLoc}/install"/>
</target>
</project>

32
plugin.xml

@ -0,0 +1,32 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<plugin>
<id>com.fr.plugin.BI.fusion.front</id>
<name><![CDATA[BI融合方案前端]]></name>
<active>yes</active>
<version>0.0.5</version>
<env-version>11.0~11.0</env-version>
<group>bi</group>
<bi-env-version>6.0~6.0</bi-env-version>
<jartime>2023-01-10</jartime>
<vendor>ezreal</vendor>
<description><![CDATA[BI融合方案前端]]></description>
<change-notes><![CDATA[
[2023-02-13]初始化插件。<br/>
]]></change-notes>
<extra-core>
</extra-core>
<extra-decision>
<ControllerRegisterProvider class="com.fr.plugin.bi.fusion.web.FrontControllerRegisterProvider"/>
<!--BI 预览页面前端注入-->
<WebResourceProvider class="com.fr.plugin.bi.fusion.web.ShowReportWebBridge"/>
<!--BI 编辑页面前端注入-->
<WebResourceProvider class="com.fr.plugin.bi.fusion.web.EditReportWebBridge"/>
<!--BI 主题页面前端注入-->
<WebResourceProvider class="com.fr.plugin.bi.fusion.web.SubjectWebBridge"/>
<!--BI 平台页面前端注入-->
<WebResourceProvider class="com.fr.plugin.bi.fusion.web.DecisionWebBridge"/>
</extra-decision>
<function-recorder class="com.fr.plugin.bi.fusion.web.DecisionWebBridge"/>
</plugin>

39
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);
}
};
}
}

31
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);
}
};
}
}

18
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
};
}
}

33
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);
}
};
}
}

37
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);
}
};
}
}

51
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<ReportItemBean> 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);
}
}

45
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;
}
}

30
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
}

BIN
src/main/resources/com/fr/plugin/bi/web/css/iconfont.ttf

Binary file not shown.

1
src/main/resources/com/fr/plugin/bi/web/img/fanruanCpt.svg

@ -0,0 +1 @@
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1684845496690" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="1794" width="16" height="16" xmlns:xlink="http://www.w3.org/1999/xlink"><path d="M181.401763 951.171037l-58.053274-0.027645c-39.376582-0.054266-60.186027-20.919001-60.240293-60.377494l0.027645-224.283104c0-10.062745 0-19.08727 0.820132-26.770506h-0.792487l-0.027645-80.667829c-0.054266-91.140128-0.109556-208.832675 0.1372-272.437455 0.219111-53.760123 13.563409-97.184123 40.82538-132.814309 32.567744-42.602844 79.820052-68.690419 144.435407-79.764762 22.641176-3.855952 41.345513-5.660038 58.927672-5.660038l3.55493 0.027645c35.739741 0.464844 48.208617 13.043275 48.208617 48.044795l0.054266 305.934887 92.562305 0.054266c36.314141 0 72.600637-0.054266 108.887132-0.327643 29.286192 0 45.666309 16.324828 45.66631 44.763242v204.676724c0.054266 5.031372 0.163822 21.055178-11.648744 32.978323-10.527589 10.6095-23.981442 11.84021-33.169789 11.84021-33.224055-0.245732-65.654599-0.327643-98.058521-0.327644l-96.281057 0.109556-0.054265 189.499672c-0.054266 32.704945-12.851809 45.447198-45.692931 45.447198l-140.08799 0.081911z m-62.154959-56.166254c1.09351 0.081911 2.46142 0.137201 4.155951 0.137201l57.997984 0.027645 129.778489-0.081911 0.054266-189.33585c0-32.759211 12.633721-45.556754 45.009999-45.61102l107.274513-0.109556c28.930904 0 57.889452 0.054266 86.820356 0.245733l0.054266-182.034524c-33.90801 0.137201-66.228998 0.191467-98.55101 0.191466l-103.418561-0.054266c-32.485834 0-45.146176-12.797543-45.146176-45.666309l-0.054266-308.286752c-13.207097 0.273377-27.727838 1.80511-45.255731 4.78564-50.725327 8.695858-85.48009 27.31726-109.379622 58.600029-19.852113 25.922729-29.150015 57.369319-29.313837 99.015854-0.245732 63.54949-0.191467 181.132481-0.1372 272.190699l0.027645 80.69445v0.355288c-0.027645 5.687683-0.109556 163.959876-0.054266 250.643032 0 1.750844 0.054266 3.171997 0.1372 4.293151z" fill="#d81e06" p-id="1795"></path><path d="M702.376118 951.773081c-15.039852 0-24.418641-6.262083-29.614859-11.512566-12.004032-12.113587-11.867855-28.220327-11.812565-33.525077 0.301022-43.970755 0.163822-289.828147 0.054266-442.085015l-0.054266-100.464652-197.265842-0.1372c-34.399475-0.054266-47.169373-12.633721-47.169374-46.431152l-0.027644-68.744685c-0.027645-45.447198-0.054266-90.648663 0.027644-134.947062 0.054266-31.857168 13.125186-44.872798 45.146176-44.872798l436.944086-0.109556c14.136785 0.027645 31.993345 1.723199 44.982354 14.793096 12.961364 13.043275 14.493097 30.626458 14.411186 44.463244-0.327643 45.09191-0.163822 286.273217-0.081911 458.272641l0.081911 150.888957c0 66.639576-22.723087 119.005167-67.541619 155.674596-37.844849 30.954101-83.948358 48.72875-145.037452 55.865231-7.355592 0.875422-14.82074 1.258355-22.259267 1.640264-5.003728 0.245732-10.036124 0.492489-15.012206 0.957333a60.743021 60.743021 0 0 1-5.770618 0.274401zM472.514886 308.047163l197.239222 0.136176c34.372854 0.054266 47.142752 12.715632 47.197017 46.705553l0.054266 109.73491c0.081911 141.536788 0.219111 363.878606 0 430.162894 1.121154-0.081911 2.242309-0.137201 3.335819-0.191467 6.207817-0.301022 12.41461-0.601021 18.567136-1.312621 49.986082-5.851505 86.874622-19.715936 116.106548-43.615467 32.048635-26.223751 46.97893-61.909226 46.978931-112.304862l-0.081911-150.862335c-0.081911-172.135601-0.245732-413.563665 0.081911-458.683219 0-1.066889 0-1.996576-0.027645-2.816709-0.957333-0.027645-2.105108-0.054266-3.391108-0.054266l-426.087831 0.109556c-0.054266 40.716848-0.027645 82.144272 0 123.763162l0.027645 59.228695z" fill="#d81e06" p-id="1796"></path></svg>

After

Width:  |  Height:  |  Size: 3.7 KiB

1
src/main/resources/com/fr/plugin/bi/web/img/fanruanFrm.svg

@ -0,0 +1 @@
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1685608725372" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="2406" width="16" height="16" xmlns:xlink="http://www.w3.org/1999/xlink"><path d="M258.133333 128A106.666667 106.666667 0 0 0 362.666667 213.333333h298.666666a106.666667 106.666667 0 0 0 104.533334-85.333333h87.424A128 128 0 0 1 981.333333 255.744v597.845333A127.872 127.872 0 0 1 853.290667 981.333333H170.666667A128 128 0 0 1 42.666667 853.589333V255.744A127.872 127.872 0 0 1 170.709333 128H258.133333zM298.666667 384a42.666667 42.666667 0 1 0 0 85.333333h256a42.666667 42.666667 0 0 0 0-85.333333H298.666667z m0 170.666667a42.666667 42.666667 0 0 0 0 85.333333h426.666666a42.666667 42.666667 0 0 0 0-85.333333H298.666667z m0 170.666666a42.666667 42.666667 0 0 0 0 85.333334h256a42.666667 42.666667 0 0 0 0-85.333334H298.666667zM362.666667 42.666667h298.666666a64 64 0 0 1 0 128h-298.666666a64 64 0 0 1 0-128z" p-id="2407" fill="#1afa29"></path></svg>

After

Width:  |  Height:  |  Size: 1.1 KiB

191
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);
});
})();

33
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;
})
})();

86
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;
})
})();

16
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;
});
})();

40
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);
}
}
})
})();

142
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;
})
})();

93
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;
})
})();

21
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);
}
})
})();

35
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;
});
})();

117
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
}
])
}
});
})();

25
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);
});
})();

3
src/main/resources/com/fr/plugin/bi/web/js/edit.report.js

@ -0,0 +1,3 @@
;!(function () {
console.log("report edit ....")
})();

32
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);
})();

203
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);
})();

61
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);
})();

123
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);
})();

58
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);
})();

3
src/main/resources/com/fr/plugin/bi/web/js/show.report.js

@ -0,0 +1,3 @@
;!(function () {
console.log("report show .......")
})();

106
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);
}
})
})();
Loading…
Cancel
Save