1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465 |
- /**
- * 加载表达式所需依赖
- * @author hjh
- */
- (function () {
- //依赖检查
- if (typeof jQuery === 'undefined') {
- console.error('错误:此组件需要jQuery,但是jQuery没有被加载。');
- }
- /**判断当前页面是否是HRS运行界面 */
- function IsRunningPage() {
- let win = window;
- do {
- if (win.HrsPage != null) {
- return true;
- } else {
- win = win.parent;
- }
- } while (win !== window.top);
- return false;
- }
- /**
- * 加载所需的依赖
- * */
- function LoadDependency(basePath) {
- //引入自身的依赖
- Import(basePath + "css/ExpressEditor.css", true);
- if (!IsRunningPage() || (typeof g_needLoadzlExpressEditor != 'undefined' && g_needLoadzlExpressEditor == true)) {
- Import(basePath + "monaco-editor/min/vs/loader.min.js");
- }
- Import(basePath + "js/EnvironmentHelper.js");
- Import(basePath + "js/ExpressExecutor.js");
- Import(basePath + "singleRowModel/SingleRowEditor.js");
- }
- /**
- * 导入JS
- * @param {any} url
- */
- function Import(url, isCss) {
- $.ajax({
- type: "GET",
- url: url,
- async: false,
- success: (res) => {
- if (isCss) {
- let $style = $(`<style type="text/css">${res}</style>`);
- $("head").append($style);
- }
- }
- });
- }
- //加载依赖
- LoadDependency("/lib/zlExpressEditor/");
- })();
|