作者 开飞机的舒克

修改学生管理中缺少总排行问题

... ... @@ -22,5 +22,6 @@ return [
'Grade' => '班级名称',
'School' => '学校名称',
'Team.title' => '所属战队',
'Download' => '批量下载'
'Download' => '批量下载',
'Rank' => '总排名',
];
... ...
... ... @@ -27,7 +27,8 @@ class Study extends Model
protected $append = [
'gender_text',
'team_rank',
'barcode_images'
'barcode_images',
'rank'
];
... ... @@ -57,6 +58,18 @@ class Study extends Model
return $order;
}
public function getRankAttr($value,$data){
$list = $this->order('earn_score','desc')->column('id');
$order = 0;
foreach ($list as $k=> $v){
if($data['id'] == $v){
$order = $k+1;
break;
}
}
return $order;
}
public function getBarcodeImagesAttr($value,$data){
$list = $this->where('id',$data['id'])->value('barcode');
$order = 'http://campus.shs.broing.cn'.$list;
... ...
... ... @@ -102,6 +102,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
{field: 'earn_score', title: __('Earn_score'),operate:false},
{field: 'unique', title: __('Unique'), operate:false},
{field: 'barcode_images', title: __('Barcode'),events: Table.api.events.image, formatter: Table.api.formatter.image, operate:false},
{field: 'rank', title: __('Rank'),operate: false},
// {field: 'createtime', title: __('Createtime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
// {field: 'updatetime', title: __('Updatetime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
{field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate,
... ...