forked from ezreal/BI-FR-MIX-FRONT
ezreal
11 months ago
32 changed files with 1836 additions and 0 deletions
@ -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> |
@ -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> |
@ -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); |
||||
} |
||||
}; |
||||
} |
||||
} |
@ -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); |
||||
} |
||||
}; |
||||
} |
||||
} |
@ -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 |
||||
}; |
||||
} |
||||
} |
@ -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); |
||||
} |
||||
}; |
||||
} |
||||
} |
@ -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); |
||||
} |
||||
}; |
||||
} |
||||
} |
@ -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); |
||||
} |
||||
} |
@ -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; |
||||
} |
||||
} |
@ -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 |
||||
} |
||||
|
Binary file not shown.
After Width: | Height: | Size: 3.7 KiB |
After Width: | Height: | Size: 1.1 KiB |
@ -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); |
||||
}); |
||||
})(); |
@ -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; |
||||
}) |
||||
})(); |
@ -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; |
||||
}) |
||||
})(); |
@ -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; |
||||
}); |
||||
})(); |
@ -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); |
||||
|
||||
} |
||||
} |
||||
}) |
||||
})(); |
@ -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; |
||||
}) |
||||
})(); |
@ -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; |
||||
}) |
||||
|
||||
})(); |
@ -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); |
||||
} |
||||
}) |
||||
})(); |
@ -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; |
||||
}); |
||||
})(); |
@ -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 |
||||
} |
||||
]) |
||||
} |
||||
}); |
||||
})(); |
@ -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); |
||||
}); |
||||
})(); |
@ -0,0 +1,3 @@
|
||||
;!(function () { |
||||
console.log("report edit ....") |
||||
})(); |
@ -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); |
||||
|
||||
})(); |
@ -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); |
||||
})(); |
@ -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); |
||||
})(); |
@ -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); |
||||
|
||||
})(); |
@ -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); |
||||
})(); |
@ -0,0 +1,3 @@
|
||||
;!(function () { |
||||
console.log("report show .......") |
||||
})(); |
@ -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…
Reference in new issue