jhrcxq.html 8.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <title>湖北智慧水运</title>
  5. <meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
  6. <meta http-equiv="description" content="this is my page">
  7. <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  8. <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" />
  9. <link href="../css/base.min.css" rel="stylesheet">
  10. <link rel="stylesheet" type="text/css" href="../css/mui.min.css">
  11. <meta http-equiv="description" content="this is my page">
  12. <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  13. <script type="text/javascript" src="../js/zepto.min.js"></script>
  14. <script type="text/javascript">
  15. //获取url参数
  16. function getQueryString(name) {
  17. var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i");
  18. var r = window.location.search.substr(1).match(reg);
  19. if (r != null) return unescape(r[2]); return null;
  20. }
  21. $(function(){
  22. $("#baocun").click(function(){
  23. if($("#info").val() == ""){
  24. layer.open({
  25. content: '日程内容不能为空',
  26. style: 'background-color:rgba(0,0,0,0.5);color:white; border:none;font-size:20px;text-align:center',
  27. shade:false,
  28. time: 1.5
  29. });
  30. return;
  31. }
  32. if($("#time2").val() == ""){
  33. layer.open({
  34. content: '时间不能为空',
  35. style: 'background-color:rgba(0,0,0,0.5);color:white; border:none;font-size:20px;text-align:center',
  36. shade:false,
  37. time: 1.5
  38. });
  39. return;
  40. }
  41. $.ajax({
  42. type : 'post',
  43. url : '../../jhrccontroller/savejhrc.do',
  44. data:{
  45. year:year,
  46. month:month,
  47. day:day,
  48. flag:"8",
  49. id:$("#savaId").val(),
  50. info:$("#info").val(),
  51. remindtime:$("#time2").val()+":00",
  52. uid:"402881e44e86c26d014e86c9ae8c0008"
  53. },
  54. dataType : 'json',
  55. success : function(data) {
  56. if(data[0].resultCode == '0'){
  57. window.location.reload();
  58. }
  59. }
  60. });
  61. });
  62. var pdata = getQueryString("data");
  63. pdata = pdata.substring(0,11);
  64. var da = pdata.split("-");
  65. var year = da[0];
  66. var month = parseInt(da[1]);
  67. var day = parseInt(da[2]);
  68. $.ajax({
  69. type : 'post',
  70. url : '../../jhrccontroller/viewjhrc.do',
  71. data:{
  72. year:year,
  73. month:month,
  74. day:day,
  75. flag:"8",
  76. uid:"402881e44e86c26d014e86c9ae8c0008"
  77. },
  78. dataType : 'json',
  79. success : function(data) {
  80. console.log(data);
  81. if(data[0].resultCode == '0'){
  82. for (var i = 0; i < data[0].grrcList.length; i++) {
  83. var str = "<li class='mui-table-view-cell' id='mui"+data[0].grrcList[i].id+"'>";
  84. str= str+data[0].grrcList[i].scheduleinfo;
  85. var month="";
  86. if(data[0].month < 10){
  87. month = "0"+data[0].month;
  88. }else{
  89. month = data[0].month;
  90. }
  91. var day = "";
  92. if(data[0].day < 10){
  93. day = "0"+data[0].day;
  94. }else{
  95. day = data[0].day;
  96. }
  97. var time="";
  98. var time1= "";
  99. if(data[0].grrcList[i].remindtime!=null){
  100. var h = data[0].grrcList[i].remindtime.hour;
  101. var m = data[0].grrcList[i].remindtime.minute;
  102. if(h<10){
  103. h=" 0"+h;
  104. }
  105. if(m<10){
  106. m="0"+m
  107. }
  108. time= h+":"+m+":00";
  109. time1=data[0].grrcList[i].remindtime.hour+":"+data[0].grrcList[i].remindtime.minute;
  110. }
  111. var da = data[0].year+"-"+month+"-"+day+" "+time;
  112. str=str+"<p>"+da+"</p>";
  113. str=str+"<span style='float: right;'>";
  114. str=str+"<span class='mui-icon mui-icon-compose upjihua' id='"+data[0].grrcList[i].id+"' info='"+data[0].grrcList[i].scheduleinfo+"' da='"+time1+"' onclick='edit(this);'></span>";
  115. str=str+"<span class='mui-icon mui-icon-trash' onclick='del(\""+data[0].grrcList[i].id+"\");'></span>";
  116. str=str+"</span>";
  117. str=str+"</li>";
  118. $("#infoul").append(str);
  119. }
  120. }
  121. }
  122. });
  123. $(".upjihua").on("click",function(){
  124. $("#jid").val("1");
  125. $("#title").html("修改计划");
  126. $("#div-alert").show(200);
  127. $("#div-alert1").show(200);
  128. });
  129. $("#queren").on("click",function(){
  130. var jid = $("#jid").val();
  131. if(jid!=""){
  132. alert("修改")
  133. }else{
  134. alert("保存")
  135. }
  136. $("#div-alert").hide();
  137. $("#div-alert1").hide();
  138. });
  139. $("#quxiao").on("click",function(){
  140. $("#div-alert").hide();
  141. $("#div-alert1").hide();
  142. });
  143. });
  144. function addjihua(id){
  145. $("#time2").val("--:--");//清空时间
  146. $("#info").val("");//清空信息描述
  147. $("#jid").val("");
  148. $("#title").html("添加计划");
  149. $("#div-alert").show(200);
  150. $("#div-alert1").show(200);
  151. $("#savaId").val(id);
  152. }
  153. function del(id){
  154. layer.open({
  155. content: '确定删除日程吗?',
  156. btn: ['取消', '确定'],
  157. shadeClose: false,
  158. yes: function(){
  159. layer.closeAll();
  160. }, no: function(){
  161. $.ajax({
  162. type : 'post',
  163. url : '../../jhrccontroller/deletejhrc.do',
  164. data:{
  165. year:"2015",
  166. month:"7",
  167. day:"1",
  168. flag:"8",
  169. id:id,
  170. uid:"402881e44e86c26d014e86c9ae8c0008"
  171. },
  172. dataType : 'json',
  173. success : function(data) {
  174. if(data[0].resultCode == '0'){
  175. $("#mui"+id).remove();
  176. }
  177. }
  178. });
  179. layer.closeAll();
  180. }
  181. });
  182. }
  183. //编辑
  184. function edit(ok){
  185. var time = $(ok).attr("da").split(":");
  186. var h = time[0];
  187. var m = time[1];
  188. if(h < 10){
  189. h = "0"+h
  190. }
  191. if(m < 10){
  192. m = "0"+m;
  193. }
  194. $("#savaId").val($(ok).attr("id"));//存储处理id
  195. $("#time2").val(h+":"+m);//回写时间
  196. $("#info").val($(ok).attr("info"));//回写信息
  197. $("#jid").val("");
  198. $("#title").html("编辑计划");
  199. $("#div-alert").show(200);
  200. $("#div-alert1").show(200);
  201. }
  202. </script>
  203. <style type="text/css">
  204. .header {
  205. width:100%;
  206. height:45px;
  207. line-height:45px;
  208. padding:0;
  209. color:#eee;
  210. font-size:22px;
  211. text-align:center;
  212. color:white;
  213. background: #2196f3;
  214. }
  215. .nav{position: fixed;}
  216. .header-logo{float: none;}
  217. body,button,input,div{margin: 0px;padding: 0px}
  218. </style>
  219. </head>
  220. <body>
  221. <header class="header">
  222. <ul class="nav nav-list pull-left">
  223. <li><a href="javascript:void(0);" id="goback" onclick="history.back()"><span class="icon icon-arrow-back icback"></span>
  224. </a></li>
  225. </ul>
  226. <a class="header-logo" href="#">当天计划</a>
  227. </header>
  228. <div class="mui-content" style="background: white;margin-top: 45px;">
  229. <ul class="mui-table-view" id = "infoul">
  230. </ul>
  231. </div>
  232. <div style="text-align: center;padding-top: 10px;"> <button class="mui-btn mui-btn-positive" type="button" style="width: 90%;background: #2196f3;border: 0px;" onclick="addjihua('');" id="addjihua">添加计划</button></div>
  233. <div id="div-alert" style="position: absolute;display:none;top: 20%;left: 10%;z-index: 100;height:270px;border:4px solid #2196f3;border-radius:10px;width: 82%;background:white;">
  234. <form id="jhform">
  235. <input type="hidden" name="jid" id="jid" value=""/>
  236. <div id="title" style="width:100%;height:30px;text-align: center;background:#2196f3;line-height: 30px;color: white;margin-bottom: 20px;font-size:20px;" >添加计划</div>
  237. &nbsp;<label style="">时间:&nbsp;</label><input id="time2" name="time2" type="time" style="width: 72%" /><br>
  238. &nbsp;<label style="">内容:&nbsp;</label><input id="info" name="content" type="text" style="width: 72%" />
  239. </form>
  240. <div style="width: 100%;text-align: center;">
  241. <input type="hidden" id = "savaId" />
  242. <button class="mui-btn mui-btn-positive" type="button" style="width: 40%;background: #2196f3;border: 0px;" id="baocun">保存 </button>&nbsp;&nbsp;
  243. <button class="mui-btn mui-btn-positive" type="button" style="width: 40%;background: #2196f3;border: 0px;" id="quxiao">取消</button>
  244. </div>
  245. </div>
  246. <div id="div-alert1" style="position:absolute;width:100%;height: 100%;display:none;z-index: 50;top:0px;background: black; opacity:0.2; "></div>
  247. </body>
  248. </html>