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

AddAppeal.html 18KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443
  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. } else {
  198. $(".Nows_box").hide();
  199. }
  200. })
  201. $(".BC").click(function () {
  202. submit = 0;
  203. Add();
  204. })
  205. $('.SavedSubmit').click(function () {
  206. submit = 1;
  207. Add();
  208. })
  209. //上传附件
  210. $("#scwj").click(function () {
  211. $("#upFile").trigger("click");
  212. })
  213. $("#upFile").change(function () {
  214. upload();
  215. })
  216. $("#scfj").click(function () {
  217. // $(".fjnr").text("");
  218. // $("#scfj").hide();
  219. })
  220. });
  221. //添加工单
  222. function Add() {
  223. var value = $(' input[name="banli"]:checked ').val();
  224. var content = $("#content").val();
  225. if (!$("#cusname").val()) {
  226. layer.msg("请输入姓名");
  227. } else if (!$("#cusphone").val()) {
  228. layer.msg("请输入投诉电话");
  229. } else if (!$("#title").val()) {
  230. layer.msg("请输入标题");
  231. } else if (!$("#content").val()) {
  232. layer.msg("请输入内容");
  233. } else if (!$("#keys").val()) {
  234. layer.msg("请选择主题词");
  235. } else if (!$("#sourcearea").val()) {
  236. layer.msg("请选择事发区域");
  237. } else if (value == 1 && !$('#result').val()) {
  238. layer.msg("请输入直办内容");
  239. } else {
  240. $.ajax({
  241. type: "post",
  242. url: huayi.config.callcenter_url + "/WorkOrder/AddWorkOrder",
  243. dataType: 'json',
  244. async: true,
  245. data: {
  246. cusname: $("#cusname").val(), //=投诉人姓名
  247. cussex: $("#cussex").val(),
  248. cusphone: $("#cusphone").val(), //=投诉人电话
  249. email: $("#email").val(),
  250. zipcode: $("#zipcode").val(),
  251. conphone: $("#conphone").val(),
  252. title: $("#title").val(),
  253. content: $("#content").val(),
  254. files: $("#file").val(), //(多个用英文逗号,隔开)
  255. sourcearea: $("#sourcearea").val(), //=事发地域id
  256. sourceaddress: $('#sourceaddress').val(), //=事发详细地址
  257. longitude: $('.store_Lng').val(),
  258. latitude: $('.store_Lat').val(),
  259. source: $("#source").val(), //=来源
  260. isresult: $(' input[name="banli"]:checked ').val(), //=(0转办1直办)
  261. result: $('#result').val(),
  262. keys: $("#keys").val(), //=关键词id(多个用英文逗号,隔开)
  263. type: $("#type").val(), //=类型
  264. isprotect: $(' input[name="mj"]:checked ').val(), //=(0普通1保密)
  265. level: $('#level').val(), //=(1普通2紧急)
  266. issubmit: submit, //=(0保存1保存并提交)
  267. token: $.cookie("token")
  268. },
  269. success: function (data) {
  270. Clean();
  271. $('.fileBox').html('');
  272. layer.msg("创建工单成功");
  273. }
  274. });
  275. }
  276. }
  277. //上传文件
  278. function upload() {
  279. var Files = document.getElementById("upFile").files;
  280. if (Files.length > 0) {
  281. var formData = new FormData();
  282. for (var i = 0; i < Files.length; i++) {
  283. formData.append('file' + i, Files[i]);
  284. }
  285. formData.append("token", $.cookie("token"));
  286. var typeName=Files[0].name.split('.')[1];
  287. if (typeName=="png"||typeName=='jpg'||typeName=='mp4'||typeName=='mp3'||typeName=='pdf'||typeName=='doc'||typeName=='docx'||typeName=='xls'||typeName=='xlsx') {
  288. $.ajax({
  289. url: huayi.config.callcenter_url + "/WorkOrder/UploadFile",
  290. type: "POST",
  291. data: formData,
  292. /**
  293. *必须false才会自动加上正确的Content-Type
  294. */
  295. contentType: false,
  296. /**
  297. * 必须false才会避开jQuery对 formdata 的默认处理
  298. * XMLHttpRequest会对 formdata 进行正确的处理
  299. */
  300. processData: false,
  301. success: function (result) {
  302. debugger
  303. document.getElementById("upFile").outerHTML = document.getElementById("upFile").outerHTML;
  304. $("#upFile").change(function () {
  305. upload();
  306. });
  307. var r = $.parseJSON(result);
  308. if (r.state.toLowerCase() == "success") {
  309. var a = r.data;
  310. $(a).each(function (i, n) {
  311. var strs = '<span class="files" fiel-num="' + n.F_FileId + '">' + n.F_FileName.substring(19) + '<i class="fa fa-remove del_file"></i></span>'
  312. $(strs).appendTo($('.fileBox')).find('.del_file').click(function (event) {
  313. event.stopPropagation();
  314. $(this).parent().remove();
  315. file_num()
  316. })
  317. })
  318. file_num();
  319. }
  320. }
  321. });
  322. }else{
  323. layer.msg("格式不正确");
  324. }
  325. } else {
  326. layer.confirm('请上传文件!', {
  327. btn: ['确定']
  328. });
  329. }
  330. }
  331. //上传文件隐藏域值
  332. function file_num() {
  333. var str = '';
  334. var Str;
  335. $('.fileBox .files').each(function (j, m) {
  336. var aa = $(m).attr("fiel-num")
  337. console.log(aa);
  338. str += aa + ",";
  339. Str = (str.substring(str.length - 1) == ',') ? str.substring(0, str.length - 1) : str;
  340. })
  341. $("#file").val(Str);
  342. }
  343. //来源
  344. function LY(obj) {
  345. obj.empty();
  346. $.getJSON(huayi.config.callcenter_url + "Dictionary/GetDicValueListById", {
  347. "token": $.cookie("token"),
  348. id: 1
  349. }, function (data) {
  350. if (data.state.toLowerCase() == "success") {
  351. var content = data.data;
  352. $(content).each(function (i, n) {
  353. $("<option value='" + n.F_ValueId + "'>" + n.F_Value + "</option>").appendTo(obj);
  354. })
  355. }
  356. })
  357. }
  358. //类别
  359. function LB(obj) {
  360. obj.empty();
  361. $.getJSON(huayi.config.callcenter_url + "Dictionary/GetDicValueListById", {
  362. "token": $.cookie("token"),
  363. id: 2
  364. }, function (data) {
  365. if (data.state.toLowerCase() == "success") {
  366. var content = data.data;
  367. $(content).each(function (i, n) {
  368. $("<option value='" + n.F_ValueId + "'>" + n.F_Value + "</option>").appendTo(obj);
  369. })
  370. }
  371. })
  372. }
  373. // 主题
  374. function ZT(obj) {
  375. obj.empty();
  376. $.getJSON(huayi.config.callcenter_url + "Dictionary/GetDicValueListById", {
  377. "token": $.cookie("token"),
  378. id: 3
  379. }, function (data) {
  380. if (data.state.toLowerCase() == "success") {
  381. var content = data.data;
  382. $(content).each(function (i, n) {
  383. if(n.F_ValueId==24)
  384. $("<option value='" + n.F_ValueId + "' selected>" + n.F_Value + "</option>").appendTo(obj);
  385. else
  386. $("<option value='" + n.F_ValueId + "'>" + n.F_Value + "</option>").appendTo(obj);
  387. })
  388. }
  389. })
  390. }
  391. //区域
  392. function QY(obj) {
  393. obj.empty();
  394. obj.append('<option selected="selected" value="">请选择</option>');
  395. $.getJSON(huayi.config.callcenter_url + "Area/GetAreaListById", {
  396. "token": $.cookie("token"),
  397. }, function (data) {
  398. if (data.state.toLowerCase() == "success") {
  399. var content = data.data;
  400. $(content).each(function (i, n) {
  401. if (n.F_AreaName != '商丘市') {
  402. $("<option value='" + n.F_AreaId + "'>" + n.F_AreaName + "</option>").appendTo(obj);
  403. }
  404. })
  405. }
  406. })
  407. }
  408. function Clean() {
  409. $("#cusname").val(''); //=投诉人姓名
  410. $("#cussex").val('');
  411. $("#cusphone").val(''); //=投诉人电话
  412. $("#email").val('');
  413. $("#zipcode").val('');
  414. $("#conphone").val('');
  415. $("#title").val('');
  416. $("#content").val('');
  417. $("#sourcearea").val(); //=事发地域id
  418. $('#sourceaddress').val(''); //=事发详细地址
  419. $("input[name='baomi'][value='1']").prop("checked", true) //=(0转办1直办)
  420. $("#type option:first").prop("selected", 'selected');
  421. $("#level option:first").prop("selected", 'selected');
  422. $("#keys option:first").prop("selected", 'selected');
  423. $("#sourcearea option:first").prop("selected", 'selected');
  424. $('#result').val('');
  425. }
  426. </script>
  427. </body>
  428. </html>