You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

141 lines
6.6 KiB

2 years ago
2 years ago
2 years ago
  1. 'use strict';
  2. var version = '?v=201904291',
  3. bundles = {
  4. base: [//基本所有頁面都需要用到的js
  5. '/Scripts/plugins/jquery-ui/jquery-ui.min.js',
  6. '/Scripts/plugins/bootstrap/js/bootstrap.min.js',
  7. '/Scripts/plugins/jquery-blockui/jquery.blockui.min.js',
  8. '/Scripts/plugins/jquery-slimscroll/jquery.slimscroll.min.js',
  9. '/Scripts/plugins/jquery-validation/jquery.validate.min.js',
  10. '/Scripts/plugins/uniform/jquery.uniform.min.js',
  11. '/Scripts/plugins/toastr/toastr.min.js',
  12. '/Scripts/3rd/underscore-1.9.0.min.js',
  13. '/Scripts/3rd/jquery.serialize-object.min.js',
  14. '/Scripts/3rd/linq/linq.min.js',
  15. '/Scripts/3rd/jsrender.min.js',
  16. '/Scripts/3rd/base64.min.js',
  17. '/Scripts/MessageBox.min.js',
  18. '/Scripts/wedget/ToolBar.js' + version,
  19. '/Scripts/Common.js' + version
  20. ],
  21. base_css: [
  22. '/Content/googleapis.css',
  23. '/Scripts/plugins/jquery-ui/jquery-ui.min.css',
  24. '/Scripts/plugins/bootstrap/css/bootstrap.min.css',
  25. '/Scripts/plugins/fontawesome/css/font-awesome.css',
  26. '/Scripts/plugins/line-icons/simple-line-icons.css',
  27. '/Scripts/plugins/uniform/css/uniform.default.min.css',
  28. '/Scripts/plugins/toastr/toastr.min.css',
  29. '/Content/modern.min.css',
  30. '/Content/custom.min.css',
  31. '/Content/themes/red.css',
  32. '/Content/style2.0.css',
  33. ],
  34. timepicker: [//時間選擇器的要引用
  35. '/Scripts/3rd/datetimepicker-addon/jquery-ui-timepicker-addon.min.js',
  36. '/Scripts/3rd/datetimepicker-addon/i18n/jquery-ui-timepicker-zh-TW.js'
  37. ],
  38. timepicker_css: [//時間選擇器的要引用
  39. '/Scripts/3rd/datetimepicker-addon/jquery-ui-timepicker-addon.min.css',
  40. '/Scripts/3rd/datetimepicker-addon/i18n/jquery-ui-timepicker-zh-TW.js'
  41. ],
  42. daterangepicker: [//日曆控件需要選擇區間的要引用
  43. '/Scripts/3rd/daterangepicker/moment.min.js',
  44. '/Scripts/3rd/daterangepicker/jquery.daterangepicker.js'
  45. ],
  46. daterangepicker_css: ['/Scripts/3rd/daterangepicker/css/daterangepicker.css'],
  47. clndr: ['/Scripts/3rd/clndr/moment.js', '/Scripts/3rd/clndr/clndr.js'],//(月)行事曆
  48. clndr_css: ['/Scripts/3rd/clndr/clndr.css'],
  49. jbox: ['/Scripts/3rd/jBox/jBox.js'],//提示插件
  50. jbox_css: ['/Scripts/3rd/jBox/jBox.css'],
  51. convetlng: ['/Scripts/lib/ConvertLang.min.js'],//多語系轉換js
  52. jqprint: ['/Scripts/3rd/jquery.jqprint-0.3.js'],//列印插件
  53. jqtree: ['/Scripts/3rd/jqtree/tree.jquery.min.js'],//樹插件
  54. jqtree_css: ['/Scripts/3rd/jqtree/jqtree.css'],//樹插件
  55. spectrum: ['/Scripts/3rd/Spectrum/spectrum.js'],//顏色選擇器
  56. spectrum_css: ['/Scripts/3rd/Spectrum/spectrum.css'],
  57. autocompleter: ['/Scripts/3rd/quickQuery/jquery.autocompleter.min.js' + version],//模糊搜索插件
  58. autocompleter_css: ['/Scripts/3rd/quickQuery/jquery.autocompleter.css'],
  59. jquerytoolbar: ['/Scripts/3rd/jquery.toolbar/jquery.toolbar.min.js'],//客製化按鈕插件
  60. jquerytoolbar_css: ['/Scripts/3rd/jquery.toolbar/jquery.toolbar.css'],
  61. formatnumber: ['/Scripts/3rd/format-number.min.js'],//金額插件
  62. select2: ['/Scripts/3rd/select2/js/select2.full.min.js'],//select2選擇器插件
  63. select2_css: ['/Scripts/3rd/select2/css/select2.min.css'],
  64. jsgrid: ['/Scripts/3rd/jGrid/jsgrid.min.js' + version],//grid插件
  65. jsgrid_css: ['/Scripts/3rd/jGrid/jsgrid.min.css', '/Scripts/3rd/jGrid/jsgrid-theme.min.css'],
  66. ajaxfile: ['/Scripts/3rd/jquery.filer/ajaxfileupload.js'],//上傳插件
  67. filer: [//上傳插件
  68. '/Scripts/3rd/jquery.filer/jquery.filer.js' + version,
  69. '/Scripts/3rd/jquery.dragsort/jquery.dragsort-0.5.2.min.js'
  70. ],
  71. filer_css: [
  72. '/Scripts/3rd/jquery.filer/jquery.filer.css',
  73. '/Scripts/3rd/jquery.filer/jquery.filer-dragdropbox-theme.css',
  74. '/Scripts/3rd/jquery.filer/file.theme.list.css'
  75. ],
  76. common_opm: ['/Scripts/Common.Opm.min.js' + version],
  77. common_eip: ['/Scripts/Common.Eip.js' + version],
  78. util: ['/Scripts/lib/Util.min.js' + version],
  79. cando: ['/Scripts/lib/PageUtil.js' + version]
  80. },
  81. /**
  82. * 通過url獲取程式id
  83. * @param {String} path 文件路徑
  84. * @return {String} json字串
  85. */
  86. getProgramId = function (path) {
  87. var sHerf = path || document.location.href,
  88. saHerf = sHerf.split('/');
  89. saHerf = saHerf[saHerf.length - 1].split('.');
  90. return saHerf[0] || '';
  91. },
  92. /**
  93. * 通過編輯程式ID獲取查詢程式ID
  94. * @return {String} 編輯頁面程式ID
  95. */
  96. getQueryPrgId = function () {
  97. var sPrgId = getProgramId();
  98. return sPrgId.replace('_Upd', '_Qry');
  99. },
  100. /**
  101. * 通過查詢程式ID獲取編輯頁面程式ID
  102. * @return {String} 編輯頁面程式ID
  103. */
  104. getEditPrgId = function () {
  105. var sPrgId = getProgramId();
  106. return sPrgId.replace('_Qry', '_Upd');
  107. },
  108. /**
  109. * 取得Url參數
  110. * @param {String} name 取得部分的名稱 例如輸入"Action"就能取到"Add"之類參數
  111. * @return {String}參數值
  112. */
  113. getUrlParam = function (name) {
  114. var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)"); //構造一個含有目標參數的正則表達式對象
  115. var r = window.location.search.substr(1).match(reg); //匹配目標參數
  116. if (r !== null) return unescape(r[2]); return null; //返回參數值
  117. },
  118. /**
  119. * 取得Url參數
  120. * @param {Array} bundleIds 要加載的文件js組名稱
  121. * @param {Function} callbackFn 文件js加載完回調函數
  122. * @param {Boolean} asyncs 需要同步加載執行的文件組名稱
  123. */
  124. require = function (bundleIds, callbackFn, asyncs) {
  125. asyncs = asyncs || '';
  126. bundleIds.forEach(function (bundleId) {
  127. var basync = true,
  128. bundleCssId = bundleId + '_css';
  129. if (asyncs.indexOf(bundleId) > -1) {
  130. basync = false;
  131. }
  132. if (!loadjs.isDefined(bundleId)) {
  133. loadjs(bundles[bundleId], bundleId, { async: basync });
  134. if (!loadjs.isDefined(bundleCssId) && bundles[bundleCssId]) {
  135. //loadjs(bundles[bundleCssId], bundleCssId);
  136. }
  137. }
  138. });
  139. loadjs.ready(bundleIds, callbackFn);
  140. };