jformGraphreportHead.js 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. $(function(){
  2. $("body").append("<link href=\"plug-in/lhgDialog/skins/default.css\" rel=\"stylesheet\" id=\"lhgdialoglink\">");
  3. var $btn = $("<div class=\"ui_buttons\" style=\"display:inline-block;padding:0px;\"><input style=\"position: relative;top: 0px;\" class=\"ui_state_highlight\" type=\"button\" value=\"sql解析\" id=\"sqlAnalyze\" /></div>");
  4. $("#cgrSql").after($btn);
  5. $btn.click(function(){
  6. $.ajax({
  7. url:"cgReportController.do?getFields",
  8. data:{sql:$("#cgrSql").val()},
  9. type:"Post",
  10. dataType:"json",
  11. success:function(data){
  12. if(data.status=="success"){
  13. $("#add_jformGraphreportItem_table").empty();
  14. $.each(data.fields,function(index,e){
  15. $("#addJformGraphreportItemBtn").click();
  16. $("#add_jformGraphreportItem_table tr:last").find(":text")
  17. .eq(0).val(e)
  18. .end().eq(1).val(e)
  19. .end().eq(2).val(index);
  20. });
  21. }else{
  22. $.messager.alert('??',data.datas);
  23. }
  24. }
  25. });
  26. });
  27. });
  28. //初始化下标
  29. function resetTrNum(tableId) {
  30. $tbody = $("#"+tableId+"");
  31. $tbody.find('>tr').each(function(i){
  32. $(':input, select,button,a', this).each(function(){
  33. var $this = $(this), name = $this.attr('name'),id=$this.attr('id'),onclick_str=$this.attr('onclick'), val = $this.val();
  34. if(name!=null){
  35. if (name.indexOf("#index#") >= 0){
  36. $this.attr("name",name.replace('#index#',i));
  37. }else{
  38. var s = name.indexOf("[");
  39. var e = name.indexOf("]");
  40. var new_name = name.substring(s+1,e);
  41. $this.attr("name",name.replace(new_name,i));
  42. }
  43. }
  44. if(id!=null){
  45. if (id.indexOf("#index#") >= 0){
  46. $this.attr("id",id.replace('#index#',i));
  47. }else{
  48. var s = id.indexOf("[");
  49. var e = id.indexOf("]");
  50. var new_id = id.substring(s+1,e);
  51. $this.attr("id",id.replace(new_id,i));
  52. }
  53. }
  54. if(onclick_str!=null){
  55. if (onclick_str.indexOf("#index#") >= 0){
  56. $this.attr("onclick",onclick_str.replace(/#index#/g,i));
  57. }else{
  58. }
  59. }
  60. });
  61. $(this).find('div[name=\'xh\']').html(i+1);
  62. });
  63. }
  64. jQuery(function() {
  65. jQuery("#formobj").Validform({
  66. tiptype: 1,
  67. btnSubmit: "#btn_sub",
  68. btnReset: "#btn_reset",
  69. ajaxPost: true,
  70. usePlugin: {
  71. passwordstrength: {
  72. minLen: 6,
  73. maxLen: 18,
  74. trigger: function(obj, error) {
  75. if (error) {
  76. obj.parent().next().find(".Validform_checktip").show();
  77. obj.find(".passwordStrength").hide();
  78. } else {
  79. jQuery(".passwordStrength").show();
  80. obj.parent().next().find(".Validform_checktip").hide();
  81. }
  82. }
  83. }
  84. },
  85. callback: function(data) {
  86. var win = frameElement.api.opener;
  87. if (data.success == true) {
  88. frameElement.api.close();
  89. win.tip(data.msg);
  90. } else {
  91. if (data.responseText == '' || data.responseText == undefined) {
  92. jQuery.messager.alert('错误', data.msg);
  93. jQuery.Hidemsg();
  94. } else {
  95. try {
  96. var emsg = data.responseText.substring(data.responseText.indexOf('错误描述'), data.responseText.indexOf('错误信息'));
  97. jQuery.messager.alert('错误', emsg);
  98. jQuery.Hidemsg();
  99. } catch(ex) {
  100. jQuery.messager.alert('错误', data.responseText + "");
  101. jQuery.Hidemsg();
  102. }
  103. }
  104. return false;
  105. }
  106. win.reloadTable();
  107. }
  108. });
  109. });