list.php 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483
  1. <link rel="stylesheet" href="/css/assist/taskPage.css">
  2. <script src="/js/assist/drag.js" type="text/javascript"></script>
  3. <div class="hgc_taskPage">
  4. <div class="hgc_totalHeader">
  5. <span class="active">发送权限状态</span>
  6. </div>
  7. <div class="searchArea">
  8. <span>
  9. 发送权限:
  10. <?php
  11. if($acceptSchoolOpen){
  12. echo '<strong class="schoolStatus">开启中</strong>';
  13. }else{
  14. echo '<strong class="schoolStatus">关闭中</strong>';
  15. }
  16. ?>
  17. <a class="changeSchoolOnOff">切换</a> 注释:开启后所有学校将支持发送扫描异常任务至服务后台,不受名单限制!
  18. </span>
  19. </div>
  20. <div class="hgc_totalHeader">
  21. <span class="active">学校名单</span>
  22. </div>
  23. <div class="searchArea">
  24. <form class="task_search" action="<?php echo $this->createUrl('assistSchool/index');?>" method="get" >
  25. <div class="searchLeft">
  26. <div class="conditionItem">
  27. <em>省份:</em>
  28. <select name="province_id" id="provinceId">
  29. <option value="0">全部</option>
  30. <?php
  31. foreach ($province as $val){
  32. if(isset($condition['province_id']) && $condition['province_id']==$val->region_id){
  33. echo '<option selected value="'.$val->region_id.'">'.$val->region_name.'</option>';
  34. }else{
  35. echo '<option value="'.$val->region_id.'">'.$val->region_name.'</option>';
  36. }
  37. }
  38. ?>
  39. </select>
  40. </div>
  41. <div class="conditionItem">
  42. <em>市:</em>
  43. <select name="city_id" id="cityId">
  44. <option value="0">全部</option>
  45. </select>
  46. </div>
  47. <div class="conditionItem">
  48. <em>区:</em>
  49. <select name="area_id" id="areaId">
  50. <option value="0">全部</option>
  51. </select>
  52. </div>
  53. <div class="conditionItem">
  54. <input type="text" placeholder="学校名称关键字搜索" name="school_name" value="<?php if(isset($condition['school_name'])){ echo $condition['school_name'];} ?>">
  55. <div class="submit hbtn">搜索</div>
  56. </div>
  57. </div>
  58. </form>
  59. <div class="conditionItem last">
  60. <div class="addSchool hbtn">添加学校</div>
  61. </div>
  62. </div>
  63. <div class="tableBox openSchoolList">
  64. <table class="hgc_table" border="1" cellspacing="0">
  65. <thead>
  66. <tr>
  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
  78. if(isset($pages['page'])){
  79. $i=($pages['page']-1)*10+1;
  80. }else{
  81. $i=1;
  82. }
  83. if ($dataList):foreach ($dataList as $loop): ?>
  84. <tr id="<?php echo $loop['school_id'] ?>">
  85. <td><?php echo $i ?></td>
  86. <td><?php echo $loop['school_name'] ?></td>
  87. <td><?php echo $loop['province'] ?></td>
  88. <td><?php echo $loop['city'] ?></td>
  89. <td><?php echo $loop['area'] ?></td>
  90. <td><?php echo $loop['coach'] ?></td>
  91. <td >
  92. <div class="operator">
  93. <a rel="<?php echo $loop['school_id'] ?>" href="#" class="theme removeSchool">移除</a>
  94. </div>
  95. </td>
  96. </tr>
  97. <?php ++$i;endforeach;
  98. else:?>
  99. <tr><td colspan="12">暂无学校数据</td></tr>
  100. <?php
  101. endif;
  102. ?>
  103. </tbody>
  104. </table>
  105. <div class="dataTables_paginate paging_simple_numbers" >
  106. <?php
  107. if(isset($pages['totalPage']) && $pages['totalPage']>1){
  108. $StartPage=$pages['page']-5;
  109. $EndPage=$pages['page']+5;
  110. if($StartPage<1){
  111. $StartPage=1;
  112. }
  113. if($EndPage>$pages['totalPage']){
  114. $EndPage=$pages['totalPage'];
  115. }
  116. ?>
  117. <div class="row" style="padding-top:10px;margin:0 auto;">
  118. <div class="col-xs-5" style="font-size: 16px;text-align: center;width: 100%;padding: 20px 0;">
  119. <div class="dataTables_paginate paging_simple_numbers" style="vertical-align:sub;">
  120. <ul id="yw0" class="yiiPager">
  121. <?php
  122. if($pages['page']>1){
  123. echo '<li class="previous"><a href="'.$this->createUrl('assistSchool/index')."?page=".($pages['page']-1).'&'.http_build_query($condition).'">上一页</a></li>';
  124. }
  125. for($i=$StartPage;$i<=$EndPage;$i++){
  126. $url=$this->createUrl('assistSchool/index')."?page=".$i.'&'.http_build_query($condition);
  127. if($pages['page']==$i){
  128. echo '<li class="page selected"><a href="#">'.$i.'</a></li>';
  129. }else{
  130. echo '<li class="page"><a href="'.$url.'">'.$i.'</a></li>';
  131. }
  132. }
  133. if($pages['page']<$pages['totalPage']){
  134. echo '<li class="previous"><a href="'.$this->createUrl('assistSchool/index')."?page=".($pages['page']+1).'&'.http_build_query($condition).'">下一页</a></li>';
  135. }
  136. ?>
  137. </ul>
  138. 共:<?php echo $pages['total']?> 条
  139. </div>
  140. </div>
  141. </div>
  142. <?php } ?>
  143. </div>
  144. </div>
  145. <div class="hgc_dialog switch" style="display: none">
  146. <div class="hgc_dialogContent">
  147. <h2>提示 <i class="close btn-colse">x</i></h2>
  148. <div class="content">
  149. <p class="warning">注意:开启后系统内所有学校将支持发送任务至服务后台,不受名单限制, 请谨慎操作!</p>
  150. <div class="conditionItem" style="margin:0;">
  151. <form class="radioForm" style="width: 100%;display: flex;align-items: center; justify-content: space-around;">
  152. <div class="radioItem"><input type="radio" value="1" <?php if($acceptSchoolOpen){ echo 'checked';}?> name="isLimit"> <label>开启</label></div>
  153. <div class="radioItem"><input type="radio" value="0" <?php if(!$acceptSchoolOpen){ echo 'checked';}?> name="isLimit"> <label>关闭</label></div>
  154. </form>
  155. </div>
  156. </div>
  157. <div class="btns">
  158. <div class="hbtn up-form-switch" >确定</div>
  159. <div class="hbtn btn-colse" id="">取消</div>
  160. </div>
  161. </div>
  162. </div>
  163. <div class="hgc_dialog remove_school" style="display: none">
  164. <div class="hgc_dialogContent">
  165. <h2>提示 <i class="close btn-colse">x</i></h2>
  166. <div class="content" style="text-align: center">
  167. 移除后所选学校将不支持发送协助任务
  168. </div>
  169. <div class="btns">
  170. <input type="hidden" name="school_id" value="0">
  171. <div class="hbtn submit_remove_school" >确定</div>
  172. <div class="hbtn btn-colse" id="">取消</div>
  173. </div>
  174. </div>
  175. </div>
  176. <div class="hgc_dialog add_school" id="dialog1" style="display: none;">
  177. <div class="hgc_dialogContent" style="width: 700px;">
  178. <h2>添加学校 <i class="close btn-colse">x</i></h2>
  179. <div class="content">
  180. <div class="searchArea">
  181. <div class="conditionItem" style="margin:0;">
  182. <em>省份:</em>
  183. <select name="province_id" id="searchProvinceId" style="width: 100px;">
  184. <option value="0">全部</option>
  185. <?php
  186. foreach ($province as $val){
  187. echo '<option value="'.$val->region_id.'">'.$val->region_name.'</option>';
  188. }
  189. ?>
  190. </select>
  191. </div>
  192. <div class="conditionItem" style="margin:0;">
  193. <em>城市:</em>
  194. <select name="province_id" id="searchCityId" style="width: 100px;">
  195. <option value="0">全部</option>
  196. </select>
  197. </div>
  198. <div class="conditionItem" style="margin:0;">
  199. <em>区县:</em>
  200. <select name="province_id" id="searchAreaId" style="width: 100px;">
  201. <option value="0">全部</option>
  202. </select>
  203. </div>
  204. <div class="conditionItem" style="margin:0;">
  205. <input type="text" placeholder="学校名称关键字搜索" name="search_school_name" style="width: 100px" value="">
  206. <div class="search_school hbtn" style="width: 50px;">搜索</div>
  207. </div>
  208. </div>
  209. <table class="hgc_table" border="1" cellspacing="0">
  210. <thead>
  211. <tr>
  212. <th>序号</th>
  213. <th>学校名称</th>
  214. <th>省份</th>
  215. <th>城市</th>
  216. <th>区县</th>
  217. <th>操作</th>
  218. </tr>
  219. </thead>
  220. <tbody id="schoolList">
  221. </tbody>
  222. </table>
  223. <div class="dataTables_paginate paging_simple_numbers" >
  224. <div class="row" style="padding-top:10px;margin:0 auto;">
  225. <div class="col-xs-5" style="font-size: 16px;text-align: center;width: 100%;padding: 20px 0;">
  226. <div class="dataTables_paginate paging_simple_numbers ajaxSearchSchoolPage" style="vertical-align:sub;">
  227. <ul id="yw1" class="yiiPager">
  228. </ul>
  229. </div>
  230. </div>
  231. </div>
  232. </div>
  233. </div>
  234. <div class="btns">
  235. <input type="hidden" name="page" value="1">
  236. <div class="hbtn btn-colse">关闭</div>
  237. </div>
  238. </div>
  239. </div>
  240. </div>
  241. <script type="text/javascript">
  242. $(document).ready(function () {
  243. var provinceId=parseInt('<?php if(isset($condition['province_id'])){ echo $condition['province_id'];}else{ echo 0;} ?>');
  244. var cityId=parseInt('<?php if(isset($condition['city_id'])){ echo $condition['city_id'];}else{echo 0;} ?>');
  245. var areaId=parseInt('<?php if(isset($condition['area_id'])){echo $condition['area_id'];}else{echo 0;} ?>');
  246. var areaLoaded=false;
  247. if(provinceId){
  248. getRegion(provinceId,$('#cityId'))
  249. }
  250. //关闭弹窗
  251. $(".btn-colse").on("click", function () {
  252. // layer.close(layer.index);
  253. layer.closeAll();
  254. $('.hgc_dialog').hide();
  255. });
  256. $('.changeSchoolOnOff').click(function(){
  257. $('.switch').show();
  258. });
  259. $('.addSchool').click(function(){
  260. $('.add_school').show();
  261. });
  262. $('.up-form-switch').click(function(){
  263. var value= $('input[name=isLimit]:checked').val();
  264. $.ajax({
  265. url:'<?php echo $this->createUrl('assistSchool/switch')?>',
  266. type:'POST',
  267. dataType:'json',
  268. data:{value:value},
  269. success:function(res){
  270. if(res.status==1){
  271. layer.msg('操作成功');
  272. if(value==1){
  273. $('.schoolStatus').html('开启中');
  274. }else{
  275. $('.schoolStatus').html('关闭中');
  276. }
  277. $('.hgc_dialog').hide();
  278. }else{
  279. layer.msg('操作失败');
  280. }
  281. }
  282. });
  283. });
  284. $(".prompt").mouseover(function(event){
  285. var tooltipHtml = "<div id='tooltip' class='tooltip'>Hello!</div>";
  286. $(this).append(tooltipHtml);
  287. $("#tooltip").css({
  288. "top": "0px",
  289. "left": (event.pageX) + "px" //紧跟在内容的后面
  290. }).show("fast"); //设置提示框的坐标,并显示
  291. }).mouseout(function(){
  292. $("#tooltip").remove();
  293. })
  294. $('.submit').click(function(){
  295. $('.task_search').submit();
  296. });
  297. $('#provinceId').change(function(){
  298. console.log($(this).val())
  299. var provinceId=$(this).val();
  300. $('#cityId').html('<option value="0">全部</option>');
  301. $('#areaId').html('<option value="0">全部</option>');
  302. if(provinceId>0){
  303. getRegion(provinceId,$('#cityId'))
  304. }
  305. });
  306. $('#cityId').change(function(){
  307. $('#areaId').html('<option value="0">全部</option>');
  308. var cityId=$(this).val();
  309. if(cityId>0){
  310. getRegion(cityId,$('#areaId'))
  311. }
  312. });
  313. $('#searchProvinceId').change(function(){
  314. console.log($(this).val())
  315. var provinceId=$(this).val();
  316. $('#searchCityId').html('<option value="0">全部</option>');
  317. $('#searchAreaId').html('<option value="0">全部</option>');
  318. if(provinceId>0){
  319. getRegion(provinceId,$('#searchCityId'))
  320. }
  321. });
  322. $('#searchCityId').change(function(){
  323. $('#searchAreaId').html('<option value="0">全部</option>');
  324. var provinceId=$(this).val();
  325. if(provinceId>0){
  326. getRegion(provinceId,$('#searchAreaId'))
  327. }
  328. });
  329. function getRegion(parentId,obj){
  330. if(parentId>0){
  331. $.ajax({
  332. url:'<?php echo $this->createUrl('assistSchool/getRegion')?>',
  333. type:'POST',
  334. dataType:'json',
  335. data:{parent_id:parentId},
  336. success:function(res){
  337. if(res.status==1){
  338. obj.html(res.data);
  339. if(cityId>0 && areaLoaded==false){
  340. $("#cityId option").each(function(){ //遍历所有option
  341. if(cityId==$(this).val()){
  342. $(this).attr('selected',true);
  343. }
  344. })
  345. getRegion(cityId,$('#areaId'))
  346. areaLoaded=true;
  347. }
  348. if(areaId>0){
  349. $("#areaId option").each(function(){ //遍历所有option
  350. if(areaId==$(this).val()){
  351. $(this).attr('selected',true);
  352. }
  353. })
  354. }
  355. }
  356. }
  357. });
  358. }
  359. }
  360. $('.search_school').click(function(){
  361. var province_id=$('#searchProvinceId').val(),
  362. city_id=$('#searchCityId').val(),
  363. area_id=$('#searchAreaId').val(),
  364. school_name=$('input[name=search_school_name]').val(),
  365. page=1;
  366. if(school_name!=''){
  367. province_id=0;
  368. city_id=0;
  369. area_id=0;
  370. $('#searchProvinceId').val(0);
  371. $('#searchCityId').val(0);
  372. $('#searchAreaId').val(0);
  373. }
  374. searchSchool(province_id,city_id,area_id,school_name,page);
  375. });
  376. $('.removeSchool').click(function(){
  377. var school_id=$(this).attr('rel');
  378. $('input[name=school_id]').val(school_id);
  379. $('.remove_school').show();
  380. });
  381. $('.submit_remove_school').click(function(){
  382. var school_id=$('input[name=school_id]').val();
  383. $.ajax({
  384. url:'<?php echo $this->createUrl('assistSchool/Remove')?>',
  385. type:'POST',
  386. dataType:'json',
  387. data:{school_id:school_id},
  388. success:function(res){
  389. if(res.status==1){
  390. layer.msg('操作成功');
  391. $('#'+school_id).remove();
  392. $('.remove_school').hide();
  393. //window.location.reload();
  394. }else{
  395. layer.msg('操作失败');
  396. }
  397. }
  398. });
  399. });
  400. $('.main-content')
  401. .on('click','.page',function(){
  402. var province_id=$('#searchProvinceId').val(),
  403. city_id=$('#searchCityId').val(),
  404. area_id=$('#searchAreaId').val(),
  405. school_name=$('input[name=search_school_name]').val(),
  406. page=$(this).find('a').attr('rel');
  407. searchSchool(province_id,city_id,area_id,school_name,page);
  408. }).on('click','.addSchoolList',function(){
  409. var school_id=$(this).attr('rel'),
  410. school_name=$(this).attr('name');
  411. var obj=$(this).closest('tr');
  412. $.ajax({
  413. url:'<?php echo $this->createUrl('assistSchool/addWhiteList')?>',
  414. type:'POST',
  415. dataType:'json',
  416. data:{school_id:school_id,school_name:school_name},
  417. success:function(res){
  418. if(res.status==1){
  419. layer.msg('添加成功');
  420. //obj.remove();
  421. obj.find('.control-school').html('添加');
  422. //window.location.reload();
  423. }else{
  424. layer.msg('添加失败');
  425. }
  426. }
  427. });
  428. })
  429. function searchSchool(province_id,city_id,area_id,school_name,page){
  430. $.ajax({
  431. url:'<?php echo $this->createUrl('assistSchool/searchSchool')?>',
  432. type:'POST',
  433. dataType:'json',
  434. data:{province_id:province_id,city_id:city_id,area_id:area_id,school_name:school_name,page:page},
  435. success:function(res){
  436. if(res.status==1){
  437. $('#schoolList').html(res.data['list']);
  438. $('.ajaxSearchSchoolPage').html(res.data['pages']);
  439. }
  440. }
  441. });
  442. }
  443. });
  444. </script>