Nenhuma Descrição

Supervision_.html 7.0KB

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