add.html 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  1. {extend name="common/common2" /}
  2. {block name="main"}
  3. <div class="row">
  4. <div class="col-sm-12">
  5. <div class="ibox float-e-margins">
  6. <div class="ibox-title">
  7. <h5>{$title}</h5>
  8. <div class="ibox-tools">
  9. <a class="toback" href="{:url('index')}">
  10. 返回上一页
  11. </a>
  12. </div>
  13. </div>
  14. <div class="ibox-content">
  15. <form method="post" action="{:url('add')}" class="form-horizontal">
  16. <input type="hidden" name="id" value="{$info['id']|default='0'}">
  17. <div class="form-group">
  18. <label class="col-sm-2 control-label">名称<span class="text-danger">*</span></label>
  19. <div class="col-sm-6">
  20. <input type="text" class="form-control" name="name" value="{$info.name|default=''}">
  21. </div>
  22. </div>
  23. <div class="form-group">
  24. <label class="col-sm-2 control-label">时间段设置<span class="text-danger">*</span></label>
  25. <div class="col-sm-6">
  26. <select name="type" class="form-control" id="changeType">
  27. <option value="1">一天一次上下班</option>
  28. <option value="2">一天二次上下班</option>
  29. <option value="3">一天三次上下班</option>
  30. </select>
  31. </div>
  32. </div>
  33. <div class="form-group">
  34. <label class="col-sm-2 control-label">第一次开始时间~结束时间<span class="text-danger">*</span></label>
  35. <div class="col-sm-6">
  36. <div class="col-xs-6" style="padding-left: 0">
  37. {:widget_view('common/timepicker',['name'=>'start1', 'val' =>isset($info['start1'])?$info['start1']:''])}
  38. </div>
  39. <div class="col-xs-6" style="padding-right: 0">
  40. {:widget_view('common/timepicker',['name'=>'end1', 'val' =>isset($info['end1'])?$info['end1']:''])}
  41. </div>
  42. </div>
  43. </div>
  44. <div class="form-group" id="start22" style="display: none">
  45. <label class="col-sm-2 control-label">第二次开始时间~结束时间<span class="text-danger">*</span></label>
  46. <div class="col-sm-6">
  47. <div class="col-xs-6" style="padding-left: 0">
  48. {:widget_view('common/timepicker',['name'=>'start2', 'val' =>isset($info['start2'])?$info['start2']:''])}
  49. </div>
  50. <div class="col-xs-6" style="padding-right: 0">
  51. {:widget_view('common/timepicker',['name'=>'end2', 'val' =>isset($info['end2'])?$info['end2']:''])}
  52. </div>
  53. </div>
  54. </div>
  55. <div class="form-group" id="start33" style="display: none">
  56. <label class="col-sm-2 control-label">第三次开始时间~结束时间<span class="text-danger">*</span></label>
  57. <div class="col-sm-6">
  58. <div class="col-xs-6" style="padding-left: 0">
  59. {:widget_view('common/timepicker',['name'=>'start3', 'val' =>isset($info['start3'])?$info['start3']:''])}
  60. </div>
  61. <div class="col-xs-6" style="padding-right: 0">
  62. {:widget_view('common/timepicker',['name'=>'end3', 'val' =>isset($info['end3'])?$info['end3']:''])}
  63. </div>
  64. </div>
  65. </div>
  66. <div class="hr-line-dashed"></div>
  67. <div class="form-group">
  68. <div class="col-sm-6 col-sm-offset-2">
  69. <button class="btn btn-primary ajax-post" target-form="form-horizontal" type="submit">确 定</button>
  70. <a href="{:url('index')}" class="btn btn-default">取 消</a>
  71. </div>
  72. </div>
  73. </form>
  74. </div>
  75. </div>
  76. </div>
  77. </div>
  78. {/block}
  79. {block name="script"}
  80. <script>
  81. $(document).ready(function(){
  82. formSetValue("enable", {$info.enable|default=1});
  83. });
  84. $(document).ready(function(){
  85. formSetValue("type", {$info.type|default=1});
  86. });
  87. //监听下拉列表的change事件
  88. $(function (){
  89. var types =$('#changeType').val(); //获取下拉列表选中的值
  90. if(types == 1){
  91. $('#start22').attr('style','display:none');
  92. $('#start33').attr('style','display:none');
  93. }
  94. if(types == 2){
  95. $('#start22').attr('style','display:block');
  96. $('#start33').attr('style','display:none');
  97. }
  98. if(types == 3){
  99. $('#start22').attr('style','display:block');
  100. $('#start33').attr('style','display:block');
  101. }
  102. })
  103. $("#changeType").change(function(){
  104. var types = $(this).val(); //获取下拉列表选中的值
  105. if(types == 1){
  106. $('#start22').attr('style','display:none');
  107. $('#start33').attr('style','display:none');
  108. }
  109. if(types == 2){
  110. $('#start22').attr('style','display:block');
  111. $('#start33').attr('style','display:none');
  112. }
  113. if(types == 3){
  114. $('#start22').attr('style','display:block');
  115. $('#start33').attr('style','display:block');
  116. }
  117. });
  118. </script>
  119. {/block}