| | |
| | | // 获取实例ID,如存在多个返回#id1,#id2 delimeter分隔符 |
| | | getOptionsIds: function(separator) { |
| | | var _separator = $.common.isEmpty(separator) ? "," : separator; |
| | | var optionsIds = ""; |
| | | var optionsIds = ""; |
| | | $.each(table.config, function(key, value){ |
| | | optionsIds += "#" + key + _separator; |
| | | }); |
| | |
| | | isAsc: params.order |
| | | }; |
| | | var currentId = $.common.isEmpty(table.options.formId) ? $('form').attr('id') : table.options.formId; |
| | | return $.extend(curParams, $.common.formToJSON(currentId)); |
| | | return $.extend(curParams, $.common.formToJSON(currentId)); |
| | | }, |
| | | // 请求获取数据后处理回调函数 |
| | | responseHandler: function(res) { |
| | |
| | | }); |
| | | }); |
| | | }, |
| | | // Dorado页面导出数据:url-跳转路径,name-数据名称,param-查询参数 |
| | | exportExcelDorado: function(url, name, param) { |
| | | $.modal.confirm("确定导出当前页面" + name + "吗?", function() { |
| | | $.modal.loading("正在导出数据,请稍候..."); |
| | | $.post(url, param, function(result) { |
| | | if (result.code == web_status.SUCCESS) { |
| | | window.location.href = ctx + "common/download?fileName=" + encodeURI(result.msg) + "&delete=" + true; |
| | | } else if (result.code == web_status.WARNING) { |
| | | $.modal.alertWarning(result.msg) |
| | | } else { |
| | | $.modal.alertError(result.msg); |
| | | } |
| | | $.modal.closeLoading(); |
| | | }); |
| | | }); |
| | | }, |
| | | // 下载模板 |
| | | importTemplate: function() { |
| | | $.get(activeWindow().table.options.importTemplateUrl, function(result) { |
| | |
| | | type: 'POST', |
| | | success: function (result) { |
| | | if (result.code == web_status.SUCCESS) { |
| | | $.modal.close(index); |
| | | $.modal.close(index); |
| | | $.modal.closeAll(); |
| | | $.modal.alertSuccess(result.msg); |
| | | $.table.refresh(); |
| | | } else if (result.code == web_status.WARNING) { |
| | | $.modal.close(index); |
| | | $.modal.close(index); |
| | | $.modal.enable(); |
| | | $.modal.alertWarning(result.msg) |
| | | } else { |
| | |
| | | } |
| | | }, |
| | | complete: function () { |
| | | layero.find('#file').val(''); |
| | | layero.find('#file').val(''); |
| | | } |
| | | }); |
| | | } |
| | |
| | | // 消息提示 |
| | | msg: function(content, type) { |
| | | if (type != undefined) { |
| | | top.layer.msg(content, { icon: $.modal.icon(type), time: 1000, shift: 5 }); |
| | | top.layer.msg(content, { icon: $.modal.icon(type), time: 1000, shift: 5 }); |
| | | } else { |
| | | top.layer.msg(content); |
| | | top.layer.msg(content); |
| | | } |
| | | }, |
| | | // 错误消息 |
| | |
| | | // 消息提示,重新加载页面 |
| | | msgReload: function(msg, type) { |
| | | top.layer.msg(msg, { |
| | | icon: $.modal.icon(type), |
| | | time: 500, |
| | | shade: [0.1, '#8F8F8F'] |
| | | }, |
| | | function() { |
| | | $.modal.reload(); |
| | | }); |
| | | icon: $.modal.icon(type), |
| | | time: 500, |
| | | shade: [0.1, '#8F8F8F'] |
| | | }, |
| | | function() { |
| | | $.modal.reload(); |
| | | }); |
| | | }, |
| | | // 消息提示成功并刷新父窗体 |
| | | msgSuccessReload: function(msg) { |
| | | $.modal.msgReload(msg, modal_status.SUCCESS); |
| | | $.modal.msgReload(msg, modal_status.SUCCESS); |
| | | }, |
| | | // 获取iframe页的DOM |
| | | getChildFrame: function (index) { |
| | |
| | | }, |
| | | // 弹出层指定参数选项 |
| | | openOptions: function (options) { |
| | | var _url = $.common.isEmpty(options.url) ? "/404.html" : options.url; |
| | | var _title = $.common.isEmpty(options.title) ? "系统窗口" : options.title; |
| | | var _width = $.common.isEmpty(options.width) ? "800" : options.width; |
| | | var _url = $.common.isEmpty(options.url) ? "/404.html" : options.url; |
| | | var _title = $.common.isEmpty(options.title) ? "系统窗口" : options.title; |
| | | var _width = $.common.isEmpty(options.width) ? "800" : options.width; |
| | | var _height = $.common.isEmpty(options.height) ? ($(window).height() - 50) : options.height; |
| | | var _btn = ['<i class="fa fa-check"></i> 确认', '<i class="fa fa-close"></i> 关闭']; |
| | | // 如果是移动端,就使用自适应大小弹窗 |
| | |
| | | top.layer.full(index); |
| | | }, |
| | | // 选卡页方式打开 |
| | | openTab: function (title, url, isRefresh) { |
| | | createMenuItem(url, title, isRefresh); |
| | | openTab: function (title, url, isRefresh, panelId) { |
| | | createMenuItem(url, title, isRefresh, panelId); |
| | | }, |
| | | // 选卡页同一页签打开 |
| | | parentTab: function (title, url) { |
| | |
| | | if (result.code == web_status.SUCCESS) { |
| | | var parent = activeWindow(); |
| | | if ($.common.isEmpty(parent.table)) { |
| | | $.modal.msgSuccessReload(result.msg); |
| | | $.modal.msgSuccessReload(result.msg); |
| | | } else if (parent.table.options.type == table_type.bootstrapTable) { |
| | | $.modal.close(); |
| | | parent.$.modal.msgSuccess(result.msg); |
| | |
| | | var currentId = $('.page-tabs-content', topWindow).find('.active').attr('data-panel'); |
| | | var topWindow = $('.RuoYi_iframe[data-id="' + currentId + '"]', topWindow)[0]; |
| | | if ($.common.isNotEmpty(topWindow) && $.common.isNotEmpty(currentId)) { |
| | | var $contentWindow = topWindow.contentWindow; |
| | | $contentWindow.$.modal.msgSuccess(result.msg); |
| | | var $contentWindow = topWindow.contentWindow; |
| | | $contentWindow.$.modal.msgSuccess(result.msg); |
| | | $contentWindow.$(".layui-layer-padding").removeAttr("style"); |
| | | if ($contentWindow.table.options.type == table_type.bootstrapTable) { |
| | | $contentWindow.$.table.refresh(); |
| | |
| | | if (!date) return; |
| | | if (!format) format = "yyyy-MM-dd"; |
| | | switch (typeof date) { |
| | | case "string": |
| | | date = new Date(date.replace(/-/g, "/")); |
| | | break; |
| | | case "number": |
| | | date = new Date(date); |
| | | break; |
| | | case "string": |
| | | date = new Date(date.replace(/-/g, "/")); |
| | | break; |
| | | case "number": |
| | | date = new Date(date); |
| | | break; |
| | | } |
| | | if (!date instanceof Date) return; |
| | | var dict = { |
| | |
| | | "ss": ("" + (date.getSeconds() + 100)).substr(1) |
| | | }; |
| | | return format.replace(/(yyyy|MM?|dd?|HH?|ss?|mm?)/g, |
| | | function() { |
| | | return dict[arguments[0]]; |
| | | }); |
| | | function() { |
| | | return dict[arguments[0]]; |
| | | }); |
| | | }, |
| | | // 获取节点数据,支持多层级访问 |
| | | getItemField: function (item, field) { |
| | |
| | | }, |
| | | // 获取obj对象长度 |
| | | getLength: function(obj) { |
| | | var count = 0; |
| | | var count = 0; |
| | | for (var i in obj) { |
| | | if (obj.hasOwnProperty(i)) { |
| | | count++; |
| | | } |
| | | } |
| | | } |
| | | return count; |
| | | }, |