pioneer
2 years ago
commit
892c427ff2
22 changed files with 1659 additions and 0 deletions
@ -0,0 +1,6 @@
|
||||
# open-JSD-11057 |
||||
|
||||
JSD-11057 隐藏掉BI指定页面中的组件功能\ |
||||
免责说明:该源码为第三方爱好者提供,不保证源码和方案的可靠性,也不提供任何形式的源码教学指导和协助!\ |
||||
仅作为开发者学习参考使用!禁止用于任何商业用途!\ |
||||
为保护开发者隐私,开发者信息已隐去!若原开发者希望公开自己的信息,可联系【pioneer】处理。 |
@ -0,0 +1,126 @@
|
||||
|
||||
apply plugin: 'java' |
||||
|
||||
|
||||
ext { |
||||
/** |
||||
* 项目中依赖的jar的路径 |
||||
* 1.如果依赖的jar需要打包到zip中,放置在lib根目录下 |
||||
* 2.如果依赖的jar仅仅是编译时需要,防止在lib下子目录下即可 |
||||
*/ |
||||
libPath = "$projectDir/../webroot/WEB-INF/lib" |
||||
|
||||
/** |
||||
* 是否对插件的class进行加密保护,防止反编译 |
||||
*/ |
||||
guard = true |
||||
|
||||
def pluginInfo = getPluginInfo() |
||||
pluginPre = "fine-plugin" |
||||
pluginName = pluginInfo.id |
||||
pluginVersion = pluginInfo.version |
||||
|
||||
outputPath = "$projectDir/../webroot/WEB-INF/plugins/plugin-" + pluginName + "-1.0/classes" |
||||
} |
||||
|
||||
group = 'com.fr.plugin' |
||||
version = '10.0' |
||||
sourceCompatibility = '8' |
||||
|
||||
sourceSets { |
||||
main { |
||||
java.outputDir = file(outputPath) |
||||
output.resourcesDir = file(outputPath) |
||||
} |
||||
} |
||||
|
||||
ant.importBuild("encrypt.xml") |
||||
//定义ant变量 |
||||
ant.projectDir = projectDir |
||||
ant.references["compile.classpath"] = ant.path { |
||||
fileset(dir: libPath, includes: '**/*.jar') |
||||
fileset(dir: ".",includes:"**/*.jar" ) |
||||
} |
||||
|
||||
classes.dependsOn('clean') |
||||
|
||||
task copyFiles(type: Copy,dependsOn: 'classes'){ |
||||
from outputPath |
||||
into "$projectDir/classes" |
||||
} |
||||
|
||||
task preJar(type:Copy,dependsOn: guard ? 'compile_encrypt_javas' : 'compile_plain_javas'){ |
||||
from "$projectDir/classes" |
||||
into "$projectDir/transform-classes" |
||||
include "**/*.*" |
||||
} |
||||
jar.dependsOn("preJar") |
||||
|
||||
tasks.withType(JavaCompile){ |
||||
options.encoding="UTF-8" |
||||
} |
||||
|
||||
task makeJar(type: Jar,dependsOn: preJar){ |
||||
from fileTree(dir: "$projectDir/transform-classes") |
||||
baseName pluginPre |
||||
appendix pluginName |
||||
version pluginVersion |
||||
destinationDir = file("$buildDir/libs") |
||||
|
||||
doLast(){ |
||||
delete file("$projectDir/classes") |
||||
delete file("$projectDir/transform-classes") |
||||
} |
||||
} |
||||
|
||||
task copyFile(type: Copy,dependsOn: ["makeJar"]){ |
||||
from "$buildDir/libs" |
||||
from("$projectDir/lib") { |
||||
include "*.jar" |
||||
} |
||||
from "$projectDir/plugin.xml" |
||||
into file("$buildDir/temp/plugin") |
||||
} |
||||
|
||||
task zip(type:Zip,dependsOn:["copyFile"]){ |
||||
from "$buildDir/temp/plugin" |
||||
destinationDir file("$buildDir/install") |
||||
baseName pluginPre |
||||
appendix pluginName |
||||
version pluginVersion |
||||
} |
||||
|
||||
//控制build时包含哪些文件,排除哪些文件 |
||||
processResources { |
||||
// exclude everything |
||||
// 用*.css没效果 |
||||
// exclude '**/*.css' |
||||
// except this file |
||||
// include 'xx.xml' |
||||
} |
||||
|
||||
/*读取plugin.xml中的version*/ |
||||
def getPluginInfo(){ |
||||
def xmlFile = file("plugin.xml") |
||||
if (!xmlFile.exists()) { |
||||
return ["id":"none", "version":"1.0.0"] |
||||
} |
||||
def plugin = new XmlParser().parse(xmlFile) |
||||
def version = plugin.version[0].text() |
||||
def id = plugin.id[0].text() |
||||
return ["id":id,"version":version] |
||||
} |
||||
|
||||
repositories { |
||||
mavenLocal() |
||||
maven { |
||||
url = uri('http://mvn.finedevelop.com/repository/maven-public/') |
||||
} |
||||
} |
||||
|
||||
dependencies { |
||||
//使用本地jar |
||||
implementation fileTree(dir: 'lib', include: ['**/*.jar']) |
||||
implementation fileTree(dir: libPath, include: ['**/*.jar']) |
||||
} |
||||
|
@ -0,0 +1,13 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?> |
||||
<project> |
||||
<target name="compile_encrypt_javas" depends="copyFiles"> |
||||
<echo message="加密文件"/> |
||||
<echo message="${projectDir}"/> |
||||
<taskdef name="pretreatment" classname="com.fr.plugin.pack.PluginPretreatmentTask"> |
||||
<classpath refid="compile.classpath"/> |
||||
</taskdef> |
||||
<pretreatment baseDir="${projectDir}"/> |
||||
</target> |
||||
<target name="compile_plain_javas" depends="copyFiles"> |
||||
</target> |
||||
</project> |
@ -0,0 +1,23 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?><plugin> |
||||
<id>com.fr.plugin.bi.hidden.buttons</id> |
||||
<name><![CDATA[BI隐藏按钮插件]]></name> |
||||
<active>yes</active> |
||||
<version>1.0.4</version> |
||||
<env-version>10.0</env-version> |
||||
<jartime>2018-07-31</jartime> |
||||
<vendor>fr.open</vendor> |
||||
<description><![CDATA[BI隐藏按钮插件]]></description> |
||||
<change-notes><![CDATA[ |
||||
[2018-07-31]初始化插件。<br/> |
||||
]]></change-notes> |
||||
|
||||
<extra-decision> |
||||
<SystemOptionProvider class="com.fr.plugin.bi.hidden.buttons.systemOptionProvider.BiButtonHiddenOptionProvider"/> |
||||
<ControllerRegisterProvider class="com.fr.plugin.bi.hidden.buttons.controller.ReportButtonControllerProvider"/> |
||||
<WebResourceProvider class="com.fr.plugin.bi.hidden.buttons.webresporces.ReportEditWebResourceProvider"/> |
||||
<WebResourceProvider class="com.fr.plugin.bi.hidden.buttons.webresporces.ReportViewWebResourceProvider"/> |
||||
</extra-decision> |
||||
<function-recorder class="com.fr.plugin.bi.hidden.buttons.BiHiddenButtonPluginLifeCycleMonitor"/> |
||||
<lifecycle-monitor class="com.fr.plugin.bi.hidden.buttons.BiHiddenButtonPluginLifeCycleMonitor"/> |
||||
|
||||
</plugin> |
@ -0,0 +1,35 @@
|
||||
package com.fr.plugin.bi.hidden.buttons; |
||||
|
||||
import com.fr.decision.webservice.bean.authority.PrivilegeBean; |
||||
import com.fr.decision.webservice.bean.authority.PrivilegeDetailBean; |
||||
import com.fr.decision.webservice.bean.authority.PrivilegeOperator; |
||||
import com.fr.decision.webservice.bean.authority.PrivilegeSourceBean; |
||||
import com.fr.decision.webservice.bean.entry.DecisionMgrModuleBean; |
||||
import com.fr.decision.webservice.v10.authority.AuthorityService; |
||||
import com.fr.decision.webservice.v10.module.ManagerModuleService; |
||||
import com.fr.decision.webservice.v10.user.UserService; |
||||
import com.fr.log.FineLoggerFactory; |
||||
import com.fr.plugin.context.PluginContext; |
||||
import com.fr.plugin.context.PluginContexts; |
||||
import com.fr.plugin.observer.inner.AbstractPluginLifecycleMonitor; |
||||
import com.fr.plugin.transform.FunctionRecorder; |
||||
import com.fr.record.analyzer.EnableMetrics; |
||||
|
||||
import java.util.*; |
||||
|
||||
@EnableMetrics |
||||
@FunctionRecorder |
||||
public class BiHiddenButtonPluginLifeCycleMonitor extends AbstractPluginLifecycleMonitor { |
||||
@Override |
||||
public void afterRun(PluginContext pluginContext) { |
||||
// ResourcesIOUitls
|
||||
FineLoggerFactory.getLogger().info(PluginContexts.currentContext().getID()+"插件启动"); |
||||
} |
||||
|
||||
@Override |
||||
public void beforeStop(PluginContext pluginContext) { |
||||
FineLoggerFactory.getLogger().info(PluginContexts.currentContext().getID()+"插件停止"); |
||||
} |
||||
|
||||
|
||||
} |
@ -0,0 +1,59 @@
|
||||
package com.fr.plugin.bi.hidden.buttons.config; |
||||
|
||||
import com.fr.config.ConfigContext; |
||||
import com.fr.config.Configuration; |
||||
import com.fr.config.DefaultConfiguration; |
||||
import com.fr.config.holder.CheckedKey; |
||||
import com.fr.config.holder.Conf; |
||||
import com.fr.config.holder.ConfigCallBack; |
||||
import com.fr.config.holder.factory.Holders; |
||||
import com.fr.transaction.ValidateProxy; |
||||
|
||||
import java.util.Map; |
||||
|
||||
public class ReportButtonConfig extends DefaultConfiguration implements ConfigCallBack { |
||||
|
||||
private static volatile ReportButtonConfig config = null; |
||||
|
||||
public static ReportButtonConfig getInstance(){ |
||||
if(null == config){ |
||||
config = (ReportButtonConfig) ConfigContext.getConfigInstance(ReportButtonConfig.class); |
||||
ValidateProxy.getInstance().getValidateManager().registerCallBack(config); |
||||
} |
||||
return config; |
||||
} |
||||
|
||||
|
||||
public String getNameSpace() { |
||||
return "ReportButtonConfig"; |
||||
} |
||||
|
||||
private Conf<String> editBtnConfig = Holders.simple("1,1,1,1,1,1,1,1,1,1"); |
||||
private Conf<String> viewBtnConfig = Holders.simple("1,1"); |
||||
|
||||
public String getEditBtnConfig() { |
||||
return editBtnConfig.get(); |
||||
} |
||||
|
||||
public void setEditBtnConfig(String s) { |
||||
this.editBtnConfig.set(s); |
||||
} |
||||
|
||||
public String getViewBtnConfig() { |
||||
return viewBtnConfig.get(); |
||||
} |
||||
|
||||
public void setViewBtnConfig(String s) { |
||||
this.viewBtnConfig.set(s); |
||||
} |
||||
|
||||
@Override |
||||
public void change(Map<CheckedKey, Object> map) { |
||||
|
||||
} |
||||
|
||||
@Override |
||||
public boolean accept(Class<? extends Configuration> aClass) { |
||||
return ReportButtonConfig.class.equals(aClass); |
||||
} |
||||
} |
@ -0,0 +1,54 @@
|
||||
package com.fr.plugin.bi.hidden.buttons.controller; |
||||
|
||||
import com.fr.decision.webservice.annotation.LoginStatusChecker; |
||||
import com.fr.json.JSONObject; |
||||
import com.fr.log.FineLoggerFactory; |
||||
import com.fr.plugin.bi.hidden.buttons.config.ReportButtonConfig; |
||||
import com.fr.plugin.context.PluginContexts; |
||||
import com.fr.third.springframework.stereotype.Controller; |
||||
import com.fr.third.springframework.web.bind.annotation.*; |
||||
import com.fr.decision.webservice.Response; |
||||
import javax.servlet.http.HttpServletRequest; |
||||
import javax.servlet.http.HttpServletResponse; |
||||
|
||||
@Controller |
||||
@LoginStatusChecker( |
||||
required = false |
||||
) |
||||
public class ReportButtonController { |
||||
|
||||
@CrossOrigin |
||||
@RequestMapping( |
||||
value = {"/getReportConfig"}, |
||||
method = {RequestMethod.GET} |
||||
) |
||||
@ResponseBody |
||||
public Response getReportConfig(HttpServletRequest req, HttpServletResponse res) throws Exception { |
||||
String editConfig = ReportButtonConfig.getInstance().getEditBtnConfig(); |
||||
String viewConfig = ReportButtonConfig.getInstance().getViewBtnConfig(); |
||||
JSONObject jsonObject = new JSONObject(); |
||||
jsonObject.put("edit",editConfig); |
||||
jsonObject.put("view",viewConfig); |
||||
return Response.ok(jsonObject); |
||||
} |
||||
|
||||
|
||||
@RequestMapping( |
||||
value = {"/saveReportConfig"}, |
||||
method = {RequestMethod.POST} |
||||
) |
||||
@ResponseBody |
||||
public Response saveReportConfig(HttpServletRequest req, HttpServletResponse res, @RequestBody ReqParam postRequest) throws Exception { |
||||
String jsonParam = postRequest.getJsonParam(); |
||||
FineLoggerFactory.getLogger().info("jsonParam:"+jsonParam); |
||||
JSONObject jsonObject = new JSONObject(jsonParam); |
||||
String editConfig = jsonObject.getString("edit"); |
||||
String viewConfig = jsonObject.getString("view"); |
||||
FineLoggerFactory.getLogger().info("editConfig:"+editConfig); |
||||
FineLoggerFactory.getLogger().info("viewConfig:"+viewConfig); |
||||
ReportButtonConfig.getInstance().setEditBtnConfig(editConfig); |
||||
ReportButtonConfig.getInstance().setViewBtnConfig(viewConfig); |
||||
return Response.ok("ok"); |
||||
} |
||||
|
||||
} |
@ -0,0 +1,10 @@
|
||||
package com.fr.plugin.bi.hidden.buttons.controller; |
||||
import com.fr.decision.fun.impl.AbstractControllerRegisterProvider; |
||||
public class ReportButtonControllerProvider extends AbstractControllerRegisterProvider { |
||||
@Override |
||||
public Class<?>[] getControllers() { |
||||
return new Class[]{ |
||||
ReportButtonController.class |
||||
}; |
||||
} |
||||
} |
@ -0,0 +1,14 @@
|
||||
package com.fr.plugin.bi.hidden.buttons.controller; |
||||
|
||||
public class ReqParam { |
||||
|
||||
private String jsonParam; |
||||
|
||||
public String getJsonParam() { |
||||
return jsonParam; |
||||
} |
||||
|
||||
public void setJsonParam(String jsonParam) { |
||||
this.jsonParam = jsonParam; |
||||
} |
||||
} |
@ -0,0 +1,32 @@
|
||||
package com.fr.plugin.bi.hidden.buttons.systemOptionProvider; |
||||
|
||||
import com.fr.decision.fun.impl.AbstractSystemOptionProvider; |
||||
import com.fr.decision.web.MainComponent; |
||||
import com.fr.web.struct.Atom; |
||||
|
||||
public class BiButtonHiddenOptionProvider extends AbstractSystemOptionProvider { |
||||
@Override |
||||
public String id() { |
||||
return "bi-hidden-buttons-menuid"; |
||||
} |
||||
|
||||
@Override |
||||
public String displayName() { |
||||
return "隐藏按钮"; |
||||
} |
||||
|
||||
@Override |
||||
public int sortIndex() { |
||||
return 0; |
||||
} |
||||
|
||||
@Override |
||||
public Atom attach() { |
||||
return MainComponent.KEY; |
||||
} |
||||
@Override |
||||
public Atom client() { |
||||
return BiHiddenButtonsComponent.KEY; |
||||
} |
||||
|
||||
} |
@ -0,0 +1,31 @@
|
||||
package com.fr.plugin.bi.hidden.buttons.systemOptionProvider; |
||||
|
||||
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.ScriptPath; |
||||
import com.fr.web.struct.category.StylePath; |
||||
|
||||
public class BiHiddenButtonsComponent extends Component { |
||||
|
||||
public static final BiHiddenButtonsComponent KEY = new BiHiddenButtonsComponent(); |
||||
|
||||
|
||||
public ScriptPath script(RequestClient client ) { |
||||
|
||||
return ScriptPath.build("com/fr/plugin/bi/js/hiddenButtons.js"); |
||||
} |
||||
|
||||
public StylePath style(RequestClient var1){ |
||||
return StylePath.build("com/fr/plugin/bi/js/hiddenButtons.css"); |
||||
} |
||||
|
||||
public Filter filter() { |
||||
return new Filter(){ |
||||
@Override |
||||
public boolean accept() { |
||||
return true; |
||||
} |
||||
}; |
||||
} |
||||
} |
@ -0,0 +1,19 @@
|
||||
package com.fr.plugin.bi.hidden.buttons.webresporces; |
||||
|
||||
import com.fr.gen.TextGenerator; |
||||
|
||||
import javax.servlet.http.HttpServletRequest; |
||||
import javax.servlet.http.HttpServletResponse; |
||||
|
||||
public class ReportEditClassFile implements TextGenerator { |
||||
|
||||
@Override |
||||
public String text(HttpServletRequest var1, HttpServletResponse var2) throws Exception { |
||||
return "console.log(123);BI.addI18n({\"BI-Design_Target\": \"因子\"});"; |
||||
} |
||||
|
||||
@Override |
||||
public String mimeType() { |
||||
return "text/javascript"; |
||||
} |
||||
} |
@ -0,0 +1,18 @@
|
||||
package com.fr.plugin.bi.hidden.buttons.webresporces; |
||||
|
||||
import com.fr.web.struct.Component; |
||||
import com.fr.web.struct.browser.RequestClient; |
||||
import com.fr.web.struct.category.ScriptPath; |
||||
|
||||
public class ReportEditComponent extends Component { |
||||
|
||||
public static ReportEditComponent KEY = new ReportEditComponent(); |
||||
|
||||
|
||||
|
||||
@Override |
||||
public ScriptPath script(RequestClient requestClient) { |
||||
return ScriptPath.build("com/fr/plugin/bi/js/reportEdit.js"); |
||||
} |
||||
|
||||
} |
@ -0,0 +1,79 @@
|
||||
package com.fr.plugin.bi.hidden.buttons.webresporces; |
||||
|
||||
import com.fr.gen.TextGenerator; |
||||
import com.fr.log.FineLoggerFactory; |
||||
import com.fr.plugin.bi.hidden.buttons.config.ReportButtonConfig; |
||||
import com.fr.plugin.context.PluginContexts; |
||||
|
||||
import javax.servlet.http.HttpServletRequest; |
||||
import javax.servlet.http.HttpServletResponse; |
||||
import java.util.HashMap; |
||||
public class ReportEditCssFile implements TextGenerator { |
||||
|
||||
@Override |
||||
public String text(HttpServletRequest var1, HttpServletResponse var2) throws Exception { |
||||
String cssText = ""; |
||||
String editConfig = ReportButtonConfig.getInstance().getEditBtnConfig(); |
||||
FineLoggerFactory.getLogger().info("editConfig:"+editConfig); |
||||
editConfig = editConfig.replace("{", ""); |
||||
editConfig = editConfig.replace("}", ""); |
||||
String temp[] = editConfig.split(","); |
||||
|
||||
HashMap editMap = new HashMap(); |
||||
|
||||
for (int i = 0; i < temp.length; i++) { |
||||
String[] aa = temp[i].split("="); |
||||
editMap.put(aa[0].trim(),aa[1].trim()); |
||||
FineLoggerFactory.getLogger().info(aa[0].trim()+"="+aa[1].trim()); |
||||
} |
||||
|
||||
if(editMap.get("saveAsBtn").toString().equals("false")){ |
||||
cssText+=".bi-add-dashboard{display: none !important;}\n"; |
||||
} |
||||
if(editMap.get("exportBtn").toString().equals("false")){ |
||||
cssText+=".bi-design-global-export{display: none !important;}\n"; |
||||
} |
||||
if(editMap.get("undoBtn").toString().equals("false")){ |
||||
cssText+=(".dashboard-toolbar > div:nth-child(3) {display: none !important;}"); |
||||
} |
||||
if(editMap.get("redoBtn").toString().equals("false")){ |
||||
cssText+=(".dashboard-toolbar > div:nth-child(4) {display: none !important;}"); |
||||
} |
||||
if(editMap.get("styleBtn").toString().equals("false")){ |
||||
cssText+=".bi-design-template-style{display: none !important;}\n"; |
||||
} |
||||
if(editMap.get("moreBtn").toString().equals("false")){ |
||||
cssText+=".bi-design-more-item{display: none !important;}\n"; |
||||
} |
||||
|
||||
|
||||
if(editMap.get("addCompBtn").toString().equals("false")){ |
||||
cssText+=(".bi-drag-icon-group > div:nth-child(1) > div:nth-child(1) {display: none !important;}"); |
||||
cssText+=(".bi-drag-icon-group > div:nth-child(1) > div:nth-child(2) {display: none !important;}"); |
||||
cssText+=(".bi-drag-icon-group > div:nth-child(1) > div:nth-child(3) {display: none !important;}"); |
||||
} |
||||
|
||||
if(editMap.get("filterCompBtn").toString().equals("false")){ |
||||
cssText+=(".bi-drag-icon-group > div:nth-child(1) > div:nth-child(4) {display: none !important;}"); |
||||
} |
||||
if(editMap.get("otherCompBtn").toString().equals("false")){ |
||||
cssText+=(".bi-drag-icon-group > div:nth-child(1) > div:nth-child(5) {display: none !important;}"); |
||||
} |
||||
if(editMap.get("recoverCompBtn").toString().equals("false")){ |
||||
cssText+=(".bi-drag-icon-group > div:nth-child(1) > div:nth-child(6) {display: none !important;}"); |
||||
} |
||||
|
||||
if(editMap.get("nameAndAddCompBtn").toString().equals("false")){ |
||||
cssText+=(".bi-design-widget-expand > div:nth-child(1) > div:nth-child(1) {display: none !important;}"); |
||||
cssText+=(".bi-design-widget-expand > div:nth-child(1) > div:nth-child(3) {display: none !important;}"); |
||||
} |
||||
|
||||
FineLoggerFactory.getLogger().info("cssText:"+cssText); |
||||
return cssText; |
||||
} |
||||
|
||||
@Override |
||||
public String mimeType() { |
||||
return "text/css"; |
||||
} |
||||
} |
@ -0,0 +1,39 @@
|
||||
package com.fr.plugin.bi.hidden.buttons.webresporces; |
||||
|
||||
|
||||
import com.finebi.conf.internalimp.component.ReportComponent; |
||||
import com.fr.decision.fun.impl.AbstractWebResourceProvider; |
||||
import com.fr.web.struct.Atom; |
||||
import com.fr.web.struct.Component; |
||||
import com.fr.web.struct.category.FileType; |
||||
import com.fr.web.struct.category.ParserType; |
||||
import com.fr.web.struct.category.ScriptPath; |
||||
import com.fr.web.struct.category.StylePath; |
||||
|
||||
public class ReportEditWebResourceProvider extends AbstractWebResourceProvider { |
||||
@Override |
||||
public Atom attach() { |
||||
return ReportComponent.KEY; |
||||
} |
||||
/* |
||||
public Atom[] clients() { |
||||
return new Atom[]{ReportEditComponent.KEY}; |
||||
} |
||||
*/ |
||||
|
||||
@Override |
||||
public Atom client() { |
||||
return new Component() { |
||||
@Override |
||||
public ScriptPath script() { |
||||
return ScriptPath.build(ReportEditClassFile.class.getName(), FileType.CLASS, ParserType.PLAIN); |
||||
} |
||||
@Override |
||||
public StylePath style() { |
||||
return StylePath.build(ReportEditCssFile.class.getName(),FileType.CLASS, ParserType.PLAIN); |
||||
} |
||||
}; |
||||
} |
||||
|
||||
} |
||||
|
@ -0,0 +1,18 @@
|
||||
package com.fr.plugin.bi.hidden.buttons.webresporces; |
||||
|
||||
import com.fr.web.struct.Component; |
||||
import com.fr.web.struct.browser.RequestClient; |
||||
import com.fr.web.struct.category.ScriptPath; |
||||
|
||||
public class ReportViewComponent extends Component { |
||||
|
||||
public static ReportViewComponent KEY = new ReportViewComponent(); |
||||
|
||||
|
||||
|
||||
@Override |
||||
public ScriptPath script(RequestClient requestClient) { |
||||
return ScriptPath.build("com/fr/plugin/bi/js/reportView.js"); |
||||
} |
||||
|
||||
} |
@ -0,0 +1,44 @@
|
||||
package com.fr.plugin.bi.hidden.buttons.webresporces; |
||||
|
||||
import com.fr.gen.TextGenerator; |
||||
import com.fr.log.FineLoggerFactory; |
||||
import com.fr.plugin.bi.hidden.buttons.config.ReportButtonConfig; |
||||
import java.util.HashMap; |
||||
import javax.servlet.http.HttpServletRequest; |
||||
import javax.servlet.http.HttpServletResponse; |
||||
|
||||
public class ReportViewCssFile implements TextGenerator { |
||||
@java.lang.Override |
||||
public java.lang.String text(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse) throws Exception { |
||||
String cssText = ""; |
||||
String viewConfig = ReportButtonConfig.getInstance().getViewBtnConfig(); |
||||
FineLoggerFactory.getLogger().info("viewConfig:"+viewConfig); |
||||
viewConfig = viewConfig.replace("{", ""); |
||||
viewConfig = viewConfig.replace("}", ""); |
||||
String temp[] = viewConfig.split(","); |
||||
|
||||
HashMap editMap = new HashMap(); |
||||
|
||||
for (int i = 0; i < temp.length; i++) { |
||||
String[] aa = temp[i].split("="); |
||||
editMap.put(aa[0].trim(),aa[1].trim()); |
||||
FineLoggerFactory.getLogger().info(aa[0].trim()+"="+aa[1].trim()); |
||||
} |
||||
|
||||
if(editMap.get("saveAsBtn").toString().equals("false")){ |
||||
cssText+=".bi-add-dashboard{display: none !important;}\n"; |
||||
} |
||||
if(editMap.get("exportBtn").toString().equals("false")){ |
||||
cssText+=".bi-design-global-export{display: none !important;}\n"; |
||||
} |
||||
|
||||
FineLoggerFactory.getLogger().info("cssText:"+cssText); |
||||
|
||||
return cssText; |
||||
} |
||||
|
||||
@java.lang.Override |
||||
public java.lang.String mimeType() { |
||||
return "text/css"; |
||||
} |
||||
} |
@ -0,0 +1,36 @@
|
||||
package com.fr.plugin.bi.hidden.buttons.webresporces; |
||||
|
||||
import com.fr.decision.fun.impl.AbstractWebResourceProvider; |
||||
import com.finebi.conf.internalimp.component.ShowComponent; |
||||
import com.fr.web.struct.Atom; |
||||
import com.fr.web.struct.Component; |
||||
import com.fr.web.struct.category.FileType; |
||||
import com.fr.web.struct.category.ParserType; |
||||
import com.fr.web.struct.category.ScriptPath; |
||||
import com.fr.web.struct.category.StylePath; |
||||
|
||||
public class ReportViewWebResourceProvider extends AbstractWebResourceProvider { |
||||
@Override |
||||
public Atom attach() { |
||||
return ShowComponent.KEY; |
||||
} |
||||
|
||||
/* |
||||
public Atom[] clients() { |
||||
return new Atom[]{ReportViewComponent.KEY}; |
||||
} |
||||
|
||||
*/ |
||||
|
||||
@Override |
||||
public Atom client() { |
||||
return new Component() { |
||||
|
||||
@Override |
||||
public StylePath style() { |
||||
return StylePath.build(ReportViewCssFile.class.getName(),FileType.CLASS, ParserType.PLAIN); |
||||
} |
||||
}; |
||||
} |
||||
|
||||
} |
@ -0,0 +1,4 @@
|
||||
.setting-font1 .b-font:before,.setting-font1.disabled .b-font:before { |
||||
content: "\e632"; |
||||
color: inherit |
||||
} |
@ -0,0 +1,390 @@
|
||||
; (function () { |
||||
console.log("加载隐藏按钮配置JS。。。。") |
||||
BI.addI18n({"BI-Design_Target": "因子"}); |
||||
|
||||
//扩展菜单,增加用户授权菜单
|
||||
BI.config("dec.provider.management", function (provider) { |
||||
provider.inject({ |
||||
modules: [ |
||||
{ |
||||
value: "hidden-buttons-config", //显示再浏览上的hash值
|
||||
id: "bi-hidden-buttons-menuid", |
||||
text: '隐藏按钮管理', |
||||
cardType: "gb.bi.hidden.buttons.config.main", |
||||
// iconCls: "management-user-role-font",
|
||||
cls: "setting-font1", |
||||
$testId: "bi-hidden-buttons-menuid" |
||||
|
||||
} |
||||
] |
||||
}); |
||||
}); |
||||
|
||||
|
||||
|
||||
var e = BI.inherit(BI.Widget, { |
||||
mounted: function () { |
||||
var t = this; |
||||
console.log("加载完成...") |
||||
$.ajax({ |
||||
url: Dec.fineServletURL + "/getReportConfig", |
||||
contentType: "application/json", |
||||
success: function (res) { |
||||
console.log("getFrontSeed:" + JSON.stringify(res)) |
||||
var editConfig = res.data.map.edit; |
||||
editConfig = editConfig.replace("{","") |
||||
editConfig = editConfig.replace("}","") |
||||
var temp = editConfig.split(","); |
||||
for(var i = 0 ; i < temp.length;i++){ |
||||
var aa = temp[i].split("="); |
||||
var comp = t.editCompMap[aa[0].trim()]; |
||||
if(aa[1].trim() == "true"){ |
||||
comp.setSelected(true) |
||||
} |
||||
else{ |
||||
comp.setSelected(false) |
||||
} |
||||
} |
||||
var viewConfig = res.data.map.view; |
||||
viewConfig = viewConfig.replace("{","") |
||||
viewConfig = viewConfig.replace("}","") |
||||
temp = viewConfig.split(","); |
||||
for(var i = 0 ; i < temp.length;i++){ |
||||
var aa = temp[i].split("="); |
||||
var comp = t.viewCompMap[aa[0].trim()]; |
||||
if(aa[1].trim() == "true"){ |
||||
comp.setSelected(true) |
||||
} |
||||
else{ |
||||
comp.setSelected(false) |
||||
} |
||||
} |
||||
|
||||
}, |
||||
}); |
||||
}, |
||||
getEditValues:function(){ |
||||
var t = this; |
||||
var aa = {}; |
||||
var editCompMap = t.editCompMap; |
||||
for(var key in editCompMap){ |
||||
var comp = editCompMap[key]; |
||||
aa[key] = comp.isSelected(); |
||||
} |
||||
return aa; |
||||
}, |
||||
getViewValue:function(){ |
||||
var t = this; |
||||
var aa = {}; |
||||
var viewCompMap = t.viewCompMap; |
||||
for(var key in viewCompMap){ |
||||
var comp = viewCompMap[key]; |
||||
aa[key] = comp.isSelected(); |
||||
} |
||||
return aa; |
||||
}, |
||||
render: function () { |
||||
var t = this; |
||||
if(t.editCompMap == undefined){ |
||||
t.editCompMap = {}; |
||||
} |
||||
if(t.viewCompMap == undefined){ |
||||
t.viewCompMap = {}; |
||||
} |
||||
|
||||
|
||||
|
||||
return { |
||||
type: "bi.vtape", |
||||
tgap:20, |
||||
items: [ |
||||
{ |
||||
type: "bi.vertical_adapt", |
||||
cls: "bi-card bi-border-bottom bi-font-bold", |
||||
items: [{ |
||||
type: "bi.label", |
||||
text: '报表编辑界面配置:', |
||||
textAlign: "left", |
||||
hgap: 10 |
||||
}], |
||||
height: 30 |
||||
}, |
||||
{ |
||||
type: "bi.vertical_adapt", |
||||
cls: "bi-card bi-border-bottom bi-font-bold", |
||||
height: 30, |
||||
items: [ |
||||
{ |
||||
type: "bi.label", |
||||
text: ' ', |
||||
textAlign: "left", |
||||
hgap: 10 |
||||
}, |
||||
{ |
||||
type: "bi.flex_horizontal", |
||||
items: [ |
||||
{ |
||||
el: { |
||||
type: "bi.multi_select_item", |
||||
text: "另存为按钮", |
||||
logic: { |
||||
dynamic: true |
||||
}, |
||||
ref: function (e) { |
||||
//t.saveAsBtn = e
|
||||
t.editCompMap["saveAsBtn"] = e; |
||||
} |
||||
} |
||||
}, |
||||
{ |
||||
el: { |
||||
type: "bi.multi_select_item", |
||||
text: "导出按钮", |
||||
logic: { |
||||
dynamic: true |
||||
}, |
||||
ref: function (e) { |
||||
//t.exportBtn = e
|
||||
// t.editCompArray[1] = e;
|
||||
t.editCompMap["exportBtn"] = e; |
||||
} |
||||
} |
||||
}, |
||||
{ |
||||
el: { |
||||
type: "bi.multi_select_item", |
||||
text: "撤销按钮", |
||||
logic: { |
||||
dynamic: true |
||||
}, |
||||
ref: function (e) { |
||||
//t.chexiaoBtn = e
|
||||
// t.editCompArray[2] = e;
|
||||
t.editCompMap["undoBtn"] = e; |
||||
} |
||||
} |
||||
}, |
||||
{ |
||||
el: { |
||||
type: "bi.multi_select_item", |
||||
text: "还原按钮", |
||||
logic: { |
||||
dynamic: true |
||||
} |
||||
, |
||||
ref: function (e) { |
||||
t.editCompMap["redoBtn"] = e; |
||||
} |
||||
} |
||||
}, |
||||
{ |
||||
el: { |
||||
type: "bi.multi_select_item", |
||||
text: "仪表板样式按钮", |
||||
logic: { |
||||
dynamic: true |
||||
}, |
||||
ref: function (e) { |
||||
t.editCompMap["styleBtn"] = e; |
||||
} |
||||
|
||||
} |
||||
}, |
||||
{ |
||||
el: { |
||||
type: "bi.multi_select_item", |
||||
text: "更多按钮", |
||||
logic: { |
||||
dynamic: true |
||||
}, |
||||
ref: function (e) { |
||||
t.editCompMap["moreBtn"] = e; |
||||
} |
||||
} |
||||
} |
||||
] |
||||
} |
||||
], |
||||
}, |
||||
{ |
||||
type: "bi.vertical_adapt", |
||||
cls: "bi-card bi-border-bottom bi-font-bold", |
||||
height: 30, |
||||
items: [ |
||||
{ |
||||
type: "bi.label", |
||||
text: ' ', |
||||
textAlign: "left", |
||||
hgap: 10 |
||||
}, |
||||
{ |
||||
type: "bi.flex_horizontal", |
||||
items: [ |
||||
{ |
||||
el: { |
||||
type: "bi.multi_select_item", |
||||
text: "组件按钮", |
||||
logic: { |
||||
dynamic: true |
||||
} |
||||
, |
||||
ref: function (e) { |
||||
t.editCompMap["addCompBtn"] = e; |
||||
} |
||||
} |
||||
}, |
||||
{ |
||||
el: { |
||||
type: "bi.multi_select_item", |
||||
text: "过滤组件按钮", |
||||
logic: { |
||||
dynamic: true |
||||
} |
||||
, |
||||
ref: function (e) { |
||||
t.editCompMap["filterCompBtn"] = e; |
||||
} |
||||
} |
||||
}, |
||||
{ |
||||
el: { |
||||
type: "bi.multi_select_item", |
||||
text: "其他按钮", |
||||
logic: { |
||||
dynamic: true |
||||
} |
||||
, |
||||
ref: function (e) { |
||||
t.editCompMap["otherCompBtn"] = e; |
||||
} |
||||
} |
||||
}, |
||||
{ |
||||
el: { |
||||
type: "bi.multi_select_item", |
||||
text: "复用按钮", |
||||
logic: { |
||||
dynamic: true |
||||
}, |
||||
ref: function (e) { |
||||
t.editCompMap["recoverCompBtn"] = e; |
||||
} |
||||
} |
||||
}, |
||||
{ |
||||
el: { |
||||
type: "bi.multi_select_item", |
||||
text: "组件名称与新建", |
||||
logic: { |
||||
dynamic: true |
||||
}, |
||||
ref: function (e) { |
||||
t.editCompMap["nameAndAddCompBtn"] = e; |
||||
} |
||||
} |
||||
}, |
||||
] |
||||
} |
||||
], |
||||
}, |
||||
{ |
||||
type: "bi.vertical_adapt", |
||||
cls: "bi-card bi-border-bottom bi-font-bold", |
||||
items: [{ |
||||
type: "bi.label", |
||||
text: '报表预览界面配置:', |
||||
textAlign: "left", |
||||
hgap: 10 |
||||
}], |
||||
height: 30 |
||||
}, |
||||
{ |
||||
type: "bi.vertical_adapt", |
||||
cls: "bi-card bi-border-bottom bi-font-bold", |
||||
height: 30, |
||||
items: [ |
||||
{ |
||||
type: "bi.label", |
||||
text: ' ', |
||||
textAlign: "left", |
||||
hgap: 10 |
||||
}, |
||||
{ |
||||
type: "bi.flex_horizontal", |
||||
items: [ |
||||
{ |
||||
el: { |
||||
type: "bi.multi_select_item", |
||||
text: "另存为按钮", |
||||
logic: { |
||||
dynamic: true |
||||
}, |
||||
ref: function (e) { |
||||
// t.saveAsBtn1 = e
|
||||
|
||||
t.viewCompMap["saveAsBtn"] = e; |
||||
} |
||||
} |
||||
}, |
||||
{ |
||||
el: { |
||||
type: "bi.multi_select_item", |
||||
text: "导出按钮", |
||||
logic: { |
||||
dynamic: true |
||||
}, |
||||
ref: function (e) { |
||||
|
||||
t.viewCompMap["exportBtn"] = e; |
||||
} |
||||
} |
||||
}, |
||||
|
||||
] |
||||
} |
||||
], |
||||
}, |
||||
{ |
||||
type: "bi.right_vertical_adapt", |
||||
rgap: 30, |
||||
height: 30, |
||||
items: [ |
||||
{ |
||||
type: "bi.button", |
||||
|
||||
text: '保存',//BI.i18nText("BI-Basic_Sure"),
|
||||
//once: true,
|
||||
handler: function () { |
||||
t.saveResult() |
||||
} |
||||
} |
||||
] |
||||
} |
||||
] |
||||
} |
||||
}, |
||||
|
||||
saveResult: function () { |
||||
var editConf = this.getEditValues(); |
||||
var viewConf = this.getViewValue(); |
||||
|
||||
$.ajax({ |
||||
url: Dec.fineServletURL + "/saveReportConfig", |
||||
type: 'POST', |
||||
contentType: "application/json; charset=utf-8", |
||||
data: JSON.stringify({ "jsonParam": JSON.stringify({"edit":editConf,"view":viewConf}) }), |
||||
success: function (res) { |
||||
console.log("res:" + JSON.stringify(res)) |
||||
|
||||
BI.Msg.toast("保存成功", { |
||||
level: "success" |
||||
}); |
||||
}, |
||||
}); |
||||
console.log("sss") |
||||
} |
||||
}); |
||||
BI.shortcut("gb.bi.hidden.buttons.config.main", e) |
||||
|
||||
|
||||
})(); |
@ -0,0 +1,508 @@
|
||||
; (function () { |
||||
console.log("加载仪表板编辑JS。。。。") |
||||
BI.addI18n({"BI-Design_Target": "因子"}); |
||||
|
||||
var toolbarClassName = "dashboard-toolbar"; |
||||
var verticalToolBarClassName = "bi-h-o"; |
||||
|
||||
var editConfigMap = {}; |
||||
$.ajax({ |
||||
url: BI.fineServletURL + "/getReportConfig", |
||||
contentType: "application/json", |
||||
//async:false,
|
||||
success: function (res) { |
||||
console.log("getFrontSeed:" + JSON.stringify(res)) |
||||
var editConfig = res.data.map.edit; |
||||
editConfig = editConfig.replace("{", "") |
||||
editConfig = editConfig.replace("}", "") |
||||
var temp = editConfig.split(","); |
||||
for (var i = 0; i < temp.length; i++) { |
||||
var aa = temp[i].split("="); |
||||
editConfigMap[aa[0].trim()] = aa[1].trim(); |
||||
} |
||||
|
||||
var flag1 = setInterval(() => { |
||||
var pname = "." + toolbarClassName + " >div"; |
||||
var toolbar = $(pname) |
||||
if (toolbar != undefined) { |
||||
$(pname).each(function (index) { |
||||
var comp = $(this); |
||||
if (editConfigMap["saveAsBtn"] == "false" && index == 0) { |
||||
comp.hide(); |
||||
} |
||||
if (editConfigMap["exportBtn"] == "false" && index == 1) { |
||||
comp.hide(); |
||||
} |
||||
if (editConfigMap["undoBtn"] == "false" && index == 2) { |
||||
comp.hide(); |
||||
} |
||||
if (editConfigMap["redoBtn"] == "false" && index == 3) { |
||||
comp.hide(); |
||||
} |
||||
if (editConfigMap["styleBtn"] == "false" && index == 5) { |
||||
comp.hide(); |
||||
} |
||||
if (editConfigMap["moreBtn"] == "false" && index == 6) { |
||||
comp.hide(); |
||||
} |
||||
console.log("comp:" + comp) |
||||
}); |
||||
clearInterval(flag1); |
||||
} |
||||
|
||||
}, 10); |
||||
|
||||
|
||||
var flag2 = setInterval(() => { |
||||
var pname1 = "." + verticalToolBarClassName + " ."+verticalToolBarClassName; |
||||
var pcomp = $(pname1)[0]; |
||||
console.log("pcomp:" + pcomp) |
||||
var children = pcomp.children; |
||||
if(children.length == 6){ |
||||
if (editConfigMap["addCompBtn"] == "false") { |
||||
$(children[0]).hide(); |
||||
$(children[1]).hide(); |
||||
$(children[2]).hide(); |
||||
} |
||||
if (editConfigMap["filterCompBtn"] == "false") { |
||||
$(children[3]).hide(); |
||||
} |
||||
if (editConfigMap["otherCompBtn"] == "false") { |
||||
$(children[4]).hide(); |
||||
} |
||||
if (editConfigMap["recoverCompBtn"] == "false") { |
||||
$(children[5]).hide(); |
||||
} |
||||
clearInterval(flag2) |
||||
} |
||||
|
||||
}, 10); |
||||
|
||||
}, |
||||
}); |
||||
|
||||
/* |
||||
var He = function (e) { |
||||
var t, i; |
||||
function n() { |
||||
for (var t, i = arguments.length, n = new Array(i), o = 0; o < i; o++) |
||||
n[o] = arguments[o]; |
||||
return (t = e.call.apply(e, [this].concat(n)) || this).props = { |
||||
baseCls: "dashboard-toolbar", |
||||
leftItems: [], |
||||
rightItems: [] |
||||
}, |
||||
t |
||||
} |
||||
return i = e, |
||||
(t = n).prototype = Object.create(i.prototype), |
||||
t.prototype.constructor = t, |
||||
//P(t, i),
|
||||
|
||||
n.prototype.render = function () { |
||||
|
||||
var leftItems = this.options.leftItems; |
||||
console.log("leftItems:" + leftItems) |
||||
var newLeftItems = []; |
||||
|
||||
if (editConfigMap["saveAsBtn"] == "true") { |
||||
newLeftItems.push(leftItems[0]); |
||||
} |
||||
if (editConfigMap["exportBtn"] == "true") { |
||||
newLeftItems.push(leftItems[1]); |
||||
} |
||||
if (editConfigMap["undoBtn"] == "true") { |
||||
newLeftItems.push(leftItems[2]); |
||||
} |
||||
if (editConfigMap["redoBtn"] == "true") { |
||||
newLeftItems.push(leftItems[3]); |
||||
} |
||||
|
||||
var t1 = BI.Providers.getProvider("bi.provider.dashboard_toolbar").getItems(); |
||||
console.log("t1:" + t1) |
||||
var newT = []; |
||||
if (editConfigMap["styleBtn"] == "true") { |
||||
newT.push(t1[0]); |
||||
//newT[0].type = "bi.design.template.style1";
|
||||
} |
||||
if (editConfigMap["moreBtn"] == "true") { |
||||
newT.push(t1[1]); |
||||
} |
||||
var as = BI.concat(newLeftItems, newT); |
||||
|
||||
var e = this.options |
||||
, t = newLeftItems |
||||
, i = this.options.rightItems |
||||
, n = as |
||||
, o = BI.concat(BI.Providers.getProvider("bi.provider.dashboard_toolbar").getRightItems(), i); |
||||
return { |
||||
type: BI.LeftRightVerticalAdaptLayout.xtype, |
||||
cls: "bi-border-bottom bi-card dashboard-toolbar", |
||||
items: { |
||||
left: BI.map(n, (function (e, t) { |
||||
return BI.extend({ |
||||
type: BI.IconTextItem.xtype, |
||||
extraCls: "bi-list-item", |
||||
height: 25, |
||||
textRgap: 5 |
||||
}, t) |
||||
} |
||||
)), |
||||
right: BI.map(o, (function (e, t) { |
||||
return BI.extend({ |
||||
type: BI.IconTextItem.xtype, |
||||
extraCls: "bi-list-item", |
||||
height: 25, |
||||
textRgap: 5 |
||||
}, t) |
||||
} |
||||
)) |
||||
}, |
||||
height: 35, |
||||
lrgap: 40, |
||||
rlgap: 30 |
||||
} |
||||
} |
||||
, |
||||
n |
||||
}(BI.Widget) |
||||
He.xtype = "bi.widget.dashboard.toolbar1"; |
||||
BI.shortcut('bi.widget.dashboard.toolbar1', He); |
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
BI.config("bi.widget.dashboard.toolbar", function (options) { |
||||
options.type = "bi.widget.dashboard.toolbar1"; // 将组件的type替换为自定义的组件
|
||||
return options; |
||||
}); |
||||
|
||||
|
||||
var c40336 = function () { |
||||
var t, e, i, n, o, s; |
||||
t = 60, |
||||
e = 1, |
||||
i = 80, |
||||
n = 36, |
||||
o = { |
||||
CONTROL: "control", |
||||
SPECIAL: "special", |
||||
REUSE: "reuse" |
||||
}, |
||||
s = BI.inherit(BI.Widget, { |
||||
props: { |
||||
baseCls: "bi-drag-icon-group bi-card bi-border-right", |
||||
width: BICst.DRAG_TOOLBAR_WIDTH, |
||||
drag: BI.emptyFn, |
||||
stop: BI.emptyFn, |
||||
helper: BI.emptyFn, |
||||
isGeneralQueryExist: !1 |
||||
}, |
||||
|
||||
render: function () { |
||||
var i = this.options |
||||
, n = BI.Services.getService("bi.service.design.fit"); |
||||
|
||||
var childitems = [ |
||||
{ |
||||
type: "bi.design.fit.drag_icon_button", |
||||
value: n.getDefaultWidgetType(), |
||||
cls: "add-chart-font add-widget-button icon-size-24 bi-border", |
||||
$testId: "bi-component-drag-group-add-widget", |
||||
$value: "button", |
||||
width: 24, |
||||
height: 24, |
||||
tgap: 32, |
||||
drag: i.drag, |
||||
stop: i.stop, |
||||
helper: i.helper |
||||
}, |
||||
{ |
||||
el: { |
||||
type: "bi.label", |
||||
text: BI.i18nText("BI-Design_Widget") |
||||
}, |
||||
tgap: 18, |
||||
bgap: 30 |
||||
}, |
||||
{ |
||||
type: "bi.center_adapt", |
||||
height: 1, |
||||
items: [{ |
||||
type: "bi.label", |
||||
height: e, |
||||
width: t, |
||||
cls: "bi-border-bottom" |
||||
}] |
||||
}, |
||||
this._createControlWidgetCombo(), |
||||
this._createSpecialWidgetCombo(), |
||||
this._createReuseCombo() |
||||
]; |
||||
|
||||
var newChildItems = []; |
||||
if (editConfigMap["addCompBtn"] == "true") { |
||||
newChildItems.push({ |
||||
type: "bi.design.fit.drag_icon_button", |
||||
value: n.getDefaultWidgetType(), |
||||
cls: "add-chart-font add-widget-button icon-size-24 bi-border", |
||||
$testId: "bi-component-drag-group-add-widget", |
||||
$value: "button", |
||||
width: 24, |
||||
height: 24, |
||||
tgap: 32, |
||||
drag: i.drag, |
||||
stop: i.stop, |
||||
helper: i.helper |
||||
}) |
||||
newChildItems.push(childitems[1]) |
||||
newChildItems.push({ |
||||
type: "bi.center_adapt", |
||||
height: 1, |
||||
items: [{ |
||||
type: "bi.label", |
||||
height: e, |
||||
width: t, |
||||
cls: "bi-border-bottom" |
||||
}] |
||||
}) |
||||
} |
||||
if (editConfigMap["filterCompBtn"] == "true") { |
||||
newChildItems.push(this._createControlWidgetCombo()) |
||||
} |
||||
if (editConfigMap["otherCompBtn"] == "true") { |
||||
newChildItems.push(this._createSpecialWidgetCombo()) |
||||
} |
||||
if (editConfigMap["recoverCompBtn"] == "true") { |
||||
newChildItems.push(this._createReuseCombo()) |
||||
} |
||||
|
||||
// childitems = [];
|
||||
|
||||
return { |
||||
type: "bi.horizontal_auto", |
||||
items: [ |
||||
{ |
||||
type: "bi.horizontal_auto", |
||||
width: i.width, |
||||
height: "100%", |
||||
scrolly: !0, |
||||
items: newChildItems |
||||
}] |
||||
} |
||||
}, |
||||
_createControlWidgetCombo: function () { |
||||
var t = this |
||||
, e = this.options; |
||||
return { |
||||
type: "bi.combo", |
||||
cls: "expander-combo", |
||||
direction: "right,top", |
||||
isNeedAdjustHeight: !1, |
||||
isNeedAdjustWidth: !1, |
||||
ref: function (e) { |
||||
t.controlCombo = e |
||||
}, |
||||
listeners: [{ |
||||
eventName: BI.Combo.EVENT_BEFORE_POPUPVIEW, |
||||
action: function () { |
||||
t.control.refresh(), |
||||
t.control.setHeight(t.element.height()) |
||||
} |
||||
}, { |
||||
eventName: BI.Combo.EVENT_BEFORE_HIDEVIEW, |
||||
action: function () { |
||||
t.controlButton.setSelected(!1) |
||||
} |
||||
}], |
||||
el: { |
||||
type: "bi.design.fit.widget_chooser.control_trigger", |
||||
cls: "bi-list-item-effect drag-icon-button-text add-control-widget-font icon-size-24", |
||||
$testId: "bi-design-fit-widget-chooser-control-trigger", |
||||
value: o.CONTROL, |
||||
text: BI.i18nText("BI-Design_Control_Widget"), |
||||
height: i, |
||||
ref: function (e) { |
||||
t.controlButton = e |
||||
} |
||||
}, |
||||
tgap: 20, |
||||
bgap: 20, |
||||
popup: { |
||||
tgap: n, |
||||
cls: "combo-shadow", |
||||
el: { |
||||
type: "bi.control.widget.pane", |
||||
drag: function (i, n, o) { |
||||
e.drag.apply(t, [i, n, o, t.controlCombo]) |
||||
}, |
||||
stop: function (i, n, o, s) { |
||||
e.stop.apply(t, [i, n, o, s, t.controlCombo]) |
||||
}, |
||||
helper: e.helper, |
||||
ref: function (e) { |
||||
t.control = e |
||||
}, |
||||
isGeneralQueryExistGetter: e.isGeneralQueryExistGetter, |
||||
isQueryControlExistGetter: e.isQueryControlExistGetter, |
||||
isResetControlExistGetter: e.isResetControlExistGetter |
||||
} |
||||
} |
||||
} |
||||
}, |
||||
_createSpecialWidgetCombo: function () { |
||||
var t = this |
||||
, e = this.options; |
||||
return { |
||||
type: "bi.combo", |
||||
cls: "expander-combo", |
||||
direction: "right,top", |
||||
isNeedAdjustHeight: !1, |
||||
isNeedAdjustWidth: !1, |
||||
ref: function (e) { |
||||
t.specialCombo = e |
||||
}, |
||||
listeners: [{ |
||||
eventName: BI.Combo.EVENT_BEFORE_POPUPVIEW, |
||||
action: function () { |
||||
t.speical.setHeight(t.element.height()) |
||||
} |
||||
}, { |
||||
eventName: BI.Combo.EVENT_BEFORE_HIDEVIEW, |
||||
action: function () { |
||||
t.specialButton.setSelected(!1) |
||||
} |
||||
}], |
||||
el: { |
||||
type: "bi.design.fit.widget_chooser.control_trigger", |
||||
cls: "bi-list-item-effect drag-icon-button-text add-other-widget-font icon-size-24", |
||||
value: o.OTHER, |
||||
height: i, |
||||
text: BI.i18nText("BI-Basic_Other"), |
||||
ref: function (e) { |
||||
t.specialButton = e |
||||
} |
||||
}, |
||||
tgap: 20, |
||||
bgap: 20, |
||||
popup: { |
||||
tgap: n, |
||||
minWidth: 60, |
||||
cls: "combo-shadow", |
||||
el: { |
||||
type: "bi.special.widget.pane", |
||||
drag: function (i, n, o) { |
||||
e.drag.apply(t, [i, n, o, t.specialCombo]) |
||||
}, |
||||
stop: function (i, n, o, s) { |
||||
e.stop.apply(t, [i, n, o, s, t.specialCombo]) |
||||
}, |
||||
helper: e.helper, |
||||
ref: function (e) { |
||||
t.speical = e |
||||
} |
||||
} |
||||
} |
||||
} |
||||
}, |
||||
_createReuseCombo: function () { |
||||
var t = this |
||||
, e = this.options; |
||||
return { |
||||
type: "bi.combo", |
||||
cls: "expander-combo", |
||||
direction: "right,top", |
||||
ref: function (e) { |
||||
t.reuseCombo = e |
||||
}, |
||||
isNeedAdjustWidth: !1, |
||||
isNeedAdjustHeight: !1, |
||||
listeners: [{ |
||||
eventName: BI.Combo.EVENT_BEFORE_POPUPVIEW, |
||||
action: function () { |
||||
t.reuse.setHeight(t.element.height()) |
||||
} |
||||
}, { |
||||
eventName: BI.Combo.EVENT_BEFORE_HIDEVIEW, |
||||
action: function () { |
||||
t.reuseButton.setSelected(!1) |
||||
} |
||||
}], |
||||
el: { |
||||
type: "bi.design.fit.widget_chooser.control_trigger", |
||||
cls: "bi-list-item-effect drag-icon-button-text add-reuse-widget-font icon-size-24", |
||||
height: i, |
||||
text: BI.i18nText("BI-Design_Reuse"), |
||||
title: BI.i18nText("BI-Design_Reuse_Control_Widget_Or_Widget"), |
||||
value: o.REUSE, |
||||
ref: function (e) { |
||||
t.reuseButton = e |
||||
}, |
||||
$point: BICst.POINT.DESIGN_REUSE_BUTTON |
||||
}, |
||||
tgap: 20, |
||||
bgap: 20, |
||||
popup: { |
||||
stopPropagation: !1, |
||||
cls: "combo-shadow", |
||||
tgap: n, |
||||
height: "100%", |
||||
minWidth: 240, |
||||
width: 240, |
||||
logic: { |
||||
dynamic: !1 |
||||
}, |
||||
el: { |
||||
type: "bi.resizable_container", |
||||
height: "100%", |
||||
width: 240, |
||||
minSize: 240, |
||||
maxSize: 360, |
||||
broadCastResize: !1, |
||||
direction: "e", |
||||
content: { |
||||
type: "bi.reuse.pane", |
||||
templateHelper: this.options.templateHelper, |
||||
drag: function (i, n, o) { |
||||
e.drag.apply(t, [i, n, o, t.reuseCombo]) |
||||
}, |
||||
stop: function (i, n, o, s) { |
||||
e.stop.apply(t, [i, n, o, s, t.reuseCombo]) |
||||
}, |
||||
helper: e.helper, |
||||
ref: function (e) { |
||||
t.reuse = e |
||||
} |
||||
}, |
||||
resize: BI.bind(this._resizePopup, this), |
||||
ref: function (e) { |
||||
t.resizeContainer = e |
||||
} |
||||
} |
||||
} |
||||
} |
||||
}, |
||||
_resizePopup: function (t) { |
||||
this.reuseCombo.resetListWidth(t), |
||||
this.resizeContainer.setWidth(t) |
||||
}, |
||||
hidePopup: function () { |
||||
this.controlCombo.hideView(), |
||||
this.specialCombo.hideView() |
||||
} |
||||
}), |
||||
BI.shortcut("bi.component.drag.group1", s) |
||||
}; |
||||
|
||||
c40336(); |
||||
|
||||
BI.config("bi.component.drag.group", function (options) { |
||||
options.type = "bi.component.drag.group1";
|
||||
return options; |
||||
}); |
||||
*/ |
||||
|
||||
|
||||
})(); |
@ -0,0 +1,101 @@
|
||||
; (function () { |
||||
console.log("加载仪表板预览JS。。。。") |
||||
BI.addI18n({"BI-Design_Target": "因子"}); |
||||
|
||||
var viewConfigMap = {}; |
||||
$.ajax({ |
||||
url: BI.fineServletURL + "/getReportConfig", |
||||
contentType: "application/json", |
||||
async: false, |
||||
success: function (res) { |
||||
console.log("getFrontSeed:" + JSON.stringify(res)) |
||||
var viewConfig = res.data.map.view; |
||||
viewConfig = viewConfig.replace("{", "") |
||||
viewConfig = viewConfig.replace("}", "") |
||||
var temp = viewConfig.split(","); |
||||
for (var i = 0; i < temp.length; i++) { |
||||
var aa = temp[i].split("="); |
||||
viewConfigMap[aa[0].trim()] = aa[1].trim(); |
||||
} |
||||
}, |
||||
}); |
||||
|
||||
var He = function (e) { |
||||
var t, i; |
||||
function n() { |
||||
for (var t, i = arguments.length, n = new Array(i), o = 0; o < i; o++) |
||||
n[o] = arguments[o]; |
||||
return (t = e.call.apply(e, [this].concat(n)) || this).props = { |
||||
baseCls: "dashboard-toolbar", |
||||
leftItems: [], |
||||
rightItems: [] |
||||
}, |
||||
t |
||||
} |
||||
return i = e, |
||||
(t = n).prototype = Object.create(i.prototype), |
||||
t.prototype.constructor = t, |
||||
|
||||
n.prototype.render = function () { |
||||
|
||||
var newLeftItems = []; |
||||
var leftItems = this.options.leftItems; |
||||
console.log("leftItems:" + leftItems) |
||||
if (viewConfigMap["saveAsBtn"] == "true") { |
||||
newLeftItems.push(leftItems[0]) |
||||
} |
||||
if (viewConfigMap["exportBtn"] == "true") { |
||||
newLeftItems.push(leftItems[1]) |
||||
} |
||||
//leftItems = [];
|
||||
var t1 = BI.Providers.getProvider("bi.provider.dashboard_toolbar").getItems(); |
||||
console.log("t1:" + t1) |
||||
|
||||
var e = this.options |
||||
, t = newLeftItems |
||||
, i = this.options.rightItems |
||||
, n = BI.concat(t, t1) |
||||
, o = BI.concat(BI.Providers.getProvider("bi.provider.dashboard_toolbar").getRightItems(), i); |
||||
return { |
||||
type: BI.LeftRightVerticalAdaptLayout.xtype, |
||||
cls: "bi-border-bottom bi-card dashboard-toolbar", |
||||
items: { |
||||
left: BI.map(n, (function (e, t) { |
||||
return BI.extend({ |
||||
type: BI.IconTextItem.xtype, |
||||
extraCls: "bi-list-item", |
||||
height: 25, |
||||
textRgap: 5 |
||||
}, t) |
||||
} |
||||
)), |
||||
right: BI.map(o, (function (e, t) { |
||||
return BI.extend({ |
||||
type: BI.IconTextItem.xtype, |
||||
extraCls: "bi-list-item", |
||||
height: 25, |
||||
textRgap: 5 |
||||
}, t) |
||||
} |
||||
)) |
||||
}, |
||||
height: 35, |
||||
lrgap: 40, |
||||
rlgap: 30 |
||||
} |
||||
} |
||||
, |
||||
n |
||||
}(BI.Widget) |
||||
He.xtype = "bi.widget.dashboard.toolbar2"; |
||||
BI.shortcut('bi.widget.dashboard.toolbar2', He); |
||||
|
||||
|
||||
|
||||
|
||||
BI.config("bi.widget.dashboard.toolbar", function (options) { |
||||
options.type = "bi.widget.dashboard.toolbar2"; // 将组件的type替换为自定义的组件
|
||||
return options; |
||||
}); |
||||
|
||||
})(); |
Loading…
Reference in new issue