ab855952b168030fc9c4bf105efdaf005e25bd69.svn-base 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. var table;
  2. var report_type;
  3. //增加报表列时表单验证
  4. function addType() {
  5. var valid = $("#addForm").validationEngine({
  6. returnIsValid : true,
  7. });
  8. if(valid==true){
  9. add();
  10. }else{
  11. if($("#COLUMN_NAME_529").val().trim()==""){
  12. top.Dialog.alert("字段描述不能为空");
  13. }else if($("#TABLE_COLUMN_529").val().trim()==""){
  14. top.Dialog.alert("备用字段不能为空");
  15. }else if($("#IS_COUNT_529").val()==""){
  16. top.Dialog.alert("统计类型不能为空");
  17. }
  18. }
  19. }
  20. function add(){
  21. //var formValue = $('#addForm').serialize();
  22. var type = $("#REPORT_TYPE_529").val();
  23. var head = $("#TABLE_HEAD_529").val();
  24. var column = $("#COLUMN_NAME_529").val();
  25. var table_column = $("#TABLE_COLUMN_529").val();
  26. var count = $("#IS_COUNT_529").val();
  27. var url = $.pathname()+ "/ws/xianlutingyun/XianlutingyunService/addDictionary";
  28. $.ajax({
  29. url : url,
  30. type : 'post',
  31. data :{
  32. report_type:type,
  33. table_column:table_column,
  34. column_name:column,
  35. is_count:count,
  36. table_head:head,
  37. type:"rc"
  38. },
  39. dataType : 'text',
  40. timeout : 60000,
  41. success : function(data){
  42. top.Dialog.alert("保存成功",null,null,null,1);
  43. goback();
  44. },
  45. error : function(){
  46. $.messager.alert('操作失败');
  47. }
  48. });
  49. }
  50. function goback(){
  51. window.parent.document.getElementById("frmright").setAttribute("src", encodeURI("/nwyj/page/business/am/report/dictionary/Show_Type.html?"+$("#REPORT_TYPE_529").val()+"?"+$("#REPORT_NAME_529").val()));
  52. }
  53. $(function(){
  54. var url =decodeURI(window.location.href);
  55. if(url.indexOf("?")>-1){
  56. var data = url.split("?");
  57. $("#REPORT_TYPE_529").val(data[1]);
  58. $("#REPORT_NAME_529").val(data[2]);
  59. /*$("#dept").val(data[3]);*/
  60. }
  61. // 初始化下拉框
  62. $.ajax({
  63. url:$.pathname()
  64. + "/ws/xianlutingyun/XianlutingyunService/getItems",
  65. type : 'post',
  66. timeout : 15000,
  67. async : false,
  68. data : {
  69. "report_type" : $("#REPORT_TYPE_529").val(),
  70. "type":"rc"
  71. },
  72. dataType : 'json',
  73. success : function(data) {
  74. table = data;
  75. },
  76. error : function(e) {
  77. $.messager.alert('查询失败!', '访问服务失败!', 'error');
  78. }
  79. });
  80. $("#TABLE_COLUMN_529").data("data",table);
  81. $("#TABLE_COLUMN_529").render();
  82. });
  83. //让下拉框不让改动
  84. window.onload = function (){
  85. $(".selectbox").attr("readonly","readonly");
  86. };
  87. function clear_msg(){
  88. top.Dialog.confirm("确定要重置?填写的信息将会被清除,请慎重选择|重置", function() {
  89. $("#TABLE_HEAD_529").val("");
  90. $("#COLUMN_NAME_529").val("");
  91. $("#TABLE_COLUMN_529").render();
  92. $("#IS_COUNT_529").render();
  93. });
  94. }