Нет описания

Supervision_.html 5.6KB

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