diff --git a/README.md b/README.md index 80af138d..4505cbdb 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,6 @@ ## 主要功能: -<<<<<<< HEAD *设置系统信息、单位信息管理、类别管理 *学期、班级、学科 管理 *管理员与权限管理 @@ -19,23 +18,4 @@ ## 更详细信息请查阅官方手册 -======= - -- 设置系统信息、单位信息管理、类别管理 -- 学期、班级、学科 管理 -- 管理员与权限管理 -- 教师与学生信息管理 -- 考试信息设置 -- 生成学生的考试号 -- 生成学生试卷标签 -- 生成学生成绩采集表 -- 使用电子表格录入成绩 -- 使用二维码录入成绩 -- 编辑、删除成绩 -- 查看成绩列表 -- 查看成绩统计结果 - - -## 更详细信息请查阅手册 ->>>>>>> master https://www.kancloud.cn/llblax/abcd/content/chengji/xuyan.md \ No newline at end of file diff --git a/application/chengji/controller/Index.php b/application/chengji/controller/Index.php index a9d19183..b3cb1c74 100644 --- a/application/chengji/controller/Index.php +++ b/application/chengji/controller/Index.php @@ -57,14 +57,12 @@ class Index extends Base public function update($id) { - // 获取表单数据 $list = request()->param(); // 更新成绩 $data = Chengji::update($list); - // 判断返回内容 $data ? $data=['msg'=>'录入成功','val'=>1] : $data=['msg'=>'数据处理错误','val'=>0]; diff --git a/application/chengji/controller/Tongji.php b/application/chengji/controller/Tongji.php index c1a1bdb7..1eb4fe71 100644 --- a/application/chengji/controller/Tongji.php +++ b/application/chengji/controller/Tongji.php @@ -58,7 +58,7 @@ class Tongji extends Base } - // 班级学生成绩统计下载表格,带年级汇总 + // 年级、班级学生成绩统计下载表格 public function dwBanjixls($id) { // 获取表单参数 @@ -160,7 +160,7 @@ class Tongji extends Base } - // 获取年级成绩统计结果,带区级成绩汇总结果 + // 获取年级成绩统计结果 public function ajaxNianji() { // 获取表单参数 diff --git a/application/chengji/model/Tongji.php b/application/chengji/model/Tongji.php index 4aa36867..01b744be 100644 --- a/application/chengji/model/Tongji.php +++ b/application/chengji/model/Tongji.php @@ -68,7 +68,7 @@ class Tongji extends Model ->when(!empty($school),function($query) use($school){ $query->where('school','in',$school); }) - ->append(['numTitle','schooljian']) + ->append(['title']) ->select(); @@ -81,7 +81,7 @@ class Tongji extends Model $i = 0; foreach ($bjids as $key => $value) { $data[$i]['id'] = $i+1; - $data[$i]['title'] = $value['schooljian'].$value['numTitle']; + $data[$i]['title'] = $value['title']; $bjlist = $cjlist->where('banji',$value['id']); $data[$i]['data'] = $this->tongji($bjlist,$canshu); diff --git a/application/chengji/view/index/edit.html b/application/chengji/view/index/edit.html index e26719f4..50015273 100644 --- a/application/chengji/view/index/edit.html +++ b/application/chengji/view/index/edit.html @@ -30,7 +30,7 @@
- +
{/foreach} diff --git a/application/chengji/view/tongji/tj_banji.html b/application/chengji/view/tongji/tj_banji.html index 7cb9fd09..b438a99b 100644 --- a/application/chengji/view/tongji/tj_banji.html +++ b/application/chengji/view/tongji/tj_banji.html @@ -87,7 +87,7 @@ // 定义DTajax参数 var myajax = { - url: "{:url('ajaxBianji')}", + url: "{:url('ajaxNianji')}", type: "post", data: { kaoshiid:"{$list.kaoshi}", @@ -103,11 +103,11 @@ }, ruxuenian:function(){ var a = $('input:radio:checked').val(); - if(typeof(a) == "undefined") - { - var date=new Date; - a = date.getFullYear()-1; - } + // if(typeof(a) == "undefined") + // { + // var date=new Date; + // a = date.getFullYear()-1; + // } return a; }, }, diff --git a/application/rongyu/controller/JsRongyu.php b/application/rongyu/controller/JsRongyu.php index 1bfdde19..e4cad51d 100644 --- a/application/rongyu/controller/JsRongyu.php +++ b/application/rongyu/controller/JsRongyu.php @@ -156,50 +156,8 @@ class JsRongyu extends Base } - /** - * 上传荣誉图片并保存 - * - * @param \think\Request $request - * @return \think\Response - */ - public function upload() - { - // 获取文件信息 - $rongyuce=input('post.rongyuce'); - // 获取表单上传文件 例如上传了001.jpg - $file = request()->file('file'); - // 移动到框架应用根目录/uploads/ 目录下 - $info = $file->validate(['size'=>2*1024*1024,'ext'=>'jpg,png,gif,jpeg'])->move('uploads\jiaoshirongyu'); - - - - if($info){ - // 成功上传后 获取上传信息 - $list['url'] = $info->getSaveName(); - // $list['category'] = $info->getExtension(); - // $list['newname'] = $info->getFilename(); - // $myfileurl = '\uploads\\'.$list['url']; - // $list['bianjitime'] = filemtime('uploads\danweirongyu\\'.$list['url']); - $list['url'] = str_replace('\\','/',$list['url']); - - - - // 如果图片上传成功,则添加荣誉记录 - $data = jsryinfo::create(['url'=>$list['url'],'rongyuce'=>$rongyuce]); - $id = $data->id; - - $id ? $data = array('msg'=>'上传成功','val'=>true,'url'=>$list['url'],'ryid'=>$id) : $data = array('msg'=>'保存文件信息失败','val'=>false,'url'=>null); - }else{ - // 上传失败获取错误信息 - $data = array('msg'=>$file->getError(),'val'=>false,'url'=>null); - } - - // 返回信息 - return json($data); - } - /** * 显示指定的资源 * diff --git a/application/rongyu/controller/JsRongyuInfo.php b/application/rongyu/controller/JsRongyuInfo.php index e537acd1..8dc14c49 100644 --- a/application/rongyu/controller/JsRongyuInfo.php +++ b/application/rongyu/controller/JsRongyuInfo.php @@ -10,13 +10,80 @@ use app\rongyu\model\JsRongyuInfo as ryinfo; class JsRongyuInfo extends Base { /** - * 显示资源列表 + * 显示教师荣誉册列表 * * @return \think\Response */ public function index() { - // + // 设置数据总数 + $list['count'] = ryinfo::count(); + // 设置页面标题 + $list['title'] = '教师荣誉信息'; + + // 模板赋值 + $this->assign('list', $list); + + // 渲染模板 + return $this->fetch(); + } + + /** + * 显示教师荣誉册列表 + * + * @return \think\Response + */ + public function ajaxData() + { + // 获取DT的传值 + $getdt = request()->param(); + + //得到排序的方式 + $order = $getdt['order'][0]['dir']; + //得到排序字段的下标 + $order_column = $getdt['order'][0]['column']; + //根据排序字段的下标得到排序字段 + $order_field = $getdt['columns'][$order_column]['name']; + if($order_field=='') + { + $order_field = $getdt['columns'][$order_column]['data']; + } + //得到limit参数 + $limit_start = $getdt['start']; + $limit_length = $getdt['length']; + + //得到搜索的关键词 + $search = [ + 'fzschool'=>$getdt['fzschool'], + 'category'=>$getdt['category'], + 'search'=>$getdt['search']['value'], + 'order'=>$order, + 'order_field'=>$order_field + ]; + + // 实例化 + $ryinfo = new ryinfo; + + // 获取荣誉总数 + $cnt = $ryinfo->select()->count(); + + // 查询数据 + $data = $ryinfo->search($search); + $datacnt = $data->count(); + + // 获取当前页数据 + $data = $data->slice($limit_start,$limit_length); + + + // 重组返回内容 + $data = [ + 'draw'=> $getdt["draw"] , // ajax请求次数,作为标识符 + 'recordsTotal'=>$cnt, // 获取到的结果数(每页显示数量) + 'recordsFiltered'=>$datacnt, // 符合条件的总数据量 + 'data'=>$data, //获取到的数据结果 + ]; + + return json($data); } /** @@ -26,7 +93,14 @@ class JsRongyuInfo extends Base */ public function create() { - // + // 设置页面标题 + $list['title'] = '添加教师荣誉册'; + + // 模板赋值 + $this->assign('list',$list); + + // 渲染 + return $this->fetch(); } /** @@ -35,9 +109,93 @@ class JsRongyuInfo extends Base * @param \think\Request $request * @return \think\Response */ - public function save(Request $request) + public function save() { - // + // 获取表单数据 + $list = request()->only(['title','category','fzshijian','fzschool'],'post'); + + // 实例化验证模型 + $validate = new \app\rongyu\validate\JsRongyu; + // 验证表单数据 + $result = $validate->check($list); + $msg = $validate->getError(); + // 如果验证不通过则停止保存 + if(!$result){ + return json(['msg'=>$msg,'val'=>0]);; + } + + // 保存数据 + $data = ryinfo::create($list); + + // 根据更新结果设置返回提示信息 + $data ? $data=['msg'=>'添加成功','val'=>1] : $data=['msg'=>'数据处理错误','val'=>0]; + + // 返回信息 + return json($data); + } + + /** + * 批量上传教师荣誉册图片 + * + * @param \think\Request $request + * @return \think\Response + */ + public function createall($id) + { + // 设置页面标题 + $list['title'] = '添加教师荣誉册'; + $list['id'] = $id; + + // 模板赋值 + $this->assign('list',$list); + + // 渲染 + return $this->fetch(); + + } + + /** + * 上传荣誉图片并保存 + * + * @param \think\Request $request + * @return \think\Response + */ + public function upload() + { + // 获取文件信息 + $rongyuce=input('post.rongyuce'); + + + // 获取表单上传文件 例如上传了001.jpg + $file = request()->file('file'); + // 移动到框架应用根目录/uploads/ 目录下 + $info = $file->validate(['size'=>2*1024*1024,'ext'=>'jpg,png,gif,jpeg'])->move('uploads\jiaoshirongyu'); + + + + if($info){ + // 成功上传后 获取上传信息 + $list['url'] = $info->getSaveName(); + // $list['category'] = $info->getExtension(); + // $list['newname'] = $info->getFilename(); + // $myfileurl = '\uploads\\'.$list['url']; + // $list['bianjitime'] = filemtime('uploads\danweirongyu\\'.$list['url']); + $list['url'] = str_replace('\\','/',$list['url']); + + + + // 如果图片上传成功,则添加荣誉记录 + $data = ryinfo::create(['url'=>$list['url'],'rongyuce'=>$rongyuce]); + $id = $data->id; + + $id ? $data = array('msg'=>'上传成功','val'=>true,'url'=>$list['url'],'ryid'=>$id) : $data = array('msg'=>'保存文件信息失败','val'=>false,'url'=>null); + }else{ + // 上传失败获取错误信息 + $data = array('msg'=>$file->getError(),'val'=>false,'url'=>null); + } + + // 返回信息 + return json($data); } /** @@ -59,7 +217,15 @@ class JsRongyuInfo extends Base */ public function edit($id) { - // + // 获取学生信息 + $list = ryinfo::where('id',$id) + ->field('id,title,category,fzshijian,fzschool') + ->find(); + + + $this->assign('list',$list); + + return $this->fetch(); } /** @@ -69,9 +235,33 @@ class JsRongyuInfo extends Base * @param int $id * @return \think\Response */ - public function update(Request $request, $id) + public function update($id) { - // + // 获取表单数据 + $list = request()->only(['title','category','fzshijian','fzschool'],'put'); + $list['id'] = $id; + + + // 实例化验证类 + $validate = new \app\rongyu\validate\JsRongyu; + // 验证表单数据 + $result = $validate->check($list); + $msg = $validate->getError(); + + // 如果验证不通过则停止保存 + if(!$result){ + return json(['msg'=>$msg,'val'=>0]);; + } + + + // 更新数据 + $data = ryinfo::update($list); + + // 根据更新结果设置返回提示信息 + $data ? $data=['msg'=>'更新成功','val'=>1] : $data=['msg'=>'数据处理错误','val'=>0]; + + // 返回信息 + return json($data); } /** @@ -82,6 +272,38 @@ class JsRongyuInfo extends Base */ public function delete($id) { - // + + if($id == 'm') + { + $id = request()->delete('ids/a');// 获取delete请求方式传送过来的数据并转换成数据 + } + + $data = ryinfo::destroy($id); + + // 根据更新结果设置返回提示信息 + $data ? $data=['msg'=>'删除成功','val'=>1] : $data=['msg'=>'数据处理错误','val'=>0]; + + // 返回信息 + return json($data); + } + + + + // 设置荣誉状态 + public function setStatus() + { + + // 获取id变量 + $id = request()->post('id'); + $value = request()->post('value'); + + // 获取学生信息 + $data = ryinfo::where('id',$id)->update(['status'=>$value]); + + // 根据更新结果设置返回提示信息 + $data ? $data=['msg'=>'状态设置成功','val'=>1] : $data=['msg'=>'数据处理错误','val'=>0]; + + // 返回信息 + return json($data); } } diff --git a/application/rongyu/model/JsRongyuInfo.php b/application/rongyu/model/JsRongyuInfo.php index d6ac3c62..a193c44f 100644 --- a/application/rongyu/model/JsRongyuInfo.php +++ b/application/rongyu/model/JsRongyuInfo.php @@ -7,5 +7,101 @@ use app\common\model\Base; class JsRongyuInfo extends Base { - // + //搜索单位获奖荣誉 + public function search($search) + { + // 获取参数 + // $hjschool = $search['hjschool']; + $fzschool = $search['fzschool']; + $category = $search['category']; + $order_field = $search['order_field']; + $order = $search['order']; + $category = $search['category']; + $search = $search['search']; + + $data = $this->order([$order_field =>$order]) + // ->when(!empty($hjschool),function($query) use($hjschool){ + // $query->where('hjschool','in',$hjschool); + // }) + ->when(!empty($fzschool),function($query) use($fzschool){ + $query->where('fzschool','in',$fzschool); + }) + ->when(!empty($category),function($query) use($category){ + $query->where('category','in',$category); + }) + ->when(!empty($search),function($query) use($search){ + $query->where('title','like',$search); + }) + ->with( + [ + 'hjSchool'=>function($query){ + $query->field('id,jiancheng'); + }, + 'fzSchool'=>function($query){ + $query->field('id,jiancheng'); + }, + 'lxCategory'=>function($query){ + $query->field('id,title'); + }, + 'jxCategory'=>function($query){ + $query->field('id,title'); + } + ] + ) + ->append(['jibie']) + ->select(); + + + return $data; + } + + + // 获奖单位关联 + public function hjSchool() + { + return $this->belongsTo('\app\system\model\School','hjschool','id'); + } + + // 颁奖单位关联 + public function fzSchool() + { + return $this->belongsTo('\app\system\model\School','fzschool','id'); + } + + // 荣誉类型 + public function lxCategory() + { + return $this->belongsTo('\app\system\model\Category','category','id'); + } + + // 奖项 + public function jxCategory() + { + return $this->belongsTo('\app\system\model\Category','category','id'); + } + + // 荣誉级别 + public function getJibieAttr() + { + $jibie = ''; + + if($this->fzschool){ + $jibie = $this->fzSchool->jibie; + } + + return $jibie; + } + + + // 发证时间修改器 + public function setFzshijianAttr($value) + { + return strtotime($value); + } + + // 发证时间获取器 + public function getFzshijianAttr($value) + { + return date('Y-m-d',$value); + } } diff --git a/application/rongyu/view/js_rongyu/createall.html b/application/rongyu/view/js_rongyu/createall.html index 00effef7..443a0dc8 100644 --- a/application/rongyu/view/js_rongyu/createall.html +++ b/application/rongyu/view/js_rongyu/createall.html @@ -24,7 +24,7 @@ - + {/block} {block name="yanzheng"} {js href="/static/H-ui.admin_v3.1.3.1/H-ui.admin/lib/webuploader/0.1.5/webuploader.js"} @@ -190,7 +190,7 @@ function article_save(){ chunked: false, chunkSize: 512 * 1024, compress:false, //是否压缩图片 - server: '{:url("upload")}', + server: '{:url("JsRongyuInfo/upload")}', formData:{ rongyuce:"{$list.id}" }, diff --git a/application/rongyu/view/js_rongyu_info/create.html b/application/rongyu/view/js_rongyu_info/create.html new file mode 100644 index 00000000..99ce7596 --- /dev/null +++ b/application/rongyu/view/js_rongyu_info/create.html @@ -0,0 +1,248 @@ +{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} +{block name="formaa"} +
+
+ +
+
+
+
选择文件
+ +
+
+
+
+
+ +
+ +
+ +
+
+
+ +
+ + {php}$category = getCategory(112);{/php} + + +
+
+
+ +
+ + {php} $school = schlist('校级','区级');{/php} + + +
+
+
+ +
+ +
+
+
+ +
+ + {php} $school = schlist('区级','其它级');{/php} + + +
+
+
+ +
+ + {php}$jiangxiang = getCategory(113);{/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 diff --git a/application/rongyu/view/js_rongyu_info/createall.html b/application/rongyu/view/js_rongyu_info/createall.html new file mode 100644 index 00000000..1dda5c2f --- /dev/null +++ b/application/rongyu/view/js_rongyu_info/createall.html @@ -0,0 +1,604 @@ +{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} +{block name="formaa"} +
+ +
+
+
+
+
+

或将照片拖到这里,单次最多可选300张

+
+
+ +
+
+
+ +{/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 diff --git a/application/rongyu/view/js_rongyu_info/edit.html b/application/rongyu/view/js_rongyu_info/edit.html new file mode 100644 index 00000000..ee86b726 --- /dev/null +++ b/application/rongyu/view/js_rongyu_info/edit.html @@ -0,0 +1,77 @@ +{extend name="common@create" /} +{block name="mycss"} +{/block} +{block name="formaa"} +
+
+ +
+ +
+
+
+ +
+ + {php}$category = getCategory(112);{/php} + + +
+
+
+ +
+ + {php} $school = schlist('区级','其它级');{/php} + + +
+
+
+ +
+ +
+
+
+
+ +
+
+
+{/block} +{block name="yanzheng"} + +{/block} \ No newline at end of file diff --git a/application/rongyu/view/js_rongyu_info/index.html b/application/rongyu/view/js_rongyu_info/index.html new file mode 100644 index 00000000..c4373756 --- /dev/null +++ b/application/rongyu/view/js_rongyu_info/index.html @@ -0,0 +1,216 @@ +{extend name="common@list" /} +{block name="topnav"} + +{/block} +{block name="bouttons"} +
+ + + + + 批量删除 + + + + + 添加荣誉 + + + + 共有数据:{$list.count} 条 + +
+
+
筛选荣誉册
+
+
+ {php} + $school = schlist('校级','区级'); + {/php} + +
+
+ {foreach $school as $key=>$vo } + + {/foreach} +
+ +
+
+ {php} + $school = schlist('区级','部级'); + {/php} + +
+
+ {foreach $school as $key=>$vo } + + {/foreach} +
+ +
+
+ {php}$category = getCategory(112);{/php} + +
+
+ {foreach $category as $key=>$vo } + + {/foreach} +
+ +
+
+
+{/block} +{block name="tables"} + + + + + + + + + + + + + + + + + +
获奖人获奖人单位荣誉名称荣誉册学科奖项获奖时间状态操作
+ + +{/block} +{block name="myjs"} + +{/block} \ No newline at end of file diff --git a/application/teach/model/Banji.php b/application/teach/model/Banji.php index abd5c80f..f009118f 100644 --- a/application/teach/model/Banji.php +++ b/application/teach/model/Banji.php @@ -57,17 +57,6 @@ class Banji extends Base - // 学校简称获取器 - public function getSchooljianAttr($value) - { - // 查询学校名称 - $schoolname = db('school')->where('id',$this->getData('school'))->value('jiancheng'); - // 返回学校名称 - return $schoolname; - } - - - // 班级学生数 public function getStusumAttr() { diff --git a/database/migrations/20181102004156_banji.php b/database/migrations/20181102004156_banji.php index 440a1861..c5aa0899 100644 --- a/database/migrations/20181102004156_banji.php +++ b/database/migrations/20181102004156_banji.php @@ -34,7 +34,7 @@ class Banji extends Migrator // 添加当前表字段 $table ->addColumn('school','integer',['limit'=>11,'null'=>false,'comment'=>'学校']) - ->addColumn('ruxuenian','integer',['limit'=>4,'null'=>true,'comment'=>'入学年']) + ->addColumn('ruxuenian','integer',['limit'=>4,'null'=>true,'comment'=>'学段']) ->addColumn('paixu','integer',['limit'=>3,'null'=>true,'comment'=>'排序']) ->addColumn('create_time','integer',['limit'=>11,'null'=>true,'comment'=>'创建时间']) ->addColumn('update_time','integer',['limit'=>11,'null'=>true,'comment'=>'更新时间']) diff --git a/database/migrations/20181221041523_js_rongyu_info.php b/database/migrations/20181221041523_js_rongyu_info.php index 6c3d6005..2ee98e8e 100644 --- a/database/migrations/20181221041523_js_rongyu_info.php +++ b/database/migrations/20181221041523_js_rongyu_info.php @@ -37,7 +37,7 @@ class JsRongyuInfo extends Migrator ->addColumn('rongyuce','integer',['limit'=>11,'null'=>false,'comment'=>'荣誉册']) ->addColumn('bianhao','string',['limit'=>15,'null'=>true,'comment'=>'证书编号']) ->addColumn('hjschool','integer',['limit'=>11,'null'=>false,'comment'=>'证书所属单位']) - ->addColumn('xueke','integer',['limit'=>11,'null'=>false,'comment'=>'所属学科']) + ->addColumn('subject','integer',['limit'=>11,'null'=>false,'comment'=>'所属学科']) ->addColumn('jiangxiang','integer',['limit'=>11,'null'=>false,'comment'=>'荣誉奖项']) ->addColumn('pic','string',['limit'=>40,'null'=>false,'comment'=>'证书图片']) ->addColumn('create_time','integer',['limit'=>11,'null'=>true,'comment'=>'创建时间'])