data_source.html 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  1. <include file="public@header"/>
  2. <style>
  3. .data-item-tr, .search-btn {
  4. cursor: pointer;
  5. }
  6. .col-xs-3 {
  7. padding-right: 0;
  8. }
  9. </style>
  10. </head>
  11. <body>
  12. <div class="wrap js-check-wrap">
  13. <notempty name="filters">
  14. <form method="post" action="{:url('theme/dataSource')}" id="search-form">
  15. <div class="row">
  16. <foreach name="filters" item="filter" key="filterName">
  17. <switch name="filter.type">
  18. <case value="text">
  19. <div class="col-xs-3">
  20. <div class="form-group">
  21. <label class="sr-only">{$filter.title|default=''}</label>
  22. <input type="text" class="form-control" name="{$filterName}"
  23. placeholder="{$filter.placeholder|default=''}"
  24. value="{$form[$filterName]|default=''}">
  25. </div>
  26. </div>
  27. </case>
  28. <case value="select">
  29. <div class="col-xs-3">
  30. <div class="form-group">
  31. <label class="sr-only">{$filter.title|default=''}</label>
  32. <select class="form-control" name="{$filterName}">
  33. <notempty name="filter.placeholder">
  34. <option value="">{$filter.placeholder|default=''}</option>
  35. </notempty>
  36. <foreach name="filter.options" item="option">
  37. <php>
  38. $option_selected='';
  39. if(isset($form[$filterName]) && $form[$filterName]==$option['id']){
  40. $option_selected='selected';
  41. };
  42. </php>
  43. <option value="{$option.id}" {$option_selected}>{$option.name}</option>
  44. </foreach>
  45. </select>
  46. </div>
  47. </div>
  48. </case>
  49. </switch>
  50. </foreach>
  51. <div class="col-xs-3">
  52. <input type="hidden" value="{$data_source}" name="data_source">
  53. <button type="submit" class="btn btn-primary">搜索</button>
  54. <a class="btn btn-danger" href="{:url('theme/dataSource')}?data_source={$data_source}">清空</a>
  55. </div>
  56. </div>
  57. <!--<div class="form-group">-->
  58. <!--<div class="input-group">-->
  59. <!--<input type="text" class="form-control" name="keyword" value="{$keyword|default=''}"-->
  60. <!--placeholder="请输入关键字">-->
  61. <!--<input type="hidden" value="{$data_source}" name="data_source">-->
  62. <!--<span class="input-group-addon search-btn" onclick="submitSearchForm()">GO!</span>-->
  63. <!--</div>-->
  64. <!--</div>-->
  65. </form>
  66. </notempty>
  67. <form method="post" class="js-ajax-form">
  68. <table class="table table-hover table-bordered table-list">
  69. <thead>
  70. <tr>
  71. <th width="16">
  72. <if condition="$multi">
  73. <label>
  74. <input type="checkbox" class="js-check-all" data-direction="x" data-checklist="js-check-x">
  75. </label>
  76. </if>
  77. </th>
  78. <th width="50">ID</th>
  79. <th>名称</th>
  80. </tr>
  81. </thead>
  82. <tbody>
  83. {$items_tree}
  84. </tbody>
  85. </table>
  86. </form>
  87. </div>
  88. <script src="__STATIC__/js/admin.js"></script>
  89. <script>
  90. $('.data-item-tr').click(function (e) {
  91. console.log(e);
  92. var $this = $(this);
  93. if ($(e.target).is('input')) {
  94. return;
  95. }
  96. var $input = $this.find('input');
  97. if ($input.is(':checked')) {
  98. $input.prop('checked', false);
  99. } else {
  100. $input.prop('checked', true);
  101. }
  102. });
  103. function submitSearchForm() {
  104. $('#search-form').get(0).submit();
  105. }
  106. function confirm() {
  107. var selectedObjectsId = [];
  108. var selectedObjectsName = [];
  109. var selectedObjects = [];
  110. $('.js-select-box:checked').each(function () {
  111. var $this = $(this);
  112. selectedObjectsId.push($this.val());
  113. selectedObjectsName.push($this.data('name'));
  114. selectedObjects.push({
  115. id: $this.val(),
  116. name: $this.data('name')
  117. });
  118. });
  119. return {
  120. selectedObjects: selectedObjects,
  121. selectedObjectsId: selectedObjectsId,
  122. selectedObjectsName: selectedObjectsName
  123. };
  124. }
  125. </script>
  126. </body>
  127. </html>