信阳市12345演示系统-前端代码

AddAppeal.html 18KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440
  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. <input id="sourceaddress" type="text" placeholder="输入详细地址" style="width:50%; padding-left: 15px;" />
  99. </td>
  100. </tr>
  101. <tr>
  102. <th class="Importent"></th>
  103. <td colspan="7">
  104. <div style="width:710px">
  105. <div id="myMap" style="width:100%;height:400px;"></div>
  106. <input type="hidden" class="store_Lng" value="114.090325"/>
  107. <input type="hidden" class="store_Lat" value="32.129247" />
  108. </div>
  109. </td>
  110. </tr>
  111. <tr>
  112. <th>附件上传:</th>
  113. <td colspan="7">
  114. <div class="fileBox"></div>
  115. <input class="input" type="file" name="upFile" id="upFile" multiple="multiple" style="display: none;">
  116. <input class="input" type="button" value="上传" id="scwj" />
  117. <input class="input" type="button" value="删除附件" id="scfj" style="display:none;" />
  118. <input type="hidden" id="file" />
  119. <!--</br>-->
  120. <span style="color:#FF0000; border: none;">
  121. (文件格式为png,jpg,mp4,mp3,pdf,doc,docx,xls,xlsx)
  122. </span>
  123. </td>
  124. </tr>
  125. <!--<tr>
  126. <th>&nbsp;</th>
  127. <td></td>
  128. </tr>-->
  129. <tr>
  130. <th>处理方式:</th>
  131. <td colspan="7">
  132. <input type="radio" value="1" name="banli" class="Nows" />当即办理
  133. <input checked="true" type="radio" value="0" name="banli" class="Nows_" />网络转办
  134. </td>
  135. </tr>
  136. <tr class="Nows_box Hidens">
  137. <th>办理内容:</th>
  138. <td colspan="7">
  139. <input type="text" style="width: 100%;" id="result" />
  140. </td>
  141. </tr>
  142. <tr>
  143. <th class="Importent">主题词:</th>
  144. <td>
  145. <!--<input id="keys" type="text" placeholder="输入主题词" style="width:100%" />-->
  146. <select class="select_" id="keys">
  147. <option value=""></option>
  148. </select>
  149. </td>
  150. <th>类型:</th>
  151. <td>
  152. <select class="select_" id="type"></select>
  153. </td>
  154. <th>密级:</th>
  155. <td>
  156. <input checked="true" type="radio" name="mj" id="" value="0" />普通
  157. <input type="radio" name="mj" id="" value="1" />保密
  158. </td>
  159. <th>紧急程度:</th>
  160. <td>
  161. <select class="select_" id="level">
  162. <!--<option value="0">选择</option>-->
  163. <option value="1">普通</option>
  164. <option value="2">紧急</option>
  165. </select>
  166. </td>
  167. </tr>
  168. </table>
  169. <div class="btn_box">
  170. <button class="btns BC">保存</button>
  171. <button class="btns SavedSubmit">保存并提交</button>
  172. </div>
  173. </div>
  174. </div>
  175. </div>
  176. <script src="https://api.map.baidu.com/api?v=2.0&ak=ZG4gLQZUD6Eq1K11cqlYAR4by8CKgLyu&callback=mapinit"></script>
  177. <script src="../css/laydate/laydate.js"></script>
  178. <script src="../js/adjustHeight.js"></script>
  179. <script src="../js/appeal/index.js"></script>
  180. <script>
  181. var submit;
  182. $(document).ready(function () {
  183. QY($("#sourcearea"));
  184. LY($("#source"));
  185. LB($("#type"));
  186. ZT($("#keys"))
  187. //当即办理
  188. $(' input[name="banli"]').change(function () {
  189. var val = $(this).val();
  190. if (val == "1") {
  191. $(".Nows_box").show();
  192. } else {
  193. $(".Nows_box").hide();
  194. }
  195. })
  196. $(".BC").click(function () {
  197. submit = 0;
  198. Add();
  199. })
  200. $('.SavedSubmit').click(function () {
  201. submit = 1;
  202. Add();
  203. })
  204. //上传附件
  205. $("#scwj").click(function () {
  206. $("#upFile").trigger("click");
  207. })
  208. $("#upFile").change(function () {
  209. upload();
  210. })
  211. $("#scfj").click(function () {
  212. // $(".fjnr").text("");
  213. // $("#scfj").hide();
  214. })
  215. });
  216. //添加工单
  217. function Add() {
  218. var value = $(' input[name="banli"]:checked ').val();
  219. var content = $("#content").val();
  220. if (!$("#cusname").val()) {
  221. layer.msg("请输入姓名");
  222. } else if (!$("#cusphone").val()) {
  223. layer.msg("请输入投诉电话");
  224. } else if (!$("#title").val()) {
  225. layer.msg("请输入标题");
  226. } else if (!$("#content").val()) {
  227. layer.msg("请输入内容");
  228. } else if (!$("#keys").val()) {
  229. layer.msg("请选择主题词");
  230. } else if (!$("#sourcearea").val()) {
  231. layer.msg("请选择事发区域");
  232. } else if (value == 1 && !$('#result').val()) {
  233. layer.msg("请输入直办内容");
  234. } else {
  235. $.ajax({
  236. type: "post",
  237. url: huayi.config.callcenter_url + "/WorkOrder/AddWorkOrder",
  238. dataType: 'json',
  239. async: true,
  240. data: {
  241. cusname: $("#cusname").val(), //=投诉人姓名
  242. cussex: $("#cussex").val(),
  243. cusphone: $("#cusphone").val(), //=投诉人电话
  244. email: $("#email").val(),
  245. zipcode: $("#zipcode").val(),
  246. conphone: $("#conphone").val(),
  247. title: $("#title").val(),
  248. content: $("#content").val(),
  249. files: $("#file").val(), //(多个用英文逗号,隔开)
  250. sourcearea: $("#sourcearea").val(), //=事发地域id
  251. sourceaddress: $('#sourceaddress').val(), //=事发详细地址
  252. longitude: $('.store_Lng').val(),
  253. latitude: $('.store_Lat').val(),
  254. source: $("#source").val(), //=来源
  255. isresult: $(' input[name="banli"]:checked ').val(), //=(0转办1直办)
  256. result: $('#result').val(),
  257. keys: $("#keys").val(), //=关键词id(多个用英文逗号,隔开)
  258. type: $("#type").val(), //=类型
  259. isprotect: $(' input[name="mj"]:checked ').val(), //=(0普通1保密)
  260. level: $('#level').val(), //=(1普通2紧急)
  261. issubmit: submit, //=(0保存1保存并提交)
  262. token: $.cookie("token")
  263. },
  264. success: function (data) {
  265. debugger
  266. Clean();
  267. $('.fileBox').html('');
  268. layer.msg("创建工单成功");
  269. }
  270. });
  271. }
  272. }
  273. //上传文件
  274. function upload() {
  275. var Files = document.getElementById("upFile").files;
  276. if (Files.length > 0) {
  277. var formData = new FormData();
  278. for (var i = 0; i < Files.length; i++) {
  279. formData.append('file' + i, Files[i]);
  280. }
  281. formData.append("token", $.cookie("token"));
  282. var typeName=Files[0].name.split('.')[1];
  283. if (typeName=="png"||typeName=='jpg'||typeName=='mp4'||typeName=='mp3'||typeName=='pdf'||typeName=='doc'||typeName=='docx'||typeName=='xls'||typeName=='xlsx') {
  284. $.ajax({
  285. url: huayi.config.callcenter_url + "/WorkOrder/UploadFile",
  286. type: "POST",
  287. data: formData,
  288. /**
  289. *必须false才会自动加上正确的Content-Type
  290. */
  291. contentType: false,
  292. /**
  293. * 必须false才会避开jQuery对 formdata 的默认处理
  294. * XMLHttpRequest会对 formdata 进行正确的处理
  295. */
  296. processData: false,
  297. success: function (result) {
  298. debugger
  299. document.getElementById("upFile").outerHTML = document.getElementById("upFile").outerHTML;
  300. $("#upFile").change(function () {
  301. upload();
  302. });
  303. var r = $.parseJSON(result);
  304. if (r.state.toLowerCase() == "success") {
  305. var a = r.data;
  306. $(a).each(function (i, n) {
  307. var strs = '<span class="files" fiel-num="' + n.F_FileId + '">' + n.F_FileName.substring(19) + '<i class="fa fa-remove del_file"></i></span>'
  308. $(strs).appendTo($('.fileBox')).find('.del_file').click(function (event) {
  309. event.stopPropagation();
  310. $(this).parent().remove();
  311. file_num()
  312. })
  313. })
  314. file_num();
  315. }
  316. }
  317. });
  318. }else{
  319. layer.msg("格式不正确");
  320. }
  321. } else {
  322. layer.confirm('请上传文件!', {
  323. btn: ['确定']
  324. });
  325. }
  326. }
  327. //上传文件隐藏域值
  328. function file_num() {
  329. var str = '';
  330. var Str;
  331. $('.fileBox .files').each(function (j, m) {
  332. var aa = $(m).attr("fiel-num")
  333. console.log(aa);
  334. str += aa + ",";
  335. Str = (str.substring(str.length - 1) == ',') ? str.substring(0, str.length - 1) : str;
  336. })
  337. $("#file").val(Str);
  338. }
  339. //来源
  340. function LY(obj) {
  341. obj.empty();
  342. $.getJSON(huayi.config.callcenter_url + "Dictionary/GetDicValueListById", {
  343. "token": $.cookie("token"),
  344. id: 1
  345. }, function (data) {
  346. if (data.state.toLowerCase() == "success") {
  347. var content = data.data;
  348. $(content).each(function (i, n) {
  349. $("<option value='" + n.F_ValueId + "'>" + n.F_Value + "</option>").appendTo(obj);
  350. })
  351. }
  352. })
  353. }
  354. //类别
  355. function LB(obj) {
  356. obj.empty();
  357. $.getJSON(huayi.config.callcenter_url + "Dictionary/GetDicValueListById", {
  358. "token": $.cookie("token"),
  359. id: 2
  360. }, function (data) {
  361. if (data.state.toLowerCase() == "success") {
  362. var content = data.data;
  363. $(content).each(function (i, n) {
  364. $("<option value='" + n.F_ValueId + "'>" + n.F_Value + "</option>").appendTo(obj);
  365. })
  366. }
  367. })
  368. }
  369. // 主题
  370. function ZT(obj) {
  371. obj.empty();
  372. $.getJSON(huayi.config.callcenter_url + "Dictionary/GetDicValueListById", {
  373. "token": $.cookie("token"),
  374. id: 3
  375. }, function (data) {
  376. if (data.state.toLowerCase() == "success") {
  377. var content = data.data;
  378. $(content).each(function (i, n) {
  379. if(n.F_ValueId==24)
  380. $("<option value='" + n.F_ValueId + "' selected>" + n.F_Value + "</option>").appendTo(obj);
  381. else
  382. $("<option value='" + n.F_ValueId + "'>" + n.F_Value + "</option>").appendTo(obj);
  383. })
  384. }
  385. })
  386. }
  387. //区域
  388. function QY(obj) {
  389. obj.empty();
  390. obj.append('<option selected="selected" value="">请选择</option>');
  391. $.getJSON(huayi.config.callcenter_url + "Area/GetAreaListById", {
  392. "token": $.cookie("token"),
  393. }, function (data) {
  394. if (data.state.toLowerCase() == "success") {
  395. var content = data.data;
  396. $(content).each(function (i, n) {
  397. if (n.F_AreaName != '商丘市') {
  398. $("<option value='" + n.F_AreaId + "'>" + n.F_AreaName + "</option>").appendTo(obj);
  399. }
  400. })
  401. }
  402. })
  403. }
  404. function Clean() {
  405. $("#cusname").val(''); //=投诉人姓名
  406. $("#cussex").val('');
  407. $("#cusphone").val(''); //=投诉人电话
  408. $("#email").val('');
  409. $("#zipcode").val('');
  410. $("#conphone").val('');
  411. $("#title").val('');
  412. $("#content").val('');
  413. $("#sourcearea").val(); //=事发地域id
  414. $('#sourceaddress').val(''); //=事发详细地址
  415. $("input[name='baomi'][value='1']").prop("checked", true) //=(0转办1直办)
  416. $("#type option:first").prop("selected", 'selected');
  417. $("#level option:first").prop("selected", 'selected');
  418. $("#keys option:first").prop("selected", 'selected');
  419. $("#sourcearea option:first").prop("selected", 'selected');
  420. $('#result').val('');
  421. }
  422. </script>
  423. </body>
  424. </html>