Compare commits

..

2 Commits

Author SHA1 Message Date
Karson fdb912e3e2 优化会员列表
移除User模型的group方法避免和基类group方法冲突
2025-06-18 17:01:54 +08:00
Karson a165258ffa 移除.bowerrc文件 2025-06-18 14:25:56 +08:00
5 changed files with 15 additions and 23 deletions

View File

@ -1,14 +0,0 @@
{
"directory": "public/assets/libs",
"ignoredDependencies": [
"es6-promise",
"file-saver",
"html2canvas",
"jspdf",
"jspdf-autotable",
"pdfmake"
],
"scripts":{
"postinstall": "node bower-cleanup.js"
}
}

View File

@ -41,7 +41,6 @@ class User extends Backend
}
list($where, $sort, $order, $offset, $limit) = $this->buildparams();
$list = $this->model
->with('group')
->where($where)
->order($sort, $order)
->paginate($limit);
@ -49,7 +48,9 @@ class User extends Backend
$v->avatar = $v->avatar ? cdnurl($v->avatar, true) : letter_avatar($v->nickname);
$v->hidden(['password', 'salt']);
}
$result = array("total" => $list->total(), "rows" => $list->items());
$rows = $list->items();
addtion($rows, [['field' => 'group_id', 'display' => 'group_name', 'model' => \app\admin\model\UserGroup::class]]);
$result = array("total" => $list->total(), "rows" => $rows);
return json($result);
}

View File

@ -106,9 +106,9 @@ class User extends Model
return $value ? $value : null;
}
public function group()
public function getGroupAttr($value, $data)
{
return $this->belongsTo('UserGroup', 'group_id', 'id', [], 'LEFT')->setEagerlyType(0);
return UserGroup::get($data['group_id']);
}
}

View File

@ -54,10 +54,10 @@ class UserRule extends Model
Tree::instance()->init($ruleList);
$ruleList = Tree::instance()->getTreeList(Tree::instance()->getTreeArray(0), 'name');
$hasChildrens = [];
foreach ($ruleList as $k => $v)
{
if ($v['haschild'])
foreach ($ruleList as $k => $v) {
if ($v['haschild']) {
$hasChildrens[] = $v['id'];
}
}
foreach ($ruleList as $k => $v) {
$state = array('selected' => in_array($v['id'], $selected) && !in_array($v['id'], $hasChildrens));

View File

@ -20,14 +20,19 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
table.bootstrapTable({
url: $.fn.bootstrapTable.defaults.extend.index_url,
pk: 'id',
sortName: 'user.id',
sortName: 'id',
fixedColumns: true,
fixedRightNumber: 1,
columns: [
[
{checkbox: true},
{field: 'id', title: __('Id'), sortable: true},
{field: 'group.name', title: __('Group')},
{
field: 'group_id', title: __('Group'), formatter: function (value, row, index) {
value = Fast.api.escape(row.group_name || '');
return '<a href="javascript:;" class="searchit" data-toggle="tooltip" title="' + __('Click to search %s', value) + '" data-field="group_id" data-value="' + parseInt(row.group_id) + '">' + value + '</a>';
}
},
{field: 'username', title: __('Username'), operate: 'LIKE'},
{field: 'nickname', title: __('Nickname'), operate: 'LIKE'},
{field: 'email', title: __('Email'), operate: 'LIKE'},