From bff44efcb04f0b281ae9da3653b5b4ac2ac7efd3 Mon Sep 17 00:00:00 2001 From: RuoYi Date: Sat, 1 Jun 2019 11:30:39 +0800 Subject: [PATCH] =?UTF-8?q?=E6=93=8D=E4=BD=9C=E6=A0=8F=E6=94=AF=E6=8C=81?= =?UTF-8?q?=E8=AF=A6=E7=BB=86=E6=8C=89=E9=92=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/resources/static/ruoyi/js/ry-ui.js | 63 +++++++++++-------- 1 file changed, 37 insertions(+), 26 deletions(-) diff --git a/ruoyi-admin/src/main/resources/static/ruoyi/js/ry-ui.js b/ruoyi-admin/src/main/resources/static/ruoyi/js/ry-ui.js index 19be9783c..65053b89f 100644 --- a/ruoyi-admin/src/main/resources/static/ruoyi/js/ry-ui.js +++ b/ruoyi-admin/src/main/resources/static/ruoyi/js/ry-ui.js @@ -65,6 +65,7 @@ toolbar: '#' + options.toolbar, // 指定工作栏 sidePagination: options.sidePagination, // server启用服务端分页client客户端分页 search: options.search, // 是否显示搜索框功能 + searchText: options.searchText, // 搜索框初始显示的内容,默认为空 showSearch: options.showSearch, // 是否显示检索信息 showPageGo: options.showPageGo, // 是否显示跳转页 showRefresh: options.showRefresh, // 是否显示刷新按钮 @@ -134,6 +135,7 @@ var rows = $.common.isEmpty($.table._option.uniqueId) ? $.table.selectFirstColumns() : $.table.selectColumns($.table._option.uniqueId); $('#' + $.table._option.toolbar + ' .btn-del').toggleClass('disabled', !rows.length); $('#' + $.table._option.toolbar + ' .btn-edit').toggleClass('disabled', rows.length!=1); + $('#' + $.table._option.toolbar + ' .btn-detail').toggleClass('disabled', rows.length!=1); }); // 绑定选中事件、取消事件、全部选中、全部取消 $("#" + $.table._option.id).on("check.bs.table check-all.bs.table uncheck.bs.table uncheck-all.bs.table", function (e, rows) { @@ -608,6 +610,11 @@ var _width = $.common.isEmpty(options.width) ? "800" : options.width; var _height = $.common.isEmpty(options.height) ? ($(window).height() - 50) : options.height; var _btn = [' 确认', ' 关闭']; + if ($.common.isEmpty(options.yes)) { + options.yes = function(index, layero) { + options.callBack(index, layero); + } + } layer.open({ type: 2, maxmin: true, @@ -617,10 +624,10 @@ area: [_width + 'px', _height + 'px'], content: _url, shadeClose: true, + skin: options.skin, btn: $.common.isEmpty(options.btn) ? _btn : options.btn, - yes: function (index, layero) { - options.callBack(index, layero) - }, cancel: function () { + yes: options.yes, + cancel: function () { return true; } }); @@ -730,30 +737,34 @@ }, // 详细信息 detail: function(id, width, height) { - var _url = $.common.isEmpty(id) ? $.table._option.detailUrl : $.table._option.detailUrl.replace("{id}", id); - var _width = $.common.isEmpty(width) ? "800" : width; - var _height = $.common.isEmpty(height) ? ($(window).height() - 50) : height; - //如果是移动端,就使用自适应大小弹窗 - if (navigator.userAgent.match(/(iPhone|iPod|Android|ios)/i)) { - _width = 'auto'; - _height = 'auto'; + var _url = $.operate.detailUrl(id); + var options = { + title: $.table._option.modalName + "详细", + width: width, + height: height, + url: $.operate.detailUrl(id), + skin: 'layui-layer-molv', + btn: ['关闭'], + yes: function (index, layero) { + layer.close(index); + } + }; + $.modal.openOptions(options); + }, + // 详细访问地址 + detailUrl: function(id) { + var url = "/404.html"; + if ($.common.isNotEmpty(id)) { + url = $.table._option.detailUrl.replace("{id}", id); + } else { + var id = $.common.isEmpty($.table._option.uniqueId) ? $.table.selectFirstColumns() : $.table.selectColumns($.table._option.uniqueId); + if (id.length == 0) { + $.modal.alertWarning("请至少选择一条记录"); + return; + } + url = $.table._option.detailUrl.replace("{id}", id); } - layer.open({ - type: 2, - area: [_width + 'px', _height + 'px'], - fix: false, - //不固定 - maxmin: true, - shade: 0.3, - title: $.table._option.modalName + "详细", - content: _url, - btn: ['关闭'], - // 弹层外区域关闭 - shadeClose: true, - cancel: function(index){ - return true; - } - }); + return url; }, // 删除信息 remove: function(id) {