(function($) { $.fn.getCanstSelect = function(options) { var select = new getCanstSelect(options); select.create($(this)); return select; }; })(jQuery); function getCanstSelect(options){ var defaults={ state :"123", width :"300" }; this.options = $.extend(defaults, options); this.$dom = null; } getCanstSelect.prototype.create = function($dom) { var _this = this; this.$dom = $dom; var selectId = this.$dom.attr("id"); var clearDIv=selectId+"clear"; var type=_this.options.state; var width=_this.options.width; var orgPic = "/nwyj/scripts/qui/libs/icons/home.png"; //this.$dom.initCanstSelect(_this.options.state); $select=$(""); this.$dom.attr("id",clearDIv); $select.attr("id",selectId); $select.attr("selWidth",width); this.$dom.append($select); $img=$(""); this.$dom.append($img); getSingleSelect(type,selectId); this.$dom.find("img").eq(0).on("click", function() { addWindow(_this.options.state,selectId,type); }); } function addWindow(params,selectId,type){ var diag = new top.Dialog();// 定义一个窗口对象 diag.Title = "添加常量";// 窗口标题//nwyj/WebContent/page/business/em/alert/warning/MyHtml.html diag.URL = "/nwyj/page/system/mapvaluecanst/EditCanstSelect.html?type=" +params// 窗口对应的页面 diag.Height = 450; diag.Width = 600; diag.ShowOkButton = false;// 不显示确认按钮 diag.ShowCancelButton = false;// 不显示取消按钮 diag.ButtonAlign = "center";// 按钮居中 diag.CancelEvent = function(){ getSingleSelect(type,selectId); diag.close(); diag=null; }; diag.show();// 显示窗口 // 添加关闭按钮 diag.addButton("close","关闭",function(){ //var sId=document.getElementById(selectId); //var $obj=$(sId); //$obj.initCanstSelect(params); getSingleSelect(type,selectId); diag.close(); diag=null; }); // 添加确定按钮 //diag.addButton("yes","保存",function(){ // var callbackfn = diag.innerFrame.contentWindow.addMapValue(); //}); } //查询装备数量 function SPQueryNo(){ window.location.href="SPQueryZhuangbeiNum.jsp"; } //装备调拨清单 function SPSendAssignForm(){ window.location.href="SPSendZhuangbeiForm.jsp"; } function getSingleSelect(params,selectId){ var sId=document.getElementById(selectId); var $obj=$(sId); $.ajax({ url : $.pathname() +"/ws/FILEPOLL/FileAMService/queryListValue/", type : 'post', timeout : 15000, data : params, dataType : 'json', async:false, success : function(data){ $obj.data("data",data); $obj.render(); }, error : function(e){ $.messager.alert('系统提示信息', '访问服务失败!', 'error'); } }); }