提交 3a443e4f 编写于 作者: F fit2-zhao 提交者: fit2-zhao

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

上级 ea6ef2ab
......@@ -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}
......
......@@ -27,4 +27,7 @@ public class OperatingLogRequest implements Serializable {
private String operTitle;
private List<Long> times;
private List<String> projectIds;
}
\ No newline at end of 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>
......@@ -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() {
let projectIds = this.condition.projectIds;
this.condition = {projectIds: projectIds};
this.initTableData();
},
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();
})
},
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);
})
}
})
}
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);
......
......@@ -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']}
}
]
};
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册