商丘12345 前端

AddAppeal.html 17KB

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