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.
 
 
 
 
 
 

82 lines
4.2 KiB

  1. /*
  2. * 版 本 Learun-ADMS-Ultimate V7.0.0 数字化智慧校园(http://www.learun.cn)
  3. * Copyright (c) 2013-2018 北京泉江科技有限公司
  4. * 创建人:陈彬彬
  5. * 日 期:2017.03.16
  6. * 描 述:excel 导入导出
  7. */
  8. (function ($, learun) {
  9. "use strict";
  10. $(function () {
  11. function excelInit() {
  12. if (!!lrModule) {
  13. // 导入
  14. learun.httpAsync('GET', top.$.rootUrl + '/LR_SystemModule/ExcelImport/GetList', { moduleId: lrModule.F_ModuleId }, function (data) {
  15. if (!!data && data.length > 0) {
  16. var $layouttool = $('.lr-layout-tool-right');
  17. var $btnGroup = $('<div class=" btn-group btn-group-sm"></div>');
  18. var hasBtn = false;
  19. $.each(data, function (id, item) {
  20. if (!!lrModuleButtonList[item.F_ModuleBtnId]) {
  21. hasBtn = true;
  22. var $btn = $('<a id="' + item.F_ModuleBtnId + '" data-value="' + item.F_Id + '" class="btn btn-default"><i class="fa fa-sign-in"></i>&nbsp;' + item.F_BtnName + '</a>')
  23. $btn.on('click', function () {
  24. var id = $(this).attr('data-value');
  25. var text = $(this).text();
  26. learun.layerForm({
  27. id: 'ImportForm',
  28. title: text,
  29. url: top.$.rootUrl + '/LR_SystemModule/ExcelImport/ImportForm?id=' + id,
  30. width: 600,
  31. height: 400,
  32. maxmin: true,
  33. btn: null
  34. });
  35. });
  36. $btnGroup.append($btn);
  37. }
  38. });
  39. $layouttool.append($btnGroup);
  40. }
  41. });
  42. // 导出
  43. learun.httpAsync('GET', top.$.rootUrl + '/LR_SystemModule/ExcelExport/GetList', { moduleId: lrModule.F_ModuleId }, function (data) {
  44. if (!!data && data.length > 0) {
  45. var $layouttool = $('.lr-layout-tool-right');
  46. var $btnGroup = $('<div class=" btn-group btn-group-sm"></div>');
  47. var hasBtn = false;
  48. $.each(data, function (id, item) {
  49. if (!!lrModuleButtonList[item.F_ModuleBtnId]) {
  50. hasBtn = true;
  51. var $btn = $('<a id="' + item.F_ModuleBtnId + '" class="btn btn-default"><i class="fa fa-sign-out"></i>&nbsp;' + item.F_BtnName + '</a>')
  52. $btn[0].dfop = item;
  53. $btn.on('click', function () {
  54. item = $btn[0].dfop;
  55. learun.layerForm({
  56. id: "ExcelExportForm",
  57. title: '导出Excel数据',
  58. url: top.$.rootUrl + '/Utility/ExcelExportForm?gridId=' + item.F_GridId + '&filename=' + encodeURI(encodeURI(item.F_Name)),
  59. width: 500,
  60. height: 380,
  61. callBack: function (id) {
  62. return top[id].acceptClick();
  63. },
  64. btn: ['导出Excel', '关闭']
  65. });
  66. });
  67. $btnGroup.append($btn);
  68. }
  69. });
  70. $layouttool.append($btnGroup);
  71. }
  72. });
  73. }
  74. else {
  75. setTimeout(excelInit, 100);
  76. }
  77. }
  78. excelInit();
  79. });
  80. })(window.jQuery, top.learun);