71aac11dc94895ed7fb9929f9cc8384ff7fd56d7.svn-base 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  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_329").val().trim()==""){
  12. top.Dialog.alert("字段描述不能为空");
  13. }else if($("#TABLE_COLUMN_329").val().trim()==""){
  14. top.Dialog.alert("备用字段不能为空");
  15. }else if($("#IS_COUNT_329").val()==""){
  16. top.Dialog.alert("统计类型不能为空");
  17. }
  18. }
  19. }
  20. function add(){
  21. //var formValue = $('#addForm').serialize();
  22. var type = $("#REPORT_TYPE_329").val();
  23. var head = $("#TABLE_HEAD_329").val();
  24. var column = $("#COLUMN_NAME_329").val();
  25. var table_column = $("#TABLE_COLUMN_329").val();
  26. var count = $("#IS_COUNT_329").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:"yj"
  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/em/report/Show_Type.html?"+$("#REPORT_TYPE_329").val()+"?"+$("#REPORT_NAME_329").val()));
  52. }
  53. var selectData = {"list":[
  54. {"value":"0","key":"该字段既统计又要输入数字"},
  55. {"value":"1","key":"该字段不统计但要输入数字"},
  56. {"value":"2","key":"该字段既不统计又不要输入数字"},
  57. {"value":"3","key":"该字段需要日期统计"}]};
  58. $(function(){
  59. $("#IS_COUNT_329").data("data",selectData);
  60. $("#IS_COUNT_329").render();
  61. var url =decodeURI(window.location.href);
  62. if(url.indexOf("?")>-1){
  63. var data = url.split("?");
  64. $("#REPORT_TYPE_329").val(data[1]);
  65. $("#REPORT_NAME_329").val(data[2]);
  66. if(data[1]=="7"){
  67. $("#TABLE_HEAD_329").removeClass("validate[required,length[0,10]]");
  68. $("#TABLE_HEAD_329").addClass("validate[length[0,10]]");
  69. $("#span").html("");
  70. }
  71. }
  72. // 初始化下拉框
  73. $.ajax({
  74. url:$.pathname()
  75. + "/ws/xianlutingyun/XianlutingyunService/getItems",
  76. type : 'post',
  77. timeout : 15000,
  78. async : false,
  79. data : {
  80. "report_type" : $("#REPORT_TYPE_329").val(),
  81. "type":"yj"
  82. },
  83. dataType : 'json',
  84. success : function(data) {
  85. table = data;
  86. },
  87. error : function(e) {
  88. $.messager.alert('查询失败!', '访问服务失败!', 'error');
  89. }
  90. });
  91. $("#TABLE_COLUMN_329").data("data",table);
  92. $("#TABLE_COLUMN_329").render();
  93. });
  94. //让下拉框不让改动
  95. window.onload = function (){
  96. $(".selectbox").attr("readonly","readonly");
  97. };
  98. function clear_msg(){
  99. top.Dialog.confirm("确定要重置?填写的信息将会被清除,请慎重选择|重置", function() {
  100. $("#TABLE_HEAD_329").val("");
  101. $("#COLUMN_NAME_329").val("");
  102. $("#TABLE_COLUMN_329").render();
  103. $("#IS_COUNT_329").render();
  104. });
  105. }