From 8c77d91e00c82afc35e508f6239d5aad3c79c9ed Mon Sep 17 00:00:00 2001 From: Jhonton Chen <504071088@qq.com> Date: Sun, 24 May 2026 15:54:24 +0800 Subject: [PATCH] fix(oper-log): fix json.parse error --- src/pages/oper-log/index.tsx | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/src/pages/oper-log/index.tsx b/src/pages/oper-log/index.tsx index e605fda..4ba66a0 100644 --- a/src/pages/oper-log/index.tsx +++ b/src/pages/oper-log/index.tsx @@ -45,15 +45,15 @@ const OperLog: React.FC = () => { return `'${item.operName || '-'}' Logout`; }, 'data-source insert': (item) => { - const operParam = JSON.parse(item.operParam || '{}'); + const operParam = parseOperParam(item); return `Add Data Source: '${operParam.sourceName || '-'}'`; }, 'rule insert': (item) => { - const operParam = JSON.parse(item.operParam || '{}'); + const operParam = parseOperParam(item); return `Add Rule: '${ruleBaseMeta[operParam.type].title || '-'}'`; }, 'rule update': (item) => { - const operParam = JSON.parse(item.operParam || '{}'); + const operParam = parseOperParam(item); return `Update Rule: '${ruleBaseMeta[operParam.type].title || '-'}'`; }, 'rule update status': (item) => { @@ -63,6 +63,15 @@ const OperLog: React.FC = () => { }, }; + function parseOperParam(item: API.OperLogListItem) { + try { + return JSON.parse(item.operParam || '{}'); + } catch (error) { + console.error('parse operParam error', error); + return {}; + } + } + const columns: ProColumns[] = [ { title: $t('table.time'),