0
0

madd.html 7.0 KB

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