作者 杨育虎

服务端

... ... @@ -22,7 +22,7 @@ class User extends Backend
{
parent::_initialize();
$this->model = new \app\admin\model\User;
$this->view->assign("statusList", $this->model->getStatusList());
}
public function import()
... ... @@ -60,7 +60,7 @@ class User extends Backend
->paginate($limit);
foreach ($list as $row) {
$row->visible(['nickname','avatar','money','createtime','updatetime','status']);
$row->visible(['id','nickname','avatar','money','createtime','updatetime','status']);
}
... ...
... ... @@ -9,5 +9,7 @@ return [
'Money' => '钱包',
'Createtime' => '创建时间',
'Updatetime' => '登陆时间',
'Status' => '状态0=正常,1=已拉黑'
'Status' => '状态',
'Status 0' => '正常',
'Status 1' => '已拉黑'
];
... ...
... ... @@ -25,14 +25,23 @@ class User extends Model
// 追加属性
protected $append = [
'status_text'
];
public function getStatusList()
{
return ['0' => __('Status 0'), '1' => __('Status 1')];
}
public function getStatusTextAttr($value, $data)
{
$value = $value ? $value : (isset($data['status']) ? $data['status'] : '');
$list = $this->getStatusList();
return isset($list[$value]) ? $list[$value] : '';
}
... ...
... ... @@ -41,7 +41,13 @@
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Status')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-status" data-rule="required" class="form-control" name="row[status]" type="number">
<div class="radio">
{foreach name="statusList" item="vo"}
<label for="row[status]-{$key}"><input id="row[status]-{$key}" name="row[status]" type="radio" value="{$key}" {in name="key" value="0"}checked{/in} /> {$vo}</label>
{/foreach}
</div>
</div>
</div>
<div class="form-group layer-footer">
... ...
... ... @@ -41,7 +41,13 @@
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Status')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-status" data-rule="required" class="form-control" name="row[status]" type="number" value="{$row.status|htmlentities}">
<div class="radio">
{foreach name="statusList" item="vo"}
<label for="row[status]-{$key}"><input id="row[status]-{$key}" name="row[status]" type="radio" value="{$key}" {in name="key" value="$row.status"}checked{/in} /> {$vo}</label>
{/foreach}
</div>
</div>
</div>
<div class="form-group layer-footer">
... ...
<div class="panel panel-default panel-intro">
{:build_heading()}
<div class="panel-heading">
{:build_heading(null,FALSE)}
<ul class="nav nav-tabs" data-field="status">
<li class="{:$Think.get.status === null ? 'active' : ''}"><a href="#t-all" data-value="" data-toggle="tab">{:__('All')}</a></li>
{foreach name="statusList" item="vo"}
<li class="{:$Think.get.status === (string)$key ? 'active' : ''}"><a href="#t-{$key}" data-value="{$key}" data-toggle="tab">{$vo}</a></li>
{/foreach}
</ul>
</div>
<div class="panel-body">
<div id="myTabContent" class="tab-content">
... ...
g4D7ya9NVQ6UQzRm
\ No newline at end of file
... ...
g4D7ya9NVQ6UQzRm
\ No newline at end of file
... ...
... ... @@ -25,12 +25,13 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
columns: [
[
{checkbox: true},
{field: 'id', title: __('Id')},
{field: 'nickname', title: __('Nickname'), operate: 'LIKE'},
{field: 'avatar', title: __('Avatar'), operate: 'LIKE', events: Table.api.events.image, formatter: Table.api.formatter.image},
{field: 'money', title: __('Money'), operate:'BETWEEN'},
{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: 'status', title: __('Status')},
{field: 'status', title: __('Status'), searchList: {"0":__('Status 0'),"1":__('Status 1')}, formatter: Table.api.formatter.status},
{field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
]
]
... ...
不能预览此文件类型

217 字节 | 宽: | 高:

217 字节 | 宽: | 高:

  • 两方对比
  • 交换覆盖
  • 透明覆盖

289 字节 | 宽: | 高:

221 字节 | 宽: | 高:

  • 两方对比
  • 交换覆盖
  • 透明覆盖

215 字节 | 宽: | 高:

219 字节 | 宽: | 高:

  • 两方对比
  • 交换覆盖
  • 透明覆盖