fix(admin): 修复监控规则表单提交失效与页面转义及搜索入口缺陷

This commit is contained in:
augushong
2026-08-15 11:44:33 +08:00
parent 5a41f6a425
commit 4d71c6553a
6 changed files with 11 additions and 9 deletions

View File

@@ -16,7 +16,6 @@ $(function () {
ua.table.render({
init: init,
toolbar: [],
defaultToolbar: ['filter'],
cols: [[
{field: 'request_time', title: '请求时间', width: 170, sort: true, search: 'range', templet: formatRequestTime},
{
@@ -40,9 +39,11 @@ $(function () {
},
{
field: 'url', title: 'URL', minWidth: 220, searchOp: '%*%', templet: function (d) {
var u = d.url || '';
var u = String(d.url || '');
var esc = u.replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;').replace(/"/g, '&quot;');
var short = u.length > 50 ? u.substring(0, 50) + '…' : u;
return '<span title="' + u.replace(/"/g, '&quot;') + '">' + (short === '' ? '/' : short) + '</span>';
short = short.replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;').replace(/"/g, '&quot;');
return '<span title="' + esc + '">' + (short === '' ? '/' : short) + '</span>';
}
},
{field: 'node_id', title: '节点', width: 160, search: 'select', searchOp: '=', selectList: ua.getDataBrage('select_list_node_id') || {}},

View File

@@ -32,7 +32,7 @@
<div class="detail-field-label">请求完整 URL超长截断</div>
<div class="detail-field-value">
{notempty name="row.url"}
{$row.url}
{$row.url|htmlspecialchars=###,ENT_QUOTES,'UTF-8'}
{else/}
<span class="layui-text-em">暂无数据</span>
{/notempty}
@@ -42,7 +42,7 @@
<div class="detail-field-label">规范化 URL query、数字段替换聚合用</div>
<div class="detail-field-value">
{notempty name="row.simple_url"}
{$row.simple_url}
{$row.simple_url|htmlspecialchars=###,ENT_QUOTES,'UTF-8'}
{else/}
<span class="layui-text-em">暂无数据</span>
{/notempty}

View File

@@ -2,7 +2,6 @@ $(function(){
ua.table.render({
init: init,
toolbar: [],
defaultToolbar: ['filter'],
cols: [[
{field: 'id', title: 'ID', width: 80, sort: true},
{field: 'watch_id', title: '监控规则', width: 160, search: 'select', searchOp: '=', selectList: ua.getDataBrage('select_list_watch'), templet: function(d) {

View File

@@ -62,7 +62,7 @@
<div class="detail-field-label">请求 URL</div>
<div class="detail-field-value">
{notempty name="row.run.url"}
{$row.run.url}
{$row.run.url|htmlspecialchars=###,ENT_QUOTES,'UTF-8'}
{else/}
<span class="layui-text-em">暂无数据</span>
{/notempty}

View File

@@ -1,6 +1,7 @@
$(function(){
// PCRE 正则前端预校验:必须带定界符(权威校验在后端 @preg_match
var form = window.UA_CORE.form;
// layui.form 本体在 tab iframe 中同步可用;window.UA_CORE 依赖 admin-core.js 的 IIFE 执行时序,存在竞态,此处不可使用
var form = layui.form;
if (form) {
form.verify({
watchRegex: function (value) {

View File

@@ -1,6 +1,7 @@
$(function(){
// PCRE 正则前端预校验:必须带定界符(权威校验在后端 @preg_match
var form = window.UA_CORE.form;
// layui.form 本体在 tab iframe 中同步可用;window.UA_CORE 依赖 admin-core.js 的 IIFE 执行时序,存在竞态,此处不可使用
var form = layui.form;
if (form) {
form.verify({
watchRegex: function (value) {