fix(系统设置): 操作日志放到 系统,组织,工作空间,项目 下根据不同的权限加载。

This commit is contained in:
fit2-zhao 2021-05-26 15:30:55 +08:00 committed by fit2-zhao
parent ea6ef2abb5
commit 3a443e4fcb
5 changed files with 125 additions and 23 deletions

View File

@ -20,6 +20,10 @@
LEFT JOIN project t2 ON t.project_id = t2.id
LEFT JOIN workspace w on t2.workspace_id = w.id
<where>
t.project_id in
<foreach collection="request.projectIds" item="projectId" separator="," open="(" close=")">
#{projectId}
</foreach>
<if test="request.operUser != null and request.operUser != ''">
and t.oper_user like #{request.operUser, jdbcType=VARCHAR}
or t1.NAME like #{request.operUser, jdbcType=VARCHAR}

View File

@ -27,4 +27,7 @@ public class OperatingLogRequest implements Serializable {
private String operTitle;
private List<Long> times;
private List<String> projectIds;
}

View File

@ -9,7 +9,13 @@
</div>
</el-row>
<ms-chart id="chart" ref="chart" :options="options" :autoresize="true"></ms-chart>
<!--<ms-chart id="chart" ref="chart" :options="options" :autoresize="true"></ms-chart>-->
<span class="ms-req ms-req-error" v-if="content.error && content.error>0">
<span class="ms-req-span"> {{content.success+content.error}} 请求</span>
</span>
<span class="ms-req ms-req-success" v-else>
<span class="ms-req-span"> {{content.success? content.success+content.error :0}} 请求</span>
</span>
<el-row type="flex" justify="center" align="middle">
<i class="circle success"/>
<div class="metric-box">
@ -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;
}
</style>

View File

@ -29,7 +29,7 @@
<el-col :span="4">
<el-form-item :label="$t('commons.project')" prop="project">
<el-select size="small" v-model="condition.projectId" clearable>
<el-select size="small" v-model="condition.projectId" @change="initTableData" clearable>
<el-option v-for="o in items" :key="o.id" :label="$t(o.label)" :value="o.id"/>
</el-select>
</el-form-item>
@ -37,7 +37,7 @@
<el-col :span="4">
<el-form-item :label="$t('operating_log.type')" prop="type">
<el-select size="small" v-model="condition.operType" clearable>
<el-select size="small" v-model="condition.operType" clearable @change="initTableData">
<el-option v-for="o in LOG_TYPE" :key="o.id" :label="$t(o.label)" :value="o.id"/>
</el-select>
</el-form-item>
@ -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);

View File

@ -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']}
}
]
};