add.html 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  1. {extend name="common/common2" /}
  2. {block name="main"}
  3. <link rel="stylesheet" href="/static/bootstrap-multiselect-0.9.15/dist/css/bootstrap-multiselect.css">
  4. <style>
  5. </style>
  6. <div class="row">
  7. <div class="col-sm-12">
  8. <div class="ibox float-e-margins">
  9. <div class="ibox-content">
  10. <form method="post" action="{:url('add')}" class="form-horizontal">
  11. <input type="hidden" name="plan_id" value="{$plan_id}">
  12. <div class="form-group">
  13. <label class="col-sm-2 control-label">开始日期<span class="text-danger">*</span></label>
  14. <div class="col-sm-6">
  15. {:widget_view('common/datepicker',['name'=>'start', 'val' =>isset($info)?$info['start']:''])}
  16. </div>
  17. </div>
  18. <div class="form-group">
  19. <label class="col-sm-2 control-label">结束日期<span class="text-danger">*</span></label>
  20. <div class="col-sm-6">
  21. {:widget_view('common/datepicker',['name'=>'end', 'val' =>isset($info)?$info['end']:''])}
  22. </div>
  23. </div>
  24. <div class="form-group">
  25. <label class="col-sm-2 control-label">任务项<span class="text-danger">*</span></label>
  26. <div class="col-sm-6">
  27. <select id="plantype" name="forms[]" multiple="multiple">
  28. {volist name="type" id="v"}
  29. <option value="{$v['id']}" {if condition="isset($info['forms']) and in_array($v['id'],$info['forms'])"}selected{/if}>{$v['title']}</option>
  30. {/volist}
  31. </select>
  32. </div>
  33. </div>
  34. <div class="form-group">
  35. <label class="col-sm-2 control-label">地点<span class="text-danger">*</span></label>
  36. <div class="col-sm-6">
  37. <select id="planaddr" name="addrs[]" multiple="multiple">
  38. {volist name="address" id="v"}
  39. <option value="{$v['id']}" {if condition="isset($info['addrs']) and in_array($v['id'],$info['addrs'])"}selected{/if}>{$v['title']}</option>
  40. {/volist}
  41. </select>
  42. </div>
  43. </div>
  44. <div class="form-group">
  45. <label class="col-sm-2 control-label">人员<span class="text-danger">*</span></label>
  46. <div class="col-sm-6">
  47. {:widget_view('common/multiselect',['name'=>'user','lists' =>$user, 'val' =>isset($info['user'])?$info['user']:[]])}
  48. </div>
  49. </div>
  50. <div class="form-group">
  51. <label class="col-sm-2 control-label">备注</label>
  52. <div class="col-sm-6">
  53. <textarea name="remark" class="form-control" rows="3" value="{$info.remark|default=''}"></textarea>
  54. </div>
  55. </div>
  56. <div class="hr-line-dashed"></div>
  57. <div class="form-group">
  58. <div class="col-sm-6 col-sm-offset-2">
  59. <button class="btn btn-primary ajax-post" data-layer="1" target-form="form-horizontal" type="submit">确 定</button>
  60. <button class="btn cancel-btn btn-default" type="button">取 消</button>
  61. </div>
  62. </div>
  63. </form>
  64. </div>
  65. </div>
  66. </div>
  67. </div>
  68. {/block}
  69. {block name="script"}
  70. <script src="/static/bootstrap-multiselect-0.9.15/dist/js/bootstrap-multiselect.js"></script>
  71. <script>
  72. $(document).ready(function(){
  73. $('#plantype').multiselect({
  74. buttonText: function(options, select) {
  75. if (options.length === 0) {
  76. return '请选择';
  77. }
  78. else if (options.length > 2) {
  79. return '已选择'+options.length+'项';
  80. }
  81. else {
  82. var labels = [];
  83. options.each(function() {
  84. if ($(this).attr('label') !== undefined) {
  85. labels.push($(this).attr('label'));
  86. }
  87. else {
  88. labels.push($(this).html());
  89. }
  90. });
  91. return labels.join(', ') + '';
  92. }
  93. },
  94. filterPlaceholder: '搜索',
  95. includeSelectAllOption: true, // 显示全选
  96. selectAllText: '全选',
  97. maxHeight: 300,
  98. // enableClickableOptGroups: true, // 分组可选
  99. // enableCollapsibleOptGroups: true, // 分组可折叠
  100. enableFiltering: true, // 开启搜索
  101. buttonClass: 'btn btn-primary',
  102. onChange: function(option, checked) {
  103. console.log(option.length + ' options ' + (checked ? 'selected' : 'deselected'));
  104. }
  105. });
  106. $('#planaddr').multiselect({
  107. buttonText: function(options, select) {
  108. if (options.length === 0) {
  109. return '请选择';
  110. }
  111. else if (options.length > 2) {
  112. return '已选择'+options.length+'项';
  113. }
  114. else {
  115. var labels = [];
  116. options.each(function() {
  117. if ($(this).attr('label') !== undefined) {
  118. labels.push($(this).attr('label'));
  119. }
  120. else {
  121. labels.push($(this).html());
  122. }
  123. });
  124. return labels.join(', ') + '';
  125. }
  126. },
  127. filterPlaceholder: '搜索',
  128. includeSelectAllOption: true, // 显示全选
  129. selectAllText: '全选',
  130. maxHeight: 300,
  131. // enableClickableOptGroups: true, // 分组可选
  132. // enableCollapsibleOptGroups: true, // 分组可折叠
  133. enableFiltering: true, // 开启搜索
  134. buttonClass: 'btn btn-primary',
  135. onChange: function(option, checked) {
  136. console.log(option.length + ' options ' + (checked ? 'selected' : 'deselected'));
  137. }
  138. });
  139. });
  140. </script>
  141. {/block}