diff --git a/app/chengji/controller/Tongji.php b/app/chengji/controller/Tongji.php index 9b1df0ea..c67cc802 100755 --- a/app/chengji/controller/Tongji.php +++ b/app/chengji/controller/Tongji.php @@ -9,70 +9,6 @@ use app\chengji\model\Tongji as TJ; class Tongji extends AdminBase { - // 统计已经录入成绩数量 - public function yiluCnt($kaoshi_id) - { - // 获取考试信息 - $ks = new \app\kaoshi\model\Kaoshi; - $ksinfo = $ks->where('id', $kaoshi_id) - ->field('id, title') - ->find(); - - // 获取参加考试的年级和学科 - $ksset = new \app\kaoshi\model\KaoshiSet; - $list['nianji'] = $ksset->srcGrade($kaoshi_id); - $src = [ - 'kaoshi_id' => $kaoshi_id - ]; - $list['subject_id'] = $ksset->srcSubject($src); - - // 获取参与学校 - if(count($list['nianji']) > 0) - { - $khSrc = new \app\kaohao\model\SearchCanYu; - $src['ruxuenian'] = [$list['nianji'][0]['ruxuenian']]; - $src['kaoshi_id'] = $kaoshi_id; - $list['school_id'] = $khSrc->school($src); - } - - // 设置要给模板赋值的信息 - $list['webtitle'] = '各年级的班级成绩列表'; - $list['kaoshi_id'] = $kaoshi_id; - $list['kaoshititle'] = $ksinfo->title; - $list['dataurl'] = '/chengji/tongji/data'; - // 模板赋值 - $this->view->assign('list', $list); - - // 渲染模板 - return $this->view->fetch(); - } - - - // 获取年级成绩统计结果 - public function ajaxData() - { - // 获取参数 - $src = $this->request - ->only([ - 'page' => '1' - ,'limit' => '10' - ,'kaoshi_id' => '' - ,'ruxuenian' => '' - ,'school_id' => array() - ,'banji_id' => array() - ,'field' => 'banji_id' - ,'order' => 'asc' - ], 'POST'); - - // 统计成绩 - $btj = new \app\chengji\model\TongjiBj; - $data = $btj->tjBanjiCnt($src); - $data = reSetArray($data, $src); - - return json($data); - } - - // 批量统计得分率 public function updateDefenLv() { // 获取参数 @@ -131,28 +67,4 @@ class Tongji extends AdminBase // 渲染模板 return $this->view->fetch(); } - - - public function ajaxNewJieguo() - { - // 获取参数 - $src = $this->request - ->only([ - 'kaoshi_id' => '', - ],'POST'); - - // 实例化考号 - $khSrc = new \app\kaohao\model\Search; - $lastcj = $khSrc->lastUpdateTime($src['kaoshi_id']); - $logLastTime = $lastcj->getData('update_time'); - - $log = new \app\kaoshi\model\TongjiLog; - - - halt($logLastTime); - - - } - - } diff --git a/app/chengji/model/Tongji.php b/app/chengji/model/Tongji.php index 8d6748ae..fdc31fa3 100755 --- a/app/chengji/model/Tongji.php +++ b/app/chengji/model/Tongji.php @@ -387,10 +387,10 @@ class Tongji extends BaseModel $src = array_cover($srcfrom, $src); $cj = new \app\chengji\model\Chengji; $kh = new \app\kaohao\model\Kaohao; + $ksset = new \app\kaoshi\model\KaoshiSet; // 查询考号 $kaohaoid = $kh->where('kaoshi_id', $src['kaoshi_id']) - ->where('ruxuenian', $src['ruxuenian']) ->column('id'); // 查询成绩 @@ -399,12 +399,16 @@ class Tongji extends BaseModel ->whereNotNull('defen') ->field('id, defen, defenlv') ->select(); + $manfen = $ksset->where('kaoshi_id', $src['kaoshi_id']) + ->where('subject_id', $src['subject_id']) + ->where('ruxuenian', $src['ruxuenian']) + ->value('manfen'); // 循环写入新成绩 $data = array(); foreach ($cjList as $cj_k => $cj_v) { $data[] = [ - 'id' => $cj_v->id - ,'defenlv' => $cj_v->defen / $mf_v['fenshuxian']['manfen'] *100 + 'id' => $cj_v->id + ,'defenlv' => $cj_v->defen / $manfen *100 ]; } $data = $cj->saveAll($data); diff --git a/app/chengji/model/TongjiBj.php b/app/chengji/model/TongjiBj.php index 2f330c11..7145a860 100755 --- a/app/chengji/model/TongjiBj.php +++ b/app/chengji/model/TongjiBj.php @@ -691,7 +691,7 @@ class TongjiBj extends BaseModel // 获取优秀率 public function getYouxiulvAttr() { - $youxiu = 0; + $youxiu = null; $ycnt = $this->youxiu; $cjcnt = $this->chengji_cnt; if ($cjcnt > 0) { @@ -705,7 +705,7 @@ class TongjiBj extends BaseModel // 获取及格率 public function getJigelvAttr() { - $jige = 0; + $jige = null; $jcnt = $this->jige; $cjcnt = $this->chengji_cnt; if ($cjcnt > 0) { @@ -721,7 +721,7 @@ class TongjiBj extends BaseModel { $cjCnt = $this->chengji_cnt; $chaCnt = $cjCnt - $this->jige; - $chalv = 0; + $chalv = null; if ($cjCnt > 0) { $chalv = round($chaCnt / $cjCnt * 100, 2); } @@ -735,7 +735,7 @@ class TongjiBj extends BaseModel { $cjCnt = $this->chengji_cnt; $stu_cnt = $this->stu_cnt; - $canshilv = 0; + $canshilv = null; if ($stu_cnt > 0) { $chalv = round($cjCnt / $stu_cnt * 100, 2); } diff --git a/app/chengji/model/TongjiNj.php b/app/chengji/model/TongjiNj.php index b9cb80f0..3f66fd73 100755 --- a/app/chengji/model/TongjiNj.php +++ b/app/chengji/model/TongjiNj.php @@ -280,7 +280,7 @@ class TongjiNj extends BaseModel // 获取优秀率 public function getYouxiulvAttr() { - $youxiu = 0; + $youxiu = null; $ycnt = $this->youxiu; $cjcnt = $this->chengji_cnt; if ($cjcnt > 0) { @@ -294,7 +294,7 @@ class TongjiNj extends BaseModel // 获取优秀率 public function getJigelvAttr() { - $jige = 0; + $jige = null; $jcnt = $this->jige; $cjcnt = $this->chengji_cnt; if ($cjcnt > 0) { @@ -310,7 +310,7 @@ class TongjiNj extends BaseModel { $cjCnt = $this->chengji_cnt; $chaCnt = $cjCnt - $this->jige; - $chalv = 0; + $chalv = null; if ($cjCnt > 0) { $chalv = round($chaCnt / $cjCnt * 100, 2); } @@ -324,12 +324,12 @@ class TongjiNj extends BaseModel { $cjCnt = $this->chengji_cnt; $stu_cnt = $this->stu_cnt; - $canshilv = 0; + $canshilv = null; if ($stu_cnt > 0) { - $chalv = round($cjCnt / $stu_cnt * 100, 2); + $canshilv = round($cjCnt / $stu_cnt * 100, 2); } - return $chalv; + return $canshilv; } } diff --git a/app/chengji/model/TongjiSch.php b/app/chengji/model/TongjiSch.php index 583880f8..2e590a0b 100755 --- a/app/chengji/model/TongjiSch.php +++ b/app/chengji/model/TongjiSch.php @@ -222,7 +222,7 @@ class TongjiSch extends BaseModel // 获取优秀率 public function getYouxiulvAttr() { - $youxiu = 0; + $youxiu = null; $ycnt = $this->youxiu; $cjcnt = $this->chengji_cnt; if ($cjcnt > 0) { @@ -236,7 +236,7 @@ class TongjiSch extends BaseModel // 获取优秀率 public function getJigelvAttr() { - $jige = 0; + $jige = null; $jcnt = $this->jige; $cjcnt = $this->chengji_cnt; if ($cjcnt > 0) { @@ -252,7 +252,7 @@ class TongjiSch extends BaseModel { $cjCnt = $this->chengji_cnt; $chaCnt = $cjCnt - $this->jige; - $chalv = 0; + $chalv = null; if ($cjCnt > 0) { $chalv = round($chaCnt / $cjCnt * 100, 2); } @@ -266,12 +266,12 @@ class TongjiSch extends BaseModel { $cjCnt = $this->chengji_cnt; $stu_cnt = $this->stu_cnt; - $canshilv = 0; + $canshilv = null; if ($stu_cnt > 0) { - $chalv = round($cjCnt / $stu_cnt * 100, 2); + $canshilv = round($cjCnt / $stu_cnt * 100, 2); } - return $chalv; + return $canshilv; } } diff --git a/app/chengji/route/chengji.php b/app/chengji/route/chengji.php index ab1dd410..316c078e 100755 --- a/app/chengji/route/chengji.php +++ b/app/chengji/route/chengji.php @@ -30,8 +30,7 @@ Route::group('index', function () { // 成绩统计 Route::group('tongji', function () { - Route::rule('yilucnt/','Tongji/yiluCnt'); # 更新信息 - Route::rule('data','Tongji/ajaxData','post'); # 扫码界面 + // Route::rule('editdfl/','Tongji/editDefenLv','get'); # 扫码界面 Route::rule('editdfl','Tongji/updateDefenLv','post'); # 扫码界面 }); diff --git a/app/chengji/view/tongji/edit_defenlv.html b/app/chengji/view/tongji/edit_defenlv.html deleted file mode 100755 index 755fc90a..00000000 --- a/app/chengji/view/tongji/edit_defenlv.html +++ /dev/null @@ -1,66 +0,0 @@ -{extend name=".././view/create.html" /} - -{block name="form"} -
-
- -
- -
-
-
- -
- -
-
- -
- -
-
-{/block} - -{block name="myjs"} - -{/block} - diff --git a/app/kaohao/controller/Excel.php b/app/kaohao/controller/Excel.php deleted file mode 100755 index d75ae075..00000000 --- a/app/kaohao/controller/Excel.php +++ /dev/null @@ -1,177 +0,0 @@ -srcGrade($kaoshi_id); - $srcMore = new srcMore; - $src['kaoshi_id'] = $kaoshi_id; - if(count($list['data']['nianji']) > 0){ - $src['ruxuenian'] = $list['data']['nianji'][0]; - } else { - $src['ruxuenian'] = array(); - } - $srcCy = new srcCy(); - $list['data']['school'] = $srcCy->school($src); - // 设置页面标题 - $list['set'] = array( - 'webtitle' => '下载考号' - ,'butname' => '下载' - ,'formpost' => 'POST' - ,'url' => '/kaohao/excel/biaoqianxls' - ,'kaoshi_id' => $kaoshi_id - ); - - // 模板赋值 - $this->view->assign('list', $list); - // 渲染 - return $this->view->fetch(); - } - - - //生成标签信息 - public function biaoqianXls() - { - // 获取表单数据 - $list = request()->only([ - 'banji_id'=>array() - ,'kaoshi_id' - ,'subject_id'=>array() - ], 'POST'); - event('kslu', $list['kaoshi_id']); - $kaoshi_id = $list['kaoshi_id']; - $banji_id = $list['banji_id']; - $subject = $list['subject_id']; - - // 实例化验证模型 - $validate = new \app\kaoshi\validate\Biaoqian; - $result = $validate->scene('biaoqian')->check($list); - $msg = $validate->getError(); - if(!$result){ - $this->error($msg); - } - - ob_start(); - $ks = new KS(); - $kslist = $ks::where('id', $kaoshi_id) - ->field('id, title') - ->find(); - // 获取参考学科 - $ksset = new ksset(); - $ksSubject = $ksset->srcSubject($list); - - // 查询考号 - $srcMore = new srcMore(); - $src = [ - 'kaoshi_id' => $kaoshi_id - ,'banji_id' => $banji_id - ]; - $kaohao = $srcMore->srcBanjiKaohao($src); - - $thistime = date("Y-m-d h:i:sa"); - // 创建表格 - $spreadsheet = new Spreadsheet(); - $sheet = $spreadsheet->getActiveSheet(); - $thistime = date("Y-m-d h:i:sa"); - // 设置文档属性 - $spreadsheet->getProperties() - ->setCreator("尚码成绩管理系统") //作者 - ->setTitle("尚码成绩管理") //标题 - ->setLastModifiedBy(session('username')) //最后修改者 - ->setDescription("该表格由" . session('username') . session('id') . "于" . $thistime . "在尚码成绩管理系统中下载,只作为内部交流材料,不允许外泄。") //描述 - ->setKeywords("尚码 成绩管理") //关键字 - ->setCategory("成绩管理"); //分类 - - // 设置表头信息 - $sheet->setCellValue('A1', '序号'); - $sheet->setCellValue('B1', '考号'); - $sheet->setCellValue('C1', '学校'); - $sheet->setCellValue('D1', '班级'); - $sheet->setCellValue('E1', '学科'); - $sheet->setCellValue('F1', '姓名'); - - // 循环写出信息 - $i = 2; - foreach ($kaohao as $key=>$bj) - { - foreach ($ksSubject as $ksbj => $sbj) - { - foreach ($bj->banjiKaohao as $kkh => $kh) - { - // 表格赋值 - $sheet->setCellValue('A' . $i, $i-1); - $stuKaohao = ''; - $stuKaohao = \app\facade\Tools::encrypt($kh->id . '|' . $sbj['id'], 'dlbz'); - $sheet->setCellValue('C' . $i, $bj->cjSchool->jiancheng); - $sheet->setCellValue('B' . $i, $stuKaohao); - $sheet->setCellValue('D' . $i, $bj->numBanjiTitle); - $sheet->setCellValue('E' . $i, $sbj['jiancheng']); - $sheet->setCellValue('F' . $i, $kh->cjStudent['xingming']); - $i++; - } - } - } - - // 保存文件 - $filename = $kslist->title . ' 标签数据' . date('ymdHis') . '.xls'; - header('Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'); - header('Content-Disposition: attachment;filename="' . $filename . '"'); - header('Cache-Control: max-age=0'); - $writer = \PhpOffice\PhpSpreadsheet\IOFactory::createWriter($spreadsheet, 'Xls'); - $writer->save('php://output'); - - ob_flush(); - flush(); - exit(); - } - - - // 下载考试成绩采集表 - public function caiji($kaoshi_id) - { - // 获取参考年级、学科 - $ksset = new ksset; - $list['data']['nianji'] = $ksset->srcGrade($kaoshi_id); - $srcMore = new srcMore; - $src['kaoshi_id'] = $kaoshi_id; - if(count($list['data']['nianji']) > 0){ - $src['ruxuenian'] = $list['data']['nianji'][0]; - } else { - $src['ruxuenian'] = array(); - } - $srcCy = new srcCy(); - $list['data']['school'] = $srcCy->school($src); - - // 设置页面标题 - $list['set'] = array( - 'webtitle'=>'下载成绩采集表' - ,'butname'=>'下载' - ,'formpost'=>'POST' - ,'url'=>'/luru/index/dwcaiji' - ,'kaoshi_id'=>$kaoshi_id - ); - - // 模板赋值 - $this->view->assign('list', $list); - // 渲染 - return $this->view->fetch('biaoqian'); - } -} diff --git a/app/kaohao/controller/Index.php b/app/kaohao/controller/Index.php index 98ed1bc5..2561ba17 100755 --- a/app/kaohao/controller/Index.php +++ b/app/kaohao/controller/Index.php @@ -2,7 +2,7 @@ namespace app\kaohao\controller; // 引用控制器基类 -use app\base\controller\AdminBase; +use app\base\controller\ToolBase; // 引用数据模型类 use app\kaoshi\model\Kaoshi as KS; @@ -11,7 +11,7 @@ use app\kaohao\model\Kaohao as KH; use think\Validate; -class Index extends AdminBase +class Index extends ToolBase { // 生成考号 public function createAll($kaoshi_id) diff --git a/app/kaohao/model/SearchMore.php b/app/kaohao/model/SearchMore.php index 195619fc..7200e326 100755 --- a/app/kaohao/model/SearchMore.php +++ b/app/kaohao/model/SearchMore.php @@ -55,7 +55,7 @@ class SearchMore extends BaseModel $query->field('id, jiancheng'); } ,'cjStudent' => function($query){ - $query->field('id, xingming, sex'); + $query->field('id, xingming, sex, shengri'); } ]) ->append(['banjiTitle', 'banTitle']) @@ -160,6 +160,49 @@ class SearchMore extends BaseModel } + // 获取在线编辑成绩数据 + public function srcOnlineEdit($srcfrom) + { + // 初始化参数 + $src = array( + 'kaoshi_id' => '0' + ,'banji_id' => array() + ,'subject_id' => array() + ); + // 用新值替换初始值 + $src = array_cover($srcfrom, $src); + $khlist = $this->search($src); + if($khlist->isEmpty()) + { + return $data = array(); + } + $sbj = new \app\teach\model\Subject; + $sbjList = $sbj->where('id', 'in', $src['subject_id']) + ->field('id, title, jiancheng, lieming') + ->select(); + $data = array(); + foreach ($khlist as $key => $value) { + $data[$key]['id'] = $value['id']; + $data[$key]['school_jiancheng'] = $value->cjSchool->jiancheng; + $data[$key]['ban_title'] = $value->banTitle; + $data[$key]['student_xingming'] = $value->cjStudent->xingming; + $data[$key]['sex'] = $value->cjStudent->sex; + $data[$key]['shengri'] = $value->cjStudent->shengri; + + foreach ($sbjList as $sbj_k => $sbj_v) { + $data[$key][$sbj_v->lieming] = ''; + foreach ($value->ksChengji as $cj_k => $cj_v) { + if($cj_v->subject_id == $sbj_v->id) + { + $data[$key][$sbj_v->lieming] = $cj_v->defen * 1; + } + } + } + } + return $data; + } + + // 查询本次考试各班级考号,并以班级进行分组 public function srcBanjiKaohao($srcfrom) { diff --git a/app/kaohao/route/kaohao.php b/app/kaohao/route/kaohao.php index 4ac0337e..334d4195 100755 --- a/app/kaohao/route/kaohao.php +++ b/app/kaohao/route/kaohao.php @@ -18,12 +18,4 @@ Route::group('index', function () { Route::rule('createall/', 'Index/createAll', 'get'); # 信息列表 Route::rule('saveall', 'Index/saveAll', 'post'); # 保存信息 Route::rule('read/', 'Index/read', 'get'); # 读取信息 -}); - - -// 考号管理 -Route::group('excel', function () { - Route::rule('biaoqian/', 'Excel/biaoqian', 'get'); # 信息列表 - Route::rule('biaoqianxls', 'Excel/biaoqianXls', 'post'); # 信息列表 - Route::rule('caiji/', 'Excel/caiji', 'get'); # 成绩采集下载页面 -}); +}); \ No newline at end of file diff --git a/app/kaohao/view/excel/biaoqian.html b/app/kaohao/view/excel/biaoqian.html deleted file mode 100755 index 69037240..00000000 --- a/app/kaohao/view/excel/biaoqian.html +++ /dev/null @@ -1,93 +0,0 @@ -{extend name=".././view/createhref.html" /} - -{block name="form"} -
-
- -
- -
-
-
- -
- -
-
-
- -
-
-
-
- -
- -
-
- - - -
- -
-
-{/block} - -{block name="myjs"} - -{/block} - diff --git a/app/kaoshi/controller/Index.php b/app/kaoshi/controller/Index.php index 2d15e4ad..2819c433 100755 --- a/app/kaoshi/controller/Index.php +++ b/app/kaoshi/controller/Index.php @@ -41,7 +41,6 @@ class Index extends AdminBase ,'field' => 'id' ,'order' => 'desc' ,'searchval' => '' - ,'user_group' => 'admin' ], 'POST'); // 根据条件查询数据 $ks = new KS; @@ -344,10 +343,16 @@ class Index extends AdminBase $id = request()->post('id'); $value = request()->post('value'); - // 获取考试信息 - $data = KS::where('id', $id)->update(['status' => $value]); + $ks = new KS(); + $ksInfo = $ks->where('id', $id)->field('id, luru, status')->find(); + if($value == 0){ + $ksInfo->status = $value; + $ksInfo->luru = $value; + }else{ + $ksInfo->status = $value; + } - // 根据更新结果设置返回提示信息 + $data = $ksInfo->save(); $data ? $data = ['msg' => '状态设置成功', 'val' => 1] : $data = ['msg' => '数据处理错误', 'val' => 0]; diff --git a/app/kaoshi/model/Kaoshi.php b/app/kaoshi/model/Kaoshi.php index 7ee196c2..c8b46dee 100755 --- a/app/kaoshi/model/Kaoshi.php +++ b/app/kaoshi/model/Kaoshi.php @@ -18,8 +18,6 @@ class Kaoshi extends BaseModel ,'xueqi_id' => '' ,'category_id' => array() ,'searchval' => '' - ,'user_group' => 'everyone' - ,'user_id' => '' ]; // 用新值替换初始值 $src = array_cover($srcfrom, $src); @@ -33,12 +31,6 @@ class Kaoshi extends BaseModel ->when(strlen($src['searchval']) > 0, function($query) use($src){ $query->where('title', 'like', '%' . $src['searchval']. ' %'); }) - ->when(strlen($src['user_group']) > 0, function($query) use($src){ - $query->where('user_group', $src['user_group']) - ->when($src['user_group'] == 'teacher', function($q) use($src){ - $q->where('user_id', $src['user_id']); - }); - }) ->when(count($src['zuzhi_id']) > 0, function($query) use($src){ $query->where('zuzhi_id', 'in', $src['zuzhi_id']); }) diff --git a/app/kaoshi/view/index/chengji.html b/app/kaoshi/view/index/chengji.html index 2ee3b94c..54e4d8f2 100644 --- a/app/kaoshi/view/index/chengji.html +++ b/app/kaoshi/view/index/chengji.html @@ -38,19 +38,6 @@
- -
- -
检测统计结果是否是最新结果
-
-
- -
- -
任课教师
-
-
diff --git a/app/kaoshi/view/index/index.html b/app/kaoshi/view/index/index.html index a2702ed7..7e3e8b0f 100755 --- a/app/kaoshi/view/index/index.html +++ b/app/kaoshi/view/index/index.html @@ -65,9 +65,8 @@ + - - +{/block} + diff --git a/app/luru/view/index/online.html b/app/luru/view/index/online.html new file mode 100644 index 00000000..e4b858a9 --- /dev/null +++ b/app/luru/view/index/online.html @@ -0,0 +1,113 @@ +{extend name=".././view/createhref.html" /} + +{block name="form"} +
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+
+
+
+ +
+
+
+ +
+ +
+ +
+{/block} + +{block name="myjs"} + +{/block} + diff --git a/app/luru/view/index/onlineedit.html b/app/luru/view/index/onlineedit.html new file mode 100644 index 00000000..c9980631 --- /dev/null +++ b/app/luru/view/index/onlineedit.html @@ -0,0 +1,194 @@ + +{extend name=".././view/list.html" /} +{block name="jsset"} + +{/block} +{block name="nav"} + + 成绩采集 + 在线录入 + 学生列表 + +{/block} +{block name="search"} + + {volist name="list.set.src.banji_id" id="vo"} + + {/volist} + {volist name="list.set.src.subject_id" id="vo"} + + {/volist} + +{/block} +{block name="table"} +
+{/block} +{block name="myjs"} + + + + + + +{/block} diff --git a/app/luru/view/index/yilu_cnt.html b/app/luru/view/index/yilu_cnt.html new file mode 100644 index 00000000..1bbe2888 --- /dev/null +++ b/app/luru/view/index/yilu_cnt.html @@ -0,0 +1,35 @@ +{extend name=".././view/createhref.html" /} + +{block name="form"} +
+
+ +
+ +
+
+ +
+ +
+ +
+{/block} + +{block name="myjs"} + +{/block} + diff --git a/app/chengji/view/tongji/yilu_cnt.html b/app/luru/view/index/yilu_cnt_table.html old mode 100755 new mode 100644 similarity index 92% rename from app/chengji/view/tongji/yilu_cnt.html rename to app/luru/view/index/yilu_cnt_table.html index 6bd558ea..a17c633d --- a/app/chengji/view/tongji/yilu_cnt.html +++ b/app/luru/view/index/yilu_cnt_table.html @@ -6,9 +6,7 @@ {block name="nav"} 考试管理 - 更多操作 - 前期操作 - 已录成绩数量 + 已录成绩统计 {$list['kaoshititle']} {/block} @@ -147,17 +145,17 @@ }); // 添加班级列表 - function addBanji(){ - // 获取参数 - var formval; - formval = formval = form.val("search"); - if(formval.school_id == '') - { - $('#banji').children().remove(); - }else{ - cjgl.createCheckbox('banji', formval, '/tools/kscy/class', 'banji_id', 'banTitle'); + function addBanji(){ + // 获取参数 + var formval; + formval = formval = form.val("search"); + if(formval.school_id == '') + { + $('#banji').children().remove(); + }else{ + cjgl.createCheckbox('banji', formval, '/tools/kscy/class', 'banji_id', 'banTitle'); + } } - } }); diff --git a/app/teacher/controller/Index.php b/app/teacher/controller/Index.php index ffe65b51..377dfe52 100755 --- a/app/teacher/controller/Index.php +++ b/app/teacher/controller/Index.php @@ -532,4 +532,70 @@ class Index extends AdminBase + // 将老师信息合并到admin中 + public function tongbu() + { + $ad = new \app\admin\model\Admin; + $tclist = Tc::withTrashed()->select(); + foreach ($tclist as $key => $value) { + $temp = $ad::withTrashed() + ->where('teacher_id', $value->id) + ->find(); + if($temp) + { + $temp->xingming = $value->xingming; + $temp->sex = $value->getData("sex"); + $temp->shengri = $value->getData("shengri"); + $temp->password = $value->password; + $temp->teacher_id = $value->teacher_id; + $temp->school_id = $value->danwei_id; + $temp->phone = $value->phone; + $temp->worktime = $value->getData("worktime"); + $temp->zhiwu_id = $value->zhiwu_id; + $temp->zhicheng_id = $value->zhicheng_id; + $temp->biye = $value->biye; + $temp->zhuanye = $value->zhuanye; + $temp->xueli_id = $value->xueli_id; + $temp->subject_id = $value->subject_id; + $temp->quanpin = $value->quanpin; + $temp->shoupin = $value->shoupin; + $temp->tuixiu = $value->getData("tuixiu"); + $temp->denglucishu = $value->denglucishu + $temp->denglucishu; + if($temp->this_time < $value->this_time) + { + $temp->lastip = $value->lastip; + $temp->ip = $value->ip; + $temp->lasttime = $value->lasttime; + $temp->thistime = $value->thistime; + } + $temp->status = $value->status; + if($temp->create_time > $value->create_time) + { + $temp->create_time = $value->create_time; + } + if($temp->delete_time < $value->delete_time) + { + $temp->delete_time = $value->delete_time; + } + $temp->beizhu = $value->beizhu; + $temp->save(); + } else { + $data = $value->toArray(); + $data['teacher_id'] = $value->id; + unset($data['id']); + $data['sex'] = $value->getData('sex'); + $data['shengri'] = $value->getData('shengri'); + $data['username'] = $value->phone; + + $data['delete_time'] = $value->getData('delete_time'); + $data['worktime'] = $value->getData('worktime'); + $data['tuixiu'] = $value->getData('tuixiu'); + $data['create_time'] = $value->getData('create_time'); + $data['delete_time'] = $value->getData('delete_time'); + unset($data['update_time']); + $ad->create($data); + } + } + return '已经将教师信息同步到管理员表中:1、教师信息与管理员信息已经关联:使用教师信息替换管理员信息;2、教师与管理员信息未关联:在管理员表中创建教师信息。帐号为手机号,密码为原密码。'; + } } diff --git a/app/teacher/route/teacher.php b/app/teacher/route/teacher.php index 9ad98b0b..d25a2d3b 100755 --- a/app/teacher/route/teacher.php +++ b/app/teacher/route/teacher.php @@ -32,4 +32,6 @@ Route::group('index', function () { Route::rule('datadel','Index/ajaxDataDel','post'); # 获取数据 Route::rule('redel/','Index/reDel','delete'); # 获取学生成绩 Route::rule('resetpassword/','Index/resetpassword','post'); # 重置教师密码 + + Route::rule('tongbu','Index/tongbu','get'); # 添加信息 }); diff --git a/database/migrations/20181012140355_member.php b/database/migrations/20181012140355_member.php index fe722358..d90e0ab7 100755 --- a/database/migrations/20181012140355_member.php +++ b/database/migrations/20181012140355_member.php @@ -41,6 +41,16 @@ class Member extends Migrator ->addColumn('teacher_id','string',['limit'=>11,'null'=>true,'comment'=>'教师编号']) ->addColumn('school_id','integer',['limit'=>11,'null'=>false,'default'=>0,'comment'=>'所在单位']) ->addColumn('phone','string',['limit'=>11,'null'=>true,'comment'=>'联系方式']) + ->addColumn('worktime','integer',['limit'=>11,'null'=>true,'comment'=>'工作时间']) + ->addColumn('zhiwu_id','integer',['limit'=>11,'null'=>true,'comment'=>'职务']) + ->addColumn('zhicheng_id','integer',['limit'=>11,'null'=>true,'comment'=>'职称']) + ->addColumn('biye','string',['limit'=>50,'null'=>true,'comment'=>'毕业学校']) + ->addColumn('zhuanye','string',['limit'=>20,'null'=>true,'comment'=>'专业']) + ->addColumn('xueli_id','integer',['limit'=>11,'null'=>true,'comment'=>'学历']) + ->addColumn('subject_id','integer',['limit'=>11,'null'=>true,'comment'=>'学科']) + ->addColumn('quanpin','string',['limit'=>30,'default'=>'a','null'=>false,'comment'=>'全拼']) + ->addColumn('shoupin','string',['limit'=>5,'default'=>'a','null'=>false,'comment'=>'简拼']) + ->addColumn('tuixiu','boolean',['limit'=>1,'default'=>0,'null'=>false,'comment'=>'是否已经退休']) ->addColumn('denglucishu','integer',['limit'=>5,'default'=>0,'null'=>false,'comment'=>'登录次数']) ->addColumn('lastip','string',['limit'=>55,'default'=>'127.0.0.1','null'=>false,'comment'=>'最后一次登录IP']) ->addColumn('ip','string',['limit'=>55,'default'=>'127.0.0.1','null'=>false,'comment'=>'登录IP']) @@ -52,6 +62,7 @@ class Member extends Migrator ->addColumn('delete_time','integer',['limit'=>11,'null'=>true,'comment'=>'删除时间']) ->addColumn('beizhu','string',['limit'=>80,'null'=>true,'comment'=>'备注']) ->addIndex(array('username'), array('unique' => true)) + ->addIndex(array('phone'), array('unique' => true)) ->create(); } } diff --git a/database/migrations/20210107070200_kaoshi_add_user.php b/database/migrations/20210107070200_kaoshi_add_user.php deleted file mode 100644 index 81a3d81b..00000000 --- a/database/migrations/20210107070200_kaoshi_add_user.php +++ /dev/null @@ -1,53 +0,0 @@ -table('kaoshi'); - - $table - ->addColumn('user_id','integer',['after' => 'category_id','limit'=>11,'default'=>0,'null'=>false,'comment'=>'用户ID']) - ->addColumn('user_group','string',['after' => 'user_id','limit'=>25,'default'=>'a','null'=>false,'comment'=>'用户组']) - ->addColumn('jibie_id','integer',['after' => 'user_group','limit'=>11,'default'=>1,'null'=>false,'comment'=>'级别ID']) - ->update(); - } - - - public function down() - { - // 定义数据表名称 - $table = $this->table('kaoshi'); - - $table - ->removeColumn('user_id') - ->removeColumn('user_group') - ->removeColumn('jibie_id') - ->update(); - } -} diff --git a/database/migrations/20210117005351_rule_addsystemreset.php b/database/migrations/20210117005351_rule_addsystemreset.php deleted file mode 100644 index 1062cf90..00000000 --- a/database/migrations/20210117005351_rule_addsystemreset.php +++ /dev/null @@ -1,50 +0,0 @@ - 70502 - ,'title' => '初始化' - ,'name' => 'system/systembase/resetmayi' - ,'paixu' => 2 - ,'pid' => 705 - ], - ]; - - $this->execute('DELETE FROM cj_auth_rule where id=707'); - - // this is a handy shortcut - $this->insert('auth_rule', $singleRow); - } - - public function down() - { - $this->execute('DELETE FROM cj_auth_rule where id=70502'); - } -} diff --git a/database/migrations/20210215021427_teacher_to_admin.php b/database/migrations/20210215021427_teacher_to_admin.php new file mode 100644 index 00000000..376f5138 --- /dev/null +++ b/database/migrations/20210215021427_teacher_to_admin.php @@ -0,0 +1,84 @@ +table('admin'); + $column = $table->hasColumn('worktime'); + if (!$column) { + $this->execute('UPDATE cj_admin set phone=null where id>0'); + $table + ->addColumn('worktime','integer',['limit'=>11,'null'=>true,'comment'=>'工作时间']) + ->addColumn('zhiwu_id','integer',['limit'=>11,'null'=>true,'comment'=>'职务']) + ->addColumn('zhicheng_id','integer',['limit'=>11,'null'=>true,'comment'=>'职称']) + ->addColumn('biye','string',['limit'=>50,'null'=>true,'comment'=>'毕业学校']) + ->addColumn('zhuanye','string',['limit'=>20,'null'=>true,'comment'=>'专业']) + ->addColumn('xueli_id','integer',['limit'=>11,'null'=>true,'comment'=>'学历']) + ->addColumn('subject_id','integer',['limit'=>11,'null'=>true,'comment'=>'学科']) + ->addColumn('quanpin','string',['limit'=>30,'default'=>'a','null'=>false,'comment'=>'全拼']) + ->addColumn('shoupin','string',['limit'=>5,'default'=>'a','null'=>false,'comment'=>'简拼']) + ->addColumn('tuixiu','boolean',['limit'=>1,'default'=>0,'null'=>false,'comment'=>'是否已经退休']) + ->addIndex(array('phone'), array('unique' => true)) + ->update(); + } + + $table = $this->table('system_base'); + $column = $table->hasColumn('kaoshifanwei'); + if (!$column) { + $table + ->addColumn('kaoshifanwei','boolean',['limit'=>1,'default'=>0,'null'=>false,'comment'=>'默认不限制']); + } + } + + + //版本退回 + public function down() + { + $table = $this->table('admin'); + $table + ->removeColumn('worktime') + ->removeColumn('zhiwu_id') + ->removeColumn('zhicheng_id') + ->removeColumn('biye') + ->removeColumn('zhuanye') + ->removeColumn('xueli_id') + ->removeColumn('subject_id') + ->removeColumn('quanpin') + ->removeColumn('shoupin') + ->removeColumn('worktime') + ->removeColumn('tuixiu') + ->update(); + + $table = $this->table('system_base'); + $table + ->removeColumn('kaoshifanwei') + ->update(); + } + + +} diff --git a/database/seeds/Rule.php b/database/seeds/Rule.php index df94d5a8..18dc3764 100755 --- a/database/seeds/Rule.php +++ b/database/seeds/Rule.php @@ -69,7 +69,7 @@ class Rule extends Seeder ], ['id' => 10203 ,'title' => '下载表格' - ,'name' => 'kaohao/excel/caiji' + ,'name' => 'luru/index/caiji' ,'paixu' => 3 ,'pid' => 102 ], @@ -96,11 +96,11 @@ class Rule extends Seeder ], ['id' => 105 ,'title' => '已录统计' - ,'name' => 'chengji/tongji/yilucnt' + ,'name' => 'luru/index/yilucnt' ,'paixu' => 5 ,'ismenu' => 1 ,'pid' => 1 - ,'url' => '/chengji/tongji/yilucnt' + ,'url' => '/luru/index/yilucnt' ], // 占位 ['id' => 10501 @@ -111,11 +111,11 @@ class Rule extends Seeder ], ['id' => 106 ,'title' => '下载标签' - ,'name' => 'kaohao/excel/biaoqian' + ,'name' => 'luru/index/biaoqian' ,'paixu' => 6 ,'ismenu' => 1 ,'pid' => 1 - ,'url' => '/kaohao/excel/biaoqian' + ,'url' => '/luru/index/biaoqian' ], // 占位 ['id' => 10601 @@ -1252,7 +1252,6 @@ class Rule extends Seeder ,'paixu' => 1 ,'pid' => 705 ], - // 下次要添加上 ['id' => 70502 ,'title' => '初始化' ,'name' => 'system/systembase/resetmayi' diff --git a/public/static/x-admin2.2/js/cjgl.js b/public/static/x-admin2.2/js/cjgl.js index 4cf86251..3a7d9af7 100755 --- a/public/static/x-admin2.2/js/cjgl.js +++ b/public/static/x-admin2.2/js/cjgl.js @@ -2,7 +2,7 @@ 扩展cjgl模块 **/ -layui.define(['table'],function(exports){ //提示:模块也可以依赖其它模块,如:layui.define('layer', callback); +layui.define(['table', 'form'],function(exports){ //提示:模块也可以依赖其它模块,如:layui.define('layer', callback); var table = layui.table form = layui.form; var obj = { @@ -391,7 +391,6 @@ layui.define(['table'],function(exports){ //提示:模块也可以依赖其它 checkboxParentList:function(parentId){ cnt = $('#'+parentId).children("input[checkall='c']").length; checkedCnt = $('#'+parentId).children("input:checkbox[checkall='c']:checked").length; - console.log(cnt, checkedCnt); if(cnt == checkedCnt) { $('#'+parentId).find("input[checkall='p']").prop('checked',true); diff --git a/public/static/x-admin2.2/js/createinput.js b/public/static/x-admin2.2/js/createinput.js new file mode 100644 index 00000000..691960e1 --- /dev/null +++ b/public/static/x-admin2.2/js/createinput.js @@ -0,0 +1,19 @@ +/** + 扩展cjgl模块 + **/ + +layui.define(['from'],function(exports){ //提示:模块也可以依赖其它模块,如:layui.define('layer', callback); + var form = layui.form; + var obj = { + + // 获取可以录入成绩的考试列表 + lurukaoshiSelect: function () { + + } + + + + }; + //输出test接口 + exports('createinput', obj); +});