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'),