diff --git a/backend/src/main/java/io/metersphere/base/mapper/ext/ExtOperatingLogMapper.xml b/backend/src/main/java/io/metersphere/base/mapper/ext/ExtOperatingLogMapper.xml index c40254143c..2d7237396f 100644 --- a/backend/src/main/java/io/metersphere/base/mapper/ext/ExtOperatingLogMapper.xml +++ b/backend/src/main/java/io/metersphere/base/mapper/ext/ExtOperatingLogMapper.xml @@ -77,9 +77,9 @@ and JSON_UNQUOTE(JSON_EXTRACT(t.oper_content, '$.columns[*]')) is not null - order by t.oper_time desc )tt LEFT JOIN `user` t1 ON tt.oper_user = t1.id LEFT JOIN project t2 ON tt.project_id = t2.id + order by tt.oper_time desc diff --git a/frontend/src/business/components/history/api/EnvironmentEditParams.vue b/frontend/src/business/components/history/api/EnvironmentEditParams.vue index f062f6fefc..b907002275 100644 --- a/frontend/src/business/components/history/api/EnvironmentEditParams.vue +++ b/frontend/src/business/components/history/api/EnvironmentEditParams.vue @@ -145,8 +145,13 @@ } }, getDiff(v1, v2) { - let delta = jsondiffpatch.diff(v1 , v2); - return formattersHtml.format(delta, v1); + if(typeof v1 === 'string' && typeof v2 === 'string' && v1.indexOf("{") !==-1 && v2.indexOf("{") !==-1 ){ + let delta = jsondiffpatch.diff(JSON.parse(v1), JSON.parse(v2)); + return formattersHtml.format(delta,delta); + }else{ + let delta = jsondiffpatch.diff(v1, v2); + return formattersHtml.format(delta,v1); + } }, } } diff --git a/frontend/src/business/components/settings/operatinglog/LogDetail.vue b/frontend/src/business/components/settings/operatinglog/LogDetail.vue index 931598f032..b990713087 100644 --- a/frontend/src/business/components/settings/operatinglog/LogDetail.vue +++ b/frontend/src/business/components/settings/operatinglog/LogDetail.vue @@ -136,8 +136,13 @@ this.infoVisible = false; }, getDiff(v1, v2) { - let delta = jsondiffpatch.diff(v1, v2); - return formattersHtml.format(delta, v1); + if(typeof v1 === 'string' && typeof v2 === 'string' && v1.indexOf("{") !==-1 && v2.indexOf("{") !==-1 ){ + let delta = jsondiffpatch.diff(JSON.parse(v1), JSON.parse(v2)); + return formattersHtml.format(delta,delta); + }else{ + let delta = jsondiffpatch.diff(v1, v2); + return formattersHtml.format(delta,v1); + } }, getDetails(id) { this.result = this.$get("/operating/log/get/" + id, response => {