(function($) { //默认配置 var defaults = { //参考input控件的accept属性。 accept: "", //文件类型(后缀,不包括“.”)。 types: [], //最大文件大小。 maxSize: 300, //是否支持二维码扫描上载。 enableBarcode: false, //文件模板路径,相对于WebRoot。 templetPath: "", //文件模板名称。 templetName: "", //成功的回调函数,参数:fileName,filePath。 success: null, //取消的回调函数。 canccel: null } $.fn.zrUpload = function(options) { $(this).click(function() { art.dialog.open("/hbrz/org/upload/Upload.jsp", { lock: true, params: $.extend({}, defaults, options), init: function() { this.size(this.config.width, this.config.height); this.position("50%", "40%"); }, close: function() { if (this.config.DialogResult == "ok") { var info = art.dialog.data("fileInfo"); options.success(info.fileName, info.filePath); } else { options.cancel && options.cancel(); } } }); }); } })(jQuery);