load.js 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  1. window.ss = { dom: { TYPE : { "INPUT" : 1, "OBJP":2,"DATE":3,"TIME":4,"DATETIME":5,
  2. "ONOFFBTN":6,"PIC":7,"HIDDEN":8,//加多"HIDDEN"隐藏字段 Ben(20260413)
  3. "HTML":9,
  4. "CCPSINGLE":51,//只对应一个对象属性的,带编码规则的级联菜单,如“出生地区码”(对应省、市、区)
  5. "CCPMUTIPLE":52,//对应多个对象属性的级联菜单
  6. "SEARCHINPUT":31,//查询页用到的文本框
  7. "SEARCHDATE":33,//查询页用到的日期选择
  8. "SEARCHTIME":34,//查询页用到的时间选择
  9. "SEARCHDATETIME":35//查询页用到的日期时间选择
  10. } }, config: {} };
  11. window.SS = window.ss;//最终都用小写ss,暂时先兼容大写SS
  12. (function bootstrapLegacyFormTypeAliases() {
  13. const TYPE = window.ss && window.ss.dom && window.ss.dom.TYPE;
  14. if (!TYPE) {
  15. return;
  16. }
  17. if (TYPE.OBJPICKER == null) {
  18. TYPE.OBJPICKER = TYPE.OBJP;
  19. }
  20. if (TYPE.IMG == null) {
  21. TYPE.IMG = TYPE.PIC;
  22. }
  23. const legacyInputTypeMap = {
  24. DATE: TYPE.DATE,
  25. TIME: TYPE.TIME,
  26. DATETIME: TYPE.DATETIME,
  27. IMG: TYPE.PIC
  28. };
  29. Object.keys(legacyInputTypeMap).forEach((key) => {
  30. if (Object.prototype.hasOwnProperty.call(Number.prototype, key)) {
  31. return;
  32. }
  33. Object.defineProperty(Number.prototype, key, {
  34. configurable: true,
  35. enumerable: false,
  36. get() {
  37. return legacyInputTypeMap[key];
  38. }
  39. });
  40. });
  41. })();
  42. (function(){
  43. const _deps = [
  44. ['script', '/js/ajax/axios.js',''], // , '/newUI/ss/ajax/axios.js',。Lin(新UI)
  45. ['script', '/js/vue/vue3.js',''], // , '/newUI/ss/vue/vue3.js',。Lin(新UI)
  46. ['script', '/js/vue/vue-router.gloabl.js',''], // , '/newUI/ss/vue/vue-router.gloabl.js',。Lin(新UI)
  47. ['script', '/js/lodash/lodash.js',''], // , '/newUI/ss/lodash/lodash.js',。Lin(新UI)
  48. ['script', '/js/elementPlus/element-plus.js',''], // , '/newUI/ss/elementPlus/element-plus.js',。Lin(新UI)
  49. ['script', '/js/elementPlus/element-plus-zhCN.js',''], // , '/newUI/ss/elementPlus/element-plus-zhCN.js',。Lin(新UI)
  50. ['script', '/js/echarts/echarts5-5-0.js',''], // , '/newUI/ss/echarts/echarts5-5-0.js'。Lin(新UI)
  51. ['script', '/js/Sortable/Sortable.min.js',''], // 业务面板拖拽排序 by xu 20260106
  52. ['script', '/js/jodit/ace.js',''], // , `/newUI/ss/jodit/ace.js`,。Lin(新UI)
  53. ['script', '/js/jodit/beautify.min.js',''], // , `/newUI/ss/jodit/beautify.min.js`,。Lin(新UI)
  54. ['script', '/js/jodit/beautify-html.min.js',''], // , `/newUI/ss/jodit/beautify-html.min.js`,。Lin(新UI)
  55. // ['script', `/newUI/ss/jodit/theme-idle_fingers.js`,''],
  56. // ['script', `/newUI/ss/jodit/mode-html.js`,''],
  57. ['script', '/js/jodit/jodit.js',''], // , '/newUI/ss/jodit/jodit.js',。Lin(新UI)
  58. ['script', '/js/vue/tools.js','module'], // , '/newUI/ss/js/tools.js',。Lin(新UI)
  59. ['script', '/js/vue/icon-config.js','module'], // , '/newUI/ss/js/icon-config.js',。Lin(新UI)
  60. ['script', '/js/jquery/jquery1.11.3.min.js',''], // , '/newUI/ss/jquery/jquery1.11.3.min.js',。Lin(新UI)
  61. ['script', '/js/vue/ss-components.js','module'], // , '/newUI/ss/js/ss-components.js',。Lin(新UI)
  62. ['script', '/js/cropper/cropper.js',''], // , '/newUI/ss/js/cropper.js'。Lin(新UI)
  63. ['script', '/js/vue/EventBus.js','module'], // , '/newUI/ss/js/EventBus.js',。Lin(新UI)
  64. ['style', '/skin/easy/css/base.css'], // , '/newUI/skin/easy/css/base.css']。Lin(新UI)
  65. ['style', '/skin/easy/css/jodit.css'], // , '/newUI/skin/easy/css/jodit.css']。Lin(新UI)
  66. ['style', '/skin/easy/css/element-plus.css'], // , '/newUI/skin/easy/css/element-plus.css']。Lin(新UI)
  67. ['style', '/skin/easy/css/iconfont.css'], // , '/newUI/skin/easy/css/iconfont.css']。Lin(新UI)
  68. ['style', '/skin/easy/css/cropper.css'], // , '/newUI/skin/easy/css/cropper.css']。Lin(新UI)
  69. ['style', '/skin/easy/css/font_4273728_tnvxftfb8j.css'], // , '/newUI/skin/easy/css/font_4273728_tnvxftfb8j.css']。Lin(新UI)
  70. ['style', '/skin/easy/css/font_4279221_5h4vbt6831w.css'] // , '/newUI/skin/easy/css/font_4279221_5h4vbt6831w.css']。Lin(新UI)
  71. ];
  72. function loadResource(type, src,module) {
  73. return new Promise((resolve, reject) => {
  74. const elem = document.createElement(type === 'script' ? 'script' : 'link');
  75. if (type === 'script') {
  76. elem.src = src;
  77. elem.type = module ? 'module' : '';
  78. } else {
  79. elem.rel = 'stylesheet';
  80. elem.href = src;
  81. }
  82. elem.onload = () => {
  83. if (type === 'script') {
  84. // elem.remove();
  85. }
  86. resolve();
  87. };
  88. elem.onerror = reject;
  89. document.head.appendChild(elem);
  90. });
  91. }
  92. // 等待所有依赖加载完成后再执行回调
  93. window.SS.ready = function(callback) {
  94. if (window.SS && window.SS.dom && window.SS.dom.initializeFormApp) {
  95. callback();
  96. } else {
  97. document.addEventListener('SSReady', () => {
  98. // 确保组件初始化完成后再执行回调
  99. if (window.SS && window.SS.dom && window.SS.dom.initializeFormApp) {
  100. callback();
  101. }
  102. });
  103. }
  104. };
  105. async function loadAll() {
  106. // 然后加载资源
  107. for (const [type, src,module] of _deps) {
  108. await loadResource(type, src,module);
  109. if (src.includes('ace.js')) {
  110. window.ace.require('ace/config').set('workerPath', null);
  111. }
  112. }
  113. document.dispatchEvent(new Event('SSReady'));
  114. }
  115. // 当 DOM 加载完成后执行清理和加载
  116. if (document.readyState === 'loading') {
  117. document.addEventListener('DOMContentLoaded', loadAll);
  118. console.log('DOMContentLoaded');
  119. } else {
  120. loadAll();
  121. }
  122. })();