Compare commits

...

5 Commits

  1. 2
      build.xml
  2. 2
      pom.xml
  3. 14
      src/main/resources/com/fr/plugin/pack/req.js

2
build.xml

@ -93,7 +93,7 @@
<antcall target="jar_classes">
<param name="jar_name" value="${plugin-jar}"/>
</antcall>
<delete dir="${classes}"/>
<!-- <delete dir="${classes}"/>-->
</target>
<target name="jar" depends="super_jar">

2
pom.xml

@ -53,7 +53,7 @@
</plugin>
</plugins>
<outputDirectory>
/Users/jonas/Desktop/代码/FineBI5.1/env/WebReport/WEB-INF/plugins/plugin-com.fr.plugin.pack.request-0.0.1/classes
/Users/leezerofly/env/direct-bi/WEB-INF/plugins/plugin-com.fr.plugin.pack.request-0.0.1/classes
</outputDirectory>
</build>

14
src/main/resources/com/fr/plugin/pack/req.js

@ -11,11 +11,14 @@
// 防抖机制,0.3s无新的data请求,才打包向后端发送。
var requestFunc = BI.debounce(function (config) {
if (count < 6) {
if (count < 2) {
// 发送请求时小于6则不打包,还跟之前的一样发
BI.each(handlers, function (wId, handler) {
handler.next(config);
});
widgets = {};
handlers = {};
count = 0;
} else {
BI.asyncAjax({
url: "widgets/data",
@ -34,14 +37,15 @@
});
});
},
complete: BI.emptyFn,
complete: function () {
widgets = {};
handlers = {};
count = 0;
},
opt: {},
version: "url"
});
}
widgets = {};
handlers = {};
count = 0;
}, 300);
// 不通过改写bi组件的方式去做,工作量太大且可维护性太差。使用巧妙的办法,直接通过拦截所有data请求,将其打包成一个请求发送到后端。

Loading…
Cancel
Save