3dab74ec040d566eef16ebcab098b4fddc2f3e32.svn-base 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. (function($) {
  2. $.fn.getCanstSelect = function(options) {
  3. var select = new getCanstSelect(options);
  4. select.create($(this));
  5. return select;
  6. };
  7. })(jQuery);
  8. function getCanstSelect(options){
  9. var defaults={
  10. state :"123",
  11. width :"300"
  12. };
  13. this.options = $.extend(defaults, options);
  14. this.$dom = null;
  15. }
  16. getCanstSelect.prototype.create = function($dom) {
  17. var _this = this;
  18. this.$dom = $dom;
  19. var selectId = this.$dom.attr("id");
  20. var clearDIv=selectId+"clear";
  21. var type=_this.options.state;
  22. var width=_this.options.width;
  23. var orgPic = "/nwyj/scripts/qui/libs/icons/home.png";
  24. //this.$dom.initCanstSelect(_this.options.state);
  25. $select=$("<select prompt='请选择'></select>");
  26. this.$dom.attr("id",clearDIv);
  27. $select.attr("id",selectId);
  28. $select.attr("selWidth",width);
  29. this.$dom.append($select);
  30. $img=$("<img src='" + orgPic+"' style='margin:10px 0px 0px 10px;cursor:pointer' />");
  31. this.$dom.append($img);
  32. getSingleSelect(type,selectId);
  33. this.$dom.find("img").eq(0).on("click", function() {
  34. addWindow(_this.options.state,selectId,type);
  35. });
  36. }
  37. function addWindow(params,selectId,type){
  38. var diag = new top.Dialog();// 定义一个窗口对象
  39. diag.Title = "添加常量";// 窗口标题//nwyj/WebContent/page/business/em/alert/warning/MyHtml.html
  40. diag.URL = "/nwyj/page/system/mapvaluecanst/EditCanstSelect.html?type=" +params// 窗口对应的页面
  41. diag.Height = 450;
  42. diag.Width = 600;
  43. diag.ShowOkButton = false;// 不显示确认按钮
  44. diag.ShowCancelButton = false;// 不显示取消按钮
  45. diag.ButtonAlign = "center";// 按钮居中
  46. diag.CancelEvent = function(){
  47. getSingleSelect(type,selectId);
  48. diag.close();
  49. diag=null;
  50. };
  51. diag.show();// 显示窗口
  52. // 添加关闭按钮
  53. diag.addButton("close","关闭",function(){
  54. //var sId=document.getElementById(selectId);
  55. //var $obj=$(sId);
  56. //$obj.initCanstSelect(params);
  57. getSingleSelect(type,selectId);
  58. diag.close();
  59. diag=null;
  60. });
  61. // 添加确定按钮
  62. //diag.addButton("yes","保存",function(){
  63. // var callbackfn = diag.innerFrame.contentWindow.addMapValue();
  64. //});
  65. }
  66. //查询装备数量
  67. function SPQueryNo(){
  68. window.location.href="SPQueryZhuangbeiNum.jsp";
  69. }
  70. //装备调拨清单
  71. function SPSendAssignForm(){
  72. window.location.href="SPSendZhuangbeiForm.jsp";
  73. }
  74. function getSingleSelect(params,selectId){
  75. var sId=document.getElementById(selectId);
  76. var $obj=$(sId);
  77. $.ajax({
  78. url : $.pathname() +"/ws/FILEPOLL/FileAMService/queryListValue/",
  79. type : 'post',
  80. timeout : 15000,
  81. data : params,
  82. dataType : 'json',
  83. async:false,
  84. success : function(data){
  85. $obj.data("data",data);
  86. $obj.render();
  87. },
  88. error : function(e){
  89. $.messager.alert('系统提示信息', '访问服务失败!', 'error');
  90. }
  91. });
  92. }