Browse Source

支持openOptions方法多个按钮回调

RuoYi 4 years ago
parent
commit
233089b3e6
1 changed files with 25 additions and 16 deletions
  1. 25 16
      ruoyi-admin/src/main/resources/static/ruoyi/js/ry-ui.js

+ 25 - 16
ruoyi-admin/src/main/resources/static/ruoyi/js/ry-ui.js

@@ -801,22 +801,31 @@ var table = {
                     	options.callBack(index, layero);
                     }
                 }
-                layer.open({
-                    type: 2,
-            		maxmin: true,
-                    shade: 0.3,
-                    title: _title,
-                    fix: false,
-                    area: [_width + 'px', _height + 'px'],
-                    content: _url,
-                    shadeClose: $.common.isEmpty(options.shadeClose) ? true : options.shadeClose,
-                    skin: options.skin,
-                    btn: $.common.isEmpty(options.btn) ? _btn : options.btn,
-                    yes: options.yes,
-                    cancel: function () {
-                        return true;
-                    }
-                });
+                var btnCallback = {};
+        		if(options.btn instanceof Array){
+        			for (var i = 1, len = options.btn.length; i < len; i++) {
+					    var btn = options["btn" + (i + 1)];
+					    if (btn) {
+					    	btnCallback["btn" + (i + 1)] = btn;
+					    }
+					}
+        		}
+        		layer.open($.extend({
+        			type: 2,
+        			maxmin: true,
+        			shade: 0.3,
+        			title: _title,
+        			fix: false,
+        			area: [_width + 'px', _height + 'px'],
+        			content: _url,
+        			shadeClose: $.common.isEmpty(options.shadeClose) ? true : options.shadeClose,
+        			skin: options.skin,
+        			btn: $.common.isEmpty(options.btn) ? _btn : options.btn,
+        			yes: options.yes,
+        			cancel: function () {
+        				return true;
+        			}
+        		}, btnCallback));
             },
             // 弹出层全屏
             openFull: function (title, url, width, height) {