From 47baad903367aab2cc21475ee8b15bb25a90fc97 Mon Sep 17 00:00:00 2001 From: hdw <496960745@qq.com> Date: 星期三, 21 十一月 2018 09:55:16 +0800 Subject: [PATCH] 更新实时界面放电测试面板数据 --- gx_tieta/WebRoot/js/whyc-jqueryui.js | 36 +++++++++++++++++++++++++++++++++--- 1 files changed, 33 insertions(+), 3 deletions(-) diff --git a/gx_tieta/WebRoot/js/whyc-jqueryui.js b/gx_tieta/WebRoot/js/whyc-jqueryui.js index 44229af..4c655cf 100644 --- a/gx_tieta/WebRoot/js/whyc-jqueryui.js +++ b/gx_tieta/WebRoot/js/whyc-jqueryui.js @@ -490,6 +490,7 @@ // 鏍规嵁鏁版嵁鐨勬纭�т慨鏀规枃鏈鐨勬牱寮� _proto.changeVal = function() { var testVal = this; + this.ele.off('input propertychange blur focus'); // 鏂囨湰妗嗗唴瀹规敼鍙� this.ele.on('input propertychange', function() { @@ -515,9 +516,17 @@ ele.myTooltip('hide'); ele.removeClass('error-data'); - testVal.opts.btn.removeClass('whyc-btn-disabled'); + // 閬嶅巻testVal.opts.btn鐨勫�� + testVal.opts.btn.each(function() { + if(!$(this).hasClass('error-data')) { + $(this).removeClass('whyc-btn-disabled'); + } + + $(this).removeClass('error-data'); + }); }else { ele.next('i').addClass('error-data'); + //console.log(testVal.opts.msg); ele.myTooltip({ position: testVal.opts.position, thing: 'show', @@ -525,6 +534,15 @@ content: '<span style="color:#FF0000">'+testVal.opts.msg+'</span>' }); ele.addClass('error-data'); + + // 閬嶅巻testVal.opts.btn鐨勫�� + testVal.opts.btn.each(function() { + if(!$(this).hasClass('whyc-btn-disabled') && !$(this).hasClass('error-data')) { + $(this).addClass('whyc-btn-disabled'); + }else { + $(this).addClass('whyc-btn-disabled error-data'); + } + }); testVal.opts.btn.addClass('whyc-btn-disabled'); } @@ -548,10 +566,11 @@ return flag; }; + _proto.error = function() { console.info(this.opts.msg); }; - $.fn.testVal = function(options) { + $.fn.testVal = function(options, attr, val) { var defaults = { pattern: "", event: "changeVal", @@ -563,13 +582,24 @@ max: 0, position: 'bottom' }; - var opts = $.extend(true, {}, defaults, options||{}); + var opts = {}; + // 鍒ゆ柇鏄惁涓烘洿鏂伴厤缃」 + if(isString(options)) { + var oldOpts = this.data('testVal'); + opts = $.extend({}, opts, oldOpts); + opts[attr] = val; + }else if(isObject(options)){ + opts = $.extend(true, {}, defaults, options||{}); + } + // console.log(opts); if(opts.pattern.constructor.name != 'RegExp') { opts.event = "error"; opts.msg = '璇疯緭鍏ユ纭殑姝e垯琛ㄨ揪寮忔牸寮忥紒锛侊紒' } var testVal = new TestVal(this, opts); + this.data('testVal', testVal.opts); + testVal[opts.event](); return this; -- Gitblit v1.9.1