Files
ulthon_admin/extend/base/admin/view/system/mcp_log/index.js

49 lines
2.3 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

$(function(){
// 密钥名称LEFT JOIN 关联,密钥不存在或已软删时兜底显示
var keyNameTemplet = function(d) {
// 兼容 withJoin 序列化的驼峰键名 mcpKey 与蛇形 mcp_key
var k = d.mcpKey || d.mcp_key;
if (k && k.title && (!k.delete_time || k.delete_time === 0)) {
return k.title;
}
return '<span style="color:#999">(已删除)#' + d.key_id + '</span>';
};
// 成功/失败徽章
var successTemplet = function(d) {
if (d.is_success == 1) {
return '<span style="display:inline-block;padding:2px 10px;border-radius:3px;color:#5FB878;background:#e8f8ef;font-size:12px;">成功</span>';
}
return '<span style="display:inline-block;padding:2px 10px;border-radius:3px;color:#FF5722;background:#ffe8e2;font-size:12px;">失败</span>';
};
// 参数摘要:截断 200 字符title 悬浮全文
var argumentsTemplet = function(d) {
if (!d.arguments) return '<span style="color:#999">-</span>';
var text = String(d.arguments);
var safe = text.replace(/&/g,'&amp;').replace(/</g,'&lt;').replace(/>/g,'&gt;').replace(/"/g,'&quot;').replace(/'/g,'&#39;');
if (text.length > 200) {
return '<span title="' + safe + '" style="cursor:pointer;">' + safe.substring(0, 200) + '...</span>';
}
return safe;
};
ua.table.render({
init: init,
toolbar: ['refresh', 'delete'],
defaultToolbar: ['filter'],
cols: [[
{type: 'checkbox'},
{field: 'id', title: 'ID', width: 80, sort: true},
{field: 'key_id', title: '密钥', minWidth: 140, templet: keyNameTemplet, search: 'select', selectList: ua.getDataBrage('select_list_mcp_key'), selectValue: 'id', selectLabel: 'title'},
{field: 'node', title: '节点', minWidth: 180},
{field: 'is_success', title: '状态', width: 90, templet: successTemplet, search: 'select', selectList: {1: '成功', 0: '失败'}},
{field: 'cost_ms', title: '耗时(ms)', width: 100, search: false},
{field: 'arguments', title: '参数摘要', minWidth: 220, templet: argumentsTemplet, search: false},
{field: 'create_time', title: '调用时间', width: 170, templet: ua.table.date, search: 'range'},
]],
});
ua.listen();
})