|
- /*
- * 版 本 Learun-ADMS-Ultimate V7.0.0 数字化智慧校园(http://www.learun.cn)
- * Copyright (c) 2013-2018 北京泉江科技有限公司
- * 创建人:陈彬彬
- * 日 期:2017.03.16
- * 描 述:excel 导入导出
- */
- (function ($, learun) {
- "use strict";
- $(function () {
- function excelInit() {
- if (!!lrModule) {
- // 导入
- learun.httpAsync('GET', top.$.rootUrl + '/LR_SystemModule/ExcelImport/GetList', { moduleId: lrModule.F_ModuleId }, function (data) {
- if (!!data && data.length > 0) {
- var $layouttool = $('.lr-layout-tool-right');
- var $btnGroup = $('<div class=" btn-group btn-group-sm"></div>');
- var hasBtn = false;
- $.each(data, function (id, item) {
- if (!!lrModuleButtonList[item.F_ModuleBtnId]) {
- hasBtn = true;
- var $btn = $('<a id="' + item.F_ModuleBtnId + '" data-value="' + item.F_Id + '" class="btn btn-default"><i class="fa fa-sign-in"></i> ' + item.F_BtnName + '</a>')
- $btn.on('click', function () {
- var id = $(this).attr('data-value');
- var text = $(this).text();
- learun.layerForm({
- id: 'ImportForm',
- title: text,
- url: top.$.rootUrl + '/LR_SystemModule/ExcelImport/ImportForm?id=' + id,
- width: 600,
- height: 400,
- maxmin: true,
- btn: null
- });
- });
- $btnGroup.append($btn);
- }
- });
- $layouttool.append($btnGroup);
- }
- });
- // 导出
- learun.httpAsync('GET', top.$.rootUrl + '/LR_SystemModule/ExcelExport/GetList', { moduleId: lrModule.F_ModuleId }, function (data) {
- if (!!data && data.length > 0) {
- var $layouttool = $('.lr-layout-tool-right');
- var $btnGroup = $('<div class=" btn-group btn-group-sm"></div>');
- var hasBtn = false;
- $.each(data, function (id, item) {
- if (!!lrModuleButtonList[item.F_ModuleBtnId]) {
- hasBtn = true;
- var $btn = $('<a id="' + item.F_ModuleBtnId + '" class="btn btn-default"><i class="fa fa-sign-out"></i> ' + item.F_BtnName + '</a>')
- $btn[0].dfop = item;
- $btn.on('click', function () {
- item = $btn[0].dfop;
- learun.layerForm({
- id: "ExcelExportForm",
- title: '导出Excel数据',
- //2022/12/6 苏燕燕更改不弹出报错
- //url: top.$.rootUrl + '/Utility/ExcelExportForm?gridId=' + item.F_GridId + '&iframeIndex=' + parent.layer.getFrameIndex(window.name)+'&filename=' + encodeURI(encodeURI(item.F_Name)),
- url: top.$.rootUrl + '/Utility/ExcelExportForm?gridId=' + item.F_GridId + '&iframeIndex=' + (parent.layer ? parent.layer.getFrameIndex(window.name) : '') + '&filename=' + encodeURI(encodeURI(item.F_Name)),width: 500,
- height: 380,
- callBack: function (id) {
- return top[id].acceptClick();
- },
- end: function () {
- if (learun.frameTab.currentIframe().$('#' + item.F_GridId)[0].dfop.rows == 1000000) {
- learun.frameTab.currentIframe().$('#' + item.F_GridId)[0].dfop.rows = 30;
- learun.frameTab.currentIframe().$('#' + item.F_GridId).jfGridSet('reload');
- }
- },
- btn: ['导出Excel', '关闭']
- });
- });
- $btnGroup.append($btn);
- }
- });
- $layouttool.append($btnGroup);
- }
- });
- }
- else {
- setTimeout(excelInit, 100);
- }
- }
- excelInit();
- });
-
- })(window.jQuery, top.learun);
|