fix(操作日志): 修复无项目加载bug;加强检索条件。

This commit is contained in:
fit2-zhao 2021-05-27 14:37:46 +08:00 committed by 刘瑞斌
parent d8ccf5428d
commit 10c468b1b0
2 changed files with 118 additions and 11 deletions

View File

@ -20,10 +20,13 @@
LEFT JOIN project t2 ON t.project_id = t2.id LEFT JOIN project t2 ON t.project_id = t2.id
LEFT JOIN workspace w on t2.workspace_id = w.id LEFT JOIN workspace w on t2.workspace_id = w.id
<where> <where>
( t.project_id in (
<foreach collection="request.projectIds" item="projectId" separator="," open="(" close=")"> <if test="request.projectIds != null and request.projectIds.size > 0 ">
#{projectId} t.project_id in
</foreach> <foreach collection="request.projectIds" item="projectId" separator="," open="(" close=")">
#{projectId}
</foreach>
</if>
or t.project_id is null or t.project_id is null
or t.project_id = "" or t.project_id = ""
) )

View File

@ -6,9 +6,9 @@
{{$t('operating_log.title')}} {{$t('operating_log.title')}}
</div> </div>
<div> <div>
<el-form :model="condition" label-position="right" label-width="80px" size="small" ref="basicForm" style="margin-right: 20px"> <el-form :model="condition" label-position="right" label-width="75px" size="small" ref="basicForm" style="margin-right: 20px">
<el-row> <el-row>
<el-col :span="6"> <el-col :span="5">
<el-form-item :label="$t('operating_log.time')" prop="times"> <el-form-item :label="$t('operating_log.time')" prop="times">
<el-date-picker <el-date-picker
size="small" size="small"
@ -16,14 +16,30 @@
type="datetimerange" type="datetimerange"
value-format="timestamp" value-format="timestamp"
:range-separator="$t('commons.date.range_separator')" :range-separator="$t('commons.date.range_separator')"
:start-placeholder="$t('commons.date.start_date')" :start-placeholder="$t('schedule.cron.start')"
:end-placeholder="$t('commons.date.end_date')" style="width: 100%"> :end-placeholder="$t('variables.end')" style="width: 100%">
</el-date-picker> </el-date-picker>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="4"> <el-col :span="4">
<el-form-item :label="$t('operating_log.user')" prop="user"> <el-form-item :label="$t('operating_log.user')" prop="user">
<el-input size="small" v-model="condition.operUser"/> <!--<el-input size="small" v-model="condition.operUser"/>-->
<el-autocomplete
class="input-with-autocomplete"
v-model="condition.operUser"
:placeholder="$t('member.input_id_or_email')"
:trigger-on-focus="false"
:fetch-suggestions="querySearch"
size="small"
highlight-first-item
value-key="email"
@select="handleSelect"
>
<template v-slot:default="scope">
<span class="ws-member-name">{{scope.item.name}}</span>
<span class="ws-member-email">{{scope.item.email}}</span>
</template>
</el-autocomplete>
</el-form-item> </el-form-item>
</el-col> </el-col>
@ -43,9 +59,13 @@
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="3"> <el-col :span="4">
<el-form-item :label="$t('operating_log.object')" prop="module"> <el-form-item :label="$t('operating_log.object')" prop="module">
<el-input size="small" v-model="condition.operModule"/> <!--<el-input size="small" v-model="condition.operModule"/>-->
<el-cascader :options="sysList" filterable :placeholder="$t('operating_log.object')" show-all-levels
v-model="condition.operModules" :props="props"
class="ms-case" ref="cascade"></el-cascader>
</el-form-item> </el-form-item>
</el-col> </el-col>
@ -106,6 +126,58 @@
}, },
data() { data() {
return { return {
props: {
multiple: false,
},
sysList: [
{
label: "测试跟踪", value: "track", children: [
{label: "测试用例", value: "测试用例", leaf: true},
{label: "用例评审", value: "用例评审", leaf: true},
{label: "测试计划", value: "测试计划", leaf: true},
{label: "缺陷管理", value: "缺陷管理", leaf: true},
{label: "报告", value: "报告", leaf: true}]
},
{
label: "接口测试", value: "api", children: [
{label: "接口定义", value: "接口定义", leaf: true},
{label: "接口自动化", value: "接口自动化", leaf: true},
{label: "测试报告", value: "测试报告", leaf: true}]
},
{
label: "性能测试", value: "性能测试", children: [
{label: "性能测试", value: "性能测试", leaf: true},
{label: "性能测试报告", value: "性能测试报告", leaf: true}]
},
{
label: "系统设置", value: "系统设置", children: [
{label: "系统-用户", value: "系统-用户", leaf: true},
{label: "系统-组织", value: "系统-组织", leaf: true},
{label: "工作空间", value: "工作空间", leaf: true},
{label: "系统-测试资源池", value: "系统-测试资源池", leaf: true},
{label: "系统-系统参数设置", value: "系统-系统参数设置", leaf: true},
{label: "系统-配额管理", value: "系统-配额管理", leaf: true},
{label: "系统-授权管理", value: "系统-授权管理", leaf: true},
{label: "组织-成员", value: "组织-成员", leaf: true},
{label: "组织-服务集成", value: "组织-服务集成", leaf: true},
{label: "组织-消息设置", value: "组织-消息设置", leaf: true},
{label: "工作空间-成员", value: "工作空间-成员", leaf: true},
{label: "项目-项目管理", value: "项目-项目管理", leaf: true},
{label: "工作空间-模版设置", value: "工作空间-模版设置", leaf: true},
{label: "工作空间-项目管理", value: "工作空间-项目管理", leaf: true},
{label: "项目-项目管理", value: "项目-项目管理", leaf: true},
{label: "项目-成员", value: "项目-成员", leaf: true},
{label: "工作空间-成员", value: "工作空间-成员", leaf: true},
{label: "項目-JAR包管理", value: "項目-JAR包管理", leaf: true},
{label: "项目-环境设置", value: "项目-环境设置", leaf: true},
{label: "项目-文件管理", value: "项目-文件管理", leaf: true},
{label: "个人信息-个人设置", value: "个人信息-个人设置", leaf: true},
{label: "个人信息-API Keys", value: "个人信息-API Keys", leaf: true}
]
},
],
result: {}, result: {},
form: {}, form: {},
currentPage: 0, currentPage: 0,
@ -114,6 +186,7 @@
items: [], items: [],
condition: {}, condition: {},
tableData: [], tableData: [],
userList: [],
screenHeight: 'calc(100vh - 275px)', screenHeight: 'calc(100vh - 275px)',
LOG_TYPE: [ LOG_TYPE: [
{id: 'CREATE', label: this.$t('api_test.definition.request.create_info')}, {id: 'CREATE', label: this.$t('api_test.definition.request.create_info')},
@ -169,15 +242,19 @@
switch (this.$route.name) { switch (this.$route.name) {
case "system": case "system":
this.initProject("/project/listAll"); this.initProject("/project/listAll");
this.getMember();
break; break;
case "organization": case "organization":
this.initProject("/project/listAll/" + getCurrentUser().lastWorkspaceId); this.initProject("/project/listAll/" + getCurrentUser().lastWorkspaceId);
this.getMember();
break; break;
case "workspace": case "workspace":
this.initProject("/project/listAll/" + getCurrentUser().lastWorkspaceId); this.initProject("/project/listAll/" + getCurrentUser().lastWorkspaceId);
this.getMember();
break; break;
case "project": case "project":
this.getProject(); this.getProject();
this.getMember();
break; break;
} }
}, },
@ -186,21 +263,47 @@
switch (to.name) { switch (to.name) {
case "system": case "system":
this.initProject("/project/listAll"); this.initProject("/project/listAll");
this.getMember();
break; break;
case "organization": case "organization":
this.initProject("/project/listAll/" + getCurrentUser().lastWorkspaceId); this.initProject("/project/listAll/" + getCurrentUser().lastWorkspaceId);
this.getMember();
break; break;
case "workspace": case "workspace":
this.initProject("/project/listAll/" + getCurrentUser().lastWorkspaceId); this.initProject("/project/listAll/" + getCurrentUser().lastWorkspaceId);
this.getMember();
break; break;
case "project": case "project":
this.getProject(); this.getProject();
this.getMember();
break; break;
} }
} }
}, },
methods: { methods: {
handleSelect(item) {
this.$set(this.condition, "operUser", item.id);
},
getMember() {
this.result = this.$get('/user/list/', response => {
this.userList = response.data;
});
},
createFilter(queryString) {
return (user) => {
return (user.email.indexOf(queryString.toLowerCase()) === 0 || user.id.indexOf(queryString.toLowerCase()) === 0);
};
},
querySearch(queryString, cb) {
let userList = this.userList;
let results = queryString ? userList.filter(this.createFilter(queryString)) : userList;
// callback
cb(results);
},
initTableData() { initTableData() {
if (this.condition.operModules && this.condition.operModules.length > 0) {
this.condition.operModule = this.condition.operModules[1];
}
let url = "/operating/log/list/" + this.currentPage + "/" + this.pageSize; let url = "/operating/log/list/" + this.currentPage + "/" + this.pageSize;
this.result.loading = true; this.result.loading = true;
this.$post(url, this.condition, response => { this.$post(url, this.condition, response => {
@ -208,6 +311,7 @@
this.total = response.data.itemCount; this.total = response.data.itemCount;
this.result.loading = false; this.result.loading = false;
}) })
}, },
reset() { reset() {