县级12345前端

AddOrder.html 18KB

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 rel="stylesheet" href="../css/init.css" />
  8. <title>新增诉求工单</title>
  9. <style>
  10. .input {
  11. background-color: #FFF;
  12. background-image: none;
  13. border: 1px solid #ccc;
  14. border-radius: 1px;
  15. color: inherit;
  16. padding: 6px 12px;
  17. }
  18. .fjnr {
  19. padding: 0 !important;
  20. border: none !important;
  21. }
  22. </style>
  23. </head>
  24. <body>
  25. <div class="wrapper wrapper-content">
  26. <div style="padding: 10px;" class="tj_content clearFix">
  27. <div class="Common">
  28. <table>
  29. <tr>
  30. <th class="Importent">姓名:</th>
  31. <td>
  32. <input type="text" id="cusname" />
  33. </td>
  34. <th>性别:</th>
  35. <td>
  36. <select class="select_" id="cussex">
  37. <option value="">请选择</option>
  38. <option value="0">男</option>
  39. <option value="1">女</option>
  40. </select>
  41. </td>
  42. <th>来源:</th>
  43. <td>
  44. <!--<select class="select_" id="source"></select>-->
  45. <span>语音留言</span>
  46. <input type="hidden" id="source" value="7" />
  47. </td>
  48. <th class="Importent">投诉电话:</th>
  49. <td>
  50. <input type="text" id="cusphone" />
  51. </td>
  52. </tr>
  53. <tr>
  54. <th>邮箱:</th>
  55. <td>
  56. <input type="text" id="email" />
  57. </td>
  58. <th>邮编:</th>
  59. <td>
  60. <input type="text" id="zipcode" />
  61. </td>
  62. <th>联系电话:</th>
  63. <td>
  64. <input type="text" id="conphone" />
  65. </td>
  66. </tr>
  67. <tr>
  68. <th class="Importent">标题:</th>
  69. <td colspan="7">
  70. <input id="title" type="text" style="width: 100%;" />
  71. </td>
  72. </tr>
  73. <tr>
  74. <th class="Importent">内容:</th>
  75. <td colspan="7">
  76. <textarea data-adaptheight id="content" name="" rows="" cols="" style="width: 100%;"></textarea>
  77. </td>
  78. </tr>
  79. <tr>
  80. <th class="Importent">事件地址:</th>
  81. <td colspan="7">
  82. <select class="select_" id="sourcearea"></select>
  83. <input id="sourceaddress" type="text" placeholder="输入详细地址" style="width:66%" />
  84. </td>
  85. </tr>
  86. <tr>
  87. <th>附件上传:</th>
  88. <td colspan="7">
  89. <div class="fileBox">
  90. <!--<span class="files">文件1<i class="fa fa-remove"></i></span>-->
  91. </div>
  92. <!--<input type="text" placeholder="输入附件详情" style="width:66%" />-->
  93. <!--<span class="fjnr"></span>-->
  94. <input class="input" type="file" name="upFile" id="upFile" multiple="multiple" style="display: none;">
  95. <input class="input" type="button" value="上传" id="scwj" />
  96. <input class="input" type="button" value="删除附件" id="scfj" style="display:none;" />
  97. <input type="hidden" id="file" />
  98. </td>
  99. </tr>
  100. <tr>
  101. <th>处理方式:</th>
  102. <td colspan="7">
  103. <input type="radio" value="1" name="banli" class="Nows" />当即办理
  104. <input checked="true" type="radio" value="0" name="banli" class="Nows_" />网络转办
  105. </td>
  106. </tr>
  107. <tr class="Nows_box Hidens">
  108. <th>办理内容:</th>
  109. <td colspan="7">
  110. <input type="text" style="width: 100%;" id="result" />
  111. </td>
  112. </tr>
  113. <tr>
  114. <th class="Importent">主题词:</th>
  115. <td>
  116. <!--<input id="keys" type="text" placeholder="输入主题词" style="width:100%" />-->
  117. <select class="select_" id="keys">
  118. <option value=""></option>
  119. </select>
  120. </td>
  121. <th>类型:</th>
  122. <td>
  123. <select class="select_" id="type"></select>
  124. </td>
  125. <th>密级:</th>
  126. <td>
  127. <input checked="true" type="radio" name="mj" id="" value="0" />普通
  128. <input type="radio" name="mj" id="" value="1" />保密
  129. </td>
  130. <th>紧急程度:</th>
  131. <td>
  132. <select class="select_" id="level">
  133. <option value="0">选择</option>
  134. <option value="1">普通</option>
  135. <option value="2">紧急</option>
  136. </select>
  137. </td>
  138. <!--<th class="">分管领导:</th>
  139. <td colspan="4">
  140. <input id="splituser" type="text" placeholder="" style="width:100%" readonly="readonly" />
  141. </td>-->
  142. </tr>
  143. </table>
  144. <div class="btn_box">
  145. <button class="btns BC">保存</button>
  146. <button class="btns SavedSubmit">保存并提交</button>
  147. </div>
  148. </div>
  149. </div>
  150. </div>
  151. <script src="../css/laydate/laydate.js"></script>
  152. <script src="../js/adjustHeight.js"></script>
  153. <script>
  154. var submit;
  155. var lyid = helper.request.queryString("lyid");
  156. $(document).ready(function () {
  157. if (lyid) {
  158. $.getJSON(huayi.config.callcenter_url + "Callleave/GetLeaveRecord", {
  159. id: lyid,
  160. token: $.cookie("token")
  161. }, function (result) {
  162. if (result.state.toLowerCase() == "success") {
  163. $("#cusphone").val(result.data.F_Phone);
  164. }
  165. })
  166. }
  167. QY($("#sourcearea"));
  168. //LY($("#source"));
  169. LB($("#type"));
  170. ZT($("#keys"))
  171. //当即办理
  172. $(' input[name="banli"]').change(function () {
  173. var val = $(this).val();
  174. if (val == "1") {
  175. $(".Nows_box").show();
  176. } else {
  177. $(".Nows_box").hide();
  178. }
  179. })
  180. $(".BC").click(function () {
  181. submit = 0;
  182. Add();
  183. })
  184. $('.SavedSubmit').click(function () {
  185. submit = 1;
  186. Add();
  187. })
  188. //上传附件
  189. $("#scwj").click(function () {
  190. $("#upFile").trigger("click");
  191. })
  192. $("#upFile").change(function () {
  193. upload();
  194. })
  195. $("#scfj").click(function () {
  196. // $(".fjnr").text("");
  197. // $("#scfj").hide();
  198. })
  199. });
  200. //添加工单
  201. function Add() {
  202. var value = $(' input[name="banli"]:checked ').val();
  203. var content = $("#content").val();
  204. if (!$("#cusname").val()) {
  205. layer.msg("请输入姓名");
  206. } else if (!$("#cusphone").val()) {
  207. layer.msg("请输入投诉电话");
  208. } else if (!$("#title").val()) {
  209. layer.msg("请输入标题");
  210. } else if (!$("#content").val()) {
  211. layer.msg("请输入内容");
  212. } else if (!$("#keys").val()) {
  213. layer.msg("请选择主题词");
  214. } else if (!$("#sourcearea").val()) {
  215. layer.msg("请选择事发区域");
  216. } else if (value == 1 && !$('#result').val()) {
  217. layer.msg("请输入直办内容");
  218. } else {
  219. $.ajax({
  220. type: "post",
  221. url: huayi.config.callcenter_url + "/WorkOrder/AddWorkOrderByLY",
  222. dataType: 'json',
  223. async: true,
  224. data: {
  225. lyid: lyid,
  226. cusname: $("#cusname").val(), //=投诉人姓名
  227. cussex: $("#cussex").val(),
  228. cusphone: $("#cusphone").val(), //=投诉人电话
  229. email: $("#email").val(),
  230. zipcode: $("#zipcode").val(),
  231. conphone: $("#conphone").val(),
  232. title: $("#title").val(),
  233. content: $("#content").val(),
  234. files: $("#file").val(), //(多个用英文逗号,隔开)
  235. sourcearea: $("#sourcearea").val(), //=事发地域id
  236. sourceaddress: $('#sourceaddress').val(), //=事发详细地址
  237. source: $("#source").val(), //=来源
  238. isresult: $(' input[name="banli"]:checked ').val(), //=(0转办1直办)
  239. result: $('#result').val(),
  240. keys: $("#keys").val(), //=关键词id(多个用英文逗号,隔开)
  241. type: $("#type").val(), //=类型
  242. isprotect: $(' input[name="mj"]:checked ').val(), //=(0普通1保密)
  243. level: $('#level').val(), //=(1普通2紧急)
  244. issubmit: submit, //=(0保存1保存并提交)
  245. token: $.cookie("token")
  246. },
  247. success: function (data) {
  248. Clean();
  249. $('.fileBox').html('');
  250. parent.initTable();
  251. parent.layer.msg("创建工单成功");
  252. var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
  253. parent.layer.close(index); //再执行关闭
  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. // $(".fjnr").text(r.data[0].F_FileName.substring(19));
  288. var a = r.data;
  289. $(a).each(function (i, n) {
  290. var strs = '<span class="files" fiel-num="' + n.F_FileId + '">' + n.F_FileName.substring(19) + '<i class="fa fa-remove del_file"></i></span>'
  291. $(strs).appendTo($('.fileBox')).find('.del_file').click(function (event) {
  292. event.stopPropagation();
  293. $(this).parent().remove();
  294. file_num()
  295. })
  296. })
  297. file_num()
  298. }
  299. }
  300. });
  301. } else {
  302. layer.confirm('请上传文件!', {
  303. btn: ['确定']
  304. });
  305. }
  306. }
  307. //上传文件隐藏域值
  308. function file_num() {
  309. var str = '';
  310. var Str;
  311. $('.fileBox .files').each(function (j, m) {
  312. var aa = $(m).attr("fiel-num")
  313. console.log(aa);
  314. str += aa + ",";
  315. Str = (str.substring(str.length - 1) == ',') ? str.substring(0, str.length - 1) : str;
  316. })
  317. $("#file").val(Str);
  318. }
  319. //来源
  320. function LY(obj) {
  321. obj.empty();
  322. $.getJSON(huayi.config.callcenter_url + "Dictionary/GetDicValueListById", {
  323. "token": $.cookie("token"),
  324. id: 1
  325. }, function (data) {
  326. if (data.state.toLowerCase() == "success") {
  327. var content = data.data;
  328. $(content).each(function (i, n) {
  329. $("<option value='" + n.F_ValueId + "'>" + n.F_Value + "</option>").appendTo(obj);
  330. })
  331. }
  332. })
  333. }
  334. //类别
  335. function LB(obj) {
  336. obj.empty();
  337. $.getJSON(huayi.config.callcenter_url + "Dictionary/GetDicValueListById", {
  338. "token": $.cookie("token"),
  339. id: 2
  340. }, function (data) {
  341. if (data.state.toLowerCase() == "success") {
  342. var content = data.data;
  343. $(content).each(function (i, n) {
  344. $("<option value='" + n.F_ValueId + "'>" + n.F_Value + "</option>").appendTo(obj);
  345. })
  346. }
  347. })
  348. }
  349. // 主题
  350. function ZT(obj) {
  351. obj.empty();
  352. $.getJSON(huayi.config.callcenter_url + "Dictionary/GetDicValueListById", {
  353. "token": $.cookie("token"),
  354. id: 3
  355. }, function (data) {
  356. if (data.state.toLowerCase() == "success") {
  357. var content = data.data;
  358. $(content).each(function (i, n) {
  359. $("<option value='" + n.F_ValueId + "'>" + n.F_Value + "</option>").appendTo(obj);
  360. })
  361. }
  362. })
  363. }
  364. //区域
  365. function QY(obj) {
  366. obj.empty();
  367. obj.append('<option selected="selected" value="">请选择</option>');
  368. $.getJSON(huayi.config.callcenter_url + "Area/GetAreaListById", {
  369. "token": $.cookie("token"),
  370. }, function (data) {
  371. if (data.state.toLowerCase() == "success") {
  372. var content = data.data;
  373. $(content).each(function (i, n) {
  374. $("<option value='" + n.F_AreaId + "'>" + n.F_AreaName + "</option>").appendTo(obj);
  375. })
  376. }
  377. })
  378. }
  379. function Clean() {
  380. $("#cusname").val(''); //=投诉人姓名
  381. $("#cussex").val('');
  382. $("#cusphone").val(''); //=投诉人电话
  383. $("#email").val('');
  384. $("#zipcode").val('');
  385. $("#conphone").val('');
  386. $("#title").val('');
  387. $("#content").val('');
  388. $("#sourcearea").val(); //=事发地域id
  389. $('#sourceaddress').val(''); //=事发详细地址
  390. $("input[name='baomi'][value='1']").prop("checked", true) //=(0转办1直办)
  391. $("#type option:first").prop("selected", 'selected');
  392. $("#level option:first").prop("selected", 'selected');
  393. $("#keys option:first").prop("selected", 'selected');
  394. $("#sourcearea option:first").prop("selected", 'selected');
  395. $('#result').val('');
  396. }
  397. </script>
  398. </body>
  399. </html>