potential.php 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165
  1. <?php
  2. use yii\helpers\Url;
  3. use yii\helpers\Html;
  4. use yii\widgets\LinkPager;
  5. ?>
  6. <style>
  7. .flex{display: flex;display: -webkit-flex;}
  8. .flex-one{-webkit-flex: 1;-moz-flex: 1;-ms-flex: 1;-o-flex: 1;flex: 1;}
  9. .dib{display:inline-block;}
  10. .vtm{vertical-align: middle;}
  11. .school-charact-item select{width: 120px;height: 30px;line-height: 30px;border: 1px solid #ccc;border-radius: 4px;}
  12. .sci-menu{margin-right: 10px;}
  13. .search-btn,.new-school-btn{padding: 0 20px;height: 30px;line-height: 30px;border: 1px solid #ccc;border-radius: 4px;cursor: pointer;margin: 0 20px;background: #fff;}
  14. .inp-search-con{margin-left: 20px;}
  15. .school-charact-main{margin-bottom: 20px;}
  16. .sum-page-con{margin-right: 20px;}
  17. </style>
  18. <div class="row">
  19. <div class="col-md-12 col-sm-12 col-xs-12">
  20. <div class="x_panel">
  21. <div class="x_title">
  22. <h2>学校列表列表</h2>
  23. <div class="clearfix"></div>
  24. </div>
  25. <div class="x_content">
  26. <div class="row">
  27. <form action="<?= Url::to(['school-manage/potential']);?>" method="get" >
  28. <div class="flex school-charact-main">
  29. <div class="flex-one school-charact-item">
  30. <span class="dib sci-menu">省份</span>
  31. <select name="province_id">
  32. <option value="">请选择</option>
  33. <?php if($province):foreach($province as $p => $pro):?>
  34. <option value="<?= $p ?>" <?php if($p == $condition['provinceId']){echo 'selected';}?>><?= $pro ?></option>
  35. <?php endforeach;endif;?>
  36. </select>
  37. </div>
  38. <div class="flex-one school-charact-item">
  39. <span class="dib sci-menu">城市</span>
  40. <select name="city_id">
  41. <option value="">请选择</option>
  42. <?php if($city):foreach($city as $c => $ct):?>
  43. <option value="<?= $c ?>" <?php if($c == $condition['cityId']){echo 'selected';}?>><?= $ct ?></option>
  44. <?php endforeach;endif;?>
  45. </select>
  46. </div>
  47. <div class="flex-one school-charact-item">
  48. <span class="dib sci-menu">区县</span>
  49. <select name="area_id">
  50. <option value="">请选择</option>
  51. <?php if($area):foreach($area as $a => $ar):?>
  52. <option value="<?= $a ?>" <?php if($a == $condition['areaId']){echo 'selected';}?>><?= $ar ?></option>
  53. <?php endforeach;endif;?>
  54. </select>
  55. </div>
  56. <input type="text" name="search_name" class="inp-search-con" value="<?= $condition['searchName'] ?>" placeholder="请输入学校名称">
  57. <input type="submit" value="查询" class="search-btn">
  58. <input type="button" class="new-school-btn" value="导出表格" onclick="schoolImport()">
  59. </div>
  60. </form>
  61. </div>
  62. <table id="datatable" class="table table-striped table-bordered" style="margin-bottom: 0px;">
  63. <thead>
  64. <tr>
  65. <th>序号</th>
  66. <th>学校名称</th>
  67. <th>省份</th>
  68. <th>城市</th>
  69. <th>区/县</th>
  70. <th>学段</th>
  71. <th>学校来源</th>
  72. <th>参与考试次数</th>
  73. <th>操作</th>
  74. </tr>
  75. </thead>
  76. <tbody>
  77. <?php $i = 1; if ($dataList):foreach ($dataList as $loop): ?>
  78. <tr>
  79. <td><?= $i ?></td>
  80. <td><?= Html::encode($loop['school_name']) ?></td>
  81. <td><?= isset($region[$loop['province_id']]) ? $region[$loop['province_id']] : '' ?></td>
  82. <td><?= isset($region[$loop['city_id']]) ? $region[$loop['city_id']] : '' ?></td>
  83. <td><?= isset($region[$loop['area_id']]) ? $region[$loop['area_id']] : '' ?></td>
  84. <td>高中</td>
  85. <td>字典学校</td>
  86. <td><?= $loop['exam_number'] ?></td>
  87. <td><a style="color:#337ab7" href="<?= Url::to(['school-manage/detail', 'schoolId' => $loop['school_id']]);?>">详情</a></td>
  88. </tr>
  89. <?php ++$i;endforeach;endif; ?>
  90. </tbody>
  91. </table>
  92. <div class="dataTables_paginate paging_simple_numbers">
  93. <span class="sum-page-con dib ">共:<?= $pages->totalCount ?>条</span>
  94. <?= LinkPager::widget([
  95. 'pagination' => $pages,
  96. 'options' => ['class' => ['pagination','vtm']],
  97. 'maxButtonCount' =>6
  98. ]);?>
  99. </div>
  100. </div>
  101. </div>
  102. </div>
  103. </div>
  104. <script type="text/javascript">
  105. $(document).ready(function () {
  106. // 选择省份
  107. $("select[name='province_id']").change(function(){
  108. var parentId = parseInt($(this).val());
  109. var objCity = $("select[name='city_id");
  110. $.post("<?= Url::to(['region/get-city']);?>", {parentId:parentId}, function(response){
  111. if (response.status) {
  112. objCity.empty();
  113. objCity.append('<option value="">请选择</option>');
  114. $.each(response.data, function(i){
  115. objCity.append('<option value="'+i+'">'+response.data[i]+'</option>');
  116. });
  117. }
  118. });
  119. });
  120. // 选择市
  121. $("select[name='city_id").change(function(){
  122. var parentId = parseInt($(this).val());
  123. var objArea = $("select[name='area_id']");
  124. $.post("<?= Url::to(['region/get-city']);?>", {parentId:parentId}, function(response){
  125. if (response.status) {
  126. objArea.empty();
  127. objArea.append('<option value="">请选择</option>');
  128. $.each(response.data, function(i){
  129. objArea.append('<option value="'+i+'">'+response.data[i]+'</option>');
  130. });
  131. }
  132. });
  133. });
  134. });
  135. function schoolImport(sid, type) {
  136. var pid = parseInt($("select[name='province_id").val());
  137. var cid = parseInt($("select[name='city_id").val());
  138. var aid = parseInt($("select[name='area_id").val());
  139. var name = $.trim($("input[name='search_name']").val());
  140. var paramStr = '1';
  141. if (!isNaN(aid) && aid > 0) {
  142. paramStr += '&aid='+aid;
  143. } else if (!isNaN(cid) && cid > 0) {
  144. paramStr += '&cid='+cid;
  145. } else if (!isNaN(pid) && pid > 0) {
  146. paramStr += '&pid='+pid;
  147. }
  148. if (name != '' || name != null) {
  149. paramStr = '&name='+name;
  150. }
  151. layer.confirm('确定要导出数据吗', {
  152. btn:['确定', '取消'],
  153. }, function(){
  154. layer.closeAll();
  155. window.location.href = ("<?=Url::to(['school-manage/import'])?>?"+paramStr);
  156. });
  157. }
  158. </script>