作者 开飞机的舒克

项目管理可多选界次和维度

... ... @@ -54,17 +54,17 @@ class Item extends Backend
list($where, $sort, $order, $offset, $limit) = $this->buildparams();
$list = $this->model
->with(['user','ronda','radar','campus'])
->where($where)
->order($sort, $order)
->paginate($limit);
->with(['user','ronda','radar','campus'])
->where($where)
->order($sort, $order)
->paginate($limit);
foreach ($list as $row) {
$row->getRelation('user')->visible(['username','teach_phone']);
$row->getRelation('ronda')->visible(['title']);
$row->getRelation('radar')->visible(['title']);
$row->getRelation('campus')->visible(['title']);
$row->getRelation('ronda')->visible(['title']);
$row->getRelation('radar')->visible(['title']);
$row->getRelation('campus')->visible(['title']);
}
$result = array("total" => $list->total(), "rows" => $list->items());
... ... @@ -130,7 +130,7 @@ class Item extends Backend
$res = db('study_score_log l')
->join('study s', 's.id = l.study_id')
->where('item_id', $data['id'])
->field('l.study_id,sum(l.score) as sum_score,s.name,s.unique,s.team_id,s.school,s.grade')
->field('l.study_id,sum(l.score) as sum_score,s.name,s.unique,s.team,s.school,s.grade')
->group('l.study_id')
->order('sum_score', 'desc')
->select();
... ... @@ -139,7 +139,7 @@ class Item extends Backend
$list[] = [
'name' => $v['name'],
'unique' => $v['unique'],
'title' => db('team')->where('id',$v['team_id'])->value('title'),
'title' => db('team')->where('title',$v['team'])->value('title'),
'school' => $v['school'],
'grade' => $v['grade'],
'score' => $v['sum_score']
... ...
<?php
return [
'Campus_id' => '届次',
'Ronda_id' => '所属场次',
'Title' => '项目名称',
'Radar_id' => '所属维度',
'User_id' => '所属老师',
'Details' => '项目详情',
'Score' => '可获积分',
'Createtime' => '创建时间',
'Updatetime' => '更新时间',
'User.username' => '用户名',
'User.teach_phone' => '老师手机号',
'Ronda.title' => '场次名称',
'Radar.title' => '维度名称',
'Campus.title' => '届次'
'Title' => '名称',
'Details' => '详情',
'Ronda_ids' => '场次',
'Campus_ids' => '校区',
'Radar_ids' => '所属维度',
'User_id' => '所属老师',
'Images' => '项目图片',
'Score' => '积分',
'Createtime' => '创建时间',
'Updatetime' => '更新时间',
'Campus.title' => '校区名称',
'Ronda.title' => '场次名称',
'Radar.title' => '维度名称',
'User.id' => 'ID',
'User.group_id' => '组别ID',
'User.username' => '用户名',
'User.nickname' => '昵称',
'User.password' => '密码',
'User.salt' => '密码盐',
'User.email' => '电子邮箱',
'User.mobile' => '手机号',
'User.avatar' => '头像',
'User.level' => '等级',
'User.gender' => '性别',
'User.birthday' => '生日',
'User.bio' => '格言',
'User.money' => '余额',
'User.score' => '积分',
'User.successions' => '连续登录天数',
'User.maxsuccessions' => '最大连续登录天数',
'User.prevtime' => '上次登录时间',
'User.logintime' => '登录时间',
'User.loginip' => '登录IP',
'User.loginfailure' => '失败次数',
'User.joinip' => '加入IP',
'User.jointime' => '加入时间',
'User.createtime' => '创建时间',
'User.updatetime' => '更新时间',
'User.token' => 'Token',
'User.status' => '状态',
'User.verification' => '验证',
'User.teach_phone' => '老师手机号',
'User.is_teach' => '是否为老师',
'User.is_teach 0' => '否',
'User.is_teach 1' => '是',
'User.bind_study' => '是否绑定学生信息',
'User.bind_study 0' => '否',
'User.bind_study 1' => '是'
];
... ...
... ... @@ -25,35 +25,38 @@ class Item extends Model
// 追加属性
protected $append = [
'campus_text'
];
public function getCampusTextAttr($value,$data){
$cid = db('ronda')->where('id',$data['ronda_id'])->value('campus_id');
$list = db('campus')->where('id',$cid)->value('title');
return $list;
}
public function user()
public function campus()
{
return $this->belongsTo('User', 'user_id', 'id', [], 'LEFT')->setEagerlyType(0);
return $this->belongsTo('Campus', 'campus_ids', 'id', [], 'LEFT')->setEagerlyType(0);
}
public function ronda()
{
return $this->belongsTo('Ronda', 'ronda_id', 'id', [], 'LEFT')->setEagerlyType(0);
return $this->belongsTo('Ronda', 'ronda_ids', 'id', [], 'LEFT')->setEagerlyType(0);
}
public function radar()
{
return $this->belongsTo('Radar', 'radar_id', 'id', [], 'LEFT')->setEagerlyType(0);
return $this->belongsTo('Radar', 'radar_ids', 'id', [], 'LEFT')->setEagerlyType(0);
}
public function campus()
public function user()
{
return $this->belongsTo('Campus', 'campus_id', 'id', [], 'LEFT')->setEagerlyType(0);
return $this->belongsTo('User', 'user_id', 'nickname', [], 'LEFT')->setEagerlyType(0);
}
}
... ...
... ... @@ -7,39 +7,53 @@
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Campus_id')}:</label>
<label class="control-label col-xs-12 col-sm-2">{:__('Ronda_ids')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-campus_id" data-rule="required" data-source="campus/index" class="form-control selectpage" data-field="title" name="row[campus_id]" type="text" value="">
<input id="c-ronda_ids" data-rule="required" data-source="ronda/index" data-multiple="true" data-field="title" class="form-control selectpage" name="row[ronda_ids]" type="text" value="">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Ronda_id')}:</label>
<label class="control-label col-xs-12 col-sm-2">{:__('Campus_ids')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-ronda_id" data-rule="required" data-source="ronda/index" class="form-control" data-field="id" name="row[ronda_id]" type="text" value="">
<input id="c-campus_ids" data-rule="required" data-source="campus/index" data-multiple="true" data-field="title" class="form-control selectpage" name="row[campus_ids]" type="text" value="">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Radar_id')}:</label>
<label class="control-label col-xs-12 col-sm-2">{:__('Radar_ids')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-radar_id" data-rule="required" data-source="radar/index" class="form-control selectpage" data-field="title" name="row[radar_id]" type="text" value="">
<input id="c-radar_ids" data-rule="required" data-source="radar/index" data-multiple="true" data-field="title" class="form-control selectpage" name="row[radar_ids]" type="text" value="">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('User_id')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-user_id" data-rule="required" data-source="user/user/index" data-field="nickname" class="form-control selectpage" name="row[user_id]" type="text" value="">
<input id="c-user_id" data-rule="required" data-source="user/user/index" data-field="nickname" class="form-control selectpage" name="row[user_id]" type="text" value="">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Images')}:</label>
<div class="col-xs-12 col-sm-8">
<div class="input-group">
<input id="c-images" class="form-control" size="50" name="row[images]" type="text">
<div class="input-group-addon no-border no-padding">
<span><button type="button" id="faupload-images" class="btn btn-danger faupload" data-input-id="c-images" data-mimetype="image/gif,image/jpeg,image/png,image/jpg,image/bmp,image/webp" data-multiple="true" data-preview-id="p-images"><i class="fa fa-upload"></i> {:__('Upload')}</button></span>
<span><button type="button" id="fachoose-images" class="btn btn-primary fachoose" data-input-id="c-images" data-mimetype="image/*" data-multiple="true"><i class="fa fa-list"></i> {:__('Choose')}</button></span>
</div>
<span class="msg-box n-right" for="c-images"></span>
</div>
<ul class="row list-inline faupload-preview" id="p-images"></ul>
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Score')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-score" class="form-control" step="0.01" name="row[score]" type="number">
<input id="c-score" class="form-control" step="0.01" name="row[score]" type="text">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Details')}:</label>
<div class="col-xs-12 col-sm-8">
<textarea id="c-details" class="form-control" rows="5" name="row[details]" cols="50"></textarea>
<textarea id="c-details" class="form-control " rows="5" name="row[details]" cols="50"></textarea>
</div>
</div>
<div class="form-group layer-footer">
... ...
... ... @@ -7,39 +7,53 @@
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Campus_id')}:</label>
<label class="control-label col-xs-12 col-sm-2">{:__('Ronda_ids')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-campus_id" data-rule="required" data-source="campus/index" class="form-control selectpage" name="row[campus_id]" data-field="title" type="text" value="{$row.campus_id|htmlentities}">
<input id="c-ronda_ids" data-rule="required" data-source="ronda/index" data-multiple="true" data-field="title" class="form-control selectpage" name="row[ronda_ids]" type="text" value="{$row.ronda_ids|htmlentities}">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Ronda_id')}:</label>
<label class="control-label col-xs-12 col-sm-2">{:__('Campus_ids')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-ronda_id" data-rule="required" data-source="ronda/index" class="form-control" name="row[ronda.title]" data-field="title" type="text" value="{$row.ronda.title|htmlentities}">
<input id="c-campus_ids" data-rule="required" data-source="campus/index" data-multiple="true" data-field="title" class="form-control selectpage" name="row[campus_ids]" type="text" value="{$row.campus_ids|htmlentities}">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Radar_id')}:</label>
<label class="control-label col-xs-12 col-sm-2">{:__('Radar_ids')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-radar_id" data-rule="required" data-source="radar/index" class="form-control selectpage" name="row[radar_id]" data-field="title" type="text" value="{$row.radar_id|htmlentities}">
<input id="c-radar_ids" data-rule="required" data-source="radar/index" data-multiple="true" data-field="title" class="form-control selectpage" name="row[radar_ids]" type="text" value="{$row.radar_ids|htmlentities}">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('User_id')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-user_id" data-rule="required" data-source="user/user/index" data-field="username" class="form-control selectpage" name="row[user_id]" type="text" value="{$row.user_id|htmlentities}">
<input id="c-user_id" data-rule="required" data-source="user/user/index" data-field="nickname" class="form-control selectpage" name="row[user_id]" type="text" value="{$row.user_id|htmlentities}">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Images')}:</label>
<div class="col-xs-12 col-sm-8">
<div class="input-group">
<input id="c-images" class="form-control" size="50" name="row[images]" type="text" value="{$row.images|htmlentities}">
<div class="input-group-addon no-border no-padding">
<span><button type="button" id="faupload-images" class="btn btn-danger faupload" data-input-id="c-images" data-mimetype="image/gif,image/jpeg,image/png,image/jpg,image/bmp,image/webp" data-multiple="true" data-preview-id="p-images"><i class="fa fa-upload"></i> {:__('Upload')}</button></span>
<span><button type="button" id="fachoose-images" class="btn btn-primary fachoose" data-input-id="c-images" data-mimetype="image/*" data-multiple="true"><i class="fa fa-list"></i> {:__('Choose')}</button></span>
</div>
<span class="msg-box n-right" for="c-images"></span>
</div>
<ul class="row list-inline faupload-preview" id="p-images"></ul>
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Score')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-score" class="form-control" step="0.01" name="row[score]" type="number" value="{$row.score|htmlentities}">
<input id="c-score" class="form-control" step="0.01" name="row[score]" type="text" value="{$row.score|htmlentities}">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Details')}:</label>
<div class="col-xs-12 col-sm-8">
<textarea id="c-details" class="form-control" rows="5" name="row[details]" cols="50">{$row.details|htmlentities}</textarea>
<textarea id="c-details" class="form-control editor" rows="5" name="row[details]" cols="50">{$row.details|htmlentities}</textarea>
</div>
</div>
<div class="form-group layer-footer">
... ...
... ... @@ -2,7 +2,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
var Controller = {
index: function () {
// 初始化表格参数配置
// 初始化表格参数配置
Table.api.init({
extend: {
index_url: 'item/index' + location.search,
... ... @@ -17,7 +17,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
var table = $("#table");
// 初始化表格
// 初始化表格
table.bootstrapTable({
url: $.fn.bootstrapTable.defaults.extend.index_url,
pk: 'id',
... ... @@ -26,7 +26,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
fixedRightNumber: 1,
showToggle: false,//浏览模式功能关闭
showColumns: false,//显示隐藏列功能关闭
//commonSearch: false, //关闭通用搜索按钮
//commonSearch: false, //关闭通用搜索按钮
showExport: false,//导出功能关闭
clickToSelect: false, //是否启用点击选中
dblClickToEdit: false, //是否启用双击编辑
... ... @@ -34,20 +34,28 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
[
{checkbox: true},
{field: 'id', title: __('Id'), operate: false},
// {field: 'campus_id', title: __('Campus_id')},
// {field: 'ronda_id', title: __('Ronda_id')},
// {field: 'campus_id', title: __('Campus_id')},
// {field: 'ronda_id', title: __('Ronda_id')},
{field: 'campus.title', title: __('所属校区'), operate: 'LIKE'},
{field: 'ronda.title', title: __('场次'), operate: false},
{field: 'title', title: __('Title'), operate: 'LIKE'},
// {field: 'radar_id', title: __('Radar_id')},
// {field: 'user_id', title: __('User_id')},
{field: 'score', title: __('可获积分'), operate:false},
// {field: 'radar_id', title: __('Radar_id')},
// {field: 'user_id', title: __('User_id')},
{field: 'score', title: __('可获积分'), operate: false},
{field: 'user.nickname', title: __('管理老师'), operate: false},
{field: 'user.teach_phone', title: __('User.teach_phone'), operate: false},
{field: 'radar.title', title: __('Radar.title'), operate: false},
{field: 'createtime', title: __('Createtime'), operate:false, 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,
{
field: 'createtime',
title: __('Createtime'),
operate: false,
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,
buttons: [
{
name: 'details',
... ... @@ -61,12 +69,13 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
},
},
],
formatter: Table.api.formatter.operate}
formatter: Table.api.formatter.operate
}
]
]
});
// 为表格绑定事件
// 为表格绑定事件
Table.api.bindevent(table);
},
add: function () {
... ...