Files
ulthon_admin/extend/base/admin/view/system/notice/index.js
2026-10-12 12:09:01 +00:00

55 lines
2.1 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(){
// 场景徽章:标题取 data_brage 下发的 scenes() 动态映射,色标按场景写死(layui-badge 色系)
var sceneColorMap = {
system: 'layui-badge',
common: 'layui-badge layui-bg-blue',
admin_login: 'layui-badge layui-bg-green',
mall_stock: 'layui-badge layui-bg-orange',
};
var sceneTemplet = function(d) {
var titles = ua.getDataBrage('select_list_scene');
var text = titles[d.scene] || d.scene;
var cls = sceneColorMap[d.scene] || 'layui-badge layui-bg-gray';
return '<span class="' + cls + '">' + text + '</span>';
};
var senderTemplet = function(d) {
if (!d.send_admin_id) {
return '<span style="color:#999">系统</span>';
}
return d.send_admin_nickname || ('#' + d.send_admin_id);
};
ua.table.render({
init: init,
toolbar: ['refresh', 'delete'],
defaultToolbar: ['filter'],
cols: [[
{type: 'checkbox'},
{field: 'id', title: 'ID', width: 80, sort: true},
{field: 'scene', title: '场景', width: 110, search: 'select', searchOp: '=', selectList: ua.getDataBrage('select_list_scene'), templet: sceneTemplet},
{field: 'title', title: '标题', minWidth: 220},
{field: 'send_admin_nickname', title: '发送者', width: 120, search: false, templet: senderTemplet},
{field: 'create_time', title: '创建时间', width: 170, templet: ua.table.date, search: 'range'},
{
width: 130, title: '操作', templet: ua.table.tool, fixed: 'right', operat: [
[{
class: 'layui-btn layui-btn-primary layui-btn-xs',
method: 'tab',
field: 'id',
text: '详情',
title: '查看详情',
auth: 'read',
url: init.readUrl,
icon: ''
}],
'delete'
]
},
]],
});
ua.listen();
})