edit.html 6.7 KB

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