fix(oper-log): fix json.parse error

This commit is contained in:
2026-05-24 15:54:24 +08:00
parent 961a4076fb
commit 8c77d91e00

View File

@@ -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<API.OperLogListItem>[] = [
{
title: $t('table.time'),