123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483 |
- <link rel="stylesheet" href="/css/assist/taskPage.css">
- <script src="/js/assist/drag.js" type="text/javascript"></script>
- <div class="hgc_taskPage">
- <div class="hgc_totalHeader">
- <span class="active">发送权限状态</span>
- </div>
- <div class="searchArea">
- <span>
- 发送权限:
- <?php
- if($acceptSchoolOpen){
- echo '<strong class="schoolStatus">开启中</strong>';
- }else{
- echo '<strong class="schoolStatus">关闭中</strong>';
- }
- ?>
- <a class="changeSchoolOnOff">切换</a> 注释:开启后所有学校将支持发送扫描异常任务至服务后台,不受名单限制!
- </span>
- </div>
- <div class="hgc_totalHeader">
- <span class="active">学校名单</span>
- </div>
- <div class="searchArea">
- <form class="task_search" action="<?php echo $this->createUrl('assistSchool/index');?>" method="get" >
- <div class="searchLeft">
- <div class="conditionItem">
- <em>省份:</em>
- <select name="province_id" id="provinceId">
- <option value="0">全部</option>
- <?php
- foreach ($province as $val){
- if(isset($condition['province_id']) && $condition['province_id']==$val->region_id){
- echo '<option selected value="'.$val->region_id.'">'.$val->region_name.'</option>';
- }else{
- echo '<option value="'.$val->region_id.'">'.$val->region_name.'</option>';
- }
- }
- ?>
- </select>
- </div>
- <div class="conditionItem">
- <em>市:</em>
- <select name="city_id" id="cityId">
- <option value="0">全部</option>
- </select>
- </div>
- <div class="conditionItem">
- <em>区:</em>
- <select name="area_id" id="areaId">
- <option value="0">全部</option>
- </select>
- </div>
- <div class="conditionItem">
- <input type="text" placeholder="学校名称关键字搜索" name="school_name" value="<?php if(isset($condition['school_name'])){ echo $condition['school_name'];} ?>">
- <div class="submit hbtn">搜索</div>
- </div>
- </div>
- </form>
- <div class="conditionItem last">
- <div class="addSchool hbtn">添加学校</div>
- </div>
- </div>
- <div class="tableBox openSchoolList">
- <table class="hgc_table" border="1" cellspacing="0">
- <thead>
- <tr>
- <th>序号</th>
- <th>学校名称</th>
- <th>省份</th>
- <th>城市</th>
- <th>区县</th>
- <th>学管信息</th>
- <th>操作</th>
- </tr>
- </thead>
- <tbody>
- <?php
- if(isset($pages['page'])){
- $i=($pages['page']-1)*10+1;
- }else{
- $i=1;
- }
- if ($dataList):foreach ($dataList as $loop): ?>
- <tr id="<?php echo $loop['school_id'] ?>">
- <td><?php echo $i ?></td>
- <td><?php echo $loop['school_name'] ?></td>
- <td><?php echo $loop['province'] ?></td>
- <td><?php echo $loop['city'] ?></td>
- <td><?php echo $loop['area'] ?></td>
- <td><?php echo $loop['coach'] ?></td>
- <td >
- <div class="operator">
- <a rel="<?php echo $loop['school_id'] ?>" href="#" class="theme removeSchool">移除</a>
- </div>
- </td>
- </tr>
- <?php ++$i;endforeach;
- else:?>
- <tr><td colspan="12">暂无学校数据</td></tr>
- <?php
- endif;
- ?>
- </tbody>
- </table>
- <div class="dataTables_paginate paging_simple_numbers" >
- <?php
- if(isset($pages['totalPage']) && $pages['totalPage']>1){
- $StartPage=$pages['page']-5;
- $EndPage=$pages['page']+5;
- if($StartPage<1){
- $StartPage=1;
- }
- if($EndPage>$pages['totalPage']){
- $EndPage=$pages['totalPage'];
- }
- ?>
- <div class="row" style="padding-top:10px;margin:0 auto;">
- <div class="col-xs-5" style="font-size: 16px;text-align: center;width: 100%;padding: 20px 0;">
- <div class="dataTables_paginate paging_simple_numbers" style="vertical-align:sub;">
- <ul id="yw0" class="yiiPager">
- <?php
- if($pages['page']>1){
- echo '<li class="previous"><a href="'.$this->createUrl('assistSchool/index')."?page=".($pages['page']-1).'&'.http_build_query($condition).'">上一页</a></li>';
- }
- for($i=$StartPage;$i<=$EndPage;$i++){
- $url=$this->createUrl('assistSchool/index')."?page=".$i.'&'.http_build_query($condition);
- if($pages['page']==$i){
- echo '<li class="page selected"><a href="#">'.$i.'</a></li>';
- }else{
- echo '<li class="page"><a href="'.$url.'">'.$i.'</a></li>';
- }
- }
- if($pages['page']<$pages['totalPage']){
- echo '<li class="previous"><a href="'.$this->createUrl('assistSchool/index')."?page=".($pages['page']+1).'&'.http_build_query($condition).'">下一页</a></li>';
- }
- ?>
- </ul>
- 共:<?php echo $pages['total']?> 条
- </div>
- </div>
- </div>
- <?php } ?>
- </div>
- </div>
- <div class="hgc_dialog switch" style="display: none">
- <div class="hgc_dialogContent">
- <h2>提示 <i class="close btn-colse">x</i></h2>
- <div class="content">
- <p class="warning">注意:开启后系统内所有学校将支持发送任务至服务后台,不受名单限制, 请谨慎操作!</p>
- <div class="conditionItem" style="margin:0;">
- <form class="radioForm" style="width: 100%;display: flex;align-items: center; justify-content: space-around;">
- <div class="radioItem"><input type="radio" value="1" <?php if($acceptSchoolOpen){ echo 'checked';}?> name="isLimit"> <label>开启</label></div>
- <div class="radioItem"><input type="radio" value="0" <?php if(!$acceptSchoolOpen){ echo 'checked';}?> name="isLimit"> <label>关闭</label></div>
- </form>
- </div>
- </div>
- <div class="btns">
- <div class="hbtn up-form-switch" >确定</div>
- <div class="hbtn btn-colse" id="">取消</div>
- </div>
- </div>
- </div>
- <div class="hgc_dialog remove_school" style="display: none">
- <div class="hgc_dialogContent">
- <h2>提示 <i class="close btn-colse">x</i></h2>
- <div class="content" style="text-align: center">
- 移除后所选学校将不支持发送协助任务
- </div>
- <div class="btns">
- <input type="hidden" name="school_id" value="0">
- <div class="hbtn submit_remove_school" >确定</div>
- <div class="hbtn btn-colse" id="">取消</div>
- </div>
- </div>
- </div>
- <div class="hgc_dialog add_school" id="dialog1" style="display: none;">
- <div class="hgc_dialogContent" style="width: 700px;">
- <h2>添加学校 <i class="close btn-colse">x</i></h2>
- <div class="content">
- <div class="searchArea">
- <div class="conditionItem" style="margin:0;">
- <em>省份:</em>
- <select name="province_id" id="searchProvinceId" style="width: 100px;">
- <option value="0">全部</option>
- <?php
- foreach ($province as $val){
- echo '<option value="'.$val->region_id.'">'.$val->region_name.'</option>';
- }
- ?>
- </select>
- </div>
- <div class="conditionItem" style="margin:0;">
- <em>城市:</em>
- <select name="province_id" id="searchCityId" style="width: 100px;">
- <option value="0">全部</option>
- </select>
- </div>
- <div class="conditionItem" style="margin:0;">
- <em>区县:</em>
- <select name="province_id" id="searchAreaId" style="width: 100px;">
- <option value="0">全部</option>
- </select>
- </div>
- <div class="conditionItem" style="margin:0;">
- <input type="text" placeholder="学校名称关键字搜索" name="search_school_name" style="width: 100px" value="">
- <div class="search_school hbtn" style="width: 50px;">搜索</div>
- </div>
- </div>
- <table class="hgc_table" border="1" cellspacing="0">
- <thead>
- <tr>
- <th>序号</th>
- <th>学校名称</th>
- <th>省份</th>
- <th>城市</th>
- <th>区县</th>
- <th>操作</th>
- </tr>
- </thead>
- <tbody id="schoolList">
- </tbody>
- </table>
- <div class="dataTables_paginate paging_simple_numbers" >
- <div class="row" style="padding-top:10px;margin:0 auto;">
- <div class="col-xs-5" style="font-size: 16px;text-align: center;width: 100%;padding: 20px 0;">
- <div class="dataTables_paginate paging_simple_numbers ajaxSearchSchoolPage" style="vertical-align:sub;">
- <ul id="yw1" class="yiiPager">
- </ul>
- </div>
- </div>
- </div>
- </div>
- </div>
- <div class="btns">
- <input type="hidden" name="page" value="1">
- <div class="hbtn btn-colse">关闭</div>
- </div>
- </div>
- </div>
- </div>
- <script type="text/javascript">
- $(document).ready(function () {
- var provinceId=parseInt('<?php if(isset($condition['province_id'])){ echo $condition['province_id'];}else{ echo 0;} ?>');
- var cityId=parseInt('<?php if(isset($condition['city_id'])){ echo $condition['city_id'];}else{echo 0;} ?>');
- var areaId=parseInt('<?php if(isset($condition['area_id'])){echo $condition['area_id'];}else{echo 0;} ?>');
- var areaLoaded=false;
- if(provinceId){
- getRegion(provinceId,$('#cityId'))
- }
- //关闭弹窗
- $(".btn-colse").on("click", function () {
- // layer.close(layer.index);
- layer.closeAll();
- $('.hgc_dialog').hide();
- });
- $('.changeSchoolOnOff').click(function(){
- $('.switch').show();
- });
- $('.addSchool').click(function(){
- $('.add_school').show();
- });
- $('.up-form-switch').click(function(){
- var value= $('input[name=isLimit]:checked').val();
- $.ajax({
- url:'<?php echo $this->createUrl('assistSchool/switch')?>',
- type:'POST',
- dataType:'json',
- data:{value:value},
- success:function(res){
- if(res.status==1){
- layer.msg('操作成功');
- if(value==1){
- $('.schoolStatus').html('开启中');
- }else{
- $('.schoolStatus').html('关闭中');
- }
- $('.hgc_dialog').hide();
- }else{
- layer.msg('操作失败');
- }
- }
- });
- });
- $(".prompt").mouseover(function(event){
- var tooltipHtml = "<div id='tooltip' class='tooltip'>Hello!</div>";
- $(this).append(tooltipHtml);
- $("#tooltip").css({
- "top": "0px",
- "left": (event.pageX) + "px" //紧跟在内容的后面
- }).show("fast"); //设置提示框的坐标,并显示
- }).mouseout(function(){
- $("#tooltip").remove();
- })
- $('.submit').click(function(){
- $('.task_search').submit();
- });
- $('#provinceId').change(function(){
- console.log($(this).val())
- var provinceId=$(this).val();
- $('#cityId').html('<option value="0">全部</option>');
- $('#areaId').html('<option value="0">全部</option>');
- if(provinceId>0){
- getRegion(provinceId,$('#cityId'))
- }
- });
- $('#cityId').change(function(){
- $('#areaId').html('<option value="0">全部</option>');
- var cityId=$(this).val();
- if(cityId>0){
- getRegion(cityId,$('#areaId'))
- }
- });
- $('#searchProvinceId').change(function(){
- console.log($(this).val())
- var provinceId=$(this).val();
- $('#searchCityId').html('<option value="0">全部</option>');
- $('#searchAreaId').html('<option value="0">全部</option>');
- if(provinceId>0){
- getRegion(provinceId,$('#searchCityId'))
- }
- });
- $('#searchCityId').change(function(){
- $('#searchAreaId').html('<option value="0">全部</option>');
- var provinceId=$(this).val();
- if(provinceId>0){
- getRegion(provinceId,$('#searchAreaId'))
- }
- });
- function getRegion(parentId,obj){
- if(parentId>0){
- $.ajax({
- url:'<?php echo $this->createUrl('assistSchool/getRegion')?>',
- type:'POST',
- dataType:'json',
- data:{parent_id:parentId},
- success:function(res){
- if(res.status==1){
- obj.html(res.data);
- if(cityId>0 && areaLoaded==false){
- $("#cityId option").each(function(){ //遍历所有option
- if(cityId==$(this).val()){
- $(this).attr('selected',true);
- }
- })
- getRegion(cityId,$('#areaId'))
- areaLoaded=true;
- }
- if(areaId>0){
- $("#areaId option").each(function(){ //遍历所有option
- if(areaId==$(this).val()){
- $(this).attr('selected',true);
- }
- })
- }
- }
- }
- });
- }
- }
- $('.search_school').click(function(){
- var province_id=$('#searchProvinceId').val(),
- city_id=$('#searchCityId').val(),
- area_id=$('#searchAreaId').val(),
- school_name=$('input[name=search_school_name]').val(),
- page=1;
- if(school_name!=''){
- province_id=0;
- city_id=0;
- area_id=0;
- $('#searchProvinceId').val(0);
- $('#searchCityId').val(0);
- $('#searchAreaId').val(0);
- }
- searchSchool(province_id,city_id,area_id,school_name,page);
- });
- $('.removeSchool').click(function(){
- var school_id=$(this).attr('rel');
- $('input[name=school_id]').val(school_id);
- $('.remove_school').show();
- });
- $('.submit_remove_school').click(function(){
- var school_id=$('input[name=school_id]').val();
- $.ajax({
- url:'<?php echo $this->createUrl('assistSchool/Remove')?>',
- type:'POST',
- dataType:'json',
- data:{school_id:school_id},
- success:function(res){
- if(res.status==1){
- layer.msg('操作成功');
- $('#'+school_id).remove();
- $('.remove_school').hide();
- //window.location.reload();
- }else{
- layer.msg('操作失败');
- }
- }
- });
- });
- $('.main-content')
- .on('click','.page',function(){
- var province_id=$('#searchProvinceId').val(),
- city_id=$('#searchCityId').val(),
- area_id=$('#searchAreaId').val(),
- school_name=$('input[name=search_school_name]').val(),
- page=$(this).find('a').attr('rel');
- searchSchool(province_id,city_id,area_id,school_name,page);
- }).on('click','.addSchoolList',function(){
- var school_id=$(this).attr('rel'),
- school_name=$(this).attr('name');
- var obj=$(this).closest('tr');
- $.ajax({
- url:'<?php echo $this->createUrl('assistSchool/addWhiteList')?>',
- type:'POST',
- dataType:'json',
- data:{school_id:school_id,school_name:school_name},
- success:function(res){
- if(res.status==1){
- layer.msg('添加成功');
- //obj.remove();
- obj.find('.control-school').html('添加');
- //window.location.reload();
- }else{
- layer.msg('添加失败');
- }
- }
- });
- })
- function searchSchool(province_id,city_id,area_id,school_name,page){
- $.ajax({
- url:'<?php echo $this->createUrl('assistSchool/searchSchool')?>',
- type:'POST',
- dataType:'json',
- data:{province_id:province_id,city_id:city_id,area_id:area_id,school_name:school_name,page:page},
- success:function(res){
- if(res.status==1){
- $('#schoolList').html(res.data['list']);
- $('.ajaxSearchSchoolPage').html(res.data['pages']);
- }
- }
- });
- }
- });
- </script>
|