madd.html 7.1 KB

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