暂无描述

addWorkOrder.html 19KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690
  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>
  224. <div class="mui-input-row phone">
  225. <label>姓名</label>
  226. <input type="text" placeholder="请输入姓名" id="cusname">
  227. </div>
  228. <div class="mui-input-row phone">
  229. <label><i>*</i> 手机号</label>
  230. <input type="text" placeholder="请输入手机号" id="cusphone">
  231. <span class="line" onclick="getCode()">获取验证码</span>
  232. <span class="codeTX">60s</span>
  233. </div>
  234. <div class="mui-input-row">
  235. <label><i>*</i> 验证码</label>
  236. <input type="text" class="mui-input-clear" placeholder="请输入验证码" id="code">
  237. </div>
  238. <div class="mui-input-row phone">
  239. <label><i>*</i> 反映标题</label>
  240. <input type="text" placeholder="请简要概述您的问题" id="title" maxlength="30" oninput="getTitleNum()">
  241. <div class="limit">
  242. <span id="titlenum">0</span><span>/30</span>
  243. </div>
  244. </div>
  245. <div class="mui-input-row content">
  246. <label><i>*</i> 反映内容</label>
  247. <textarea class="ztext" name="" id="cont" placeholder="请您一事一诉,请勿重复提交;
  248. 请说明您的主要诉求。" maxlength="500" oninput="getConNum()"></textarea>
  249. <div class="limit" style="top: 100px;">
  250. <span id="contnum">0</span><span>/500</span>
  251. </div>
  252. </div>
  253. <li class="mui-input-row" id="showCityPicker3">
  254. <label><i>*</i> 事发区域</label>
  255. <input type="text" id='cityResult3' data-index="" class="ui-alert type_con" placeholder="请选择区域"
  256. readonly="readonly" />
  257. <a href="javascript:void(0)"><span
  258. class="type_down mui-icon mui-icon-arrowdown mui-pull-right"></span></a>
  259. </li>
  260. <li class="mui-input-row" id="showCityPicker2">
  261. <label>乡镇</label>
  262. <input type="text" id='cityResult2' data-index="" class="ui-alert type_con" placeholder="请选择乡镇"
  263. readonly="readonly" />
  264. <a href="javascript:void(0)"><span
  265. class="type_down mui-icon mui-icon-arrowdown mui-pull-right"></span></a>
  266. </li>
  267. <li class="mui-input-row" id="showCityPicker1">
  268. <label>村</label>
  269. <input type="text" id='cityResult1' data-index="" class="ui-alert type_con" placeholder="请选择村"
  270. readonly="readonly" />
  271. <a href="javascript:void(0)"><span
  272. class="type_down mui-icon mui-icon-arrowdown mui-pull-right"></span></a>
  273. </li>
  274. <div class="mui-input-row content">
  275. <label>详细地址</label>
  276. <textarea class="ztext" name="" id="cusaddress" placeholder="请输入详细地址..."></textarea>
  277. </div>
  278. <div class="mui-input-row feedback">
  279. <label>添加附件 <span
  280. style="color: rgb(176,176,176);">(文件格式为jpg,png,mp4,avi,wmv,mp3,pdf,doc,docx,xls,xlsx)</span></label>
  281. <!-- <label>添加附件</label> -->
  282. <!-- <div id='image-list' class="row image-list"></div> -->
  283. <input class="input" type="file" name="upFile" id="upFileHandle" multiple="multiple"
  284. style="display: none;">
  285. <div class="showFile">
  286. <div id='scwjHandle' class="row image-item"></div>
  287. <div class="fileBoxHandle" style="margin-left: 5px;float: left;width: 78%;">
  288. </div>
  289. </div>
  290. <input type="hidden" id="fileHandle" />
  291. </div>
  292. <div style="margin: 10px 0;border-bottom: 1px solid #c9c9c9;padding-bottom: 20px;">
  293. <div style="font-weight: 600; padding: 13px 15px 8px;"><i>*</i>是否匿名?</div>
  294. <div class="mui-radio mui-left radio_box">
  295. <input type="radio" name="select" value="1" checked="checked"/>
  296. <label>个人信息保密</label>
  297. </div>
  298. <div class="mui-radio mui-left radio_box">
  299. <input type="radio" name="select" value="0" />
  300. <label>个人信息公开</label>
  301. </div>
  302. </div>
  303. <div class="btns">
  304. <button type="button" class="btn btnLeft" onclick="Reset()">重置</button>
  305. <button type="button" class="btn btnRight" onclick="Submit()">提交</button>
  306. </div>
  307. </div>
  308. </div>
  309. </div>
  310. <script src="../js/mui.min.js"></script>
  311. <script src="../js/mui.picker.js"></script>
  312. <script src="../js/mui.poppicker.js"></script>
  313. <script src="../js/jquery.min.js"></script>
  314. <script src="../Script/Common/huayi.config.js"></script>
  315. <script src="../Script/Common/huayi.http.js"></script>
  316. <!-- <script src="./js/feedback-page.js"></script> -->
  317. <script src="../layui/layui.js"></script>
  318. <!-- <script src="../js/zepto.js"></script> -->
  319. <script>
  320. // var openid = 'obwtK6JT-bTCeSbtqu4lkw4lIz0o'
  321. var openid = helper.cookies.get("openid");
  322. // if (!openid) {
  323. // window.location.replace("../html/error.html");
  324. // }
  325. $('.codeTX').css('display', 'none')
  326. var areaList = [],
  327. townList = [];
  328. var area = 0,town = 9,village = 0;
  329. getArea() //获取事发区域
  330. //附件
  331. $("#scwjHandle").click(function() {
  332. $("#upFileHandle").trigger("click");
  333. })
  334. $("#upFileHandle").change(function() {
  335. uploadHandle();
  336. })
  337. function getTitleNum() {
  338. if($('#title').val().length<= 30){
  339. $('#titlenum').text($('#title').val().length)
  340. }
  341. }
  342. function getConNum() {
  343. if($('#cont').val().length<= 500){
  344. $('#contnum').text($('#cont').val().length)
  345. }
  346. }
  347. function getCode() {
  348. if (!$('#cusphone').val()) {
  349. mui.alert('请输入联系电话!');
  350. return;
  351. } else {
  352. if(!(/^1[3|4|5|7|8]\d{9}$/.test($('#cusphone').val()))){
  353. mui.alert("请输入正确的手机号");
  354. return false;
  355. }
  356. }
  357. $.ajax({
  358. type: "get",
  359. url: huayi.config.callcenter_url + 'WxLogin/SendCode',
  360. async: true,
  361. dataType: 'json',
  362. data: {
  363. mobile: $('#cusphone').val()
  364. },
  365. success: function(res) {
  366. if (res.state == 'success') {
  367. let num = 60
  368. $('.line').css('display', 'none')
  369. $('.codeTX').css('display', 'inline-block')
  370. var fq = setInterval(function() {
  371. num -= 1
  372. $('.codeTX').text(num+'s')
  373. console.log(num)
  374. if (num == 0) {
  375. clearInterval(fq)
  376. $('.codeTX').css('display', 'none')
  377. $('.line').css('display', 'inline-block')
  378. }
  379. }, 1000)
  380. }
  381. }
  382. })
  383. }
  384. function getArea() {
  385. $.ajax({
  386. type: "post",
  387. url: huayi.config.callcenter_url + 'Area/GetAreaListById',
  388. dataType: 'json',
  389. async: false,
  390. data: {},
  391. success: function(res) {
  392. res.data.forEach(function(v, n) {
  393. if(v.F_AreaName != '市区'){
  394. var obj = {};
  395. obj.value = v.F_AreaId;
  396. obj.text = v.F_AreaName;
  397. areaList.push(obj)
  398. }
  399. })
  400. }
  401. });
  402. }
  403. function getAreaChildren(id) {
  404. $.ajax({
  405. type: "post",
  406. url: huayi.config.callcenter_url + 'Area/GetAreaChildren',
  407. dataType: 'json',
  408. async: false,
  409. data: {
  410. parentid: id
  411. },
  412. success: function(res) {
  413. townList = []
  414. res.data.forEach(function(v, n) {
  415. var objC = {};
  416. objC.value = v.F_AreaId;
  417. objC.text = v.F_AreaName;
  418. townList.push(objC)
  419. })
  420. }
  421. });
  422. }
  423. function Reset() {
  424. window.location.reload();
  425. // $('input[name="phoneType"][value = 9]').attr('checked' , 'checked')
  426. // $('#cusname').val('') //姓名
  427. // $('#cusaddress').val('') //详情
  428. // $('#cusphone').val('') //电话
  429. // $('#code').val('') //验证码
  430. // $('#title').val('') //标题
  431. // $('#cont').val('') //n内容
  432. // $('#cityResult3').val('') //事发区域
  433. // $('#cityResult2').val('') //乡镇
  434. // $('#cityResult1').val('') //村
  435. // $('#cusaddress').val('') //村
  436. // $("#fileHandle").val('') //附件
  437. // $(".fileBoxHandle").html('')
  438. // console.log($('input[name="select"][value = 0]'))
  439. // $('input[name="select"][value = 0]').attr('checked','checked')
  440. }
  441. function Submit() {
  442. if (!$('input[name="phoneType"]:checked').val()) {
  443. mui.alert('请输入反映类型!');
  444. return;
  445. }
  446. if (!$('#cusphone').val()) {
  447. mui.alert('请输入联系电话!');
  448. return;
  449. } else {
  450. if(!(/^1[3|4|5|7|8]\d{9}$/.test($('#cusphone').val()))){
  451. mui.alert("请输入正确的手机号");
  452. return false;
  453. }
  454. }
  455. if (!$('#code').val()) {
  456. mui.alert('请输入手机验证码!');
  457. return;
  458. }
  459. if (!$('#title').val()) {
  460. mui.alert('请输入反映标题!');
  461. return;
  462. }
  463. if (!$('#cont').val()) {
  464. mui.alert('请输入反映内容!');
  465. return;
  466. }
  467. if ($('#cityResult3').val() == '') {
  468. mui.alert('请选择事发区域!');
  469. return;
  470. }
  471. if (!$('input[name="select"]:checked').val()) {
  472. mui.alert('请选择姓名公开!');
  473. return;
  474. }
  475. $.ajax({
  476. type: "post",
  477. url: huayi.config.callcenter_url + 'APP/AddWorkOrder',
  478. async: true,
  479. dataType: 'json',
  480. contentType: 'application/x-www-form-urlencoded',
  481. data: {
  482. source: '5',
  483. type: $('input[name="phoneType"]:checked').val(), // 反应类别
  484. cusname: $('#cusname').val(), //姓名
  485. sourceaddress: $('#cusaddress').val(), //详情
  486. cusphone: $('#cusphone').val(), //电话
  487. code: $('#code').val(), //验证码
  488. title: $('#title').val(), //标题
  489. content: $('#cont').val(), //n内容
  490. sourcearea: area, //事发区域
  491. township: town, //乡镇
  492. village: village, //村
  493. sourceaddress: $('#cusaddress').val(),
  494. files: $("#fileHandle").val(), //附件
  495. isprotect: $('input[name="select"]:checked').val() //保密
  496. },
  497. success: function(data) {
  498. if (data.state == "success") {
  499. mui.alert('提交成功!')
  500. window.location.reload();
  501. }
  502. }
  503. });
  504. }
  505. //查看结果
  506. function seeResult(){
  507. window.location.replace("../html/login.html");
  508. }
  509. //上传文件
  510. function uploadHandle() {
  511. var Files = document.getElementById("upFileHandle").files;
  512. console.log(Files);
  513. if (Files.length > 0) {
  514. var formData = new FormData();
  515. for (var i = 0; i < Files.length; i++) {
  516. formData.append('file' + i, Files[i]);
  517. }
  518. var typeName = Files[0].name.split('.')[Files[0].name.split('.').length - 1].toLowerCase();
  519. if (typeName == "png" || typeName == 'jpg' || typeName == 'mp4' || typeName == 'avi' || typeName ==
  520. 'wmv' || typeName == 'mp3' || typeName == 'pdf' || typeName == 'doc' || typeName == 'docx' ||
  521. typeName == 'xls' || typeName == 'xlsx') {
  522. $.ajax({
  523. url: huayi.config.callcenter_url + "Web/UploadFile",
  524. type: "POST",
  525. data: formData,
  526. /**
  527. *必须false才会自动加上正确的Content-Type
  528. */
  529. contentType: false,
  530. /**
  531. * 必须false才会避开jQuery对 formdata 的默认处理
  532. * XMLHttpRequest会对 formdata 进行正确的处理
  533. */
  534. processData: false,
  535. success: function(result) {
  536. document.getElementById("upFileHandle").outerHTML = document.getElementById(
  537. "upFileHandle").outerHTML;
  538. $("#upFileHandle").change(function() {
  539. uploadHandle();
  540. });
  541. var r = $.parseJSON(result);
  542. if (r.state.toLowerCase() == "success") {
  543. var a = r.data;
  544. $(a).each(function(i, n) {
  545. // 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>'
  546. var strs = '<span class="filesHandle" fiel-num="' + n.F_FileId +
  547. '">' + n.F_FileName.substring(19) +
  548. '<span class="del_file">X</i></span>'
  549. $(strs).appendTo($('.fileBoxHandle')).find('.del_file').click(
  550. function(event) {
  551. event.stopPropagation();
  552. $(this).parent().remove();
  553. file_numHandle()
  554. })
  555. })
  556. file_numHandle();
  557. }
  558. }
  559. });
  560. } else {
  561. layer.msg("格式不正确");
  562. }
  563. } else {
  564. layer.confirm('请上传文件!', {
  565. btn: ['确定']
  566. });
  567. }
  568. }
  569. function file_numHandle() {
  570. var str = '';
  571. var Str;
  572. $('.fileBoxHandle .filesHandle').each(function(j, m) {
  573. var aa = $(m).attr("fiel-num")
  574. console.log(aa);
  575. str += aa + ",";
  576. Str = (str.substring(str.length - 1) == ',') ? str.substring(0, str.length - 1) : str;
  577. })
  578. console.log(Str)
  579. $("#fileHandle").val(Str);
  580. }
  581. (function($, doc) {
  582. $.init();
  583. $.ready(function() {
  584. var cityPicker3 = new $.PopPicker({
  585. layer: 1
  586. });
  587. var townPicker = new $.PopPicker({
  588. layer: 1
  589. });
  590. var valPicker = new $.PopPicker({
  591. layer: 1
  592. });
  593. cityPicker3.setData(areaList);
  594. var showCityPickerButton = doc.getElementById('showCityPicker3');
  595. var cityResult3 = doc.getElementById('cityResult3');
  596. var townPickerPickerButton = doc.getElementById('showCityPicker2');
  597. var townResult = doc.getElementById('cityResult2');
  598. var valPickerPickerButton = doc.getElementById('showCityPicker1');
  599. var valResult = doc.getElementById('cityResult1');
  600. showCityPickerButton.addEventListener('tap', function(event) {
  601. cityPicker3.show(function(items) {
  602. cityResult3.value = (items[0].text ? items[0].text : "");
  603. area = items[0].value
  604. cityResult3.setAttribute("data-index", items[0].value);
  605. getAreaChildren(items[0].value)
  606. townPicker.setData(townList);
  607. townResult.value=''
  608. valResult.value=''
  609. townPickerPickerButton.addEventListener('tap', function(event) {
  610. townPicker.show(function(items) {
  611. townResult.value = (items[0].text ? items[0].text : "");
  612. town = items[0].value
  613. townResult.setAttribute("data-index", items[0].value);
  614. getAreaChildren(items[0].value)
  615. valPicker.setData(townList);
  616. valResult.value=''
  617. valPickerPickerButton.addEventListener('tap', function(event) {
  618. valPicker.show(function(items) {
  619. valResult.value = (items[0].text ? items[0].text : "");
  620. village = items[0].value
  621. valResult.setAttribute("data-index", items[0].value);
  622. });
  623. }, false);
  624. });
  625. }, false);
  626. });
  627. }, false);
  628. //街道
  629. })
  630. })(mui, document);
  631. </script>
  632. </body>
  633. </html>