From 023bc596cb09f084e82bc5d86f0573fc3e926fd0 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E4=B8=9C=E5=AE=9D=E4=B9=A6=E8=AE=B0?=
Date: Sun, 9 May 2021 10:50:56 +0800
Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=88=A0=E9=99=A4=E5=AD=A6?=
=?UTF-8?q?=E7=A7=91=E6=9F=A5=E8=AF=A2=E4=B8=8E=E6=81=A2=E5=A4=8D=E4=B8=8E?=
=?UTF-8?q?=E5=AD=A6=E7=A7=91=E5=88=97=E9=AA=8C=E8=AF=81?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/admin/model/Admin.php | 64 +++++++++++--------
app/kaohao/controller/Index.php | 2 +-
app/login/view/index/shangma_log.html | 2 +
app/middleware/Auth.php | 3 +
app/student/controller/Index.php | 5 +-
app/student/model/Student.php | 2 +-
app/student/route/student.php | 2 +-
app/teach/controller/Subject.php | 61 ++++++++++++++++++
app/teach/model/JiaoyanZuzhang.php | 5 +-
app/teach/model/Jiaoyanzu.php | 43 ++++++++++++-
app/teach/model/Subject.php | 5 ++
app/teach/route/teach.php | 3 +-
app/teach/view/jiaoyanzu/index.html | 2 +-
app/teach/view/subject/create.html | 41 +++++++++++-
app/teach/view/subject/index.html | 16 ++++-
app/tools/controller/Index.php | 2 +-
database/seeds/Rule.php | 28 ++++----
public/static/x-admin2.2/js/mytable.js | 2 +-
public/uploads/student/student_template.xlsx | Bin 21327 -> 22494 bytes
19 files changed, 231 insertions(+), 57 deletions(-)
diff --git a/app/admin/model/Admin.php b/app/admin/model/Admin.php
index 9a78e568..7f4dbb83 100755
--- a/app/admin/model/Admin.php
+++ b/app/admin/model/Admin.php
@@ -382,35 +382,43 @@ class Admin extends BaseModel
public function myQuanxian()
{
$id = session('user_id');
- if ($id == 1 || $id == 2) {
- $banji_id = "";
- } else {
- $adInfo = $this->where('id', $id)
- ->field('zhiwu_id, school_id')
- ->with([
- 'adSchool' => function($query){
- $query->field('id, jiancheng, jibie_id');
- },
- ])
- ->find();
- // 获取职务权限
- if ($adInfo->zhiwu_id == 10703 ) {
-
- }
- // 教研组长
- $zh = new \app\teach\model\JiaoyanZuzhang;
- $zhList = $zh->srcTeacherNow($id);
- halt($zhList);
- // 获取班主任班级权限
- $bzr = new \app\teach\model\BanZhuRen;
- $banji_id = $bzr->srcTeacherNow($id);
-
-
-
-
-
-
+ $banji_id = array();
+
+ $adInfo = $this->where('id', $id)
+ ->field('zhiwu_id, school_id')
+ ->with([
+ 'adSchool' => function($query){
+ $query->field('id, jiancheng, jibie_id');
+ },
+ ])
+ ->find();
+ // 获取职务权限
+ $zhiwu_array = array(10703, 10705);
+ if (in_array($adInfo->zhiwu_id, $zhiwu_array)) {
+ $bj = new \app\teach\model\Banji;
+ $src = [
+ 'school_id' => $adInfo->school_id
+ ];
+ $bjList = $bj->search($src)
+ ->column('id');
+ $banji_id = array_merge($banji_id, $bjList);
}
+ // 教研组长
+ $zh = new \app\teach\model\JiaoyanZuzhang;
+ $zhList = $zh->srcTeacherNow($id);
+ $zz = new \app\teach\model\Jiaoyanzu;
+ foreach ($zhList as $key => $value) {
+ $zzInfo = $zz->oneInfo($value);
+ $banji_id = array_merge($banji_id, $zzInfo->banjiId);
+ }
+
+ // 获取班主任班级权限
+ $bzr = new \app\teach\model\BanZhuRen;
+ $bzr_banji_id = $bzr->srcTeacherNow($id);
+
+ $banji_id = array_merge($banji_id, $bzr_banji_id);
+ $banji_id = array_unique($banji_id);
+
return $banji_id;
}
diff --git a/app/kaohao/controller/Index.php b/app/kaohao/controller/Index.php
index 9abef00e..06f41b27 100755
--- a/app/kaohao/controller/Index.php
+++ b/app/kaohao/controller/Index.php
@@ -77,7 +77,7 @@ class Index extends AdminBase
// 获取参加考试年级数组
$enddate = KS::where('id', $list['kaoshi_id'])->value('enddate');
- $njlist = \app\facade\Tools::nianJiNameList($enddate, 'str');
+ $njlist = \app\facade\Tools::nianJiNameList($enddate);
// 重新组合学生信息
$kaohao = array();
foreach ($stulist as $key => $value) {
diff --git a/app/login/view/index/shangma_log.html b/app/login/view/index/shangma_log.html
index 347dd94f..a18b326e 100755
--- a/app/login/view/index/shangma_log.html
+++ b/app/login/view/index/shangma_log.html
@@ -79,6 +79,8 @@
增加教研组
增加教研组长
增加课题和荣誉统计
+ 增加删除学科查看与恢复
+ 增加删除学科"列标识"重复验证
diff --git a/app/middleware/Auth.php b/app/middleware/Auth.php
index e71f6a3f..e39689c9 100755
--- a/app/middleware/Auth.php
+++ b/app/middleware/Auth.php
@@ -60,6 +60,8 @@ class Auth
'admin/index/updatepassword', # 更新密码
'admin/index/adminlist', # 更新密码
'admin/index/srcadmin', # 搜索教师
+ 'admin/index/srcusername', # 验证用户名是否存在
+ 'admin/index/srcphone', # 验证用户名是否存在
'admin/admininfo/srcry', # 获取当前教师荣誉列表
'admin/admininfo/srckt', # 获取当前教师课题列表
'admin/admininfo/srcbzr', # 获取当前教师担任班主任情况列表
@@ -71,6 +73,7 @@ class Auth
'teach/banjichengji/ajaxdatatiaoxing', # 获取班级成绩-条形统计表
'teach/xueqi/srcxueqi', # 获取班级成绩-条形统计表
'teach/banji/njlist', # 获取班级数据
+ 'teach/subject/srclieming', # 获取班级数据
// Kaoshi应用
'kaoshi/index/srceditkaoshi', # 获取可以编辑的考试列表
'kaoshi/kscanyu/school', # 获取参加考试学校
diff --git a/app/student/controller/Index.php b/app/student/controller/Index.php
index a52ae6c5..045d1c45 100755
--- a/app/student/controller/Index.php
+++ b/app/student/controller/Index.php
@@ -376,9 +376,10 @@ class Index extends AdminBase
// 恢复删除
- public function reDel($id)
+ public function reDel()
{
-
+ // 获取id变量
+ $id = request()->post('id');
$user = STU::onlyTrashed()->find($id);
$data = $user->restore();
diff --git a/app/student/model/Student.php b/app/student/model/Student.php
index 43fd756f..3cb94434 100755
--- a/app/student/model/Student.php
+++ b/app/student/model/Student.php
@@ -234,7 +234,7 @@ class Student extends BaseModel
public function tongBu($stuinfo, $school_id)
{
// 整理数据
- array_splice($stuinfo, 0, 3); # 删除标题行
+ array_splice($stuinfo, 0, 4); # 删除标题行
$stuinfo = array_filter($stuinfo, function($q){ ## 过滤姓名、身份证号或班级为空的数据
return $q[1] != null && strlen($q[2]) >=6 && $q[3] != null;
});
diff --git a/app/student/route/student.php b/app/student/route/student.php
index 551944ec..840e4f3a 100755
--- a/app/student/route/student.php
+++ b/app/student/route/student.php
@@ -27,7 +27,7 @@ Route::group('index', function () {
Route::rule('deleteall','Index/deleteXlsx','post'); # 批量保存
Route::rule('download','Index/download','get'); # 批量保存
Route::rule('srcstudent','Index/srcStudent','post'); # 获取学生成绩
- Route::rule('redel/','Index/reDel','delete'); # 恢复删除的学生
+ Route::rule('redel','Index/reDel','delete'); # 恢复删除的学生
Route::rule('kaoshi','Index/setKaoshi','post'); # 删除信息
Route::rule('bylist','Index/byList','get'); # 信息列表
Route::rule('databy','Index/ajaxdataBy','post'); # 获取数据
diff --git a/app/teach/controller/Subject.php b/app/teach/controller/Subject.php
index 0c9eaaad..8baca31c 100755
--- a/app/teach/controller/Subject.php
+++ b/app/teach/controller/Subject.php
@@ -42,6 +42,7 @@ class Subject extends AdminBase
,'order' => 'asc'
,'kaoshi' => ''
,'status' => ''
+ ,'delete_time' => ''
,'xingzhi' => array()
,'searchval' => ''
],'POST');
@@ -212,6 +213,29 @@ class Subject extends AdminBase
}
+ // 恢复删除
+ public function restoreDel()
+ {
+ // 获取id变量
+ $id = request()->post('id');
+
+ // 获取学科信息
+ $info = SJ::onlyTrashed()->where('id', $id)->find();
+ if ($info)
+ {
+ $data = $info->restore();
+ // 根据更新结果设置返回提示信息
+ $data ? $data = ['msg' => '恢复记录成功' , 'val' => 1]
+ : $data = ['msg' => '数据处理错误' , 'val' => 0];
+ } else {
+ $data = ['msg' => '未删除的记录不能恢复' , 'val' => 0];
+ }
+
+ // 返回信息
+ return json($data);
+ }
+
+
// 设置学科是否参加考试
public function kaoshi()
@@ -231,4 +255,41 @@ class Subject extends AdminBase
// 返回信息
return json($data);
}
+
+
+ // 查询用户名是否重复
+ public function srcLieming()
+ {
+ // 获取参数
+ $srcfrom = $this->request
+ ->only([
+ 'searchval' => ''
+ ,'id'
+ ], 'POST');
+ $src = [
+ 'searchval' => ''
+ ,'id' => ''
+ ];
+ $src = array_cover($srcfrom, $src);
+
+ $sj = new SJ();
+ $list = $sj->where('lieming', $src['searchval'])
+ ->find();
+
+ // 根据更新结果设置返回提示信息
+ $data = ['msg' => '列标识已经存在!', 'val' => 0];
+ if($list)
+ {
+ if($src['id'] > 0)
+ {
+
+ if($src['id'] == $list->id){
+ $data = ['msg' => '', 'val' => 1];
+ }
+ }
+ }else{
+ $data = ['msg' => '', 'val' => 1];
+ }
+ return json($data);
+ }
}
diff --git a/app/teach/model/JiaoyanZuzhang.php b/app/teach/model/JiaoyanZuzhang.php
index d0c69d79..1d543599 100644
--- a/app/teach/model/JiaoyanZuzhang.php
+++ b/app/teach/model/JiaoyanZuzhang.php
@@ -69,7 +69,7 @@ class JiaoyanZuzhang extends Model
}
- // 查询教师担任班主任情况
+ // 查询教师担任组长情况
public function srcTeacherNow($admin_id)
{
$teacher = $this->where('teacher_id', $admin_id)
@@ -81,6 +81,7 @@ class JiaoyanZuzhang extends Model
->with([
'glJiaoyanzu' => function ($query) {
$query->field('id, title')
+ ->where('status', 1)
->append(['zuzhang']);
}
])
@@ -89,7 +90,7 @@ class JiaoyanZuzhang extends Model
// 循环写入班级ID
$jyz_ids = array();
foreach ($teacher as $key => $value) {
- if ($value->glJiaoyanzu->zuzhang['id'] == $admin_id) {
+ if (isset($value->glJiaoyanzu) && $value->glJiaoyanzu->zuzhang['id'] == $admin_id) {
$jyz_ids[] = $value->jiaoyanzu_id;
}
}
diff --git a/app/teach/model/Jiaoyanzu.php b/app/teach/model/Jiaoyanzu.php
index fb119457..9db77a5d 100644
--- a/app/teach/model/Jiaoyanzu.php
+++ b/app/teach/model/Jiaoyanzu.php
@@ -74,6 +74,18 @@ class Jiaoyanzu extends BaseModel
return $data;
}
+
+ // 查询教研组信息
+ public function oneInfo($id) {
+ $data = $this
+ ->where('id', $id)
+ ->field('id, school_id, ruxuenian, category_id, subject_id')
+ ->append(['banjiId'])
+ ->find();
+ return $data;
+ }
+
+
// 学科修改器
public function setsubjectIdAttr($value)
{
@@ -83,8 +95,9 @@ class Jiaoyanzu extends BaseModel
// 学科获取器
- public function getsubjectIdAttr($value)
+ public function getsubjectTitleAttr($value)
{
+ $value = $this->subject_id;
$value = explode('|', $value);
$subject = new \app\teach\model\Subject;
$list = $subject
@@ -135,4 +148,32 @@ class Jiaoyanzu extends BaseModel
return $str;
}
+
+
+ // 班级获取器
+ public function getBanjiIdAttr($value)
+ {
+ $bjList = array();
+ if ($this->category_id == 12501) {
+ $bj = new \app\teach\model\Banji;
+ $src = [
+ 'school_id' => $this->school_id
+ ,'ruxuenian' => $this->ruxuenian
+ ];
+ $bjList = $bj->search($src)
+ ->column('id');
+ }
+ return $bjList;
+ }
+
+
+ // 班级获取器
+ public function getSubjectIdAttr($value)
+ {
+ $list = array();
+ if ($this->category_id == 12502 and is_null($value) == false) {
+ $list = explode('|', $value);
+ }
+ return $list;
+ }
}
diff --git a/app/teach/model/Subject.php b/app/teach/model/Subject.php
index b9d391b7..84103db6 100755
--- a/app/teach/model/Subject.php
+++ b/app/teach/model/Subject.php
@@ -13,12 +13,14 @@ class Subject extends BaseModel
$src = [
'status' => ''
,'kaoshi' => ''
+ ,'delete_time' => ''
,'searchval' => ''
];
$src = array_cover($srcfrom, $src);
// 查询数据
$data = $this
+ ->withTrashed()
->when(strlen($src['searchval']) > 0, function($query) use($src){
$query->where('title|jiancheng', 'like', '%' . $src['searchval'] . '%');
})
@@ -28,6 +30,9 @@ class Subject extends BaseModel
->when(strlen($src['status']) > 0, function($query) use($src){
$query->where('status', $src['status']);
})
+ ->when(strlen($src['delete_time']) > 0, function($query){
+ $query->whereNotNull('delete_time');
+ })
->with([
'sbjCategory' => function($query){
$query->field('id, title');
diff --git a/app/teach/route/teach.php b/app/teach/route/teach.php
index d379a18d..06f27ff5 100755
--- a/app/teach/route/teach.php
+++ b/app/teach/route/teach.php
@@ -56,13 +56,14 @@ Route::group('subject', function () {
Route::rule('data','subject/ajaxdata','post'); # 获取数据
Route::rule('create','subject/create','get'); # 添加信息
Route::rule('save','subject/save','post'); # 保存信息
- // Route::rule('read/','subject/read','get'); # 读取信息
Route::rule('edit/','subject/edit','get'); # 修改信息
Route::rule('update/','subject/update','put'); # 更新信息
Route::rule('delete','subject/delete','delete'); # 删除信息
Route::rule('status','subject/setStatus','post'); # 删除信息
Route::rule('kaoshi','subject/kaoshi','post'); # 删除信息
Route::rule('srccy','subject/srcsbj','post'); # 获取数据
+ Route::rule('redel','subject/restoreDel','delete'); # 恢复删除信息
+ Route::rule('srclieming','subject/srcLieming','post'); # 获取数据
});
diff --git a/app/teach/view/jiaoyanzu/index.html b/app/teach/view/jiaoyanzu/index.html
index 32e88704..8c8f03aa 100644
--- a/app/teach/view/jiaoyanzu/index.html
+++ b/app/teach/view/jiaoyanzu/index.html
@@ -96,7 +96,7 @@ layui.use(['table', 'mytable', 'form', 'createInput'], function() {
title: '组长',
templet: function(d) {
var str = '';
- if (d.zuzhang) {
+ if (!d.zuzhang.xingming == '') {
str = d.zuzhang.xingming;
}
return str;
diff --git a/app/teach/view/subject/create.html b/app/teach/view/subject/create.html
index 726e2aad..c34707af 100755
--- a/app/teach/view/subject/create.html
+++ b/app/teach/view/subject/create.html
@@ -22,7 +22,7 @@
*列标识
-
+
@@ -52,10 +52,45 @@
{/block}
{block name="myjs"}
{/block}
diff --git a/app/teach/view/subject/index.html b/app/teach/view/subject/index.html
index 68c76997..4fa60aab 100755
--- a/app/teach/view/subject/index.html
+++ b/app/teach/view/subject/index.html
@@ -17,6 +17,15 @@
+
@@ -40,6 +49,7 @@