作者 开飞机的舒克

修改后台功能

@@ -57,7 +57,7 @@ class Ronda extends Backend @@ -57,7 +57,7 @@ class Ronda extends Backend
57 ->paginate($limit); 57 ->paginate($limit);
58 58
59 foreach ($list as $row) { 59 foreach ($list as $row) {
60 - $row->visible(['id','title','holdtime','images','details']); 60 + $row->visible(['id','title','holdtime','images','details','item_ids']);
61 $row->visible(['campus']); 61 $row->visible(['campus']);
62 $row->getRelation('campus')->visible(['title']); 62 $row->getRelation('campus')->visible(['title']);
63 } 63 }
@@ -3,6 +3,7 @@ @@ -3,6 +3,7 @@
3 return [ 3 return [
4 'Campus_id' => '届次', 4 'Campus_id' => '届次',
5 'Title' => '场次名称', 5 'Title' => '场次名称',
  6 + 'Item_ids' => '项目名称',
6 'Holdtime' => '举办日期', 7 'Holdtime' => '举办日期',
7 'Images' => '场次图片', 8 'Images' => '场次图片',
8 'Details' => '场次详情', 9 'Details' => '场次详情',
@@ -25,11 +25,18 @@ class Ronda extends Model @@ -25,11 +25,18 @@ class Ronda extends Model
25 25
26 // 追加属性 26 // 追加属性
27 protected $append = [ 27 protected $append = [
28 - 'holdtime_text' 28 + 'holdtime_text',
  29 + 'item_text',
29 ]; 30 ];
30 31
31 32
32 - 33 + public function getItemTextAttr($value, $data){
  34 + $item = explode(',',$data['item_ids']);
  35 + foreach ($item as $k){
  36 + $list[] = db('item')->where('id',$k)->value('title');
  37 + }
  38 + return $list;
  39 + }
33 40
34 41
35 42
@@ -6,18 +6,18 @@ @@ -6,18 +6,18 @@
6 <input id="c-title" class="form-control" name="row[title]" type="text"> 6 <input id="c-title" class="form-control" name="row[title]" type="text">
7 </div> 7 </div>
8 </div> 8 </div>
9 - <div class="form-group">  
10 - <label class="control-label col-xs-12 col-sm-2">{:__('Ronda_ids')}:</label>  
11 - <div class="col-xs-12 col-sm-8">  
12 - <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="">  
13 - </div>  
14 - </div>  
15 - <div class="form-group">  
16 - <label class="control-label col-xs-12 col-sm-2">{:__('Campus_ids')}:</label>  
17 - <div class="col-xs-12 col-sm-8">  
18 - <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="">  
19 - </div>  
20 - </div> 9 +<!-- <div class="form-group">-->
  10 +<!-- <label class="control-label col-xs-12 col-sm-2">{:__('Ronda_ids')}:</label>-->
  11 +<!-- <div class="col-xs-12 col-sm-8">-->
  12 +<!-- <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="">-->
  13 +<!-- </div>-->
  14 +<!-- </div>-->
  15 +<!-- <div class="form-group">-->
  16 +<!-- <label class="control-label col-xs-12 col-sm-2">{:__('Campus_ids')}:</label>-->
  17 +<!-- <div class="col-xs-12 col-sm-8">-->
  18 +<!-- <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="">-->
  19 +<!-- </div>-->
  20 +<!-- </div>-->
21 <div class="form-group"> 21 <div class="form-group">
22 <label class="control-label col-xs-12 col-sm-2">{:__('Radar_ids')}:</label> 22 <label class="control-label col-xs-12 col-sm-2">{:__('Radar_ids')}:</label>
23 <div class="col-xs-12 col-sm-8"> 23 <div class="col-xs-12 col-sm-8">
@@ -7,6 +7,12 @@ @@ -7,6 +7,12 @@
7 </div> 7 </div>
8 </div> 8 </div>
9 <div class="form-group"> 9 <div class="form-group">
  10 + <label class="control-label col-xs-12 col-sm-2">{:__('Item_ids')}:</label>
  11 + <div class="col-xs-12 col-sm-8">
  12 + <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="">
  13 + </div>
  14 + </div>
  15 + <div class="form-group">
10 <label class="control-label col-xs-12 col-sm-2">{:__('Title')}:</label> 16 <label class="control-label col-xs-12 col-sm-2">{:__('Title')}:</label>
11 <div class="col-xs-12 col-sm-8"> 17 <div class="col-xs-12 col-sm-8">
12 <input id="c-title" class="form-control" name="row[title]" type="text"> 18 <input id="c-title" class="form-control" name="row[title]" type="text">
@@ -15,7 +21,7 @@ @@ -15,7 +21,7 @@
15 <div class="form-group"> 21 <div class="form-group">
16 <label class="control-label col-xs-12 col-sm-2">{:__('Holdtime')}:</label> 22 <label class="control-label col-xs-12 col-sm-2">{:__('Holdtime')}:</label>
17 <div class="col-xs-12 col-sm-8"> 23 <div class="col-xs-12 col-sm-8">
18 - <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')}"> 24 + <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="">
19 </div> 25 </div>
20 </div> 26 </div>
21 <div class="form-group"> 27 <div class="form-group">
@@ -7,6 +7,12 @@ @@ -7,6 +7,12 @@
7 </div> 7 </div>
8 </div> 8 </div>
9 <div class="form-group"> 9 <div class="form-group">
  10 + <label class="control-label col-xs-12 col-sm-2">{:__('Item_ids')}:</label>
  11 + <div class="col-xs-12 col-sm-8">
  12 + <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}">
  13 + </div>
  14 + </div>
  15 + <div class="form-group">
10 <label class="control-label col-xs-12 col-sm-2">{:__('Title')}:</label> 16 <label class="control-label col-xs-12 col-sm-2">{:__('Title')}:</label>
11 <div class="col-xs-12 col-sm-8"> 17 <div class="col-xs-12 col-sm-8">
12 <input id="c-title" class="form-control" name="row[title]" type="text" value="{$row.title|htmlentities}"> 18 <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 @@ -36,29 +36,29 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
36 {field: 'id', title: __('Id'), operate: false}, 36 {field: 'id', title: __('Id'), operate: false},
37 // {field: 'campus_id', title: __('Campus_id')}, 37 // {field: 'campus_id', title: __('Campus_id')},
38 // {field: 'ronda_id', title: __('Ronda_id')}, 38 // {field: 'ronda_id', title: __('Ronda_id')},
39 - {field: 'campus_text', title: __('Campus_ids'), operate: 'LIKE',  
40 - formatter : function(value, row, index, field){  
41 - return "<span style='display: block;overflow: hidden;text-overflow: ellipsis;white-space:nowrap;' title='" + row.campus_text + "'>" + value + "</span>";  
42 - },  
43 - cellStyle : function(value, row, index, field) {  
44 - return {  
45 - css: {  
46 - "white-space": "nowrap",  
47 - "text-overflow": "ellipsis",  
48 - "overflow": "hidden",  
49 - "max-width": "150px"  
50 - }  
51 - };  
52 - },  
53 - },  
54 - {field: 'ronda_text', title: __('Ronda_ids'), operate: false,formatter:Table.api.formatter.flag}, 39 +// {field: 'campus_text', title: __('Campus_ids'), operate: 'LIKE',
  40 +// formatter : function(value, row, index, field){
  41 +// return "<span style='display: block;overflow: hidden;text-overflow: ellipsis;white-space:nowrap;' title='" + row.campus_text + "'>" + value + "</span>";
  42 +// },
  43 +// cellStyle : function(value, row, index, field) {
  44 +// return {
  45 +// css: {
  46 +// "white-space": "nowrap",
  47 +// "text-overflow": "ellipsis",
  48 +// "overflow": "hidden",
  49 +// "max-width": "150px"
  50 +// }
  51 +// };
  52 +// },
  53 +// },
  54 + //{field: 'ronda_text', title: __('Ronda_ids'), operate: false,formatter:Table.api.formatter.flag},
55 {field: 'title', title: __('Title'), operate: 'LIKE'}, 55 {field: 'title', title: __('Title'), operate: 'LIKE'},
56 // {field: 'radar_id', title: __('Radar_id')}, 56 // {field: 'radar_id', title: __('Radar_id')},
57 // {field: 'user_id', title: __('User_id')}, 57 // {field: 'user_id', title: __('User_id')},
58 - {field: 'score', title: __('Score'), operate: false},  
59 {field: 'user.nickname', title: __('User.nickname'), operate: false}, 58 {field: 'user.nickname', title: __('User.nickname'), operate: false},
60 {field: 'user.teach_phone', title: __('User.teach_phone'), operate: false}, 59 {field: 'user.teach_phone', title: __('User.teach_phone'), operate: false},
61 {field: 'radar_text', title: __('Radar.title'), operate: false, formatter: Table.api.formatter.label}, 60 {field: 'radar_text', title: __('Radar.title'), operate: false, formatter: Table.api.formatter.label},
  61 + {field: 'score', title: __('Score'), operate: false},
62 { 62 {
63 field: 'createtime', 63 field: 'createtime',
64 title: __('Createtime'), 64 title: __('Createtime'),
@@ -27,9 +27,10 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin @@ -27,9 +27,10 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
27 {checkbox: true}, 27 {checkbox: true},
28 {field: 'id', title: __('Id'), operate: false}, 28 {field: 'id', title: __('Id'), operate: false},
29 {field: 'campus.title', title: __('Campus.title'), operate: 'LIKE'}, 29 {field: 'campus.title', title: __('Campus.title'), operate: 'LIKE'},
  30 + {field: 'item_text', title: __('Item_ids'), operate: false, formatter: Table.api.formatter.flag},
30 {field: 'title', title: __('Title'), operate: 'LIKE'}, 31 {field: 'title', title: __('Title'), operate: 'LIKE'},
31 - {field: 'holdtime', title: __('Holdtime'), operate: 'LIKE',formatter:Table.api.formatter.datetime,datetimeFormat: "YYYY-MM-DD"},  
32 {field: 'images', title: __('Images'), operate: false, events: Table.api.events.image, formatter: Table.api.formatter.images}, 32 {field: 'images', title: __('Images'), operate: false, events: Table.api.events.image, formatter: Table.api.formatter.images},
  33 + {field: 'holdtime', title: __('Holdtime'), operate: 'LIKE',formatter:Table.api.formatter.datetime,datetimeFormat: "YYYY-MM-DD"},
33 {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate} 34 {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
34 ] 35 ]
35 ] 36 ]