商丘12345 前端

AddAppeal.html 21KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543
  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. <link rel="stylesheet" href="../js/layui/css/layui.css">
  10. <title>新增诉求工单</title>
  11. <style>
  12. .input {
  13. background-color: #FFF;
  14. background-image: none;
  15. border: 1px solid #ccc;
  16. border-radius: 1px;
  17. color: inherit;
  18. padding: 6px 12px
  19. }
  20. .fjnr {
  21. padding: 0 !important;
  22. border: none !important;
  23. }
  24. input, select {
  25. vertical-align: middle;
  26. }
  27. .reflectCategory-wrapper {
  28. position: relative;
  29. }
  30. .reflectCategoryList-wrapper {
  31. display: none;
  32. position: absolute;
  33. top: 38px;
  34. z-index: 9999;
  35. line-height: 32px;
  36. background: #FFF;
  37. }
  38. #reflectCategoryList {
  39. height: 240px;
  40. background: #FFF;
  41. border: 1px solid #e5e6e7;
  42. overflow: auto;
  43. }
  44. #reflectCategoryList li {
  45. padding: 0 10px;
  46. width: 100%;
  47. line-height: 32px;
  48. }
  49. .layui-menu-body-title{
  50. font-size: 12px;
  51. }
  52. #reflectCategoryList li:hover {
  53. background: #00a1cb;
  54. }
  55. </style>
  56. </head>
  57. <body>
  58. <div class="wrapper wrapper-content animated fadeInRight">
  59. <div class="daoHang clearfix">
  60. <div class="dhLeft">
  61. <sapn>
  62. <i class="syIcon"></i>位置:
  63. <a href="javaScript:;" id="ReIndex">首页</a>&gt;
  64. <a href="javaScript:;">工单处理</a>&gt;
  65. <a href="" class="nowPosition">添加工单</a>
  66. </sapn>
  67. </div>
  68. <div class="dhRight">
  69. <a href="" title="刷新"><i class="fa fa-refresh"></i></a>
  70. </div>
  71. </div>
  72. <div style="padding: 10px;" class="tj_content clearFix">
  73. <div class="Common">
  74. <table>
  75. <tr>
  76. <th class="Importent">姓名:</th>
  77. <td>
  78. <input type="text" id="cusname" />
  79. </td>
  80. <th>性别:</th>
  81. <td>
  82. <select class="select_" id="cussex">
  83. <option value="">请选择</option>
  84. <option value="0">男</option>
  85. <option value="1">女</option>
  86. </select>
  87. </td>
  88. <th>来源:</th>
  89. <td>
  90. <select class="select_" id="source"></select>
  91. </td>
  92. <th class="Importent">投诉电话:</th>
  93. <td>
  94. <input type="text" id="cusphone" />
  95. </td>
  96. </tr>
  97. <tr>
  98. <th>邮箱:</th>
  99. <td>
  100. <input type="text" id="email" />
  101. </td>
  102. <th>邮编:</th>
  103. <td>
  104. <input type="text" id="zipcode" />
  105. </td>
  106. <th class="Importent">联系电话:</th>
  107. <td>
  108. <input type="text" id="conphone" />
  109. </td>
  110. </tr>
  111. <tr>
  112. <th class="Importent">标题:</th>
  113. <td colspan="7">
  114. <input id="title" type="text" style="width: 100%;" />
  115. </td>
  116. </tr>
  117. <tr>
  118. <th class="Importent">内容:</th>
  119. <td colspan="7">
  120. <textarea data-adaptheight id="content" name="" rows="" cols="" style="width: 100%;"></textarea>
  121. </td>
  122. </tr>
  123. <tr>
  124. <th class="Importent">反映类别:</th>
  125. <td class="reflectCategory-wrapper" colspan="4">
  126. <input type="text" id="reflectCategory" autocomplete="off" style="width: 100%;" />
  127. <div class="reflectCategoryList-wrapper">
  128. <ul id="reflectCategoryList">
  129. </ul>
  130. </div>
  131. </td>
  132. </tr>
  133. <tr>
  134. <th class="Importent">事件地址:</th>
  135. <td colspan="7">
  136. <select class="select_" id="sourcearea"></select>
  137. </td>
  138. </tr>
  139. <tr>
  140. <th class="Importent"></th>
  141. <td colspan="7">
  142. <input id="sourceaddress" type="text" placeholder="输入详细地址" style="width:50%; padding-left: 15px;" />
  143. </td>
  144. </tr>
  145. <tr>
  146. <th class="Importent"></th>
  147. <td colspan="7">
  148. <div style="width:710px">
  149. <div id="myMap" style="width:100%;height:400px;"></div>
  150. <input type="hidden" class="store_Lng" value="115.659773"/>
  151. <input type="hidden" class="store_Lat" value="34.395449" />
  152. </div>
  153. </td>
  154. </tr>
  155. <tr>
  156. <th>附件上传:</th>
  157. <td colspan="7">
  158. <div class="fileBox"></div>
  159. <input class="input" type="file" name="upFile" id="upFile" multiple="multiple" style="display: none;">
  160. <input class="input" type="button" value="上传" id="scwj" />
  161. <input class="input" type="button" value="删除附件" id="scfj" style="display:none;" />
  162. <input type="hidden" id="file" />
  163. <span style="color:#FF0000; border: none;">
  164. (文件格式为png,jpg,mp4,avi,wmv,mp3,pdf,doc,docx,xls,xlsx)
  165. </span>
  166. </td>
  167. </tr>
  168. <tr>
  169. <th>处理方式:</th>
  170. <td colspan="7">
  171. <input type="radio" value="1" name="banli" class="Nows" />当即办理
  172. <input checked="true" type="radio" value="0" name="banli" class="Nows_" />网络转办
  173. </td>
  174. </tr>
  175. <tr class="Nows_box Hidens">
  176. <th>办理内容:</th>
  177. <td colspan="7">
  178. <input type="text" style="width: 100%;" id="result" />
  179. </td>
  180. </tr>
  181. <tr>
  182. <th class="Importent">主题词:</th>
  183. <td>
  184. <select class="select_" id="keys">
  185. <option value=""></option>
  186. </select>
  187. </td>
  188. <th>类型:</th>
  189. <td>
  190. <select class="select_" id="type"></select>
  191. </td>
  192. <th>密级:</th>
  193. <td>
  194. <input checked="true" type="radio" name="mj" id="" value="0" />普通
  195. <input type="radio" name="mj" id="" value="1" />保密
  196. </td>
  197. <th>紧急程度:</th>
  198. <td>
  199. <select class="select_" id="level">
  200. <option value="1">普通</option>
  201. <option value="2">紧急</option>
  202. </select>
  203. </td>
  204. </tr>
  205. </table>
  206. <div class="btn_box">
  207. <button class="btns BC">保存</button>
  208. <button class="btns SavedSubmit">保存并提交</button>
  209. </div>
  210. </div>
  211. </div>
  212. </div>
  213. <input type="hidden" id="keyvalue" value="" />
  214. <script src="https://api.map.baidu.com/api?v=2.0&ak=ZG4gLQZUD6Eq1K11cqlYAR4by8CKgLyu&callback=mapinit"></script>
  215. <script src="../js/layui/layui.js"></script>
  216. <script src="../css/laydate/laydate.js"></script>
  217. <script src="../js/adjustHeight.js"></script>
  218. <script src="../js/appeal/index1.js"></script>
  219. <script src="../js/commonJS/index.js"></script>
  220. <script>
  221. var submit;
  222. $(document).ready(function () {
  223. QY($("#sourcearea"));
  224. LY($("#source"));
  225. LB($("#type"));
  226. ZT($("#keys"))
  227. //当即办理
  228. $(' input[name="banli"]').change(function () {
  229. var val = $(this).val();
  230. if (val == "1") {
  231. $(".Nows_box").show();
  232. } else {
  233. $(".Nows_box").hide();
  234. }
  235. })
  236. $(".BC").click(function () {
  237. submit = 0;
  238. Add();
  239. })
  240. $('.SavedSubmit').click(function () {
  241. submit = 1;
  242. Add();
  243. })
  244. //上传附件
  245. $("#scwj").click(function () {
  246. $("#upFile").trigger("click");
  247. })
  248. $("#upFile").change(function () {
  249. upload();
  250. })
  251. $("#scfj").click(function () {
  252. // $(".fjnr").text("");
  253. // $("#scfj").hide();
  254. })
  255. });
  256. //添加工单
  257. function Add() {
  258. var value = $(' input[name="banli"]:checked ').val();
  259. var content = $("#content").val();
  260. if (!$("#cusname").val()) {
  261. layer.msg("请输入姓名");
  262. } else if (!$("#cusphone").val()) {
  263. layer.msg("请输入投诉电话");
  264. } else if (!$("#conphone").val()) {
  265. layer.msg("请输入联系电话");
  266. } else if (!$("#title").val()) {
  267. layer.msg("请输入标题");
  268. } else if (!$("#content").val()) {
  269. layer.msg("请输入内容");
  270. } else if (!$("#keys").val()) {
  271. layer.msg("请选择主题词");
  272. } else if (!$("#sourcearea").val()) {
  273. layer.msg("请选择事发区域");
  274. } else if (value == 1 && !$('#result').val()) {
  275. layer.msg("请输入直办内容");
  276. } else {
  277. $.ajax({
  278. type: "post",
  279. url: huayi.config.callcenter_url + "/WorkOrder/AddWorkOrder",
  280. dataType: 'json',
  281. async: true,
  282. beforeSend: function() { //触发ajax请求开始时执行
  283. $('.BC').attr("disabled", true);
  284. $('.SavedSubmit').attr("disabled", true);
  285. $('.BC').text('提交中...');
  286. $('.SavedSubmit').text('提交中...');
  287. $(document).off('click', '.BC', Add);
  288. $(document).off('click', '.SavedSubmit', Add);
  289. },
  290. data: {
  291. cusname: $("#cusname").val(), //=投诉人姓名
  292. cussex: $("#cussex").val(),
  293. cusphone: $("#cusphone").val(), //=投诉人电话
  294. email: $("#email").val(),
  295. zipcode: $("#zipcode").val(),
  296. conphone: $("#conphone").val(),
  297. title: $("#title").val(),
  298. content: $("#content").val(),
  299. files: $("#file").val(), //(多个用英文逗号,隔开)
  300. sourcearea: $("#sourcearea").val(), //=事发地域id
  301. sourceaddress: $('#sourceaddress').val(), //=事发详细地址
  302. longitude: $('.store_Lng').val(),
  303. latitude: $('.store_Lat').val(),
  304. source: $("#source").val(), //=来源
  305. keyvalue:$("#keyvalue").val(), //反映类别
  306. isresult: $(' input[name="banli"]:checked ').val(), //=(0转办1直办)
  307. result: $('#result').val(),
  308. keys: $("#keys").val(), //=关键词id(多个用英文逗号,隔开)
  309. type: $("#type").val(), //=类型
  310. isprotect: $(' input[name="mj"]:checked ').val(), //=(0普通1保密)
  311. level: $('#level').val(), //=(1普通2紧急)
  312. issubmit: submit, //=(0保存1保存并提交)
  313. token: $.cookie("token")
  314. },
  315. success: function (data) {
  316. debugger
  317. if (data.state ==="success") {
  318. $('.BC').attr("disabled", false);
  319. $('.SavedSubmit').attr("disabled", false);
  320. $('.BC').text('保存');
  321. $('.SavedSubmit').text('保存并提交');
  322. $(document).on('click', '.BC', Add);
  323. $(document).on('click', '.SavedSubmit', Add);
  324. Clean();
  325. $('.fileBox').html('');
  326. layer.msg("创建工单成功");
  327. }else{
  328. $('.BC').attr("disabled", false);
  329. $('.SavedSubmit').attr("disabled", false);
  330. $('.BC').text('保存');
  331. $('.SavedSubmit').text('保存并提交');
  332. $(document).on('click', '.BC', Add);
  333. $(document).on('click', '.SavedSubmit', Add);
  334. layer.msg("添加失败");
  335. }
  336. }
  337. });
  338. }
  339. }
  340. //上传文件
  341. function upload() {
  342. var Files = document.getElementById("upFile").files;
  343. console.log(Files);
  344. if (Files.length > 0) {
  345. debugger
  346. var formData = new FormData();
  347. for (var i = 0; i < Files.length; i++) {
  348. formData.append('file' + i, Files[i]);
  349. }
  350. formData.append("token", $.cookie("token"));
  351. var typeName=Files[0].name.split('.')[Files[0].name.split('.').length-1];
  352. if (typeName=="png"||typeName=='jpg'||typeName=='mp4'||typeName=='avi'||typeName=='wmv'||typeName=='mp3'||typeName=='pdf'||typeName=='doc'||typeName=='docx'||typeName=='xls'||typeName=='xlsx') {
  353. $.ajax({
  354. url: huayi.config.callcenter_url + "/WorkOrder/UploadFile",
  355. type: "POST",
  356. data: formData,
  357. /**
  358. *必须false才会自动加上正确的Content-Type
  359. */
  360. contentType: false,
  361. /**
  362. * 必须false才会避开jQuery对 formdata 的默认处理
  363. * XMLHttpRequest会对 formdata 进行正确的处理
  364. */
  365. processData: false,
  366. success: function (result) {
  367. debugger
  368. document.getElementById("upFile").outerHTML = document.getElementById("upFile").outerHTML;
  369. $("#upFile").change(function () {
  370. upload();
  371. });
  372. var r = $.parseJSON(result);
  373. if (r.state.toLowerCase() == "success") {
  374. var a = r.data;
  375. $(a).each(function (i, n) {
  376. var strs = '<span class="files" fiel-num="' + n.F_FileId + '">' + n.F_FileName.substring(19) + '<i class="fa fa-remove del_file"></i></span>'
  377. $(strs).appendTo($('.fileBox')).find('.del_file').click(function (event) {
  378. event.stopPropagation();
  379. $(this).parent().remove();
  380. file_num()
  381. })
  382. })
  383. file_num();
  384. }
  385. }
  386. });
  387. }else{
  388. layer.msg("格式不正确");
  389. }
  390. } else {
  391. layer.confirm('请上传文件!', {
  392. btn: ['确定']
  393. });
  394. }
  395. }
  396. //上传文件隐藏域值
  397. function file_num() {
  398. var str = '';
  399. var Str;
  400. $('.fileBox .files').each(function (j, m) {
  401. var aa = $(m).attr("fiel-num")
  402. console.log(aa);
  403. str += aa + ",";
  404. Str = (str.substring(str.length - 1) == ',') ? str.substring(0, str.length - 1) : str;
  405. })
  406. $("#file").val(Str);
  407. }
  408. //来源
  409. function LY(obj) {
  410. obj.empty();
  411. $.ajax({
  412. type:"get",
  413. url:huayi.config.callcenter_url + "Dictionary/GetDicValueListById",
  414. dataType:"json",
  415. async:true,
  416. data:{
  417. "token": $.cookie("token"),
  418. id: 1
  419. },
  420. success:function(data){
  421. if (data.state.toLowerCase() == "success") {
  422. var content = data.data;
  423. $(content).each(function (i, n) {
  424. $("<option value='" + n.F_ValueId + "'>" + n.F_Value + "</option>").appendTo(obj);
  425. })
  426. }
  427. }
  428. });
  429. }
  430. //类别
  431. function LB(obj) {
  432. obj.empty();
  433. $.ajax({
  434. type:"get",
  435. url:huayi.config.callcenter_url + "Dictionary/GetDicValueListById",
  436. dataType:"json",
  437. async:true,
  438. data:{
  439. "token": $.cookie("token"),
  440. id: 2
  441. },
  442. success:function(data){
  443. if (data.state.toLowerCase() == "success") {
  444. var content = data.data;
  445. $(content).each(function (i, n) {
  446. $("<option value='" + n.F_ValueId + "'>" + n.F_Value + "</option>").appendTo(obj);
  447. })
  448. }
  449. }
  450. });
  451. }
  452. // 主题
  453. function ZT(obj) {
  454. obj.empty();
  455. $.ajax({
  456. type:"get",
  457. url:huayi.config.callcenter_url + "Dictionary/GetDicValueListById",
  458. dataType:"json",
  459. async:true,
  460. data:{
  461. "token": $.cookie("token"),
  462. type:1,
  463. id: 3
  464. },
  465. success:function(data){
  466. if (data.state.toLowerCase() == "success") {
  467. var content = data.data;
  468. $(content).each(function (i, n) {
  469. $("<option value='" + n.F_ValueId + "'>" + n.F_Value + "</option>").appendTo(obj);
  470. })
  471. }
  472. }
  473. });
  474. }
  475. //区域
  476. function QY(obj) {
  477. obj.empty();
  478. obj.append('<option selected="selected" value="">请选择</option>');
  479. $.ajax({
  480. type:"get",
  481. url:huayi.config.callcenter_url + "Area/GetAreaListById",
  482. dataType:"json",
  483. async:true,
  484. data:{
  485. "token": $.cookie("token"),
  486. },
  487. success:function(data){
  488. if (data.state.toLowerCase() == "success") {
  489. var content = data.data;
  490. $(content).each(function (i, n) {
  491. if (n.F_AreaName != '商丘市') {
  492. $("<option value='" + n.F_AreaId + "'>" + n.F_AreaName + "</option>").appendTo(obj);
  493. }
  494. })
  495. }
  496. }
  497. });
  498. }
  499. function Clean() {
  500. $("#cusname").val(''); //=投诉人姓名
  501. $("#cussex").val('');
  502. $("#cusphone").val(''); //=投诉人电话
  503. $("#email").val('');
  504. $("#zipcode").val('');
  505. $("#conphone").val('');
  506. $("#title").val('');
  507. $("#content").val('');
  508. $("#sourcearea").val(); //=事发地域id
  509. $('#sourceaddress').val(''); //=事发详细地址
  510. $("input[name='baomi'][value='1']").prop("checked", true) //=(0转办1直办)
  511. $("#type option:first").prop("selected", 'selected');
  512. $("#level option:first").prop("selected", 'selected');
  513. $("#keys option:first").prop("selected", 'selected');
  514. $("#sourcearea option:first").prop("selected", 'selected');
  515. $('#result').val('');
  516. $("#reflectCategory").val('')
  517. $("#keyvalue").val('')
  518. }
  519. </script>
  520. </body>
  521. </html>