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 2d2145d68f..c40254143c 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 @@ -75,8 +75,9 @@ and t3.source_id = #{request.sourceId, jdbcType=VARCHAR} + and JSON_UNQUOTE(JSON_EXTRACT(t.oper_content, '$.columns[*]')) is not null - order by t.oper_time desc limit 100 + 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 diff --git a/backend/src/main/java/io/metersphere/log/controller/OperatingLogController.java b/backend/src/main/java/io/metersphere/log/controller/OperatingLogController.java index d62116344b..5ddb039882 100644 --- a/backend/src/main/java/io/metersphere/log/controller/OperatingLogController.java +++ b/backend/src/main/java/io/metersphere/log/controller/OperatingLogController.java @@ -32,9 +32,10 @@ public class OperatingLogController { } - @PostMapping("/get/source") - public List findBySourceId(@RequestBody OperatingLogRequest request) { - return operatingLogService.findBySourceId(request); + @PostMapping("/get/source/{goPage}/{pageSize}") + public Pager> findBySourceId(@PathVariable int goPage, @PathVariable int pageSize, @RequestBody OperatingLogRequest request) { + Page page = PageHelper.startPage(goPage, pageSize, true); + return PageUtils.setPageInfo(page, operatingLogService.findBySourceId(request)); } @PostMapping("/save") diff --git a/frontend/src/business/components/history/ChangeHistory.vue b/frontend/src/business/components/history/ChangeHistory.vue index e9ae3427aa..d8a810ef95 100644 --- a/frontend/src/business/components/history/ChangeHistory.vue +++ b/frontend/src/business/components/history/ChangeHistory.vue @@ -35,7 +35,10 @@
- {{ $t('operating_log.info') }} + {{ + $t('operating_log.info') + }} +
{{ detail.newValue ? detail.newValue : "空值" }}
@@ -45,6 +48,8 @@ + @@ -58,9 +63,13 @@ import MsTagsHistoryDetail from "./tags/TagsHistoryDetail"; import MsApiHistoryDetail from "./api/ApiHistoryDetail"; import MsEnvironmentHistoryDetail from "./api/EnvironmentHistoryDetail"; + export default { name: "MsChangeHistory", - components: {MsHistoryDetail, MsTagsHistoryDetail, MsApiHistoryDetail, MsEnvironmentHistoryDetail}, + components: { + MsHistoryDetail, MsTagsHistoryDetail, MsApiHistoryDetail, MsEnvironmentHistoryDetail, + MsTablePagination: () => import("@/business/components/common/pagination/TablePagination"), + }, props: { title: String, }, @@ -72,6 +81,11 @@ export default { linkDatas: ["prerequisite", "steps", "remark", "request", "config", "response", "scenarioDefinition", "tags", "loadConfiguration", "advancedConfiguration"], showChangeField: true, + pageSize: 10, + goPage: 1, + totalCount: 0, + id: String, + module: String } }, methods: { @@ -79,18 +93,24 @@ export default { this.infoVisible = false; }, getDetails(id, modules) { - this.result = this.$post("/operating/log/get/source/", {sourceId: id, modules: modules}, response => { - let data = response.data; + id = this.id; + modules = this.module; + this.result = this.$post("/operating/log/get/source/" + this.goPage + '/' + this.pageSize, { + sourceId: id, + modules: modules + }, response => { + let data = response.data.listObject; + this.totalCount = response.data.itemCount; this.loading = false; if (data) { // 过滤非全局脚本历史变更数据 - if(modules.length > 0 && modules[0] === '项目-环境设置'){ + if (modules.length > 0 && modules[0] === '项目-环境设置') { // 环境设置不显示变更字段 this.showChangeField = false; // 不显示的节点 id let ids = []; - for(let i=0; i (d.diffValue === null || d.diffValue === '')) !== -1){ + for (let i = 0; i < data.length; i++) { + if (data[i].details.columns.findIndex(d => (d.diffValue === null || d.diffValue === '')) !== -1) { ids.push(data[i].id); continue; } @@ -111,6 +131,8 @@ export default { open(id, modules) { this.infoVisible = true; this.loading = true; + this.id = id; + this.module = modules; this.getDetails(id, modules); }, openDetail(row, value) {