49ad5dcedbdbb37366928c38110532e4ab4a360b.svn-base 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. var table ;
  2. var selectData = {"list":[
  3. {"value":"0","key":"该字段既统计又要输入数字"},
  4. {"value":"1","key":"该字段不统计但要输入数字"},
  5. {"value":"2","key":"该字段既不统计又不要输入数字"},
  6. {"value":"3","key":"该字段需要日期统计"}]};
  7. function initComplete(){
  8. $("#IS_COUNT_329").data("data",selectData);
  9. $("#IS_COUNT_329").render();
  10. var url = decodeURI(window.location.href);
  11. // 初始化下拉框
  12. if(url.indexOf("?")>-1){
  13. var data = url.split("?");
  14. var title = data[1];
  15. var desc = data[2];
  16. var name = data[3];
  17. var count = data[4];
  18. var report_type = data[5];
  19. var report_name = data[6];
  20. if(title==null||title=="null"){
  21. title = "";
  22. }
  23. if(desc==null||desc=="null"){
  24. desc = "";
  25. }
  26. $("#REPORT_TYPE_329").val(report_type);
  27. $("#TABLE_HEAD_329").val(title);
  28. $("#COLUMN_NAME_329").val(desc);
  29. $("#IS_COUNT_329").setValue(count);
  30. $("#TABLE_COLUMN_329").val(name);
  31. $("#REPORT_NAME_329").val(report_name);
  32. }
  33. }
  34. //返回主页面
  35. function goback(){
  36. window.parent.document.getElementById("frmright").setAttribute("src", encodeURI("/nwyj/page/business/em/report/Show_Type.html?"+$("#REPORT_TYPE_329").val()+"?"+$("#REPORT_NAME_329").val()));
  37. }
  38. //下拉框不能修改
  39. window.onload = function (){
  40. $(".selectbox").attr("readonly","readonly");
  41. };
  42. //重置
  43. function clear_msg(){
  44. top.Dialog.confirm("确定要重置?填写的信息将会被还原,请慎重选择|重置", function() {
  45. initComplete();
  46. });
  47. }
  48. function alterType() {
  49. var valid = $("#editForm").validationEngine({
  50. returnIsValid : true,
  51. });
  52. if(valid==true){
  53. edit();
  54. }else{
  55. if($("#COLUMN_NAME_329").val().trim()==""){
  56. top.Dialog.alert("字段描述不能为空");
  57. }else if($("#IS_COUNT_329").val().trim()==""){
  58. top.Dialog.alert("统计类型不能为空");
  59. }
  60. }
  61. }
  62. function edit(){
  63. var type = $("#REPORT_TYPE_329").val();
  64. var head = $("#TABLE_HEAD_329").val();
  65. var column = $("#COLUMN_NAME_329").val();
  66. var table_column = $("#TABLE_COLUMN_329").val();
  67. var count = $("#IS_COUNT_329").val();
  68. var url = $.pathname()+ "/ws/xianlutingyun/XianlutingyunService/addDictionary";
  69. $.ajax({
  70. url : url,
  71. type : 'post',
  72. data :{
  73. report_type:type,
  74. table_column:table_column,
  75. column_name:column,
  76. is_count:count,
  77. table_head:head,
  78. type:'yj'
  79. },
  80. dataType : 'text',
  81. timeout : 60000,
  82. success : function(data){
  83. top.Dialog.alert("保存成功",null,null,null,1);
  84. goback();
  85. },
  86. error : function(){
  87. $.messager.alert('操作失败');
  88. }
  89. });
  90. }
  91. //IE屏蔽退格键
  92. document.onkeydown =function (e) {
  93. var code,type;
  94. if (!e){ var e = window.event;}
  95. if (e.keyCode){ code = e.keyCode;}
  96. else if (e.which){ code = e.which;}
  97. type = event.srcElement.type;
  98. if ((code == 8)
  99. && ((type == "text" && type == "textarea" ) || event.srcElement.readOnly == true)) {
  100. event.keyCode = 0;
  101. event.returnValue = false;
  102. }
  103. return true;
  104. };