publish.html 8.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8">
  5. <title>放号设置编辑</title>
  6. <meta name="renderer" content="webkit">
  7. <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  8. <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
  9. <link rel="stylesheet" href="/static/public/layui/css/layui.css" media="all">
  10. <link rel="stylesheet" href="/static/public/font-awesome/css/font-awesome.min.css" media="all"/>
  11. <link rel="stylesheet" href="/static/admin/css/admin.css" media="all">
  12. <script src="/static/public/layui/layui.js"></script>
  13. <script src="/static/public/jquery/jquery.min.js"></script>
  14. </head>
  15. <style>
  16. .layui-upload-img {
  17. cursor: pointer;
  18. width: 150px;
  19. height: 150px;
  20. background: url('/static/public/images/uploadimg.jpg');
  21. background-size: contain;
  22. border-radius: 2px;
  23. border-width: 1px;
  24. border-style: solid;
  25. border-color: #e6e6e6;
  26. }
  27. .layui-form-label{
  28. width: 90px;
  29. }
  30. </style>
  31. <body style="padding:10px;">
  32. <div class="tplay-body-div">
  33. <div style="margin-top: 20px;"></div>
  34. <form class="layui-form" id="publish" method="post" lay-filter="myform">
  35. <div class="layui-form-item">
  36. <label class="layui-form-label">工作日</label>
  37. <div class="layui-input-block">
  38. <input type="checkbox" name="weeks[1]" title="周一">
  39. <input type="checkbox" name="weeks[2]" title="周二">
  40. <input type="checkbox" name="weeks[3]" title="周三">
  41. <input type="checkbox" name="weeks[4]" title="周四">
  42. <input type="checkbox" name="weeks[5]" title="周五" checked>
  43. <input type="checkbox" name="weeks[6]" title="周六">
  44. <input type="checkbox" name="weeks[7]" title="周日">
  45. </div>
  46. </div>
  47. <div class="layui-form-item">
  48. <label class="layui-form-label">上午时段</label>
  49. <div class="layui-input-inline" style="width:350px;">
  50. <input type="text" name="morning_time_periods[]" placeholder="请输入,格式如:08:00 - 12:00" autocomplete="off"
  51. class="layui-input test-item" value="">
  52. </div>
  53. <div class="layui-inline" style="margin-top: 5px;">
  54. <div class="layui-btn-group">
  55. <button type="button"
  56. class="layui-btn layui-btn-primary layui-btn-sm createinput"
  57. lay-filter="createinput"><i class="layui-icon">&#xe654;</i></button>
  58. </div>
  59. </div>
  60. <!--<div class="layui-inline">-->
  61. <!--<div class="layui-input-inline" style="width:350px;">-->
  62. <!--<input type="checkbox" name="show_morning" title="显示" checked>-->
  63. <!--</div>-->
  64. <!--</div>-->
  65. </div>
  66. <div class="layui-form-item">
  67. <label class="layui-form-label">下午时段</label>
  68. <div class="layui-input-inline" style="width:350px;">
  69. <input type="text" name="afternoon_time_periods[]" placeholder="请输入,格式如:14:00 - 18:00" autocomplete="off"
  70. class="layui-input test-item" value="">
  71. </div>
  72. <div class="layui-inline" style="margin-top: 5px;">
  73. <div class="layui-btn-group">
  74. <button type="button"
  75. class="layui-btn layui-btn-primary layui-btn-sm createinput2"
  76. lay-filter="createinput"><i class="layui-icon">&#xe654;</i></button>
  77. </div>
  78. </div>
  79. <!--<div class="layui-inline">-->
  80. <!--<div class="layui-input-inline" style="width:350px;">-->
  81. <!--<input type="checkbox" name="show_afternoon" title="显示" checked>-->
  82. <!--</div>-->
  83. <!--</div>-->
  84. </div>
  85. <input type="hidden" name="pid" value="{$Request.param.pid}">
  86. {notempty name="$data"}
  87. <input type="hidden" name="id" value="{$data.id}">
  88. {/notempty}
  89. <div class="layui-form-item">
  90. <div class="layui-input-block">
  91. <button class="layui-btn" lay-submit lay-filter="admin">立即提交</button>
  92. </div>
  93. </div>
  94. </form>
  95. <div id="create_input" style="display:none">
  96. <div class="layui-form-item">
  97. <label class="layui-form-label"></label>
  98. <div class="layui-input-inline" style="width:350px;">
  99. <input type="text" name="morning_time_periods[]" placeholder="请输入,格式如:08:00 - 12:00" autocomplete="off"
  100. class="layui-input test-item" value="">
  101. </div>
  102. <div class="layui-inline" style="margin-top: 5px;">
  103. <div class="layui-btn-group">
  104. <button type="button"
  105. class="layui-btn layui-btn-primary layui-btn-sm createinput"
  106. lay-filter="createinput"><i class="layui-icon">&#xe654;</i></button>
  107. <button type="button"
  108. class="layui-btn layui-btn-primary layui-btn-sm deleteinput"
  109. lay-filter="deleteinput"><i class="layui-icon">&#xe640;</i></button>
  110. </div>
  111. </div>
  112. </div>
  113. </div>
  114. <div id="create_input2" style="display:none">
  115. <div class="layui-form-item">
  116. <label class="layui-form-label"></label>
  117. <div class="layui-input-inline" style="width:350px;">
  118. <input type="text" name="afternoon_time_periods[]" placeholder="请输入,格式如:14:00 - 18:00" autocomplete="off"
  119. class="layui-input test-item" value="">
  120. </div>
  121. <div class="layui-inline" style="margin-top: 5px;">
  122. <div class="layui-btn-group">
  123. <button type="button"
  124. class="layui-btn layui-btn-primary layui-btn-sm createinput2"
  125. lay-filter="createinput"><i class="layui-icon">&#xe654;</i></button>
  126. <button type="button"
  127. class="layui-btn layui-btn-primary layui-btn-sm deleteinput"
  128. lay-filter="deleteinput"><i class="layui-icon">&#xe640;</i></button>
  129. </div>
  130. </div>
  131. </div>
  132. </div>
  133. <script>
  134. layui.use(['layer', 'form', 'laydate','element'], function () {
  135. var layer = layui.layer,
  136. $ = layui.jquery,
  137. form = layui.form;
  138. var laydate = layui.laydate;
  139. $(window).on('load', function () {
  140. form.on('submit(admin)', function (data) {
  141. //获取表单区域所有值
  142. var data = form.val("myform");
  143. if (data['weeks[1]'] == null && data['weeks[2]'] == null && data['weeks[3]'] == null && data['weeks[4]'] == null && data['weeks[5]'] == null && data['weeks[6]'] == null && data['weeks[7]'] == null) {
  144. layer.msg('请选择排号的工作日');
  145. return false;
  146. }
  147. $.ajax({
  148. url: "{:url('publish')}",
  149. data: $('#publish').serialize(),
  150. type: 'post',
  151. dataType: 'json',
  152. async: false,
  153. success: function (res) {
  154. if (res.code == 1) {
  155. layer.alert(res.msg, function (index) {
  156. location.href = "{:url('admin/appointment/publish')}?pid=" + res.data.pid;
  157. })
  158. } else {
  159. layer.msg(res.msg);
  160. }
  161. }
  162. })
  163. return false;
  164. });
  165. });
  166. });
  167. function createinput(ele) {
  168. var parent = ele.parent().parent().parent();
  169. parent.after($('#create_input').prop("innerHTML"));
  170. init()
  171. }
  172. function createinput2(ele) {
  173. var parent = ele.parent().parent().parent();
  174. parent.after($('#create_input2').prop("innerHTML"));
  175. init()
  176. }
  177. function deleteinput(ele) {
  178. if(ele.parent().parent().next().text() == "")
  179. ele.parent().parent().parent().remove();
  180. }
  181. function init() {
  182. $('.createinput').off("click").click(function () {
  183. createinput($(this))
  184. })
  185. $('.createinput2').off("click").click(function () {
  186. createinput2($(this))
  187. })
  188. $('.deleteinput').off("click").click(function () {
  189. deleteinput($(this))
  190. })
  191. }
  192. $(function () {
  193. init()
  194. })
  195. </script>
  196. </div>
  197. </body>
  198. </html>