No Description

addWorkOrder.html 18KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668
  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="../layui/layui.js"></script>
  317. <script>
  318. $('.codeTX').css('display', 'none')
  319. var areaList = [],
  320. townList = [];
  321. var area = 0,town = 9,village = 0;
  322. getArea() //获取事发区域
  323. //附件
  324. $("#scwjHandle").click(function() {
  325. $("#upFileHandle").trigger("click");
  326. })
  327. $("#upFileHandle").change(function() {
  328. uploadHandle();
  329. })
  330. function getTitleNum() {
  331. if($('#title').val().length<= 30){
  332. $('#titlenum').text($('#title').val().length)
  333. }
  334. }
  335. function getConNum() {
  336. if($('#cont').val().length<= 500){
  337. $('#contnum').text($('#cont').val().length)
  338. }
  339. }
  340. function getCode() {
  341. if (!$('#cusphone').val()) {
  342. mui.alert('请输入联系电话!');
  343. return;
  344. } else {
  345. if(!(/^1[3|4|5|6|7|8]\d{9}$/.test($('#cusphone').val()))){
  346. mui.alert("请输入正确的手机号");
  347. return false;
  348. }
  349. }
  350. $.ajax({
  351. type: "get",
  352. url: huayi.config.callcenter_url + 'WxLogin/SendCode',
  353. async: true,
  354. dataType: 'json',
  355. data: {
  356. mobile: $('#cusphone').val()
  357. },
  358. success: function(res) {
  359. if (res.state == 'success') {
  360. let num = 60
  361. $('.line').css('display', 'none')
  362. $('.codeTX').css('display', 'inline-block')
  363. var fq = setInterval(function() {
  364. num -= 1
  365. $('.codeTX').text(num+'s')
  366. console.log(num)
  367. if (num == 0) {
  368. clearInterval(fq)
  369. $('.codeTX').css('display', 'none')
  370. $('.line').css('display', 'inline-block')
  371. }
  372. }, 1000)
  373. }
  374. }
  375. })
  376. }
  377. function getArea() {
  378. $.ajax({
  379. type: "post",
  380. url: huayi.config.callcenter_url + 'Area/GetAreaListById',
  381. dataType: 'json',
  382. async: false,
  383. data: {},
  384. success: function(res) {
  385. res.data.forEach(function(v, n) {
  386. if(v.F_AreaName != '市区'){
  387. var obj = {};
  388. obj.value = v.F_AreaId;
  389. obj.text = v.F_AreaName;
  390. areaList.push(obj)
  391. }
  392. })
  393. }
  394. });
  395. }
  396. function getAreaChildren(id) {
  397. $.ajax({
  398. type: "post",
  399. url: huayi.config.callcenter_url + 'Area/GetAreaChildren',
  400. dataType: 'json',
  401. async: false,
  402. data: {
  403. parentid: id
  404. },
  405. success: function(res) {
  406. townList = []
  407. res.data.forEach(function(v, n) {
  408. var objC = {};
  409. objC.value = v.F_AreaId;
  410. objC.text = v.F_AreaName;
  411. townList.push(objC)
  412. })
  413. }
  414. });
  415. }
  416. function Reset() {
  417. window.location.reload();
  418. }
  419. function Submit() {
  420. if (!$('input[name="phoneType"]:checked').val()) {
  421. mui.alert('请输入反映类型!');
  422. return;
  423. }
  424. if (!$('#cusphone').val()) {
  425. mui.alert('请输入联系电话!');
  426. return;
  427. } else {
  428. if(!(/^[1]([2-9])[0-9]{9}$/.test($('#cusphone').val()))){
  429. mui.alert("请输入正确的手机号");
  430. return false;
  431. }
  432. }
  433. if (!$('#code').val()) {
  434. mui.alert('请输入手机验证码!');
  435. return;
  436. }
  437. if (!$('#title').val()) {
  438. mui.alert('请输入反映标题!');
  439. return;
  440. }
  441. if (!$('#cont').val()) {
  442. mui.alert('请输入反映内容!');
  443. return;
  444. }
  445. if ($('#cityResult3').val() == '') {
  446. mui.alert('请选择事发区域!');
  447. return;
  448. }
  449. if (!$('input[name="select"]:checked').val()) {
  450. mui.alert('请选择姓名公开!');
  451. return;
  452. }
  453. $.ajax({
  454. type: "post",
  455. url: huayi.config.callcenter_url + 'APP/AddWorkOrder',
  456. async: true,
  457. dataType: 'json',
  458. contentType: 'application/x-www-form-urlencoded',
  459. data: {
  460. source: '5',
  461. type: $('input[name="phoneType"]:checked').val(), // 反应类别
  462. cusname: $('#cusname').val(), //姓名
  463. sourceaddress: $('#cusaddress').val(), //详情
  464. cusphone: $('#cusphone').val(), //电话
  465. code: $('#code').val(), //验证码
  466. title: $('#title').val(), //标题
  467. content: $('#cont').val(), //n内容
  468. sourcearea: area, //事发区域
  469. township: town, //乡镇
  470. village: village, //村
  471. sourceaddress: $('#cusaddress').val(),
  472. files: $("#fileHandle").val(), //附件
  473. isprotect: $('input[name="select"]:checked').val() //保密
  474. },
  475. success: function(data) {
  476. if (data.state == "success") {
  477. mui.alert('提交成功!')
  478. window.location.reload();
  479. }
  480. }
  481. });
  482. }
  483. //查看结果
  484. function seeResult(){
  485. window.location.replace("../html/login.html");
  486. }
  487. //上传文件
  488. function uploadHandle() {
  489. var Files = document.getElementById("upFileHandle").files;
  490. console.log(Files);
  491. if (Files.length > 0) {
  492. var formData = new FormData();
  493. for (var i = 0; i < Files.length; i++) {
  494. formData.append('file' + i, Files[i]);
  495. }
  496. var typeName = Files[0].name.split('.')[Files[0].name.split('.').length - 1].toLowerCase();
  497. if (typeName == "png" || typeName == 'jpg' || typeName == 'mp4' || typeName == 'avi' || typeName ==
  498. 'wmv' || typeName == 'mp3' || typeName == 'pdf' || typeName == 'doc' || typeName == 'docx' ||
  499. typeName == 'xls' || typeName == 'xlsx') {
  500. $.ajax({
  501. url: huayi.config.callcenter_url + "Web/UploadFile",
  502. type: "POST",
  503. data: formData,
  504. /**
  505. *必须false才会自动加上正确的Content-Type
  506. */
  507. contentType: false,
  508. /**
  509. * 必须false才会避开jQuery对 formdata 的默认处理
  510. * XMLHttpRequest会对 formdata 进行正确的处理
  511. */
  512. processData: false,
  513. success: function(result) {
  514. document.getElementById("upFileHandle").outerHTML = document.getElementById(
  515. "upFileHandle").outerHTML;
  516. $("#upFileHandle").change(function() {
  517. uploadHandle();
  518. });
  519. var r = $.parseJSON(result);
  520. if (r.state.toLowerCase() == "success") {
  521. var a = r.data;
  522. $(a).each(function(i, n) {
  523. // 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>'
  524. var strs = '<span class="filesHandle" fiel-num="' + n.F_FileId +
  525. '">' + n.F_FileName.substring(19) +
  526. '<span class="del_file">X</i></span>'
  527. $(strs).appendTo($('.fileBoxHandle')).find('.del_file').click(
  528. function(event) {
  529. event.stopPropagation();
  530. $(this).parent().remove();
  531. file_numHandle()
  532. })
  533. })
  534. file_numHandle();
  535. }
  536. }
  537. });
  538. } else {
  539. layer.msg("格式不正确");
  540. }
  541. } else {
  542. layer.confirm('请上传文件!', {
  543. btn: ['确定']
  544. });
  545. }
  546. }
  547. function file_numHandle() {
  548. var str = '';
  549. var Str;
  550. $('.fileBoxHandle .filesHandle').each(function(j, m) {
  551. var aa = $(m).attr("fiel-num")
  552. console.log(aa);
  553. str += aa + ",";
  554. Str = (str.substring(str.length - 1) == ',') ? str.substring(0, str.length - 1) : str;
  555. })
  556. console.log(Str)
  557. $("#fileHandle").val(Str);
  558. }
  559. (function($, doc) {
  560. $.init();
  561. $.ready(function() {
  562. var cityPicker3 = new $.PopPicker({
  563. layer: 1
  564. });
  565. var townPicker = new $.PopPicker({
  566. layer: 1
  567. });
  568. var valPicker = new $.PopPicker({
  569. layer: 1
  570. });
  571. cityPicker3.setData(areaList);
  572. var showCityPickerButton = doc.getElementById('showCityPicker3');
  573. var cityResult3 = doc.getElementById('cityResult3');
  574. var townPickerPickerButton = doc.getElementById('showCityPicker2');
  575. var townResult = doc.getElementById('cityResult2');
  576. var valPickerPickerButton = doc.getElementById('showCityPicker1');
  577. var valResult = doc.getElementById('cityResult1');
  578. showCityPickerButton.addEventListener('tap', function(event) {
  579. cityPicker3.show(function(items) {
  580. cityResult3.value = (items[0].text ? items[0].text : "");
  581. area = items[0].value
  582. cityResult3.setAttribute("data-index", items[0].value);
  583. getAreaChildren(items[0].value)
  584. townPicker.setData(townList);
  585. townResult.value=''
  586. valResult.value=''
  587. townPickerPickerButton.addEventListener('tap', function(event) {
  588. townPicker.show(function(items) {
  589. townResult.value = (items[0].text ? items[0].text : "");
  590. town = items[0].value
  591. townResult.setAttribute("data-index", items[0].value);
  592. getAreaChildren(items[0].value)
  593. valPicker.setData(townList);
  594. valResult.value=''
  595. valPickerPickerButton.addEventListener('tap', function(event) {
  596. valPicker.show(function(items) {
  597. valResult.value = (items[0].text ? items[0].text : "");
  598. village = items[0].value
  599. valResult.setAttribute("data-index", items[0].value);
  600. });
  601. }, false);
  602. });
  603. }, false);
  604. });
  605. }, false);
  606. //街道
  607. })
  608. })(mui, document);
  609. </script>
  610. </body>
  611. </html>