增加title,text回调函数调用;

This commit is contained in:
2023-09-07 09:33:54 +08:00
parent 01ecc4525e
commit 1b0ae546c3
3 changed files with 13 additions and 3 deletions

View File

@@ -212,7 +212,7 @@ class AdminController extends BaseController
*/ */
protected function buildTableParames($excludeFields = []) protected function buildTableParames($excludeFields = [])
{ {
$get = $this->request->get('', null, null); $get = $this->request->get('', null, []);
$page = isset($get['page']) && !empty($get['page']) ? $get['page'] : 1; $page = isset($get['page']) && !empty($get['page']) ? $get['page'] : 1;
$limit = isset($get['limit']) && !empty($get['limit']) ? $get['limit'] : 15; $limit = isset($get['limit']) && !empty($get['limit']) ? $get['limit'] : 15;
$group = isset($get['group']) && !empty($get['group']) ? $get['group'] : null; $group = isset($get['group']) && !empty($get['group']) ? $get['group'] : null;

View File

@@ -47,6 +47,7 @@ define(["jquery", "easy-admin"], function ($, ea) {
'edit', 'edit',
[{ [{
text: '设置密码', text: '设置密码',
titleField: 'username',
url: init.password_url, url: init.password_url,
method: 'open', method: 'open',
auth: 'password', auth: 'password',

View File

@@ -778,15 +778,24 @@ define(["jquery", "ckeditor", 'miniTheme', 'tableData', 'citypicker', 'tagInput'
operat.title = operat.title || operat.text; operat.title = operat.title || operat.text;
operat.text = operat.text || operat.title; operat.text = operat.text || operat.title;
var titleEndfix = ''; var titleEndfix = '';
if (typeof operat.titleField == 'function') { if (typeof operat.titleField == 'function') {
titleEndfix = operat.titleField(data) console.log(operat.titleField(data, operat));
titleEndfix = operat.titleField(data, operat)
} else if (data[operat.titleField]) { } else if (data[operat.titleField]) {
titleEndfix = '-' + data[operat.titleField]; titleEndfix = '-' + data[operat.titleField];
} }
if (typeof operat.text == 'function') {
operat.text = operat.text(data, operat)
}
if (typeof operat.title == 'function') {
operat.title = operat.title(data, operat)
}
var formatOperat = operat; var formatOperat = operat;
formatOperat.icon = formatOperat.icon !== '' ? '<i class="' + formatOperat.icon + '"></i> ' : ''; formatOperat.icon = formatOperat.icon !== '' ? '<i class="' + formatOperat.icon + '"></i> ' : '';
formatOperat.class = formatOperat.class !== '' ? 'class="' + formatOperat.class + '" ' : ''; formatOperat.class = formatOperat.class !== '' ? 'class="' + formatOperat.class + '" ' : '';