商丘12345 前端

AddAppeal.html 19KB

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