正在显示
6 个修改的文件
包含
21 行增加
和
14 行删除
@@ -3,10 +3,6 @@ | @@ -3,10 +3,6 @@ | ||
3 | namespace app\admin\controller; | 3 | namespace app\admin\controller; |
4 | 4 | ||
5 | use app\common\controller\Backend; | 5 | use app\common\controller\Backend; |
6 | -use app\common\controller\Resource; | ||
7 | -use think\Db; | ||
8 | -use think\exception\PDOException; | ||
9 | -use think\exception\ValidateException; | ||
10 | 6 | ||
11 | /** | 7 | /** |
12 | * 学生管理 | 8 | * 学生管理 |
@@ -55,14 +51,18 @@ class Study extends Backend | @@ -55,14 +51,18 @@ class Study extends Backend | ||
55 | list($where, $sort, $order, $offset, $limit) = $this->buildparams(); | 51 | list($where, $sort, $order, $offset, $limit) = $this->buildparams(); |
56 | 52 | ||
57 | $list = $this->model | 53 | $list = $this->model |
58 | - ->with(['school', 'team']) | 54 | + ->with(['grade','school','team']) |
59 | ->where($where) | 55 | ->where($where) |
60 | ->order($sort, $order) | 56 | ->order($sort, $order) |
61 | ->paginate($limit); | 57 | ->paginate($limit); |
62 | 58 | ||
63 | foreach ($list as $row) { | 59 | foreach ($list as $row) { |
64 | - | 60 | + $row->visible(['id','avatar','name','gender','birthday','grade_id','school_id','sno','team_id','team_rank','earn_score','phone','unique','barcode']); |
61 | + $row->visible(['grade']); | ||
62 | + $row->getRelation('grade')->visible(['id','name']); | ||
63 | + $row->visible(['school']); | ||
65 | $row->getRelation('school')->visible(['title']); | 64 | $row->getRelation('school')->visible(['title']); |
65 | + $row->visible(['team']); | ||
66 | $row->getRelation('team')->visible(['title']); | 66 | $row->getRelation('team')->visible(['title']); |
67 | } | 67 | } |
68 | 68 | ||
@@ -73,8 +73,6 @@ class Study extends Backend | @@ -73,8 +73,6 @@ class Study extends Backend | ||
73 | return $this->view->fetch(); | 73 | return $this->view->fetch(); |
74 | } | 74 | } |
75 | 75 | ||
76 | - | ||
77 | - | ||
78 | //导出数据 | 76 | //导出数据 |
79 | public function export() | 77 | public function export() |
80 | { | 78 | { |
@@ -8,16 +8,18 @@ return [ | @@ -8,16 +8,18 @@ return [ | ||
8 | 'Gender 0' => '女', | 8 | 'Gender 0' => '女', |
9 | 'Gender 1' => '男', | 9 | 'Gender 1' => '男', |
10 | 'Birthday' => '生日', | 10 | 'Birthday' => '生日', |
11 | - 'Grade' => '班级', | 11 | + 'Grade_id' => '班级', |
12 | 'School_id' => '学校', | 12 | 'School_id' => '学校', |
13 | 'Sno' => '学号', | 13 | 'Sno' => '学号', |
14 | 'Team_id' => '所属战队', | 14 | 'Team_id' => '所属战队', |
15 | + 'Team_rank' => '战队内排名', | ||
15 | 'Earn_score' => '总积分', | 16 | 'Earn_score' => '总积分', |
16 | 'Phone' => '手机号', | 17 | 'Phone' => '手机号', |
17 | 'Unique' => '手环ID', | 18 | 'Unique' => '手环ID', |
18 | 'Barcode' => '条形码', | 19 | 'Barcode' => '条形码', |
19 | 'Createtime' => '创建时间', | 20 | 'Createtime' => '创建时间', |
20 | 'Updatetime' => '更新时间', | 21 | 'Updatetime' => '更新时间', |
22 | + 'Grade.name' => '班级名称', | ||
21 | 'School.title' => '校区名称', | 23 | 'School.title' => '校区名称', |
22 | 'Team.title' => '战队昵称' | 24 | 'Team.title' => '战队昵称' |
23 | ]; | 25 | ]; |
@@ -46,6 +46,12 @@ class Study extends Model | @@ -46,6 +46,12 @@ class Study extends Model | ||
46 | 46 | ||
47 | 47 | ||
48 | 48 | ||
49 | + public function grade() | ||
50 | + { | ||
51 | + return $this->belongsTo('Grade', 'grade_id', 'id', [], 'LEFT')->setEagerlyType(0); | ||
52 | + } | ||
53 | + | ||
54 | + | ||
49 | public function school() | 55 | public function school() |
50 | { | 56 | { |
51 | return $this->belongsTo('School', 'school_id', 'id', [], 'LEFT')->setEagerlyType(0); | 57 | return $this->belongsTo('School', 'school_id', 'id', [], 'LEFT')->setEagerlyType(0); |
@@ -37,9 +37,9 @@ | @@ -37,9 +37,9 @@ | ||
37 | </div> | 37 | </div> |
38 | </div> | 38 | </div> |
39 | <div class="form-group"> | 39 | <div class="form-group"> |
40 | - <label class="control-label col-xs-12 col-sm-2">{:__('Grade')}:</label> | 40 | + <label class="control-label col-xs-12 col-sm-2">{:__('Grade_id')}:</label> |
41 | <div class="col-xs-12 col-sm-8"> | 41 | <div class="col-xs-12 col-sm-8"> |
42 | - <input id="c-grade" class="form-control" name="row[grade]" type="text"> | 42 | + <input id="c-grade_id" data-rule="required" data-source="grade/index" class="form-control selectpage" name="row[grade_id]" type="text" value=""> |
43 | </div> | 43 | </div> |
44 | </div> | 44 | </div> |
45 | <div class="form-group"> | 45 | <div class="form-group"> |
@@ -38,9 +38,9 @@ | @@ -38,9 +38,9 @@ | ||
38 | </div> | 38 | </div> |
39 | </div> | 39 | </div> |
40 | <div class="form-group"> | 40 | <div class="form-group"> |
41 | - <label class="control-label col-xs-12 col-sm-2">{:__('Grade')}:</label> | 41 | + <label class="control-label col-xs-12 col-sm-2">{:__('Grade_id')}:</label> |
42 | <div class="col-xs-12 col-sm-8"> | 42 | <div class="col-xs-12 col-sm-8"> |
43 | - <input id="c-grade" class="form-control" name="row[grade]" type="text" value="{$row.grade|htmlentities}"> | 43 | + <input id="c-grade_id" data-rule="required" data-source="grade/index" class="form-control selectpage" name="row[grade_id]" type="text" value="{$row.grade_id|htmlentities}"> |
44 | </div> | 44 | </div> |
45 | </div> | 45 | </div> |
46 | <div class="form-group"> | 46 | <div class="form-group"> |
@@ -89,8 +89,9 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin | @@ -89,8 +89,9 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin | ||
89 | {field: 'avatar', title: __('Avatar'), operate: false, events: Table.api.events.image, formatter: Table.api.formatter.image}, | 89 | {field: 'avatar', title: __('Avatar'), operate: false, events: Table.api.events.image, formatter: Table.api.formatter.image}, |
90 | {field: 'phone', title: __('Phone'), operate: 'LIKE'}, | 90 | {field: 'phone', title: __('Phone'), operate: 'LIKE'}, |
91 | {field: 'team.title', title: __('Team.title'), operate: 'LIKE'}, | 91 | {field: 'team.title', title: __('Team.title'), operate: 'LIKE'}, |
92 | + {field: 'team_rank', title: __('Team_rank')}, | ||
92 | {field: 'birthday', title: __('Birthday'),operate:false, addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime,datetimeFormat: "YYYY-MM-DD"}, | 93 | {field: 'birthday', title: __('Birthday'),operate:false, addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime,datetimeFormat: "YYYY-MM-DD"}, |
93 | - {field: 'grade', title: __('Grade'), operate: 'LIKE'}, | 94 | + {field: 'grade.name', title: __('Grade.name'), operate: 'LIKE'}, |
94 | {field: 'school.title', title: __('School.title'), operate: 'LIKE'}, | 95 | {field: 'school.title', title: __('School.title'), operate: 'LIKE'}, |
95 | {field: 'sno', title: __('Sno'), operate: 'LIKE'}, | 96 | {field: 'sno', title: __('Sno'), operate: 'LIKE'}, |
96 | // {field: 'team_id', title: __('Team_id')}, | 97 | // {field: 'team_id', title: __('Team_id')}, |
-
请 注册 或 登录 后发表评论