123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165 |
- <?php
- use yii\helpers\Url;
- use yii\helpers\Html;
- use yii\widgets\LinkPager;
- ?>
- <style>
- .flex{display: flex;display: -webkit-flex;}
- .flex-one{-webkit-flex: 1;-moz-flex: 1;-ms-flex: 1;-o-flex: 1;flex: 1;}
- .dib{display:inline-block;}
- .vtm{vertical-align: middle;}
- .school-charact-item select{width: 120px;height: 30px;line-height: 30px;border: 1px solid #ccc;border-radius: 4px;}
- .sci-menu{margin-right: 10px;}
- .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;}
- .inp-search-con{margin-left: 20px;}
- .school-charact-main{margin-bottom: 20px;}
- .sum-page-con{margin-right: 20px;}
- </style>
- <div class="row">
- <div class="col-md-12 col-sm-12 col-xs-12">
- <div class="x_panel">
- <div class="x_title">
- <h2>学校列表列表</h2>
- <div class="clearfix"></div>
- </div>
- <div class="x_content">
- <div class="row">
- <form action="<?= Url::to(['school-manage/potential']);?>" method="get" >
- <div class="flex school-charact-main">
-
- <div class="flex-one school-charact-item">
- <span class="dib sci-menu">省份</span>
- <select name="province_id">
- <option value="">请选择</option>
- <?php if($province):foreach($province as $p => $pro):?>
- <option value="<?= $p ?>" <?php if($p == $condition['provinceId']){echo 'selected';}?>><?= $pro ?></option>
- <?php endforeach;endif;?>
- </select>
- </div>
- <div class="flex-one school-charact-item">
- <span class="dib sci-menu">城市</span>
- <select name="city_id">
- <option value="">请选择</option>
- <?php if($city):foreach($city as $c => $ct):?>
- <option value="<?= $c ?>" <?php if($c == $condition['cityId']){echo 'selected';}?>><?= $ct ?></option>
- <?php endforeach;endif;?>
- </select>
- </div>
- <div class="flex-one school-charact-item">
- <span class="dib sci-menu">区县</span>
- <select name="area_id">
- <option value="">请选择</option>
- <?php if($area):foreach($area as $a => $ar):?>
- <option value="<?= $a ?>" <?php if($a == $condition['areaId']){echo 'selected';}?>><?= $ar ?></option>
- <?php endforeach;endif;?>
- </select>
- </div>
- <input type="text" name="search_name" class="inp-search-con" value="<?= $condition['searchName'] ?>" placeholder="请输入学校名称">
- <input type="submit" value="查询" class="search-btn">
- <input type="button" class="new-school-btn" value="导出表格" onclick="schoolImport()">
- </div>
- </form>
- </div>
- <table id="datatable" class="table table-striped table-bordered" style="margin-bottom: 0px;">
- <thead>
- <tr>
- <th>序号</th>
- <th>学校名称</th>
- <th>省份</th>
- <th>城市</th>
- <th>区/县</th>
- <th>学段</th>
- <th>学校来源</th>
- <th>参与考试次数</th>
- <th>操作</th>
- </tr>
- </thead>
- <tbody>
- <?php $i = 1; if ($dataList):foreach ($dataList as $loop): ?>
- <tr>
- <td><?= $i ?></td>
- <td><?= Html::encode($loop['school_name']) ?></td>
- <td><?= isset($region[$loop['province_id']]) ? $region[$loop['province_id']] : '' ?></td>
- <td><?= isset($region[$loop['city_id']]) ? $region[$loop['city_id']] : '' ?></td>
- <td><?= isset($region[$loop['area_id']]) ? $region[$loop['area_id']] : '' ?></td>
- <td>高中</td>
- <td>字典学校</td>
- <td><?= $loop['exam_number'] ?></td>
- <td><a style="color:#337ab7" href="<?= Url::to(['school-manage/detail', 'schoolId' => $loop['school_id']]);?>">详情</a></td>
- </tr>
- <?php ++$i;endforeach;endif; ?>
- </tbody>
- </table>
- <div class="dataTables_paginate paging_simple_numbers">
- <span class="sum-page-con dib ">共:<?= $pages->totalCount ?>条</span>
- <?= LinkPager::widget([
- 'pagination' => $pages,
- 'options' => ['class' => ['pagination','vtm']],
- 'maxButtonCount' =>6
- ]);?>
- </div>
- </div>
- </div>
- </div>
- </div>
- <script type="text/javascript">
- $(document).ready(function () {
- // 选择省份
- $("select[name='province_id']").change(function(){
- var parentId = parseInt($(this).val());
- var objCity = $("select[name='city_id");
- $.post("<?= Url::to(['region/get-city']);?>", {parentId:parentId}, function(response){
- if (response.status) {
- objCity.empty();
- objCity.append('<option value="">请选择</option>');
- $.each(response.data, function(i){
- objCity.append('<option value="'+i+'">'+response.data[i]+'</option>');
- });
- }
- });
- });
- // 选择市
- $("select[name='city_id").change(function(){
- var parentId = parseInt($(this).val());
- var objArea = $("select[name='area_id']");
- $.post("<?= Url::to(['region/get-city']);?>", {parentId:parentId}, function(response){
- if (response.status) {
- objArea.empty();
- objArea.append('<option value="">请选择</option>');
- $.each(response.data, function(i){
- objArea.append('<option value="'+i+'">'+response.data[i]+'</option>');
- });
- }
- });
- });
- });
- function schoolImport(sid, type) {
- var pid = parseInt($("select[name='province_id").val());
- var cid = parseInt($("select[name='city_id").val());
- var aid = parseInt($("select[name='area_id").val());
- var name = $.trim($("input[name='search_name']").val());
- var paramStr = '1';
- if (!isNaN(aid) && aid > 0) {
- paramStr += '&aid='+aid;
- } else if (!isNaN(cid) && cid > 0) {
- paramStr += '&cid='+cid;
- } else if (!isNaN(pid) && pid > 0) {
- paramStr += '&pid='+pid;
- }
- if (name != '' || name != null) {
- paramStr = '&name='+name;
- }
- layer.confirm('确定要导出数据吗', {
- btn:['确定', '取消'],
- }, function(){
- layer.closeAll();
- window.location.href = ("<?=Url::to(['school-manage/import'])?>?"+paramStr);
- });
- }
- </script>
|