作者 开飞机的舒克

修改后台功能

... ... @@ -57,7 +57,7 @@ class Ronda extends Backend
->paginate($limit);
foreach ($list as $row) {
$row->visible(['id','title','holdtime','images','details']);
$row->visible(['id','title','holdtime','images','details','item_ids']);
$row->visible(['campus']);
$row->getRelation('campus')->visible(['title']);
}
... ...
... ... @@ -3,6 +3,7 @@
return [
'Campus_id' => '届次',
'Title' => '场次名称',
'Item_ids' => '项目名称',
'Holdtime' => '举办日期',
'Images' => '场次图片',
'Details' => '场次详情',
... ...
... ... @@ -25,11 +25,18 @@ class Ronda extends Model
// 追加属性
protected $append = [
'holdtime_text'
'holdtime_text',
'item_text',
];
public function getItemTextAttr($value, $data){
$item = explode(',',$data['item_ids']);
foreach ($item as $k){
$list[] = db('item')->where('id',$k)->value('title');
}
return $list;
}
... ...
... ... @@ -6,18 +6,18 @@
<input id="c-title" class="form-control" name="row[title]" type="text">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Ronda_ids')}:</label>
<div class="col-xs-12 col-sm-8">
<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">{:__('Campus_ids')}:</label>
<div class="col-xs-12 col-sm-8">
<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">{:__('Ronda_ids')}:</label>-->
<!-- <div class="col-xs-12 col-sm-8">-->
<!-- <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">{:__('Campus_ids')}:</label>-->
<!-- <div class="col-xs-12 col-sm-8">-->
<!-- <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_ids')}:</label>
<div class="col-xs-12 col-sm-8">
... ...
... ... @@ -7,6 +7,12 @@
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Item_ids')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-item_ids" data-rule="required" data-source="item/index" data-multiple="true" data-field="title" class="form-control selectpage" name="row[item_ids]" type="text" value="">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Title')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-title" class="form-control" name="row[title]" type="text">
... ... @@ -15,7 +21,7 @@
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Holdtime')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-holdtime" class="form-control datetimepicker" data-date-format="YYYY-MM-DD HH:mm:ss" data-use-current="true" name="row[holdtime]" type="text" value="{:date('Y-m-d H:i:s')}">
<input id="c-holdtime" class="form-control datetimepicker" data-date-format="YYYY-MM-DD HH:mm:ss" data-use-current="true" name="row[holdtime]" type="text" value="">
</div>
</div>
<div class="form-group">
... ...
... ... @@ -7,6 +7,12 @@
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Item_ids')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-item_ids" data-rule="required" data-source="item/index" data-multiple="true" data-field="title" class="form-control selectpage" name="row[item_ids]" type="text" value="{$row.item_ids|htmlentities}">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Title')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-title" class="form-control" name="row[title]" type="text" value="{$row.title|htmlentities}">
... ...
... ... @@ -36,29 +36,29 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
{field: 'id', title: __('Id'), operate: false},
// {field: 'campus_id', title: __('Campus_id')},
// {field: 'ronda_id', title: __('Ronda_id')},
{field: 'campus_text', title: __('Campus_ids'), operate: 'LIKE',
formatter : function(value, row, index, field){
return "<span style='display: block;overflow: hidden;text-overflow: ellipsis;white-space:nowrap;' title='" + row.campus_text + "'>" + value + "</span>";
},
cellStyle : function(value, row, index, field) {
return {
css: {
"white-space": "nowrap",
"text-overflow": "ellipsis",
"overflow": "hidden",
"max-width": "150px"
}
};
},
},
{field: 'ronda_text', title: __('Ronda_ids'), operate: false,formatter:Table.api.formatter.flag},
// {field: 'campus_text', title: __('Campus_ids'), operate: 'LIKE',
// formatter : function(value, row, index, field){
// return "<span style='display: block;overflow: hidden;text-overflow: ellipsis;white-space:nowrap;' title='" + row.campus_text + "'>" + value + "</span>";
// },
// cellStyle : function(value, row, index, field) {
// return {
// css: {
// "white-space": "nowrap",
// "text-overflow": "ellipsis",
// "overflow": "hidden",
// "max-width": "150px"
// }
// };
// },
// },
//{field: 'ronda_text', title: __('Ronda_ids'), operate: false,formatter:Table.api.formatter.flag},
{field: 'title', title: __('Title'), operate: 'LIKE'},
// {field: 'radar_id', title: __('Radar_id')},
// {field: 'user_id', title: __('User_id')},
{field: 'score', title: __('Score'), operate: false},
{field: 'user.nickname', title: __('User.nickname'), operate: false},
{field: 'user.teach_phone', title: __('User.teach_phone'), operate: false},
{field: 'radar_text', title: __('Radar.title'), operate: false, formatter: Table.api.formatter.label},
{field: 'score', title: __('Score'), operate: false},
{
field: 'createtime',
title: __('Createtime'),
... ...
... ... @@ -27,9 +27,10 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
{checkbox: true},
{field: 'id', title: __('Id'), operate: false},
{field: 'campus.title', title: __('Campus.title'), operate: 'LIKE'},
{field: 'item_text', title: __('Item_ids'), operate: false, formatter: Table.api.formatter.flag},
{field: 'title', title: __('Title'), operate: 'LIKE'},
{field: 'holdtime', title: __('Holdtime'), operate: 'LIKE',formatter:Table.api.formatter.datetime,datetimeFormat: "YYYY-MM-DD"},
{field: 'images', title: __('Images'), operate: false, events: Table.api.events.image, formatter: Table.api.formatter.images},
{field: 'holdtime', title: __('Holdtime'), operate: 'LIKE',formatter:Table.api.formatter.datetime,datetimeFormat: "YYYY-MM-DD"},
{field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
]
]
... ...