商丘12345 前端

AddAppeal.html 19KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445
  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 type="text/css">
  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 style="padding: 10px;" class="tj_content clearFix">
  31. <div class="Common">
  32. <table>
  33. <tr>
  34. <th class="Importent">姓名:</th>
  35. <td>
  36. <input type="text" id="cusname" />
  37. </td>
  38. <th>性别:</th>
  39. <td>
  40. <select class="select_" id="SEX">
  41. <option value="">请选择</option>
  42. <option value="0">男</option>
  43. <option value="1">女</option>
  44. </select>
  45. </td>
  46. <th>来源:</th>
  47. <td>
  48. <select class="select_" id="source"></select>
  49. </td>
  50. <th class="Importent">投诉电话:</th>
  51. <td>
  52. <input type="text" id="cusphone" />
  53. </td>
  54. </tr>
  55. <tr>
  56. <th>邮箱:</th>
  57. <td>
  58. <input type="text" id="email" />
  59. </td>
  60. <th>邮编:</th>
  61. <td>
  62. <input type="text" id="zipcode" />
  63. </td>
  64. <th>联系电话:</th>
  65. <td>
  66. <input type="text" id="conphone" />
  67. </td>
  68. </tr>
  69. <tr>
  70. <th class="Importent">标题:</th>
  71. <td colspan="7">
  72. <input id="title" type="text" style="width: 100%;" />
  73. </td>
  74. </tr>
  75. <tr>
  76. <th class="Importent">内容:</th>
  77. <td colspan="7">
  78. <textarea data-adaptheight id="content" name="" rows="" cols="" style="width: 100%;"></textarea>
  79. </td>
  80. </tr>
  81. <tr>
  82. <th class="Importent">事件地址:</th>
  83. <td colspan="7">
  84. <select class="select_" id="sourcearea"></select>
  85. <input id="sourceaddress" type="text" placeholder="输入详细地址" style="width:66%" />
  86. </td>
  87. </tr>
  88. <tr>
  89. <th>附件上传:</th>
  90. <td colspan="7">
  91. <div class="fileBox">
  92. </div>
  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. <span style="color:#FF0000; border: none;">
  99. (文件格式为png,jpg,mp4,mp3,pdf,doc,docx,xls,xlsx)
  100. </span>
  101. </td>
  102. </tr>
  103. <tr>
  104. <th>处理方式:</th>
  105. <td colspan="7">
  106. <input type="radio" value="1" name="banli" class="Nows" />当即办理
  107. <input checked="true" type="radio" value="0" name="banli" class="Nows_" />网络转办
  108. </td>
  109. </tr>
  110. <tr class="Nows_box Hidens">
  111. <th>办理内容:</th>
  112. <td colspan="7">
  113. <input type="text" style="width: 100%;" id="result" />
  114. </td>
  115. </tr>
  116. <tr>
  117. <th class="Importent">主题词:</th>
  118. <td>
  119. <!--<input id="keys" type="text" placeholder="输入主题词" style="width:100%" />-->
  120. <select class="select_" id="keys">
  121. <option value=""></option>
  122. </select>
  123. </td>
  124. <th>类型:</th>
  125. <td>
  126. <select class="select_" id="type"></select>
  127. </td>
  128. <th>密级:</th>
  129. <td>
  130. <input type="radio" name="mj" id="" value="0" />普通
  131. <input type="radio" name="mj" id="" value="1" />保密
  132. </td>
  133. <th>紧急程度:</th>
  134. <td>
  135. <select class="select_" id="level">
  136. <!--<option value="0">选择</option>-->
  137. <option value="1">普通</option>
  138. <option value="2">紧急</option>
  139. </select>
  140. </td>
  141. <!--<th class="">分管领导:</th>
  142. <td colspan="4">
  143. <input id="splituser" type="text" placeholder="" style="width:100%" readonly="readonly" />
  144. </td>-->
  145. </tr>
  146. </table>
  147. <div class="btn_box">
  148. <button class="btns BC">保存</button>
  149. <!--<button class="btns SavedSubmit">保存并提交</button>-->
  150. </div>
  151. </div>
  152. </div>
  153. </div>
  154. <script src="../css/laydate/laydate.js"></script>
  155. <script src="../js/adjustHeight.js"></script>
  156. <script>
  157. var wid = helper.request.queryString("wid");
  158. var submit;
  159. $(document).ready(function () {
  160. QY($("#sourcearea"));
  161. LY($("#source"));
  162. LB($("#type"));
  163. ZT($("#keys"))
  164. //当即办理
  165. $(' input[name="banli"]').change(function () {
  166. var val = $(this).val();
  167. if (val == "1") {
  168. $(".Nows_box").show();
  169. } else {
  170. $(".Nows_box").hide();
  171. }
  172. })
  173. $(".BC").click(function () {
  174. submit = 0;
  175. Add()
  176. });
  177. //上传附件
  178. $("#scwj").click(function () {
  179. $("#upFile").trigger("click");
  180. })
  181. $("#upFile").change(function () {
  182. upload();
  183. })
  184. // $("#scfj").click(function() {
  185. // $(".fjnr").text("");
  186. // $("#scfj").hide();
  187. // })
  188. $(".SavedSubmit").click(function () {
  189. submit = 1;
  190. Add()
  191. })
  192. if (wid) {
  193. $.getJSON(huayi.config.callcenter_url + 'WorkOrder/GetWorkOrder', {
  194. workorderid: wid,
  195. "token": $.cookie("token")
  196. }, function (result) {
  197. if (result.state.toLowerCase() == "success") {
  198. var Data = result.data.data;
  199. $("#cusname").val(Data[0].F_CusName);
  200. $("#cusphone").val(Data[0].F_CusPhone);
  201. $("#conphone").val(Data[0].F_ConPhone);
  202. $("#title").val(Data[0].F_ComTitle);
  203. $('#content').val(Data[0].F_ComContent);
  204. $('#email').val(Data[0].F_Email);
  205. $("#zipcode").val(Data[0].F_ZipCode);
  206. $("#result").val(Data[0].F_Result);
  207. //x性别
  208. $("#SEX").val(Data[0].F_CusSex + '');
  209. //来源
  210. $("#source").val(Data[0].F_InfoSource + '');
  211. //事件地址
  212. $("#sourcearea").val(Data[0].F_SourceArea + '');
  213. //主题词
  214. $("#keys").val(Data[0].F_Key + '');
  215. //类型
  216. $("#type").val(Data[0].F_InfoType + '');
  217. //紧急程度
  218. $("#level").val(Data[0].F_Level + '');
  219. if (Data[0].F_IsResult == 1) {
  220. $(".Nows_box").toggle();
  221. }
  222. $(' input[name="mj"][value="' + Data[0].F_IsProtect + '"]').prop("checked", "checked");
  223. $(' input[name="banli"][value="' + Data[0].F_IsResult + '"]').prop("checked", "checked");
  224. $('#sourceaddress').val(Data[0].F_SourceAddress);
  225. $('.F_FinalOpinion').val(Data[0].F_FinalOpinion);
  226. $(Data[0].File).each(function (k, q) {
  227. var strs = '<span class="files" fiel-num="' + q.F_FileId + '">' + q.F_FileName.substring(19) + '<i class="fa fa-remove del_file"></i></span>'
  228. $(strs).appendTo($('.fileBox')).find('.del_file').click(function (event) {
  229. event.stopPropagation();
  230. $(this).parent().remove();
  231. file_num()
  232. })
  233. file_num()
  234. })
  235. }
  236. })
  237. }
  238. });
  239. ///修改工单
  240. function Add() {
  241. var value = $(' input[name="banli"]:checked ').val();
  242. var content = $("#content").val();
  243. if (!$("#cusname").val()) {
  244. layer.msg("请输入姓名");
  245. } else if (!$("#cusphone").val()) {
  246. layer.msg("请输入投诉电话");
  247. } else if (!$("#title").val()) {
  248. layer.msg("请输入标题");
  249. } else if (!$("#content").val()) {
  250. layer.msg("请输入内容");
  251. } else if (!$("#keys").val()) {
  252. layer.msg("请选择主题词");
  253. } else if (!$("#sourcearea").val()) {
  254. layer.msg("请选择事发区域");
  255. } else if (value == 1 && !$('#result').val()) {
  256. layer.msg("请输入直办内容");
  257. } else {
  258. $.ajax({
  259. type: "post",
  260. url: huayi.config.callcenter_url + "WorkOrder/EditWorkOrder",
  261. dataType: 'json',
  262. async: true,
  263. data: {
  264. workorderid: wid,
  265. cusname: $("#cusname").val(), //=投诉人姓名
  266. cussex: $("#SEX").val(),
  267. cusphone: $("#cusphone").val(), //=投诉人电话
  268. email: $("#email").val(),
  269. zipcode: $("#zipcode").val(),
  270. conphone: $("#conphone").val(),
  271. title: $("#title").val(),
  272. content: $("#content").val(),
  273. files: $("#file").val(), //(多个用英文逗号,隔开)
  274. sourcearea: $("#sourcearea").val(), //=事发地域id
  275. sourceaddress: $('#sourceaddress').val(), //=事发详细地址
  276. source: $("#source").val(), //=来源
  277. isresult: $(' input[name="banli"]:checked ').val(), //=(0转办1直办)
  278. result: $('#result').val(),
  279. keys: $("#keys").val(), //=关键词id(多个用英文逗号,隔开)
  280. type: $("#type").val(), //=类型
  281. bigtype: $("#bigtype").val(), //=大类别
  282. smalltype: $("#smalltype").val(), //=小类别
  283. isprotect: $(' input[name="mj"]:checked ').val(), //=(0普通1保密)
  284. level: $('#level').val(), //=(1普通2紧急)
  285. issubmit: submit, //=(0保存1保存并提交)
  286. token: $.cookie("token")
  287. },
  288. success: function (data) {
  289. if (data.state.toLowerCase() == "success") {
  290. var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
  291. parent.layer.close(index); //再执行关闭
  292. parent.load();
  293. parent.layer.msg(data.message);
  294. $('.fileBox').html('');
  295. }
  296. }
  297. });
  298. }
  299. }
  300. //上传文件隐藏域值
  301. function file_num() {
  302. var str = '';
  303. var Str;
  304. $('.fileBox .files').each(function (j, m) {
  305. var aa = $(m).attr("fiel-num")
  306. console.log(aa);
  307. str += aa + ",";
  308. Str = (str.substring(str.length - 1) == ',') ? str.substring(0, str.length - 1) : str;
  309. })
  310. $("#file").val(Str);
  311. }
  312. //来源
  313. function LY(obj) {
  314. obj.empty();
  315. $.getJSON(huayi.config.callcenter_url + "Dictionary/GetDicValueListById", {
  316. "token": $.cookie("token"),
  317. id: 1
  318. }, function (data) {
  319. if (data.state.toLowerCase() == "success") {
  320. var content = data.data;
  321. $(content).each(function (i, n) {
  322. $("<option value='" + n.F_ValueId + "'>" + n.F_Value + "</option>").appendTo(obj);
  323. })
  324. }
  325. })
  326. }
  327. //类别
  328. function LB(obj) {
  329. obj.empty();
  330. $.getJSON(huayi.config.callcenter_url + "Dictionary/GetDicValueListById", {
  331. "token": $.cookie("token"),
  332. id: 2
  333. }, function (data) {
  334. if (data.state.toLowerCase() == "success") {
  335. var content = data.data;
  336. $(content).each(function (i, n) {
  337. $("<option value='" + n.F_ValueId + "'>" + n.F_Value + "</option>").appendTo(obj);
  338. })
  339. }
  340. })
  341. }
  342. // 主题
  343. function ZT(obj) {
  344. obj.empty();
  345. $.getJSON(huayi.config.callcenter_url + "Dictionary/GetDicValueListById", {
  346. "token": $.cookie("token"),
  347. id: 3
  348. }, function (data) {
  349. if (data.state.toLowerCase() == "success") {
  350. var content = data.data;
  351. $(content).each(function (i, n) {
  352. $("<option value='" + n.F_ValueId + "'>" + n.F_Value + "</option>").appendTo(obj);
  353. })
  354. }
  355. })
  356. }
  357. //区域
  358. function QY(obj) {
  359. obj.empty();
  360. obj.append('<option selected="selected" value="">请选择</option>');
  361. $.getJSON(huayi.config.callcenter_url + "Area/GetAreaListById", {
  362. "token": $.cookie("token"),
  363. }, function (data) {
  364. if (data.state.toLowerCase() == "success") {
  365. var content = data.data;
  366. $(content).each(function (i, n) {
  367. if (n.F_AreaName != '商丘市') {
  368. $("<option value='" + n.F_AreaId + "'>" + n.F_AreaName + "</option>").appendTo(obj);
  369. }
  370. })
  371. }
  372. })
  373. }
  374. //上传文件
  375. function upload() {
  376. var Files = document.getElementById("upFile").files;
  377. if (Files.length > 0) {
  378. var formData = new FormData();
  379. for (var i = 0; i < Files.length; i++) {
  380. formData.append('file' + i, Files[i]);
  381. }
  382. formData.append("token", $.cookie("token"));
  383. var typeName=Files[0].name.split('.')[1];
  384. if (typeName=="png"||typeName=='jpg'||typeName=='mp4'||typeName=='mp3'||typeName=='pdf'||typeName=='doc'||typeName=='docx'||typeName=='xls'||typeName=='xlsx') {
  385. $.ajax({
  386. url: huayi.config.callcenter_url + "/WorkOrder/UploadFile",
  387. type: "POST",
  388. data: formData,
  389. /**
  390. *必须false才会自动加上正确的Content-Type
  391. */
  392. contentType: false,
  393. /**
  394. * 必须false才会避开jQuery对 formdata 的默认处理
  395. * XMLHttpRequest会对 formdata 进行正确的处理
  396. */
  397. processData: false,
  398. success: function (result) {
  399. document.getElementById("upFile").outerHTML = document.getElementById("upFile").outerHTML;
  400. $("#upFile").change(function () {
  401. upload();
  402. });
  403. var r = $.parseJSON(result);
  404. if (r.state.toLowerCase() == "success") {
  405. var a = r.data;
  406. $(a).each(function (i, n) {
  407. var strs = '<span class="files" fiel-num="' + n.F_FileId + '">' + n.F_FileName.substring(19) + '<i class="fa fa-remove del_file"></i></span>'
  408. $(strs).appendTo($('.fileBox')).find('.del_file').click(function (event) {
  409. event.stopPropagation();
  410. $(this).parent().remove();
  411. file_num()
  412. })
  413. })
  414. file_num();
  415. }
  416. }
  417. });
  418. }else{
  419. layer.msg("格式不正确");
  420. }
  421. } else {
  422. layer.confirm('请上传文件!', {
  423. btn: ['确定']
  424. });
  425. }
  426. }
  427. </script>
  428. </body>
  429. </html>