feat_操作日志_增加日志的跳转

This commit is contained in:
wxg0103 2021-09-15 17:29:49 +08:00 committed by fit2-zhao
parent a27cca0733
commit 3fbea438c6
8 changed files with 224 additions and 179 deletions

View File

@ -26,7 +26,7 @@ public class CustomFieldController {
private CustomFieldService customFieldService;
@PostMapping("/add")
@MsAuditLog(module = "workspace_template_settings", type = OperLogConstants.CREATE, content = "#msClass.getLogDetails(#customField.id)", msClass = CustomFieldService.class)
@MsAuditLog(module = "workspace_template_settings_field", type = OperLogConstants.CREATE, content = "#msClass.getLogDetails(#customField.id)", msClass = CustomFieldService.class)
public String add(@RequestBody CustomField customField) {
return customFieldService.add(customField);
}
@ -43,13 +43,13 @@ public class CustomFieldController {
}
@GetMapping("/delete/{id}")
@MsAuditLog(module = "workspace_template_settings", type = OperLogConstants.DELETE, beforeEvent = "#msClass.getLogDetails(#id)", msClass = CustomFieldService.class)
@MsAuditLog(module = "workspace_template_settings_field", type = OperLogConstants.DELETE, beforeEvent = "#msClass.getLogDetails(#id)", msClass = CustomFieldService.class)
public void delete(@PathVariable(value = "id") String id) {
customFieldService.delete(id);
}
@PostMapping("/update")
@MsAuditLog(module = "workspace_template_settings", type = OperLogConstants.UPDATE, beforeEvent = "#msClass.getLogDetails(#customField.id)", content = "#msClass.getLogDetails(#customField.id)", msClass = CustomFieldService.class)
@MsAuditLog(module = "workspace_template_settings_field", type = OperLogConstants.UPDATE, beforeEvent = "#msClass.getLogDetails(#customField.id)", content = "#msClass.getLogDetails(#customField.id)", msClass = CustomFieldService.class)
public void update(@RequestBody CustomField customField) {
customFieldService.update(customField);
}

View File

@ -27,7 +27,7 @@ public class IssueTemplateController {
private IssueTemplateService issueTemplateService;
@PostMapping("/add")
@MsAuditLog(module = "workspace_template_settings", type = OperLogConstants.CREATE, content = "#msClass.getLogDetails(#request.id)", msClass = IssueTemplateService.class)
@MsAuditLog(module = "workspace_template_settings_issue", type = OperLogConstants.CREATE, content = "#msClass.getLogDetails(#request.id)", msClass = IssueTemplateService.class)
public void add(@RequestBody UpdateIssueTemplateRequest request) {
issueTemplateService.add(request);
}
@ -39,13 +39,13 @@ public class IssueTemplateController {
}
@GetMapping("/delete/{id}")
@MsAuditLog(module = "workspace_template_settings", type = OperLogConstants.DELETE, beforeEvent = "#msClass.getLogDetails(#id)", msClass = IssueTemplateService.class)
@MsAuditLog(module = "workspace_template_settings_issue", type = OperLogConstants.DELETE, beforeEvent = "#msClass.getLogDetails(#id)", msClass = IssueTemplateService.class)
public void delete(@PathVariable(value = "id") String id) {
issueTemplateService.delete(id);
}
@PostMapping("/update")
@MsAuditLog(module = "workspace_template_settings", type = OperLogConstants.UPDATE, beforeEvent = "#msClass.getLogDetails(#request.id)", content = "#msClass.getLogDetails(#request.id)", msClass = IssueTemplateService.class)
@MsAuditLog(module = "workspace_template_settings_issue", type = OperLogConstants.UPDATE, beforeEvent = "#msClass.getLogDetails(#request.id)", content = "#msClass.getLogDetails(#request.id)", msClass = IssueTemplateService.class)
public void update(@RequestBody UpdateIssueTemplateRequest request) {
issueTemplateService.update(request);
}

View File

@ -29,7 +29,7 @@ public class TestCaseTemplateController {
private TestCaseTemplateService testCaseTemplateService;
@PostMapping("/add")
@MsAuditLog(module = "workspace_template_settings", type = OperLogConstants.CREATE, content = "#msClass.getLogDetails(#request.id)", msClass = TestCaseTemplateService.class)
@MsAuditLog(module = "workspace_template_settings_case", type = OperLogConstants.CREATE, content = "#msClass.getLogDetails(#request.id)", msClass = TestCaseTemplateService.class)
public void add(@RequestBody UpdateCaseFieldTemplateRequest request) {
testCaseTemplateService.add(request);
}
@ -41,13 +41,13 @@ public class TestCaseTemplateController {
}
@GetMapping("/delete/{id}")
@MsAuditLog(module = "workspace_template_settings", type = OperLogConstants.DELETE, beforeEvent = "#msClass.getLogDetails(#id)", msClass = TestCaseTemplateService.class)
@MsAuditLog(module = "workspace_template_settings_case", type = OperLogConstants.DELETE, beforeEvent = "#msClass.getLogDetails(#id)", msClass = TestCaseTemplateService.class)
public void delete(@PathVariable(value = "id") String id) {
testCaseTemplateService.delete(id);
}
@PostMapping("/update")
@MsAuditLog(module = "workspace_template_settings", type = OperLogConstants.UPDATE, beforeEvent = "#msClass.getLogDetails(#request.id)", content = "#msClass.getLogDetails(#request.id)", msClass = TestCaseTemplateService.class)
@MsAuditLog(module = "workspace_template_settings_case", type = OperLogConstants.UPDATE, beforeEvent = "#msClass.getLogDetails(#request.id)", content = "#msClass.getLogDetails(#request.id)", msClass = TestCaseTemplateService.class)
public void update(@RequestBody UpdateCaseFieldTemplateRequest request) {
testCaseTemplateService.update(request);
}

View File

@ -257,7 +257,9 @@ project_project_member=Project member
organization_service_integration=Organization service integration
organization_message_settings=Organization message settings
workspace_member=Workspace member
workspace_template_settings=Workspace template settings
workspace_template_settings_field=Workspace template settings field
workspace_template_settings_case=Workspace template settings case
workspace_template_settings_issue=Workspace template settings issue
project_project_manager=Project project manager
project_project_jar=Project project jar
project_environment_setting=Project environment setting

View File

@ -255,7 +255,9 @@ organization_workspace=组织-工作空间
organization_service_integration=组织-服务集成
organization_message_settings=组织-消息设置
workspace_member=工作空间-成员
workspace_template_settings=工作空间-模版设置
workspace_template_settings_field=工作空间-模版设置-自定义字段
workspace_template_settings_case=工作空间-模版设置-用例模版
workspace_template_settings_issue=工作空间-模版设置-缺陷模版
project_project_manager=项目-项目管理
project_project_member=项目-成员
project_project_jar=項目-JAR包管理

View File

@ -247,7 +247,7 @@ performance_test_report=性能測試報告
system_user=系统-用户
system_organization=系統-組織
system_workspace=系统-工作空间
system_test_resource=工作空間
system_test_resource=系统-測試資源池
system_parameter_setting=系统-系統參數設置
system_quota_management=系统-配額管理
system_authorization_management=系统-授權管理
@ -256,7 +256,9 @@ organization_workspace=組織-工作空間
organization_service_integration=組織-服務集成
organization_message_settings=組織-消息設置
workspace_member=工作空間-成員
workspace_template_settings=工作空間-模版設置
workspace_template_settings_field=工作空間-模版設置-自定義字段
workspace_template_settings_case=工作空間-模版設置-用例模版
workspace_template_settings_issue=工作空間-模版設置-缺陷模版
project_project_manager=項目-項目管理
project_project_member=項目-成員
project_project_jar=項目-JAR包管理

View File

@ -6,7 +6,8 @@
{{ $t('operating_log.title') }}
</div>
<div>
<el-form :model="condition" label-position="right" label-width="75px" 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-col :span="5">
<el-form-item :label="$t('operating_log.time')" prop="times">
@ -113,7 +114,8 @@
</template>
</el-table-column>
</el-table>
<ms-table-pagination :change="initTableData" :current-page.sync="currentPage" :page-size.sync="pageSize" :total="total"/>
<ms-table-pagination :change="initTableData" :current-page.sync="currentPage" :page-size.sync="pageSize"
:total="total"/>
</el-card>
<ms-log-detail ref="logDetail" :title="$t('report.test_log_details')"/>
@ -121,60 +123,39 @@
</template>
<script>
import MsTablePagination from "../../common/pagination/TablePagination";
import MsTableOperator from "../../common/components/MsTableOperator";
import {getCurrentProjectID, getCurrentWorkspaceId, getUUID, hasRoles} from "@/common/js/utils";
import {LOG_TYPE, LOG_TYPE_MAP, sysList, getUrl} from "./config";
import MsLogDetail from "./LogDetail";
import MsTablePagination from "../../common/pagination/TablePagination";
import MsTableOperator from "../../common/components/MsTableOperator";
import {getCurrentProjectID, getCurrentWorkspaceId, getUUID, hasRoles} from "@/common/js/utils";
import {LOG_TYPE, LOG_TYPE_MAP, sysList, getUrl} from "./config";
import MsLogDetail from "./LogDetail";
export default {
name: "OperatingLog",
components: {
MsTablePagination, MsTableOperator, MsLogDetail
},
data() {
return {
props: {
multiple: false,
},
result: {},
form: {},
currentPage: 0,
pageSize: 10,
total: 0,
items: [],
condition: {},
tableData: [],
userList: [],
screenHeight: 'calc(100vh - 215px)',
LOG_TYPE: new LOG_TYPE(this),
LOG_TYPE_MAP: new LOG_TYPE_MAP(this),
sysList: sysList,
}
},
mounted() {
switch (this.$route.name) {
case "system":
this.initProject("/project/listAll");
this.getMember();
break;
case "organization":
this.initProject("/project/listAll/" + getCurrentWorkspaceId());
this.getMember();
break;
case "workspace":
this.initProject("/project/listAll/" + getCurrentWorkspaceId());
this.getMember();
break;
case "project":
this.getProject();
this.getMember();
break;
}
},
watch: {
'$route'(to, from) {
switch (to.name) {
export default {
name: "OperatingLog",
components: {
MsTablePagination, MsTableOperator, MsLogDetail
},
data() {
return {
props: {
multiple: false,
},
result: {},
form: {},
currentPage: 0,
pageSize: 10,
total: 0,
items: [],
condition: {},
tableData: [],
userList: [],
screenHeight: 'calc(100vh - 215px)',
LOG_TYPE: new LOG_TYPE(this),
LOG_TYPE_MAP: new LOG_TYPE_MAP(this),
sysList: sysList,
}
},
mounted() {
switch (this.$route.name) {
case "system":
this.initProject("/project/listAll");
this.getMember();
@ -192,122 +173,140 @@ export default {
this.getMember();
break;
}
}
},
methods: {
isLink(row) {
if (!row.sourceId) {
return false;
}
let uri = getUrl(row);
if ((row.operType === 'UPDATE' || row.operType === 'ADD' || row.operType === 'EXECUTE' || row.operType === 'DEBUG') && uri !== "/#") {
return true;
}
return false;
},
clickResource(resource) {
if (!resource.sourceId) {
return;
}
let resourceId = resource.sourceId;
if (resourceId && resourceId.startsWith("\"" || resourceId.startsWith("["))) {
resourceId = JSON.parse(resource.sourceId);
}
if (resourceId instanceof Array) {
resourceId = resourceId[0];
}
let uri = getUrl(resource);
this.$get('/user/update/currentByResourceId/' + resourceId, () => {
this.toPage(uri);
});
},
toPage(uri) {
let id = "new_a";
let a = document.createElement("a");
a.setAttribute("href", uri);
a.setAttribute("target", "_blank");
a.setAttribute("id", id);
document.body.appendChild(a);
a.click();
let element = document.getElementById(id);
element.parentNode.removeChild(element);
},
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() {
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;
this.result.loading = true;
this.$post(url, this.condition, response => {
this.tableData = response.data.listObject;
this.total = response.data.itemCount;
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);
})
watch: {
'$route'(to, from) {
switch (to.name) {
case "system":
this.initProject("/project/listAll");
this.getMember();
break;
case "organization":
this.initProject("/project/listAll/" + getCurrentWorkspaceId());
this.getMember();
break;
case "workspace":
this.initProject("/project/listAll/" + getCurrentWorkspaceId());
this.getMember();
break;
case "project":
this.getProject();
this.getMember();
break;
}
this.condition.projectIds = projectIds;
}
},
methods: {
isLink(row) {
let uri = getUrl(row);
if ((row.operType === 'UPDATE' || row.operType === 'CREATE' || row.operType === 'EXECUTE' || row.operType === 'DEBUG') && uri !== "/#") {
return true;
}
return false;
},
clickResource(resource) {
if (!resource.sourceId) {
return;
}
let resourceId = resource.sourceId;
if (resourceId && resourceId.startsWith("\"" || resourceId.startsWith("["))) {
resourceId = JSON.parse(resource.sourceId);
}
if (resourceId instanceof Array) {
resourceId = resourceId[0];
}
let uri = getUrl(resource);
this.$get('/user/update/currentByResourceId/' + resourceId, () => {
this.toPage(uri);
});
},
toPage(uri) {
let id = "new_a";
let a = document.createElement("a");
a.setAttribute("href", uri);
a.setAttribute("target", "_blank");
a.setAttribute("id", id);
document.body.appendChild(a);
a.click();
let element = document.getElementById(id);
element.parentNode.removeChild(element);
},
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() {
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;
this.result.loading = true;
this.$post(url, this.condition, response => {
this.tableData = response.data.listObject;
this.total = response.data.itemCount;
this.result.loading = false;
})
},
reset() {
let projectIds = this.condition.projectIds;
this.condition = {projectIds: projectIds};
this.initTableData();
})
},
getProject() {
this.condition.projectIds = [];
this.result = this.$get("/project/get/" + getCurrentProjectID(), response => {
let project = response.data;
this.items = [{id: project.id, label: project.name}];
this.condition.projectIds = [project.id];
this.condition.projectId = project.id;
},
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/" + getCurrentProjectID(), 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);
},
search() {
this.initTableData();
});
},
getType(type) {
return this.LOG_TYPE_MAP.get(type);
},
search() {
this.initTableData();
},
openDetail(row) {
this.$refs.logDetail.open(row.id);
},
},
openDetail(row) {
this.$refs.logDetail.open(row.id);
},
}
}
}
</script>
<style scoped>

View File

@ -147,8 +147,48 @@ export function getUrl(d) {
case "测试用例" || "測試用例" || "Test case":
url += "/track/case/all?resourceId=" + resourceId;
break;
case "系统-用户" || "系统-用户" || "System user":
url += "/setting/user";
break;
case "系统-组织" || "系統-組織" || "System organization":
url += "/setting/organization";
break;
case "工作空间" || "系统-工作空间" || "workspace" :
url += "/setting/systemworkspace";
break;
case "用户组与权限" || "用戶組與權限" || "Group" :
url += "/setting/usergroup";
break;
case "系统-测试资源池" || "系统-測試資源池" || "System test resource" :
url += "/setting/testresourcepool";
break;
case "系统-系统参数设置" || "系统-系統參數設置" || "System parameter setting" :
url += "/setting/systemparametersetting";
break;
case "工作空间-成员" || "工作空間-成員" || "Workspace member" :
url += "/setting/member";
break;
case "项目-项目管理" || "項目-項目管理" || "Project project manager" :
url += "/setting/project/:type";
break;
case "项目-环境设置" || "項目-環境設置" || "Project environment setting" :
url += "/setting/envlist";
break;
case "工作空间-模版设置-自定义字段" || "工作空間-模版設置-自定義字段" || "Workspace template settings field" :
url += "/setting/workspace/template/field";
break;
case "工作空间-模版设置-用例模版" || "工作空間-模版設置-用例模板" || "Workspace template settings case" :
url += "/setting/workspace/template/case";
break;
case "工作空间-模版设置-缺陷模版" || "工作空間-模版設置-缺陷模板" || "Workspace template settings issue" :
url += "/setting/workspace/template/issues";
break;
case "项目-成员" || "項目-成員" || "Project member" :
url += "/setting/projectmember";
break;
default:
break;
}
return url;
}