12345市长热线标准版-前端

LDPS.html 4.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="UTF-8">
  5. <script src="../Script/Common/huayi.load.js"></script>
  6. <script src="../Script/Common/huayi.config.js"></script>
  7. <link href="../css/layer/need/layer.css" />
  8. <link rel="stylesheet" href="../css/init.css" />
  9. <title>领导批示</title>
  10. <style>
  11. .input {
  12. background-color: #FFF;
  13. background-image: none;
  14. border: 1px solid #ccc;
  15. border-radius: 1px;
  16. color: inherit;
  17. padding: 6px 12px
  18. }
  19. .fjnr {
  20. padding: 0!important;
  21. border: none!important;
  22. }
  23. </style>
  24. </head>
  25. <body>
  26. <div class="Common">
  27. <table>
  28. <tr>
  29. <th class="Importent">批示人:</th>
  30. <td> <input type="text" id="superuser"/></td>
  31. </tr>
  32. <tr>
  33. <th >批示类型:</th>
  34. <td>
  35. <input type="text" id="Type" readonly="readonly"/>
  36. <input type="hidden" id="Types"/>
  37. </td>
  38. </tr>
  39. <tr>
  40. <th class="Importent">批示内容:</th>
  41. <td colspan="2"><textarea data-adaptheight id="superopinion" name="" rows="6" cols=""></textarea></td>
  42. </tr>
  43. <tr>
  44. <th>附件上传:</th>
  45. <td colspan="7">
  46. <span class="fjnr"></span>
  47. <input class="input" type="file" name="upFile" id="upFile" multiple="multiple" style="display: none;">
  48. <input class="input" type="button" value="上传" id="scwj" />
  49. <input class="input" type="button" value="删除附件" id="scfj" style="display:none;" />
  50. <input type="hidden" id="file" />
  51. </td>
  52. </tr>
  53. </table>
  54. <div class="btn_box">
  55. <button class="btns">保存</button>
  56. </div>
  57. </div>
  58. <script src="../css/laydate/laydate.js"></script>
  59. <script src="../js/adjustHeight.js"></script>
  60. <script>
  61. var wid = helper.request.queryString("wid");
  62. var type = helper.request.queryString("type");
  63. var superuser =unescape(decodeURI(helper.request.queryString("superuser")));
  64. var superopinion = unescape(decodeURI(helper.request.queryString("superopinion")));
  65. $(document).ready(function() {
  66. var Ltype="";
  67. if(type==1){
  68. Ltype="领导批示";
  69. }else if(type==2){
  70. Ltype="市长指示";
  71. } else if(type==3){
  72. Ltype="回退";
  73. }
  74. $("#Type").val(Ltype);
  75. $("#Types").val(type);
  76. $("#superuser").val(superuser);
  77. $('#superopinion').val(superopinion);
  78. //上传附件
  79. $("#scwj").click(function() {
  80. $("#upFile").trigger("click");
  81. })
  82. $("#upFile").change(function() {
  83. upload();
  84. })
  85. $("#scfj").click(function() {
  86. $(".fjnr").text("");
  87. $("#scfj").hide();
  88. })
  89. $(".btns").click(function(){
  90. JA();
  91. })
  92. })
  93. //批示
  94. function JA() {
  95. $.post(huayi.config.callcenter_url + 'WorkOrder/EditSuperInfoByAdmin', {
  96. id: wid,
  97. type:$("#Types").val(),//(1领导批示 2市长指示)
  98. superuser:$("#superuser").val(),//批示人&
  99. superopinion:$('#superopinion').val(),//批示内容&
  100. files:$("#file").val(),//附件id(多个用英文逗号,隔开
  101. "token": $.cookie("token")
  102. }, function(result) {
  103. result = JSON.parse(result);
  104. if(result.state.toLowerCase() == "success") {
  105. var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
  106. parent.layer.close(index); //再执行关闭
  107. parent.layer.msg("操作成功");
  108. }
  109. })
  110. }
  111. function upload() {
  112. var Files = document.getElementById("upFile").files;
  113. if(Files.length > 0) {
  114. var formData = new FormData();
  115. for(var i = 0; i < Files.length; i++) {
  116. formData.append('file' + i, Files[i]);
  117. }
  118. formData.append("token", $.cookie("token"));
  119. $.ajax({
  120. url: huayi.config.callcenter_url + "/WorkOrder/UploadFile",
  121. type: "POST",
  122. data: formData,
  123. /**
  124. *必须false才会自动加上正确的Content-Type
  125. */
  126. contentType: false,
  127. /**
  128. * 必须false才会避开jQuery对 formdata 的默认处理
  129. * XMLHttpRequest会对 formdata 进行正确的处理
  130. */
  131. processData: false,
  132. success: function(result) {
  133. document.getElementById("upFile").outerHTML = document.getElementById("upFile").outerHTML;
  134. $("#upFile").change(function() {
  135. upload();
  136. });
  137. var r = $.parseJSON(result);
  138. if(r.state.toLowerCase() == "success") {
  139. $(".fjnr").text(r.data[0].F_FileName);
  140. var a = r.data;
  141. var str = '';
  142. var Str;
  143. $(a).each(function(i, n) {
  144. console.log(n.F_FileId);
  145. str += n.F_FileId + ",";
  146. Str = (str.substring(str.length - 1) == ',') ? str.substring(0, str.length - 1) : str;
  147. console.log(Str);
  148. })
  149. $("#file").val(Str);
  150. $("#scfj").show();
  151. }
  152. }
  153. });
  154. } else {
  155. layer.confirm('请上传文件!', {
  156. btn: ['确定']
  157. });
  158. }
  159. }
  160. </script>
  161. </body>
  162. </html>