商丘12345 前端

AddAppeal.html 12KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414
  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="wrapper wrapper-content animated fadeInRight">
  27. <div class="daoHang clearfix">
  28. <div class="dhLeft">
  29. <sapn>
  30. <i class="syIcon"></i>位置:
  31. <a href="javaScript:;" id="ReIndex">首页</a>&gt;
  32. <a href="javaScript:;">工单处理</a>&gt;
  33. <a class="nowPosition">添加工单</a>
  34. </sapn>
  35. </div>
  36. <div class="dhRight">
  37. <a href="" title="刷新"><i class="fa fa-refresh"></i></a>
  38. </div>
  39. </div>
  40. <div style="padding: 10px;" class="tj_content clearFix">
  41. <div class="Common">
  42. <table>
  43. <tr>
  44. <th class="Importent">姓名:</th>
  45. <td>
  46. <input type="text" id="cusname" />
  47. </td>
  48. <th>性别:</th>
  49. <td>
  50. <select class="select_" id="cussex">
  51. <option value="">请选择</option>
  52. <option value="0">男</option>
  53. <option value="1">女</option>
  54. </select>
  55. </td>
  56. <th>来源:</th>
  57. <td>
  58. <select class="select_" id="source">
  59. </select>
  60. </td>
  61. <th class="Importent">投诉电话:</th>
  62. <td>
  63. <input type="text" id="cusphone" />
  64. </td>
  65. </tr>
  66. <tr>
  67. <th>邮箱:</th>
  68. <td>
  69. <input type="text" id="email" />
  70. </td>
  71. <th>邮编:</th>
  72. <td>
  73. <input type="text" id="zipcode" />
  74. </td>
  75. <th>联系电话:</th>
  76. <td>
  77. <input type="text" id="conphone" />
  78. </td>
  79. </tr>
  80. <tr>
  81. <th class="Importent">标题:</th>
  82. <td colspan="7">
  83. <input id="title" type="text" style="width: 100%;" />
  84. </td>
  85. </tr>
  86. <tr>
  87. <th class="Importent">内容:</th>
  88. <td colspan="7">
  89. <textarea data-adaptheight id="content" name="" rows="" cols="" style="width: 100%;"></textarea>
  90. </td>
  91. </tr>
  92. <tr>
  93. <th class="Importent">事件地址:</th>
  94. <td colspan="7">
  95. <select class="select_" id="sourcearea">
  96. </select>
  97. <input id="sourceaddress" type="text" placeholder="输入详细地址" style="width:66%" />
  98. </td>
  99. </tr>
  100. <tr>
  101. <th>附件上传:</th>
  102. <td colspan="7">
  103. <div class="fileBox">
  104. <!--<span class="files">文件1<i class="fa fa-remove"></i></span>-->
  105. </div>
  106. <!--<input type="text" placeholder="输入附件详情" style="width:66%" />-->
  107. <!--<span class="fjnr"></span>-->
  108. <input class="input" type="file" name="upFile" id="upFile" multiple="multiple" style="display: none;">
  109. <input class="input" type="button" value="上传" id="scwj" />
  110. <input class="input" type="button" value="删除附件" id="scfj" style="display:none;" />
  111. <input type="hidden" id="file" />
  112. </td>
  113. </tr>
  114. <tr>
  115. <th>处理方式:</th>
  116. <td colspan="7">
  117. <input type="radio" value="1" name="banli" class="Nows" />当即办理
  118. <input checked="true" type="radio" value="0" name="banli" class="Nows_" />网络转办
  119. </td>
  120. </tr>
  121. <tr class="Nows_box Hidens">
  122. <th>办理内容:</th>
  123. <td colspan="7">
  124. <input type="text" style="width: 100%;" id="result" />
  125. </td>
  126. </tr>
  127. <tr>
  128. <th class="Importent">主题词:</th>
  129. <td>
  130. <!--<input id="keys" type="text" placeholder="输入主题词" style="width:100%" />-->
  131. <select class="select_" id="keys">
  132. <option value=""></option>
  133. </select>
  134. </td>
  135. <th>类型:</th>
  136. <td>
  137. <select class="select_" id="type">
  138. </select>
  139. </td>
  140. <th>密级:</th>
  141. <td>
  142. <input checked="true" type="radio" name="mj" id="" value="0" />普通
  143. <input type="radio" name="mj" id="" value="1" />保密
  144. </td>
  145. <th>紧急程度:</th>
  146. <td>
  147. <select class="select_" id="level">
  148. <option value="0">选择</option>
  149. <option value="1">普通</option>
  150. <option value="2">紧急</option>
  151. </select>
  152. </td>
  153. <!--<th class="">分管领导:</th>
  154. <td colspan="4">
  155. <input id="splituser" type="text" placeholder="" style="width:100%" readonly="readonly" />
  156. </td>-->
  157. </tr>
  158. </table>
  159. <div class="btn_box">
  160. <button class="btns BC">保存</button>
  161. <button class="btns SavedSubmit">保存并提交</button>
  162. </div>
  163. </div>
  164. </div>
  165. </div>
  166. <script src="../css/laydate/laydate.js"></script>
  167. <script src="../js/adjustHeight.js"></script>
  168. <script>
  169. var submit;
  170. $(document).ready(function() {
  171. QY($("#sourcearea"));
  172. LY($("#source"));
  173. LB($("#type"));
  174. ZT($("#keys"))
  175. //当即办理
  176. $(' input[name="banli"]').change(function(){
  177. var val=$(this).val();
  178. if(val=="1"){
  179. $(".Nows_box").show();
  180. }else{
  181. $(".Nows_box").hide();
  182. }
  183. })
  184. $(".BC").click(function() {
  185. submit = 0;
  186. Add();
  187. })
  188. $('.SavedSubmit').click(function() {
  189. submit = 1;
  190. Add();
  191. })
  192. //上传附件
  193. $("#scwj").click(function() {
  194. $("#upFile").trigger("click");
  195. })
  196. $("#upFile").change(function() {
  197. upload();
  198. })
  199. $("#scfj").click(function() {
  200. // $(".fjnr").text("");
  201. // $("#scfj").hide();
  202. })
  203. });
  204. //添加工单
  205. function Add() {
  206. var value = $(' input[name="banli"]:checked ').val();
  207. var content = $("#content").val();
  208. if (!$("#cusname").val()) {
  209. layer.msg("请输入姓名");
  210. } else if (!$("#cusphone").val()) {
  211. layer.msg("请输入投诉电话");
  212. } else if (!$("#title").val()) {
  213. layer.msg("请输入标题");
  214. } else if (!$("#content").val()) {
  215. layer.msg("请输入内容");
  216. } else if (!$("#keys").val()) {
  217. layer.msg("请选择主题词");
  218. } else if (!$("#sourcearea").val()) {
  219. layer.msg("请选择事发区域");
  220. } else if (value == 1 && !$('#result').val()) {
  221. layer.msg("请输入直办内容");
  222. } else {
  223. $.ajax({
  224. type: "post",
  225. url: huayi.config.callcenter_url + "/WorkOrder/AddWorkOrder",
  226. dataType: 'json',
  227. async: true,
  228. data: {
  229. cusname: $("#cusname").val(), //=投诉人姓名
  230. cussex: $("#cussex").val(),
  231. cusphone: $("#cusphone").val(), //=投诉人电话
  232. email: $("#email").val(),
  233. zipcode: $("#zipcode").val(),
  234. conphone: $("#conphone").val(),
  235. title: $("#title").val(),
  236. content: $("#content").val(),
  237. files: $("#file").val(), //(多个用英文逗号,隔开)
  238. sourcearea: $("#sourcearea").val(), //=事发地域id
  239. sourceaddress: $('#sourceaddress').val(), //=事发详细地址
  240. source: $("#source").val(), //=来源
  241. isresult: $(' input[name="banli"]:checked ').val(), //=(0转办1直办)
  242. result: $('#result').val(),
  243. keys: $("#keys").val(), //=关键词id(多个用英文逗号,隔开)
  244. type: $("#type").val(), //=类型
  245. isprotect: $(' input[name="mj"]:checked ').val(), //=(0普通1保密)
  246. level: $('#level').val(), //=(1普通2紧急)
  247. issubmit: submit, //=(0保存1保存并提交)
  248. token: $.cookie("token")
  249. },
  250. success: function(data) {
  251. Clean();
  252. $('.fileBox').html('');
  253. layer.msg("创建工单成功");
  254. }
  255. });
  256. }
  257. }
  258. //上传文件
  259. function upload() {
  260. var Files = document.getElementById("upFile").files;
  261. if(Files.length > 0) {
  262. var formData = new FormData();
  263. for(var i = 0; i < Files.length; i++) {
  264. formData.append('file' + i, Files[i]);
  265. ;
  266. }
  267. console.log(formData)
  268. formData.append("token", $.cookie("token"));
  269. $.ajax({
  270. url: huayi.config.callcenter_url + "/WorkOrder/UploadFile",
  271. type: "POST",
  272. data: formData,
  273. /**
  274. *必须false才会自动加上正确的Content-Type
  275. */
  276. contentType: false,
  277. /**
  278. * 必须false才会避开jQuery对 formdata 的默认处理
  279. * XMLHttpRequest会对 formdata 进行正确的处理
  280. */
  281. processData: false,
  282. success: function(result) {
  283. document.getElementById("upFile").outerHTML = document.getElementById("upFile").outerHTML;
  284. $("#upFile").change(function() {
  285. upload();
  286. });
  287. var r = $.parseJSON(result);
  288. if(r.state.toLowerCase() == "success") {
  289. // $(".fjnr").text(r.data[0].F_FileName);
  290. var a = r.data;
  291. $(a).each(function(i, n) {
  292. var strs='<span class="files" fiel-num="'+ n.F_FileId +'">'+ n.F_FileName +'<i class="fa fa-remove del_file"></i></span>'
  293. $(strs).appendTo($('.fileBox')).find('.del_file').click(function(event){
  294. event.stopPropagation();
  295. $(this).parent().remove();
  296. file_num()
  297. })
  298. })
  299. file_num()
  300. }
  301. }
  302. });
  303. } else {
  304. layer.confirm('请上传文件!', {
  305. btn: ['确定']
  306. });
  307. }
  308. }
  309. //上传文件隐藏域值
  310. function file_num(){
  311. var str = '';
  312. var Str;
  313. $('.fileBox .files').each(function(j,m){
  314. var aa=$(m).attr("fiel-num")
  315. console.log(aa);
  316. str += aa + ",";
  317. Str = (str.substring(str.length - 1) == ',') ? str.substring(0, str.length - 1) : str;
  318. })
  319. $("#file").val(Str);
  320. }
  321. //来源
  322. function LY(obj) {
  323. obj.empty();
  324. $.getJSON(huayi.config.callcenter_url + "Dictionary/GetDicValueListById", {
  325. "token": $.cookie("token"),
  326. id: 1
  327. }, function(data) {
  328. if(data.state.toLowerCase() == "success") {
  329. var content = data.data;
  330. $(content).each(function(i, n) {
  331. $("<option value='" + n.F_ValueId + "'>" + n.F_Value + "</option>").appendTo(obj);
  332. })
  333. }
  334. })
  335. }
  336. //类别
  337. function LB(obj) {
  338. obj.empty();
  339. $.getJSON(huayi.config.callcenter_url + "Dictionary/GetDicValueListById", {
  340. "token": $.cookie("token"),
  341. id: 2
  342. }, function(data) {
  343. if(data.state.toLowerCase() == "success") {
  344. var content = data.data;
  345. $(content).each(function(i, n) {
  346. $("<option value='" + n.F_ValueId + "'>" + n.F_Value + "</option>").appendTo(obj);
  347. })
  348. }
  349. })
  350. }
  351. // 主题
  352. function ZT(obj) {
  353. obj.empty();
  354. $.getJSON(huayi.config.callcenter_url + "Dictionary/GetDicValueListById", {
  355. "token": $.cookie("token"),
  356. id: 3
  357. }, function(data) {
  358. if(data.state.toLowerCase() == "success") {
  359. var content = data.data;
  360. $(content).each(function(i, n) {
  361. $("<option value='" + n.F_ValueId + "'>" + n.F_Value + "</option>").appendTo(obj);
  362. })
  363. }
  364. })
  365. }
  366. //区域
  367. function QY(obj) {
  368. obj.empty();
  369. obj.append('<option selected="selected" value="">请选择</option>');
  370. $.getJSON(huayi.config.callcenter_url + "Area/GetAreaListById", {
  371. "token": $.cookie("token"),
  372. }, function(data) {
  373. if(data.state.toLowerCase() == "success") {
  374. var content = data.data;
  375. $(content).each(function(i, n) {
  376. $("<option value='" + n.F_AreaId + "'>" + n.F_AreaName + "</option>").appendTo(obj);
  377. })
  378. }
  379. })
  380. }
  381. function Clean() {
  382. $("#cusname").val(''); //=投诉人姓名
  383. $("#cussex").val('');
  384. $("#cusphone").val(''); //=投诉人电话
  385. $("#email").val('');
  386. $("#zipcode").val('');
  387. $("#conphone").val('');
  388. $("#title").val('');
  389. $("#content").val('');
  390. $("#sourcearea").val(); //=事发地域id
  391. $('#sourceaddress').val(''); //=事发详细地址
  392. $("input[name='baomi'][value='1']").prop("checked", true) //=(0转办1直办)
  393. $("#type option:first").prop("selected", 'selected');
  394. $("#level option:first").prop("selected", 'selected');
  395. $("#keys option:first").prop("selected", 'selected');
  396. $("#sourcearea option:first").prop("selected", 'selected');
  397. $('#result').val('');
  398. }
  399. </script>
  400. </body>
  401. </html>