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 c2fd98c282..56d93c92c8 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 @@ -20,6 +20,10 @@ LEFT JOIN project t2 ON t.project_id = t2.id LEFT JOIN workspace w on t2.workspace_id = w.id + t.project_id in + + #{projectId} + and t.oper_user like #{request.operUser, jdbcType=VARCHAR} or t1.NAME like #{request.operUser, jdbcType=VARCHAR} diff --git a/backend/src/main/java/io/metersphere/log/vo/OperatingLogRequest.java b/backend/src/main/java/io/metersphere/log/vo/OperatingLogRequest.java index a22bfcaff2..7f8f54a398 100644 --- a/backend/src/main/java/io/metersphere/log/vo/OperatingLogRequest.java +++ b/backend/src/main/java/io/metersphere/log/vo/OperatingLogRequest.java @@ -27,4 +27,7 @@ public class OperatingLogRequest implements Serializable { private String operTitle; private List times; + + private List projectIds; + } \ No newline at end of file diff --git a/frontend/src/business/components/api/automation/report/components/MetricChart.vue b/frontend/src/business/components/api/automation/report/components/MetricChart.vue index 6557378569..a502103321 100644 --- a/frontend/src/business/components/api/automation/report/components/MetricChart.vue +++ b/frontend/src/business/components/api/automation/report/components/MetricChart.vue @@ -9,7 +9,13 @@ - + + + {{content.success+content.error}} 请求 + + + {{content.success? content.success+content.error :0}} 请求 +
@@ -92,10 +98,11 @@ scenarioTotal: 0, scenarioSuccess: 0, scenarioError: 0, + reqTotal: 0, } }, created() { - this.initTime() + this.initTime(); }, methods: { initTime() { @@ -279,4 +286,28 @@ font-size: 40px; } + .ms-req { + border-radius: 50%; + height: 110px; + width: 110px; + display: inline-block; + vertical-align: top; + margin-right: 30px; + } + + .ms-req-error { + border: 5px #F56C6C solid; + } + + .ms-req-success { + border: 5px #67C23A solid; + } + + .ms-req-span { + display: block; + color: black; + height: 110px; + line-height: 110px; + text-align: center; + } diff --git a/frontend/src/business/components/settings/operatinglog/OperatingLog.vue b/frontend/src/business/components/settings/operatinglog/OperatingLog.vue index 61477e7179..32098f8fd6 100644 --- a/frontend/src/business/components/settings/operatinglog/OperatingLog.vue +++ b/frontend/src/business/components/settings/operatinglog/OperatingLog.vue @@ -29,7 +29,7 @@ - + @@ -37,7 +37,7 @@ - + @@ -165,9 +165,39 @@ ]) } }, - created() { - this.initTableData(); - this.initProject(); + mounted() { + switch (this.$route.name) { + case "system": + this.initProject("/project/listAll"); + break; + case "organization": + this.initProject("/project/listAll/" + getCurrentUser().lastWorkspaceId); + break; + case "workspace": + this.initProject("/project/listAll/" + getCurrentUser().lastWorkspaceId); + break; + case "project": + this.getProject(); + break; + } + }, + watch: { + '$route'(to, from) { + switch (to.name) { + case "system": + this.initProject("/project/listAll"); + break; + case "organization": + this.initProject("/project/listAll/" + getCurrentUser().lastWorkspaceId); + break; + case "workspace": + this.initProject("/project/listAll/" + getCurrentUser().lastWorkspaceId); + break; + case "project": + this.getProject(); + break; + } + } }, methods: { initTableData() { @@ -179,22 +209,38 @@ this.result.loading = false; }) }, + reset() { - this.condition = {}; + let projectIds = this.condition.projectIds; + this.condition = {projectIds: projectIds}; + this.initTableData(); }, - initProject() { - if (hasRoles(ROLE_TEST_VIEWER, ROLE_TEST_USER, ROLE_TEST_MANAGER)) { - this.result = this.$get("/project/listAll", response => { - let projects = response.data; - if (projects) { - this.items = []; - projects.forEach(item => { - let data = {id: item.id, label: item.name}; - this.items.push(data); - }) - } - }) - } + initProject(url) { + this.condition = {}; + this.result = this.$get(url, response => { + let projects = response.data; + let projectIds = []; + if (projects) { + this.items = []; + projects.forEach(item => { + let data = {id: item.id, label: item.name}; + this.items.push(data); + projectIds.push(item.id); + }) + } + this.condition.projectIds = projectIds; + this.initTableData(); + }) + }, + getProject() { + this.condition.projectIds = []; + this.result = this.$get("/project/get/" + this.$store.state.projectId, response => { + let project = response.data; + this.items = [{id: project.id, label: project.name}]; + this.condition.projectIds = [project.id]; + this.condition.projectId = project.id; + this.initTableData(); + }) }, getType(type) { return this.LOG_TYPE_MAP.get(type); diff --git a/frontend/src/business/components/settings/router.js b/frontend/src/business/components/settings/router.js index 45afa61b04..3c39423172 100644 --- a/frontend/src/business/components/settings/router.js +++ b/frontend/src/business/components/settings/router.js @@ -129,10 +129,28 @@ export default { meta: {project: true, title: 'api_test.environment.environment_config', permissions: ['PROJECT_ENVIRONMENT:READ']} }, { - path: 'operatingLog', + path: 'operatingLog/system', component: () => import('@/business/components/settings/operatinglog/OperatingLog'), + name:'system', meta: {system: true, title: 'operating_log.title', permissions: ['SYSTEM_OPERATING_LOG:READ']} + }, + { + path: 'operatingLog/organization', + component: () => import('@/business/components/settings/operatinglog/OperatingLog'), + name:'organization', + meta: {organization: true, title: 'operating_log.title', permissions: ['SYSTEM_OPERATING_LOG:READ']} + }, + { + path: 'operatingLog/workspace', + component: () => import('@/business/components/settings/operatinglog/OperatingLog'), + name:'workspace', + meta: {workspace: true, title: 'operating_log.title', permissions: ['SYSTEM_OPERATING_LOG:READ']} + }, + { + path: 'operatingLog/project', + name:'project', + component: () => import('@/business/components/settings/operatinglog/OperatingLog'), + meta: {project: true, title: 'operating_log.title', permissions: ['SYSTEM_OPERATING_LOG:READ']} } - ] };