商丘12345 前端

AddAppeal.html 22KB

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