var _____WB$wombat$assign$function_____ = function(name) {return (self._wb_wombat && self._wb_wombat.local_init && self._wb_wombat.local_init(name)) || self[name]; }; if (!self.__WB_pmw) { self.__WB_pmw = function(obj) { this.__WB_source = obj; return this; } } { let window = _____WB$wombat$assign$function_____("window"); let self = _____WB$wombat$assign$function_____("self"); let document = _____WB$wombat$assign$function_____("document"); let location = _____WB$wombat$assign$function_____("location"); let top = _____WB$wombat$assign$function_____("top"); let parent = _____WB$wombat$assign$function_____("parent"); let frames = _____WB$wombat$assign$function_____("frames"); let opener = _____WB$wombat$assign$function_____("opener"); //主框架代码开始 (function ($, undefined) { var form = (function () { var form = function (selector, context) {//调用$(selector)时,实际是调用这个函数. return new form.fn.init(selector, context); }; //实例方法开始 form.fn = { constructor: form, init: function (selector, context) { this.jo = $(selector, context); return this; } }; form.prototype = form.fn; //实例方法结束 form.fn.init.prototype = form.fn; //静态方法开始 //静态成员结束 return form; //这个form就是$form })(); window.form = window.$form = form; })(jQuery); //主框架代码结束 //静态方法开始 $.extend($form, { }); //静态方法结束 //实例方法开始 $form.fn.select = function (options) { var _this = $(this.jo); var obj = function () { this.selector = _this; this.options =$.extend({data:[]}, options); } obj.prototype.getValue = function () { var _val = $('input', _this).val(); var _val2 = parseInt(_val, 10); if (_val2 == 0 || _val2) { return _val2; } return _val; } obj.prototype.setValue = function () { var _obj = this; var _val = arguments[0]; $('input', _this).val(_val); $.each($('li', _obj.panel), function (i, o) { if ($(o).attr('value') == _val) { $('.kui-form-sltitle span', _this).html($('a', $(o)).html()); } }); } obj.prototype.change = function () { var _obj = this; if (_obj.options.onChange) { _obj.options.onChange(_obj.panel.find('li[value="' + _obj.getValue() + '"]')[0], $c.array.first(_obj.options.data, function (i, o) { return o.value == _obj.getValue(); })) } } obj.prototype.create = function () { var _obj = this; _this.html(''); _this.addClass('kui-form-select'); var _input = $('').appendTo(_this); //if (_obj.options.value != null && _obj.options.value != undefined) { // $(_input).val(options.value); //} var _titleHtml = $('
').appendTo(_this); var selectedItem = $c.array.first(_obj.options.data, function (i, o) { return o.value == _obj.options.value; }); var _title = ''; if (selectedItem) { _title = selectedItem.text; $(_input).val(selectedItem.value); } _titleHtml.append('' + _title + ''); var _ul = $(' ').appendTo('body'); _obj.panel = _ul; _titleHtml.click(function (e) { if ($(_ul).is(":hidden")) { e.stopPropagation();//使$(document).click不执行. _ul.show(); _ul.css('left', _this.offset().left); _ul.css('top', _this.offset().top + _this.height() + parseInt(_this.css('border-top-width').split('px')[0], 10) + parseInt(_this.css('border-bottom-width').split('px')[0], 10)); _ul.css('width', _this.width()); if (_ul.offset().top + _ul.height()+20 > $(document).height()) { _ul.css('top', _this.offset().top-_ul.height());//上方显示. } } }); $.each(_obj.options.data, function (i, o) { var _item = $('