Nessuna descrizione

addWorkOrder.html 19KB

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