diff --git a/application/common/view/create.html b/application/common/view/create.html index 34f543a5..d1a84037 100644 --- a/application/common/view/create.html +++ b/application/common/view/create.html @@ -23,7 +23,6 @@
{block name="form"}{/block}
- {block name="myjs"}{/block} + {block name="myjs"}{/block} \ No newline at end of file diff --git a/application/renshi/controller/Index.php b/application/renshi/controller/Index.php index 68f0778c..7a8c3a95 100644 --- a/application/renshi/controller/Index.php +++ b/application/renshi/controller/Index.php @@ -394,14 +394,14 @@ class Index extends Base // 下载表格模板 public function download() { - $download = new \think\response\Download('TeacherInfo.xlsx'); + $download = new \think\response\Download('uploads\teacher\TeacherInfo.xlsx'); return $download->name('TeacherInfo.xlsx'); } // 下载表格VBA代码 public function downloadVba() { - $download = new \think\response\Download('jiaoShiXingMingVBA.bas'); + $download = new \think\response\Download('uploads\teacher\jiaoShiXingMingVBA.bas'); return $download->name('TeacherVBA'); } diff --git a/application/renshi/controller/Student.php b/application/renshi/controller/Student.php index 94d554bc..77e62009 100644 --- a/application/renshi/controller/Student.php +++ b/application/renshi/controller/Student.php @@ -78,7 +78,7 @@ class Student extends Base $list['set'] = array( 'webtitle'=>'添加学生', 'butname'=>'添加', - 'formpost'=>'POOST', + 'formpost'=>'POST', 'url'=>'/student', ); @@ -137,6 +137,10 @@ class Student extends Base // 获取学生信息 $list['data'] = STU::field('id,xingming,sex,shenfenzhenghao,shengri,banji,school,status') + ->with(['stuBanji'=>function($query){ + $query->field('id,ruxuenian,paixu'); + } + ]) ->find($id); // 设置页面标题 @@ -144,7 +148,7 @@ class Student extends Base 'webtitle'=>'编辑学生', 'butname'=>'修改', 'formpost'=>'PUT', - 'url'=>'/sutdent/'.$id, + 'url'=>'/student/'.$id, ); // 模板赋值 @@ -231,6 +235,17 @@ class Student extends Base // 批量添加 public function createAll() { + // 设置页面标题 + $list['set'] = array( + 'webtitle'=>'批量上传学生信息', + 'butname'=>'批传', + 'formpost'=>'POST', + 'url'=>'/student/createall', + ); + + // 模板赋值 + $this->assign('list',$list); + // 渲染 return $this->fetch(); } @@ -362,7 +377,7 @@ class Student extends Base // 下载表格模板 public function download() { - $download = new \think\response\Download('student_template.xlsx'); + $download = new \think\response\Download('uploads\student\student_template.xlsx'); return $download->name('student_template.xlsx'); } diff --git a/application/renshi/model/Student.php b/application/renshi/model/Student.php index 449bb22d..740df35e 100644 --- a/application/renshi/model/Student.php +++ b/application/renshi/model/Student.php @@ -9,11 +9,6 @@ use app\teach\model\Banji; class Student extends Base { - // 班级关联 - public function stuNanji() - { - return $this->belongsTo('\app\teach\model\Banji','banji','id')->bind(['myruxuenian'=>'ruxuenian']); - } // 班级关联 public function stuBanji() { @@ -56,12 +51,6 @@ class Student extends Base // 数据筛选 public function search($src) { - // 设置变量 - $schoolid = $search['school']; - $banji = $search['banji']; - $order = $search['order']; - $order_field = $search['order_field']; - $search = $search['search']; // 获取参数 $school = $src['school']; $banji = $src['banji']; @@ -70,16 +59,24 @@ class Student extends Base $data = $this->order([$src['field'] =>$src['order']]) - ->when(strlen($school)>0,function($query) use($schoolid){ - $query->where('school','in',$schoolid); + ->when(count($school)>0,function($query) use($school){ + $query->where('school','in',$school); }) ->when(count($banji)>0,function($query) use($banji){ $query->where('banji','in',$banji); }) - ->when(strlen($search)>0,function($query) use($search){ - $query->where('xingming','like','%'.$search.'%')->field('id'); + ->when(strlen($searchval)>0,function($query) use($searchval){ + $query->where('xingming','like','%'.$searchval.'%')->field('id'); }) - ->order([$order_field=>$order]) + ->with([ + 'stuSchool'=>function($query){ + $query->field('id,title'); + }, + 'stuBanji'=>function($query){ + $query->append(['title']); + } + ]) + ->append(['age']) ->select(); return $data; diff --git a/application/renshi/view/index/index.html b/application/renshi/view/index/index.html index f5623dba..d805687c 100644 --- a/application/renshi/view/index/index.html +++ b/application/renshi/view/index/index.html @@ -79,6 +79,7 @@ + diff --git a/application/renshi/view/student/create.html b/application/renshi/view/student/create.html index 045826d4..92c1d0c4 100644 --- a/application/renshi/view/student/create.html +++ b/application/renshi/view/student/create.html @@ -1,185 +1,208 @@ {extend name="common@create" /} -{block name="formaa"} - - - -
-
- -
- -
-
-
- -
- -
-
-
- -
-
- - -
-
- - -
-
- - -
-
-
-
- -
- -
-
-
- -
- - {php} $school = schlist('校级','校级');{/php} - - -
-
-
- -
- - {php} - $njlist = nianjiList(); - {/php} - - -
-
-
- -
- - - -
-
-
-
- -
-
-
+ +{block name="form"} +
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ + +
+
+
+ +
+ +
+
+
+ +
+ {php} $schoollist = schlist('校级','校级');{/php} + +
+
+
+ +
+ {php} $njlist = nianjiList();{/php} + +
+
+
+ +
+ {php} + if(isset($list['data'])){ + // 获取参数 + $rxn = $list['data']['stu_banji']['ruxuenian']; + $sch = $list['data']['school']; + // 获取班级列表 + $banji = new \app\teach\model\Banji; + $banjilist = $banji + ->where('ruxuenian',$rxn) + ->where('school',$sch) + ->field('id,paixu,ruxuenian') + ->append(['title']) + ->select(); + }else{ + $banjilist=array(); + } + {/php} + +
+
+
+ +
+
{/block} -{block name="yanzheng"} - -{/block} \ No newline at end of file +{/block} + diff --git a/application/renshi/view/student/create_all.html b/application/renshi/view/student/create_all.html index 056f5976..da1b9f6c 100644 --- a/application/renshi/view/student/create_all.html +++ b/application/renshi/view/student/create_all.html @@ -1,194 +1,78 @@ {extend name="common@create" /} -{block name="mycss"} -{css href="/static/H-ui.admin_v3.1.3.1/H-ui.admin/lib/webuploader/0.1.5/webuploader.css" /} + +{block name="form"} +
+ +
+
+
+ +
+ +
+
+
+ +
+ {php} $schoollist = schlist('校级','区级');{/php} + +
+
+
+ +
+
{/block} -{block name="formaa"} -
-
- -
- 批传是以本地数据为准同步服务器数据:如果服务器不存在本地数据会创建新数据,如果服务器存在本地数据,则会更新服务器数据,不支持删除。 -
-
-
- - -
-
- -
-
-
-
选择文件
- -
-
-
-
-
-
- -
- -
-
-
- -
- - {php} $school = schlist('校级','校级');{/php} - - -
-
-
-
- -
-
-
-{/block} -{block name="yanzheng"} -{js href="/static/H-ui.admin_v3.1.3.1/H-ui.admin/lib/webuploader/0.1.5/webuploader.js"} - -{/block} \ No newline at end of file +{/block} + diff --git a/application/renshi/view/student/edit.html b/application/renshi/view/student/edit.html deleted file mode 100644 index 2376c20e..00000000 --- a/application/renshi/view/student/edit.html +++ /dev/null @@ -1,160 +0,0 @@ -{extend name="common@create" /} -{block name="formaa"} -
-
- -
- -
-
-
- -
- -
-
-
- -
-
- - -
-
- - -
-
- - -
-
-
-
- -
- -
-
-
- -
- - {php}$school = schlist('校级','校级');{/php} - - -
-
-
- -
- - {php} - $njlist = nianjiList(); - $banji = new \app\teach\model\Banji; - $bj = $banji::get($list['banji']); - {/php} - - -
-
- {php} - $bjlist = $banji::where('ruxuenian',$bj->ruxuenian)->select(); - $bjlist = $bjlist->append(['title'])->visible(['id','title']); - {/php} -
- -
- - - -
-
-
-
- -
-
-
-{/block} -{block name="yanzheng"} - -{/block} \ No newline at end of file diff --git a/application/renshi/view/student/index.html b/application/renshi/view/student/index.html index 7e598376..85f8a6bf 100644 --- a/application/renshi/view/student/index.html +++ b/application/renshi/view/student/index.html @@ -54,9 +54,6 @@ {/block} {block name="table"}
- {/block} {block name="myjs"} @@ -112,24 +109,19 @@ layui.use(['table','laypage','form','cjgl'], function(){ {field: "shengri",title: '周岁',sort: true,templet:function(d){ return d.age; }}, - {field: 'xueli', title: '学历',sort: true,templet:function(d){ + {field: 'school', title: '学校',minWidth:200,sort: true,templet:function(d){ var str=''; - if(d.js_xueli) + if(d.stu_school) { - str = d.js_xueli.title; + str = d.stu_school.title; } return str; }} , - {field: 'biye', title: '毕业院校',sort: true}, - {field: 'worktime', title: '工龄', sort: true,templet:function(d){ - return d.gongling; - }}, - {field: 'zhuanye', title: '专业', sort: true}, - {field: 'danwei', title: '单位', sort: true,templet:function(d){ + {field: 'banji', title: '班级',sort: true,templet:function(d){ var str=''; - if(d.js_danwei) + if(d.stu_banji) { - str = d.js_danwei.jiancheng; + str = d.stu_banji.title; } return str; }}, @@ -179,10 +171,7 @@ layui.use(['table','laypage','form','cjgl'], function(){ cjgl.add('导入学生','/student/createall','','',true); break; case 'download': - window.open("/renshi/index/download"); - break; - case 'downloadvba': - window.open("/renshi/index/downloadVba"); + window.open("/renshi/student/download"); break; }; }); diff --git a/application/teach/controller/Banji.php b/application/teach/controller/Banji.php index bdfb3f71..b759439a 100644 --- a/application/teach/controller/Banji.php +++ b/application/teach/controller/Banji.php @@ -292,14 +292,13 @@ class Banji extends Base public function mybanji() { $school = input('post.school'); - $nianji = input('post.nianji'); + $ruxuenian = input('post.ruxuenian'); // 获取班级id列表 $list = BJ::where('school',$school) - ->where('ruxuenian',$nianji) + ->where('ruxuenian',$ruxuenian) ->order('paixu') + ->append(['title']) ->select(); - // 追加班级名 - $list = $list->append(['title']); // 声明班级空数组 $banji = array(); diff --git a/application/teach/model/Banji.php b/application/teach/model/Banji.php index 7b84c26c..d9f5ff28 100644 --- a/application/teach/model/Banji.php +++ b/application/teach/model/Banji.php @@ -36,9 +36,6 @@ class Banji extends Base 'glStudent'=>function($query){ $query->count(); }, - // 'dwXueduan'=>function($query){ - // $query->field('id,title'); - // }, ] ) ->append(['title'])