staff_listadd.html 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. {Template header}
  2. <body>
  3. <div class="warp">
  4. <div class="title winnone">变动信息 - 添加</div>
  5. <ul class="setting">
  6. <li class="length remark">
  7. <em>变更详情:</em>
  8. <textarea name="data"></textarea>
  9. </li>
  10. <li>
  11. <em>变更日期:</em>
  12. <input class="must" value="" name="time" type="text" onClick="laydate({istime: true,format:'YYYY-MM-DD'})">
  13. <i class="time fa fa-calendar fa-lg"></i>
  14. </li>
  15. <div style="clear:both;"></div>
  16. </ul>
  17. <div class="button"><font class="stafflistadd">提 交</font> <font class="fh">关 闭</font></div>
  18. </div>
  19. <input type="hidden" name="uid" value="{$_GET['uid']}" />
  20. <script>var addedit="/staff/listadd/";
  21. $(".stafflistadd").click(function() {
  22. $(".ts p").html("<i class='fa fa-2x fa-cog fa-spin'></i> &nbsp; 正在添加中,请稍后...");
  23. $(".ts").show();
  24. var f = "";
  25. var e = "";
  26. $(".select").each(function() {
  27. f = f + $(this).attr("name") + "=" + $(this).children("option:selected").val() + "&";
  28. });
  29. $("input:text").each(function() {
  30. var str = $(this).val().replace(/\+/g,"%2B");
  31. var str = str.replace(/&/g,"%26");
  32. f = f + $(this).attr("name") + "=" + str + "&";
  33. });
  34. $("input:password").each(function() {
  35. f = f + $(this).attr("name") + "=" + $(this).val() + "&";
  36. });
  37. $("input:hidden").each(function() {
  38. f = f + $(this).attr("name") + "=" + $(this).val() + "&";
  39. });
  40. $("textarea").each(function() {
  41. var str2 = $(this).val().replace(/\+/g,"%2B");
  42. var str2 = str2.replace(/&/g,"%26");
  43. f = f + $(this).attr("name") + "=" + str2 + "&";
  44. });
  45. if($(".scimg img").length > 0)
  46. {
  47. var a = '';
  48. for (var b = 0; b < $(".scimg .upimg img").length; b++)
  49. {
  50. a = a + $(".scimg .upimg img")[b].src + "|";
  51. }
  52. for (var b = 0; b < $(".scimg .upimg video").length; b++)
  53. {
  54. a = a + $('.scimg .upimg video')[b].src + "|";
  55. }
  56. var a = a.replace(/\+/g,"%2B");
  57. var a = a.replace(/&/g,"%26");
  58. f = f + "img=" + a + "&";
  59. }
  60. for(i=0;i<$(".checkbox").length;i++)
  61. {
  62. var checkid = ""; var checkname = "";
  63. $(".checkbox:eq("+i+") .ckrows input:checked").each(function(){
  64. checkname = $(this).attr("name");
  65. checkid = checkid + $(this).val()+",";
  66. });
  67. if(checkname == "")
  68. {
  69. $(".ts p").text($(".checkbox:eq("+i+")").prevAll("em").text()+"为必填项");
  70. $(".ts").show();
  71. setTimeout('$(".ts").fadeOut()', 600);
  72. return false;
  73. }
  74. f = f + checkname + "=" + checkid + "&";
  75. }
  76. for(i=0;i<$(".checkboxfbt").length;i++)
  77. {
  78. var checkid = ""; var checkname = "";
  79. $(".checkboxfbt:eq("+i+") .ckrows input:checked").each(function(){
  80. checkname = $(this).attr("name");
  81. checkid = checkid + $(this).val()+",";
  82. });
  83. if(checkname != "")
  84. {
  85. f = f + checkname + "=" + checkid + "&";
  86. }
  87. }
  88. var ab = 0;
  89. $(".must").each(function() {
  90. if ($.trim($(this).val()).length == 0) {
  91. $(this).css("border", "1px solid #F66");
  92. ab = ab + 1;
  93. }
  94. });
  95. if (ab > 0) {
  96. $(".ts p").text("红框为必填项");
  97. $(".ts").show();
  98. setTimeout('$(".ts").fadeOut()', 600);
  99. return false;
  100. }
  101. $.ajax({
  102. url: addedit,
  103. data: f,
  104. type: "POST",
  105. dataType: "json",
  106. success: function(a) {
  107. if (a && a.success) {
  108. $(".ts").hide();
  109. staffedit(a.id,a.data,a.time);
  110. var nm = $("input[name=page]",window.parent.parent.document).val();
  111. var id = $(this).data("id");
  112. window.parent.searchspanedit(nm,id);
  113. $(".fh").click();
  114. } else {
  115. $(".ts").hide();
  116. $(".ts p").html(a.msg);
  117. $(".ts").fadeIn();
  118. setTimeout('$(".ts").fadeOut()', 800);
  119. }
  120. }
  121. });
  122. });
  123. </script>
  124. <script type="text/javascript" src="{$theme}js/laydate.js"></script>
  125. {Template footer}