Нет описания

shizhang.html 5.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171
  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 class="Importent">附件:</th>
  34. <td>
  35. <div class="fileBox"></div>
  36. <input class="input" type="file" name="upFile" id="upFile" multiple="multiple" style="display: none;">
  37. <input class="input" type="button" value="上传" id="scwj" />
  38. <input class="input" type="button" value="删除附件" id="scfj" style="display:none;" />
  39. <input type="hidden" id="file" />
  40. <span style="color:#FF0000; border: none;">
  41. (文件格式为png,jpg,mp4,mp3,pdf,doc,docx,xls,xlsx)
  42. </span>
  43. </td>
  44. </tr>
  45. <tr>
  46. <th class="Importent">批示内容:</th>
  47. <td colspan="2"><textarea data-adaptheight id="superopinion" name="" rows="6" cols=""></textarea></td>
  48. </tr>
  49. </table>
  50. <div class="btn_box">
  51. <button class="btns">保存</button>
  52. </div>
  53. </div>
  54. <script src="../css/laydate/laydate.js"></script>
  55. <script src="../js/adjustHeight.js"></script>
  56. <script>
  57. var wid = helper.request.queryString("wid");
  58. $(document).ready(function() {
  59. //上传附件
  60. $("#scwj").click(function() {
  61. $("#upFile").trigger("click");
  62. })
  63. $("#upFile").change(function() {
  64. upload();
  65. })
  66. // $("#scfj").click(function() {
  67. // $(".fjnr").text("");
  68. // $("#scfj").hide();
  69. // })
  70. $(".btns").click(function(){
  71. if($("#superopinion").val()==''){
  72. layer.msg("意见不能为空");
  73. }else {
  74. JA();
  75. }
  76. })
  77. })
  78. //批示
  79. function JA() {
  80. $.post(huayi.config.callcenter_url + 'WorkOrder/SuperWorkOrder', {
  81. workorderid: wid,
  82. type:2,//(1领导批示 2市长指示)
  83. files:$("#file").val(),
  84. superuser:$("#superuser").val(),//批示人&
  85. superopinion:$('#superopinion').val(),//批示内容&
  86. "token": $.cookie("token")
  87. }, function(result) {
  88. result = JSON.parse(result);
  89. if(result.state.toLowerCase() == "success") {
  90. var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
  91. parent.layer.close(index); //再执行关闭
  92. parent.$('#orderlist').bootstrapTable('refresh');
  93. parent.layer.msg("操作成功");
  94. $('.fileBox').html('');
  95. }
  96. })
  97. }
  98. //上传文件
  99. function upload() {
  100. var Files = document.getElementById("upFile").files;
  101. if(Files.length > 0) {
  102. var formData = new FormData();
  103. for(var i = 0; i < Files.length; i++) {
  104. formData.append('file' + i, Files[i]);
  105. }
  106. formData.append("token", $.cookie("token"));
  107. var typeName=Files[0].name.split('.')[1];
  108. if (typeName=="png"||typeName=='jpg'||typeName=='mp4'||typeName=='mp3'||typeName=='pdf'||typeName=='doc'||typeName=='docx'||typeName=='xls'||typeName=='xlsx') {
  109. $.ajax({
  110. url: huayi.config.callcenter_url + "/WorkOrder/UploadFile",
  111. type: "POST",
  112. data: formData,
  113. /**
  114. *必须false才会自动加上正确的Content-Type
  115. */
  116. contentType: false,
  117. /**
  118. * 必须false才会避开jQuery对 formdata 的默认处理
  119. * XMLHttpRequest会对 formdata 进行正确的处理
  120. */
  121. processData: false,
  122. success: function(result) {
  123. document.getElementById("upFile").outerHTML = document.getElementById("upFile").outerHTML;
  124. $("#upFile").change(function() {
  125. upload();
  126. });
  127. var r = $.parseJSON(result);
  128. if(r.state.toLowerCase() == "success") {
  129. var a = r.data;
  130. $(a).each(function(i, n) {
  131. var strs='<span class="files" fiel-num="'+ n.F_FileId +'">'+ n.F_FileName.substring(19) +'<i class="fa fa-remove del_file"></i></span>'
  132. $(strs).appendTo($('.fileBox')).find('.del_file').click(function(event){
  133. event.stopPropagation();
  134. $(this).parent().remove();
  135. file_num();
  136. })
  137. })
  138. file_num();
  139. }
  140. }
  141. });
  142. }else{
  143. layer.msg("格式不正确");
  144. }
  145. } else {
  146. layer.confirm('请上传文件!', {
  147. btn: ['确定']
  148. });
  149. }
  150. }
  151. //上传文件隐藏域值
  152. function file_num(){
  153. var str = '';
  154. var Str;
  155. $('.fileBox .files').each(function(j,m){
  156. var aa=$(m).attr("fiel-num")
  157. console.log(aa);
  158. str += aa + ",";
  159. Str = (str.substring(str.length - 1) == ',') ? str.substring(0, str.length - 1) : str;
  160. })
  161. $("#file").val(Str);
  162. }
  163. </script>
  164. </body>
  165. </html>