Нет описания

addWorkOrder.html 19KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="UTF-8">
  5. <meta name="viewport" content="width=device-width, initial-scale=1,maximum-scale=1,user-scalable=no">
  6. <meta name="apple-mobile-web-app-capable" content="yes">
  7. <meta name="apple-mobile-web-app-status-bar-style" content="black">
  8. <link rel="stylesheet" href="../layui/css/layui.mobile.css" />
  9. <link href="../css/mui.min.css" rel="stylesheet" />
  10. <link href="../css/mui.picker.css" rel="stylesheet" />
  11. <link href="../css/mui.poppicker.css" rel="stylesheet" />
  12. <link href="../css/feedback-page.css" rel="stylesheet" />
  13. <link rel="stylesheet" href="../css/iconfont.css" />
  14. <link rel="stylesheet" href="../css/inits.css" />
  15. <title>添加工单</title>
  16. <style>
  17. .mui-input-row {
  18. border-bottom: 1px solid #c9c9c9;
  19. }
  20. .mui-card {
  21. margin: 0;
  22. }
  23. .mui-card-content {
  24. padding: 0 20px;
  25. }
  26. .mui-input-row {
  27. height: 75px;
  28. }
  29. #phone,
  30. #code {
  31. height: 50%;
  32. }
  33. .mui-input-row label~input, .mui-input-row label~select, .mui-input-row label~textarea{
  34. width: 90% !important;
  35. }
  36. label,
  37. input,
  38. textarea {
  39. float: none !important;
  40. }
  41. .mui-input-row input,
  42. textarea {
  43. /*padding: 0 15px !important;*/
  44. }
  45. .mui-input-row label,
  46. .reaction {
  47. display: block;
  48. font-weight: 600;
  49. padding: 13px 15px 8px;
  50. }
  51. .mui-radio {
  52. display: inline-block;
  53. }
  54. .line,
  55. .codeTX {
  56. display: inline-block;
  57. border-left: 1px solid #1ba3c9;
  58. padding-left: 10px;
  59. height: 25px;
  60. position: absolute;
  61. right: 10px;
  62. color: #1ba3c9;
  63. font-size: 16px;
  64. font-weight: 600;
  65. }
  66. .btns {
  67. width: 90%;
  68. margin: 20px auto;
  69. text-align: center;
  70. }
  71. .btn {
  72. /* width: 90%; */
  73. background-color: #1ba3c9;
  74. outline: none;
  75. border: none;
  76. padding: 5px 45px;
  77. /* display: block; */
  78. border-radius: 10px;
  79. font-size: 16px;
  80. color: #fff;
  81. }
  82. .titleW {
  83. padding: 5px 0px;
  84. margin-bottom: 5px;
  85. }
  86. .mui-icon-info-filled {
  87. color: rgb(253, 193, 30);
  88. }
  89. .warning {
  90. font-size: 15px;
  91. margin-bottom: 5px;
  92. font-weight: 600;
  93. }
  94. .mui-radio input[type=radio]:before {
  95. font-size: 20px;
  96. vertical-align: middle;
  97. }
  98. .mui-checkbox input[type=checkbox],
  99. .mui-radio input[type=radio] {
  100. top: 0 !important;
  101. }
  102. .mui-checkbox.mui-left label,
  103. .mui-radio.mui-left label {
  104. padding: 0 0 0 45px;
  105. vertical-align: middle;
  106. }
  107. .content {
  108. height: 125px;
  109. border-bottom: none;
  110. }
  111. .mui-input-row label~textarea {
  112. float: none;
  113. width: 100% !important;
  114. height: 70%;
  115. background-color: rgb(246, 246, 246);
  116. }
  117. .ztext {
  118. padding: 10px 64px 10px 15px !important;
  119. }
  120. .feedback {
  121. height: auto;
  122. border: none;
  123. }
  124. .space {
  125. background-color: rgb(246, 246, 246);
  126. }
  127. .btnLeft {
  128. background-color: rgb(254, 150, 3);
  129. margin-right: 40px;
  130. }
  131. .btnRight {
  132. background-color: #1ba3c9;
  133. }
  134. .result {
  135. position: absolute;
  136. right: -4px;
  137. top: 30px;
  138. display: inline-block;
  139. width: 85px;
  140. padding: 5px 0;
  141. color: #fff;
  142. text-align: center;
  143. border-radius: 20px 0 0 20px;
  144. background-color: rgb(17, 211, 169);
  145. }
  146. i {
  147. color: #FF0000;
  148. }
  149. .feedback .image-item {
  150. border: none;
  151. margin-left: 5px;
  152. float: left;
  153. }
  154. .feedback label {
  155. width: 125%;
  156. }
  157. .feedback span {
  158. font-weight: 100;
  159. }
  160. .filesHandle {
  161. background-color: antiquewhite;
  162. display: inline-block;
  163. padding: 2px 10px;
  164. margin-right: 5px;
  165. margin-bottom: 5px;
  166. }
  167. .del_file {
  168. margin-left: 5px;
  169. font-weight: 600;
  170. }
  171. .limit{
  172. position: absolute;
  173. right: 4px;
  174. color: #222;
  175. z-index: 10;
  176. top: 52px;
  177. color: rgb(176,176,176);
  178. }
  179. </style>
  180. </head>
  181. <body>
  182. <!-- <header class="mui-bar mui-bar-nav">
  183. <h1 class="mui-title">添加工单</h1>
  184. </header> -->
  185. <div class="mui-content">
  186. <div class="mui-card">
  187. <div class="mui-card-content">
  188. <div class="titleW">
  189. <span class="mui-icon mui-icon-info-filled"></span>
  190. <span class="warning">请填写真实信息,带 “ <i>*</i> ” 为必填项</span>
  191. <span class="result" onclick="seeResult()">查看结果</span>
  192. </div>
  193. <div style="margin: 10px 0;">
  194. <label class="label reaction" style="display: block;"><i>*</i>反映类型</label>
  195. <div class="mui-radio mui-left radio_box">
  196. <input type="radio" name="phoneType" value="9" checked="checked"/>
  197. <label>咨询</label>
  198. </div>
  199. <div class="mui-radio mui-left radio_box">
  200. <input type="radio" name="phoneType" value="10" />
  201. <label>求助</label>
  202. </div>
  203. <div class="mui-radio mui-left radio_box">
  204. <input type="radio" name="phoneType" value="11" />
  205. <label>投诉</label>
  206. </div>
  207. <div class="mui-radio mui-left radio_box">
  208. <input type="radio" name="phoneType" value="12" />
  209. <label>建议</label>
  210. </div>
  211. <div class="mui-radio mui-left radio_box">
  212. <input type="radio" name="phoneType" value="13" />
  213. <label>表扬</label>
  214. </div>
  215. <div class="mui-radio mui-left radio_box">
  216. <input type="radio" name="phoneType" value="89" />
  217. <label>举报</label>
  218. </div>
  219. <div class="mui-radio mui-left radio_box">
  220. <input type="radio" name="phoneType" value="90" />
  221. <label>其他</label>
  222. </div>
  223. <div class="mui-radio mui-left radio_box">
  224. <input type="radio" name="phoneType" value="4241" />
  225. <label>大气污染防治有奖举报</label>
  226. </div>
  227. </div>
  228. <div class="mui-input-row phone">
  229. <label>姓名</label>
  230. <input type="text" placeholder="请输入姓名" id="cusname">
  231. </div>
  232. <div class="mui-input-row phone">
  233. <label><i>*</i> 手机号</label>
  234. <input type="text" placeholder="请输入手机号" id="cusphone">
  235. <span class="line" onclick="getCode()">获取验证码</span>
  236. <span class="codeTX">60s</span>
  237. </div>
  238. <div class="mui-input-row">
  239. <label><i>*</i> 验证码</label>
  240. <input type="text" class="mui-input-clear" placeholder="请输入验证码" id="code">
  241. </div>
  242. <div class="mui-input-row phone">
  243. <label><i>*</i> 反映标题</label>
  244. <input type="text" placeholder="请简要概述您的问题" id="title" maxlength="30" oninput="getTitleNum()">
  245. <div class="limit">
  246. <span id="titlenum">0</span><span>/30</span>
  247. </div>
  248. </div>
  249. <div class="mui-input-row content">
  250. <label><i>*</i> 反映内容</label>
  251. <textarea class="ztext" name="" id="cont" placeholder="请您一事一诉,请勿重复提交;
  252. 请说明您的主要诉求。" maxlength="500" oninput="getConNum()"></textarea>
  253. <div class="limit" style="top: 100px;">
  254. <span id="contnum">0</span><span>/500</span>
  255. </div>
  256. </div>
  257. <li class="mui-input-row" id="showCityPicker3">
  258. <label><i>*</i> 事发区域</label>
  259. <input type="text" id='cityResult3' data-index="" class="ui-alert type_con" placeholder="请选择区域"
  260. readonly="readonly" />
  261. <a href="javascript:void(0)"><span
  262. class="type_down mui-icon mui-icon-arrowdown mui-pull-right"></span></a>
  263. </li>
  264. <li class="mui-input-row" id="showCityPicker2">
  265. <label>乡镇</label>
  266. <input type="text" id='cityResult2' data-index="" class="ui-alert type_con" placeholder="请选择乡镇"
  267. readonly="readonly" />
  268. <a href="javascript:void(0)"><span
  269. class="type_down mui-icon mui-icon-arrowdown mui-pull-right"></span></a>
  270. </li>
  271. <li class="mui-input-row" id="showCityPicker1">
  272. <label>村</label>
  273. <input type="text" id='cityResult1' data-index="" class="ui-alert type_con" placeholder="请选择村"
  274. readonly="readonly" />
  275. <a href="javascript:void(0)"><span
  276. class="type_down mui-icon mui-icon-arrowdown mui-pull-right"></span></a>
  277. </li>
  278. <div class="mui-input-row content">
  279. <label>详细地址</label>
  280. <textarea class="ztext" name="" id="cusaddress" placeholder="请输入详细地址..."></textarea>
  281. </div>
  282. <div class="mui-input-row feedback">
  283. <label>添加附件 <span
  284. style="color: rgb(176,176,176);">(文件格式为jpg,png,mp4,avi,wmv,mp3,pdf,doc,docx,xls,xlsx)</span></label>
  285. <!-- <label>添加附件</label> -->
  286. <!-- <div id='image-list' class="row image-list"></div> -->
  287. <input class="input" type="file" name="upFile" id="upFileHandle" multiple="multiple"
  288. style="display: none;">
  289. <div class="showFile">
  290. <div id='scwjHandle' class="row image-item"></div>
  291. <div class="fileBoxHandle" style="margin-left: 5px;float: left;width: 78%;">
  292. </div>
  293. </div>
  294. <input type="hidden" id="fileHandle" />
  295. </div>
  296. <div style="margin: 10px 0;border-bottom: 1px solid #c9c9c9;padding-bottom: 20px;">
  297. <div style="font-weight: 600; padding: 13px 15px 8px;"><i>*</i>是否匿名?</div>
  298. <div class="mui-radio mui-left radio_box">
  299. <input type="radio" name="select" value="1" checked="checked"/>
  300. <label>个人信息保密</label>
  301. </div>
  302. <div class="mui-radio mui-left radio_box">
  303. <input type="radio" name="select" value="0" />
  304. <label>个人信息公开</label>
  305. </div>
  306. </div>
  307. <div class="btns">
  308. <button type="button" class="btn btnLeft" onclick="Reset()">重置</button>
  309. <button type="button" class="btn btnRight" onclick="Submit()">提交</button>
  310. </div>
  311. </div>
  312. </div>
  313. </div>
  314. <script src="../js/mui.min.js"></script>
  315. <script src="../js/mui.picker.js"></script>
  316. <script src="../js/mui.poppicker.js"></script>
  317. <script src="../js/jquery.min.js"></script>
  318. <script src="../Script/Common/huayi.config.js"></script>
  319. <script src="../Script/Common/huayi.http.js"></script>
  320. <script src="../layui/layui.js"></script>
  321. <script>
  322. $('.codeTX').css('display', 'none')
  323. var areaList = [],
  324. townList = [];
  325. var area = 0,town = 0,village = 0;
  326. getArea() //获取事发区域
  327. //附件
  328. $("#scwjHandle").click(function() {
  329. $("#upFileHandle").trigger("click");
  330. })
  331. $("#upFileHandle").change(function() {
  332. uploadHandle();
  333. })
  334. function getTitleNum() {
  335. if($('#title').val().length<= 30){
  336. $('#titlenum').text($('#title').val().length)
  337. }
  338. }
  339. function getConNum() {
  340. if($('#cont').val().length<= 500){
  341. $('#contnum').text($('#cont').val().length)
  342. }
  343. }
  344. function getCode() {
  345. if (!$('#cusphone').val()) {
  346. mui.alert('请输入联系电话!');
  347. return;
  348. } else {
  349. if(!(/^1[0-9]\d{9}$/.test($('#cusphone').val()))){
  350. mui.alert("请输入正确的手机号");
  351. return false;
  352. }
  353. }
  354. $.ajax({
  355. type: "get",
  356. url: huayi.config.callcenter_url + 'WxLogin/SendCode',
  357. async: true,
  358. dataType: 'json',
  359. data: {
  360. mobile: $('#cusphone').val()
  361. },
  362. success: function(res) {
  363. if (res.state == 'success') {
  364. let num = 60
  365. $('.line').css('display', 'none')
  366. $('.codeTX').css('display', 'inline-block')
  367. var fq = setInterval(function() {
  368. num -= 1
  369. $('.codeTX').text(num+'s')
  370. console.log(num)
  371. if (num == 0) {
  372. clearInterval(fq)
  373. $('.codeTX').css('display', 'none')
  374. $('.line').css('display', 'inline-block')
  375. }
  376. }, 1000)
  377. }
  378. }
  379. })
  380. }
  381. function getArea() {
  382. $.ajax({
  383. type: "post",
  384. url: huayi.config.callcenter_url + 'Area/GetAreaListById',
  385. dataType: 'json',
  386. async: false,
  387. data: {},
  388. success: function(res) {
  389. res.data.forEach(function(v, n) {
  390. if(v.F_AreaName != '市区'){
  391. var obj = {};
  392. obj.value = v.F_AreaId;
  393. obj.text = v.F_AreaName;
  394. areaList.push(obj)
  395. }
  396. })
  397. }
  398. });
  399. }
  400. function getAreaChildren(id) {
  401. $.ajax({
  402. type: "post",
  403. url: huayi.config.callcenter_url + 'Area/GetAreaChildren',
  404. dataType: 'json',
  405. async: false,
  406. data: {
  407. parentid: id
  408. },
  409. success: function(res) {
  410. townList = []
  411. res.data.forEach(function(v, n) {
  412. var objC = {};
  413. objC.value = v.F_AreaId;
  414. objC.text = v.F_AreaName;
  415. townList.push(objC)
  416. })
  417. }
  418. });
  419. }
  420. function Reset() {
  421. window.location.reload();
  422. }
  423. function Submit() {
  424. if (!$('input[name="phoneType"]:checked').val()) {
  425. mui.alert('请输入反映类型!');
  426. return;
  427. }
  428. if (!$('#cusphone').val()) {
  429. mui.alert('请输入联系电话!');
  430. return;
  431. } else {
  432. if(!(/^[1]([2-9])[0-9]{9}$/.test($('#cusphone').val()))){
  433. mui.alert("请输入正确的手机号");
  434. return false;
  435. }
  436. }
  437. if (!$('#code').val()) {
  438. mui.alert('请输入手机验证码!');
  439. return;
  440. }
  441. if (!$('#title').val()) {
  442. mui.alert('请输入反映标题!');
  443. return;
  444. }
  445. if (!$('#cont').val()) {
  446. mui.alert('请输入反映内容!');
  447. return;
  448. }
  449. if ($('#cityResult3').val() == '') {
  450. mui.alert('请选择事发区域!');
  451. return;
  452. }
  453. if (!$('input[name="select"]:checked').val()) {
  454. mui.alert('请选择姓名公开!');
  455. return;
  456. }
  457. $.ajax({
  458. type: "post",
  459. url: huayi.config.callcenter_url + 'APP/AddWorkOrder',
  460. async: true,
  461. dataType: 'json',
  462. contentType: 'application/x-www-form-urlencoded',
  463. data: {
  464. source: '5',
  465. type: $('input[name="phoneType"]:checked').val(), // 反应类别
  466. cusname: $('#cusname').val(), //姓名
  467. sourceaddress: $('#cusaddress').val(), //详情
  468. cusphone: $('#cusphone').val(), //电话
  469. code: $('#code').val(), //验证码
  470. title: $('#title').val(), //标题
  471. content: $('#cont').val(), //n内容
  472. sourcearea: area, //事发区域
  473. township: town, //乡镇
  474. village: village, //村
  475. sourceaddress: $('#cusaddress').val(),
  476. files: $("#fileHandle").val(), //附件
  477. isprotect: $('input[name="select"]:checked').val() //保密
  478. },
  479. success: function(data) {
  480. if (data.state == "success") {
  481. mui.alert('提交成功!')
  482. window.location.reload();
  483. }
  484. }
  485. });
  486. }
  487. //查看结果
  488. function seeResult(){
  489. window.location.replace("../html/login.html");
  490. }
  491. //上传文件
  492. function uploadHandle() {
  493. var Files = document.getElementById("upFileHandle").files;
  494. console.log(Files);
  495. if (Files.length > 0) {
  496. var formData = new FormData();
  497. for (var i = 0; i < Files.length; i++) {
  498. formData.append('file' + i, Files[i]);
  499. }
  500. var typeName = Files[0].name.split('.')[Files[0].name.split('.').length - 1].toLowerCase();
  501. if (typeName == "png" || typeName == 'jpg' || typeName == 'mp4' || typeName == 'avi' || typeName ==
  502. 'wmv' || typeName == 'mp3' || typeName == 'pdf' || typeName == 'doc' || typeName == 'docx' ||
  503. typeName == 'xls' || typeName == 'xlsx') {
  504. $.ajax({
  505. url: huayi.config.callcenter_url + "Web/UploadFile",
  506. type: "POST",
  507. data: formData,
  508. /**
  509. *必须false才会自动加上正确的Content-Type
  510. */
  511. contentType: false,
  512. /**
  513. * 必须false才会避开jQuery对 formdata 的默认处理
  514. * XMLHttpRequest会对 formdata 进行正确的处理
  515. */
  516. processData: false,
  517. success: function(result) {
  518. document.getElementById("upFileHandle").outerHTML = document.getElementById(
  519. "upFileHandle").outerHTML;
  520. $("#upFileHandle").change(function() {
  521. uploadHandle();
  522. });
  523. var r = $.parseJSON(result);
  524. if (r.state.toLowerCase() == "success") {
  525. var a = r.data;
  526. $(a).each(function(i, n) {
  527. // var strs = '<div class="imgC"><img src='+huayi.config.callcenter_url+n.F_FileUrl+' fiel-num="' + n.F_FileId +'" /><span class="del_file">X</span></div>'
  528. var strs = '<span class="filesHandle" fiel-num="' + n.F_FileId +
  529. '">' + n.F_FileName.substring(19) +
  530. '<span class="del_file">X</i></span>'
  531. $(strs).appendTo($('.fileBoxHandle')).find('.del_file').click(
  532. function(event) {
  533. event.stopPropagation();
  534. $(this).parent().remove();
  535. file_numHandle()
  536. })
  537. })
  538. file_numHandle();
  539. }
  540. }
  541. });
  542. } else {
  543. layer.msg("格式不正确");
  544. }
  545. } else {
  546. layer.confirm('请上传文件!', {
  547. btn: ['确定']
  548. });
  549. }
  550. }
  551. function file_numHandle() {
  552. var str = '';
  553. var Str;
  554. $('.fileBoxHandle .filesHandle').each(function(j, m) {
  555. var aa = $(m).attr("fiel-num")
  556. console.log(aa);
  557. str += aa + ",";
  558. Str = (str.substring(str.length - 1) == ',') ? str.substring(0, str.length - 1) : str;
  559. })
  560. console.log(Str)
  561. $("#fileHandle").val(Str);
  562. }
  563. (function($, doc) {
  564. $.init();
  565. $.ready(function() {
  566. var cityPicker3 = new $.PopPicker({
  567. layer: 1
  568. });
  569. var townPicker = new $.PopPicker({
  570. layer: 1
  571. });
  572. var valPicker = new $.PopPicker({
  573. layer: 1
  574. });
  575. cityPicker3.setData(areaList);
  576. var showCityPickerButton = doc.getElementById('showCityPicker3');
  577. var cityResult3 = doc.getElementById('cityResult3');
  578. var townPickerPickerButton = doc.getElementById('showCityPicker2');
  579. var townResult = doc.getElementById('cityResult2');
  580. var valPickerPickerButton = doc.getElementById('showCityPicker1');
  581. var valResult = doc.getElementById('cityResult1');
  582. showCityPickerButton.addEventListener('tap', function(event) {
  583. cityPicker3.show(function(items) {
  584. cityResult3.value = (items[0].text ? items[0].text : "");
  585. area = items[0].value
  586. cityResult3.setAttribute("data-index", items[0].value);
  587. getAreaChildren(items[0].value)
  588. townPicker.setData(townList);
  589. townResult.value=''
  590. valResult.value=''
  591. townPickerPickerButton.addEventListener('tap', function(event) {
  592. townPicker.show(function(items) {
  593. townResult.value = (items[0].text ? items[0].text : "");
  594. town = items[0].value
  595. townResult.setAttribute("data-index", items[0].value);
  596. getAreaChildren(items[0].value)
  597. valPicker.setData(townList);
  598. valResult.value=''
  599. valPickerPickerButton.addEventListener('tap', function(event) {
  600. valPicker.show(function(items) {
  601. valResult.value = (items[0].text ? items[0].text : "");
  602. village = items[0].value
  603. valResult.setAttribute("data-index", items[0].value);
  604. });
  605. }, false);
  606. });
  607. }, false);
  608. });
  609. }, false);
  610. //街道
  611. })
  612. })(mui, document);
  613. </script>
  614. </body>
  615. </html>