songxingwei 4 years ago
parent
commit
32193eb3c0

+ 67 - 3
app/admin/controller/School.php

@@ -15,6 +15,7 @@
 
 namespace app\admin\controller;
 
+use ClassesWithParents\D;
 use think\admin\Controller;
 
 use think\facade\Db;
@@ -31,7 +32,7 @@ class School extends Controller
      * 绑定数据表
      * @var string
      */
-    private $table = 'School2';
+    private $table = 'school2';
 
     /**
      * 学校管理
@@ -157,12 +158,75 @@ class School extends Controller
      */
     public function student()
     {
-        $this->title = '学生管理';
-        $query = $this->_query('students')->where('school_id',$this->request->get('id'));
+        $school_id = $this->request->get('id');
+        $this->title = Db::table($this->table)->where('id',$school_id)->value('name').'--学生管理';
+        $query = $this->_query('students')->where('school_id',$school_id);
         $query->like('name,sex,id_card,student_number,grade,class');
         // 列表排序并显示
         $query->page();
     }
 
+    /**
+     * 学生管理数据列表处理
+     * @param array $data
+     * @throws \think\db\exception\DataNotFoundException
+     * @throws \think\db\exception\ModelNotFoundException
+     * @throws \think\exception\DbException
+     */
+    protected function _student_page_filter(&$data)
+    {
+        $school_id = $this->request->get('id');
+        $grade1 = array(''=>'全部');
+        $grade2 = [];
+        $grade = Db::name('students')
+            ->where('school_id',$school_id)
+            ->group('grade')
+            ->column('grade');
+        foreach ($grade as &$v){
+            $grade2[$v] = $v;
+        }
+        $grade = array_merge($grade1,$grade2);
+        $this->grade = $grade;
+
+
+        $get_grade = '';
+        if (isset($_GET['grade']) && $_GET['grade']){
+            $get_grade = mb_substr($_GET['grade'],2);
+        }
+        $class1 = array(''=>'全部');
+        $class2 = [];
+        $class = Db::name('students')
+            ->where('school_id',$school_id)
+            ->when($get_grade,function ($query) use ($get_grade){
+                if ($get_grade){
+                    $query->whereLike('class',$get_grade.'%');
+                }
+            })
+            ->group('class')
+            ->column('class');
+        foreach ($class as &$v){
+            $class2[$v] = $v;
+        }
+        $class = array_merge($class1,$class2);
+        $this->class = $class;
+    }
+
+
+
+    /**
+     * 教师管理
+     * @throws \think\db\exception\DataNotFoundException
+     * @throws \think\db\exception\DbException
+     * @throws \think\db\exception\ModelNotFoundException
+     */
+    public function teacher()
+    {
+        $school_id = $this->request->get('id');
+        $this->title = Db::table($this->table)->where('id',$school_id)->value('name').'--教师管理';
+        $query = $this->_query('teacher');
+        $query->like('name');
+        // 列表排序并显示
+        $query->where('school_id',$school_id)->page();
+    }
 
 }

+ 2 - 2
app/admin/view/school/index.html

@@ -47,9 +47,9 @@
                     {if auth("admin/school/info")}
                     <a data-dbclick class="layui-btn layui-btn-sm" data-open='{:url("info")}?id={$vo.id}'>详 情</a>
                     {/if}
-                    <a data-title="学生列表" class="layui-btn layui-btn-sm layui-btn-normal" data-open='{:url("student")}?school_id={$vo.id}'>学生列表</a>
+                    <a data-title="学生列表" class="layui-btn layui-btn-sm layui-btn-normal" data-open='{:url("student")}?id={$vo.id}'>学生列表</a>
 
-                    <a data-title="教师列表" class="layui-btn layui-btn-sm layui-btn-normal" data-open='{:url("teacher")}?school_id={$vo.id}'>教师列表</a>
+                    <a data-title="教师列表" class="layui-btn layui-btn-sm layui-btn-normal" data-open='{:url("teacher")}?id={$vo.id}'>教师列表</a>
 
                     {if $vo.status eq 1 and auth("forbid")}
                     <a class="layui-btn layui-btn-sm layui-btn-warm" data-action="{:url('forbid')}" data-value="id#{$vo.id};status#0">禁 用</a>

+ 75 - 0
app/admin/view/school/index_search2.html

@@ -0,0 +1,75 @@
+<fieldset>
+    <legend>条件搜索</legend>
+    <form class="layui-form layui-form-pane form-search" action="{:request()->url()}" onsubmit="return false" method="get" autocomplete="off">
+        <div class="layui-form-item layui-inline">
+            <label class="layui-form-label">学生姓名</label>
+            <label class="layui-input-inline">
+                <input name="name" value="{:input('get.name')}" placeholder="请输入学生姓名" class="layui-input">
+            </label>
+        </div>
+        <div class="layui-form-item layui-inline">
+            <label class="layui-form-label">性别</label>
+            <div class="layui-input-inline">
+                <select class="layui-select" name="sex">
+                    {foreach [''=>'- 全部 -','男'=>'男','女'=>'女'] as $k=>$v}
+                    {if input('get.sex') eq $k}
+                    <option selected value="{$k}">{$v}</option>
+                    {else}
+                    <option value="{$k}">{$v}</option>
+                    {/if}
+                    {/foreach}
+                </select>
+            </div>
+        </div>
+        <div class="layui-form-item layui-inline">
+            <label class="layui-form-label">身份证号</label>
+            <label class="layui-input-inline">
+                <input name="id_card" value="{:input('get.id_card')}" placeholder="请输入身份证号" class="layui-input">
+            </label>
+        </div>
+        <div class="layui-form-item layui-inline">
+            <label class="layui-form-label">全国学籍号</label>
+            <label class="layui-input-inline">
+                <input name="student_number" value="{:input('get.student_number')}" placeholder="请输入全国学籍号" class="layui-input">
+            </label>
+        </div>
+        <div class="layui-form-item layui-inline">
+            <label class="layui-form-label">年级</label>
+            <div class="layui-input-inline">
+                <select class="layui-select" name="grade">
+                    {foreach $grade as $k=>$v}
+                    {if input('get.grade') eq $k}
+                    <option selected value="{$k}">{$v}</option>
+                    {else}
+                    <option value="{$k}">{$v}</option>
+                    {/if}
+                    {/foreach}
+                </select>
+            </div>
+        </div>
+
+        <div class="layui-form-item layui-inline">
+            <label class="layui-form-label">班级</label>
+            <div class="layui-input-inline">
+                <select class="layui-select" name="class">
+                    {foreach $class as $k=>$v}
+                    {if input('get.class') eq $k}
+                    <option selected value="{$k}">{$v}</option>
+                    {else}
+                    <option value="{$k}">{$v}</option>
+                    {/if}
+                    {/foreach}
+                </select>
+            </div>
+        </div>
+
+
+
+
+        <div class="layui-form-item layui-inline">
+            <button class="layui-btn layui-btn-primary"><i class="layui-icon">&#xe615;</i> 搜 索</button>
+        </div>
+    </form>
+</fieldset>
+
+<script>form.render()</script>

+ 20 - 0
app/admin/view/school/index_search3.html

@@ -0,0 +1,20 @@
+<fieldset>
+    <legend>条件搜索</legend>
+    <form class="layui-form layui-form-pane form-search" action="{:request()->url()}" onsubmit="return false" method="get" autocomplete="off">
+        <div class="layui-form-item layui-inline">
+            <label class="layui-form-label">教师姓名</label>
+            <label class="layui-input-inline">
+                <input name="name" value="{:input('get.name')}" placeholder="请输入教师姓名" class="layui-input">
+            </label>
+        </div>
+
+
+
+
+        <div class="layui-form-item layui-inline">
+            <button class="layui-btn layui-btn-primary"><i class="layui-icon">&#xe615;</i> 搜 索</button>
+        </div>
+    </form>
+</fieldset>
+
+<script>form.render()</script>

+ 97 - 0
app/admin/view/school/student.html

@@ -0,0 +1,97 @@
+{extend name="../../admin/view/main"}
+
+{block name="button"}
+
+
+
+{/block}
+
+{block name='content'}
+<div class="think-box-shadow">
+    {include file='school/index_search2'}
+    <table class="layui-table margin-top-10" lay-skin="line">
+        {notempty name='list'}
+        <thead>
+        <tr>
+            <th class="text-left nowrap">姓名</th>
+            <th class="text-left nowrap">性别</th>
+            <th class="text-left nowrap">民族</th>
+            <th class="text-left nowrap">身份证号</th>
+            <th class="text-left nowrap">全国学籍号</th>
+            <th class="text-left nowrap">省学籍辅号</th>
+            <th class="text-left nowrap">所在年级</th>
+            <th class="text-left nowrap">所在班级</th>
+            <th class='text-left nowrap'></th>
+        </tr>
+        </thead>
+        {/notempty}
+        <tbody>
+        {foreach $list as $key=>$vo}
+        <tr>
+            <td class="text-left nowrap relative">
+                {$vo.name|default='--'}
+            </td>
+            <td class='text-left nowrap'>
+                {$vo.sex|default='--'}
+            </td>
+            <td class='text-left nowrap'>
+                {$vo.national|default='--'}
+            </td>
+            <td class='text-left nowrap'>
+                {$vo.id_card|default='--'}
+            </td>
+            <td class='text-left nowrap'>
+                {$vo.student_number|default='--'}
+            </td>
+            <td class='text-left nowrap'>
+                {$vo.province_student_number|default='--'}
+            </td>
+            <td class='text-left nowrap'>
+                {$vo.grade|default='--'}
+            </td>
+            <td class='text-left nowrap'>
+                {$vo.class|default='--'}
+            </td>
+            <td class='text-left'>
+                {if auth("store/member/userinfo")}
+                <a data-title="学生详情" class="layui-btn layui-btn-sm  margin-top-5" data-modal='{:url("userinfo")}?id={$vo.id}'>详情</a>
+                {/if}
+            </td>
+        </tr>
+        {/foreach}
+        </tbody>
+    </table>
+    {empty name='list'}<span class="notdata">没有记录哦</span>{else}{$pagehtml|raw|default=''}{/empty}
+</div>
+<script>
+    layui.use('upload', function(){
+        var upload = layui.upload;
+
+        //执行实例
+        var uploadInst = upload.render({
+            elem: '#dr' //绑定元素
+            ,url: '/school/Students/import'
+            ,accept: 'file' //普通文件,
+            ,before: function(obj){ //obj参数包含的信息,跟 choose回调完全一致,可参见上文。
+               //  layer.load(); //上传loading
+                layer.load(2, {
+                    shade: [0.5,'#000'] //0.1透明度的背景
+                });
+            }
+            ,done: function(res){
+                layer.closeAll('loading'); //关闭loading
+                //layer.msg('上传成功');
+                //配置一个透明的询问框
+                layer.msg('入库成功:'+res.data.add_count+'人<br />无身份证:'+res.data.no_id_card_count+'人<br />其他身份类型:'+res.data.id_card_error_count+'人', {
+                    time: 20000, //20s后自动关闭
+                    btn: ['知道了']
+                });
+               // console.log(res)
+            }
+            ,error: function(){
+                layer.msg('上传失败');
+            }
+        });
+    });
+</script>
+{/block}

+ 95 - 0
app/admin/view/school/teacher.html

@@ -0,0 +1,95 @@
+{extend name="../../admin/view/main"}
+
+{block name="button"}
+
+
+{/block}
+
+{block name='content'}
+<div class="think-box-shadow">
+    {include file='school/index_search3'}
+    <table class="layui-table margin-top-10" lay-skin="line">
+        {notempty name='list'}
+        <thead>
+        <tr>
+            <th class="text-left nowrap">姓名</th>
+            <th class="text-left nowrap">性别</th>
+            <th class="text-left nowrap">民族</th>
+            <th class="text-left nowrap">身份证号</th>
+            <th class="text-left nowrap">年龄</th>
+            <th class="text-left nowrap">政治面貌</th>
+            <th class="text-left nowrap">学历</th>
+            <th class="text-left nowrap">职称</th>
+            <th class="text-left nowrap">是否专任教师</th>
+            <th class="text-left nowrap">所任课程</th>
+
+        </tr>
+        </thead>
+        {/notempty}
+        <tbody>
+        {foreach $list as $key=>$vo}
+        <tr>
+            <td class="text-left nowrap relative">
+                {$vo.name|default='--'}
+            </td>
+            <td class='text-left nowrap'>
+                {$vo.sex|default='--'}
+            </td>
+            <td class='text-left nowrap'>
+                {$vo.national|default='--'}
+            </td>
+            <td class='text-left nowrap'>
+                {$vo.id_card|default='--'}
+            </td>
+            <td class='text-left nowrap'>
+                {$vo.age|default='--'}
+            </td>
+            <td class='text-left nowrap'>
+                {$vo.political|default='--'}
+            </td>
+            <td class='text-left nowrap'>
+                {$vo.education|default='--'}
+            </td>
+            <td class='text-left nowrap'>
+                {$vo.zhicheng|default='--'}
+            </td>
+            <td class='text-left nowrap'>
+                {$vo.teachers|default='--'}
+            </td>
+            <td class='text-left nowrap'>
+                {$vo.course|default='--'}
+            </td>
+
+        </tr>
+        {/foreach}
+        </tbody>
+    </table>
+    {empty name='list'}<span class="notdata">没有记录哦</span>{else}{$pagehtml|raw|default=''}{/empty}
+</div>
+<script>
+    layui.use('upload', function(){
+        var upload = layui.upload;
+
+        //执行实例
+        var uploadInst = upload.render({
+            elem: '#dr' //绑定元素
+            ,url: '/school/Teacher/import'
+            ,accept: 'file' //普通文件,
+            ,data:{
+                table:'jijiao_high_school',
+                num:8
+            }
+            ,before: function(obj){ //obj参数包含的信息,跟 choose回调完全一致,可参见上文。
+                layer.load(); //上传loading
+            }
+            ,done: function(res){
+                layer.closeAll('loading'); //关闭loading
+                layer.msg('上传成功');
+            }
+            ,error: function(){
+                layer.msg('上传失败');
+            }
+        });
+    });
+</script>
+{/block}