fix(操作日志): 修复操作日志用户角色不显示问题

This commit is contained in:
fit2-zhao 2021-05-27 18:01:17 +08:00 committed by fit2-zhao
parent 1340568ffd
commit a5a2b0b473
7 changed files with 86 additions and 64 deletions

View File

@ -14,6 +14,7 @@ import io.metersphere.i18n.Translator;
import io.metersphere.log.utils.ReflexObjectUtil; import io.metersphere.log.utils.ReflexObjectUtil;
import io.metersphere.log.vo.DetailColumn; import io.metersphere.log.vo.DetailColumn;
import io.metersphere.log.vo.OperatingLogDetails; import io.metersphere.log.vo.OperatingLogDetails;
import io.metersphere.log.vo.StatusReference;
import io.metersphere.log.vo.system.SystemReference; import io.metersphere.log.vo.system.SystemReference;
import io.metersphere.notice.domain.MessageDetail; import io.metersphere.notice.domain.MessageDetail;
import org.apache.commons.collections.CollectionUtils; import org.apache.commons.collections.CollectionUtils;
@ -224,7 +225,8 @@ public class NoticeService {
} }
if (task != null) { if (task != null) {
List<DetailColumn> columns = ReflexObjectUtil.getColumns(task, SystemReference.messageColumns); List<DetailColumn> columns = ReflexObjectUtil.getColumns(task, SystemReference.messageColumns);
OperatingLogDetails details = new OperatingLogDetails(JSON.toJSONString(task.getId()), null, task.getTaskType(), task.getUserId(), columns); OperatingLogDetails details = new OperatingLogDetails(JSON.toJSONString(task.getId()), null,
StatusReference.statusMap.containsKey(task.getTaskType()) ? StatusReference.statusMap.get(task.getTaskType()) : task.getTaskType(), task.getUserId(), columns);
return JSON.toJSONString(details); return JSON.toJSONString(details);
} }
return null; return null;

View File

@ -1202,6 +1202,12 @@ public class UserService {
if (CollectionUtils.isNotEmpty(workspaces)) { if (CollectionUtils.isNotEmpty(workspaces)) {
names = workspaces.stream().map(Workspace::getName).collect(Collectors.toList()); names = workspaces.stream().map(Workspace::getName).collect(Collectors.toList());
} }
ProjectExample projectExample = new ProjectExample();
projectExample.createCriteria().andIdIn((List<String>) map.get("ids"));
List<Project> projects = projectMapper.selectByExample(projectExample);
if (CollectionUtils.isNotEmpty(projects)) {
names = projects.stream().map(Project::getName).collect(Collectors.toList());
}
StringBuilder nameBuff = new StringBuilder(); StringBuilder nameBuff = new StringBuilder();
Group group = groupMapper.selectByPrimaryKey(id); Group group = groupMapper.selectByPrimaryKey(id);
if (group != null && CollectionUtils.isNotEmpty(names)) { if (group != null && CollectionUtils.isNotEmpty(names)) {
@ -1210,7 +1216,7 @@ public class UserService {
colNames.add(nameBuff.toString()); colNames.add(nameBuff.toString());
} }
} }
return String.join("\n", colNames); return String.join(",", colNames);
} }
public String getLogDetails(UserBatchProcessRequest request) { public String getLogDetails(UserBatchProcessRequest request) {

@ -1 +1 @@
Subproject commit 8c27caa18dd0ce5e5d81c0efdbc5ab0b16e923e7 Subproject commit 87b900d9c55591b1a3a6044172ef02c0bf5b145c

View File

@ -1,5 +1,5 @@
<template> <template>
<el-main v-loading="result.loading" class="environment-edit"> <el-main v-loading="result.loading" class="environment-edit" style="margin-left: 0px">
<el-form :model="environment" :rules="rules" ref="environment"> <el-form :model="environment" :rules="rules" ref="environment">
<span>{{$t('api_test.environment.name')}}</span> <span>{{$t('api_test.environment.name')}}</span>

View File

@ -1,5 +1,5 @@
<template> <template>
<ms-aside-container :enable-aside-hidden="false" :width="width + 'px'"> <el-aside :enable-aside-hidden="false" :width="width + 'px'">
<div class="title-bar" :style="{'height': titleBarHeight + 'px'}"> <div class="title-bar" :style="{'height': titleBarHeight + 'px'}">
<slot name="title"> <slot name="title">
<span :style="{'line-height': titleBarHeight - 10 + 'px'}" class="title-left"> <span :style="{'line-height': titleBarHeight - 10 + 'px'}" class="title-left">
@ -13,69 +13,71 @@
<slot name="content"> <slot name="content">
<div :style="{'height': itemBarHeight + 'px'}" v-for="(item, index) in data" :key="index" class="item-bar" <div :style="{'height': itemBarHeight + 'px'}" v-for="(item, index) in data" :key="index" class="item-bar"
@click="itemSelected(index, item)" :class="{'item-selected' : index == selectIndex}"> @click="itemSelected(index, item)" :class="{'item-selected' : index == selectIndex}">
<input class="item-input" <el-tooltip :content="item.name">
:style="{'height': itemBarHeight - 12 + 'px', 'line-height': itemBarHeight - 12 + 'px', 'width': width - 90 + 'px'}" <input class="item-input"
v-model="item.name" :placeholder="$t('commons.input_content')"/> :style="{'height': itemBarHeight - 12 + 'px', 'line-height': itemBarHeight - 12 + 'px', 'width': width - 90 + 'px'}"
v-model="item.name" :placeholder="$t('commons.input_content')"/>
</el-tooltip>
<span :style="{'line-height': itemBarHeight - 10 + 'px'}" class="item-right"> <span :style="{'line-height': itemBarHeight - 10 + 'px'}" class="item-right">
<i v-for="(operator, operatorIndex) in itemOperators" :key="operatorIndex" :class="operator.icon" <i v-for="(operator, operatorIndex) in itemOperators" :key="operatorIndex" :class="operator.icon"
@click.stop="operator.func(item, index)"/> @click.stop="operator.func(item, index)"/>
</span> </span>
</div> </div>
</slot> </slot>
</ms-aside-container> </el-aside>
</template> </template>
<script> <script>
import MsAsideContainer from "./MsAsideContainer"; import MsAsideContainer from "./MsAsideContainer";
export default { export default {
name: "MsAsideItem", name: "MsAsideItem",
components: {MsAsideContainer}, components: {MsAsideContainer},
data() { data() {
return { return {
selectIndex: -1 selectIndex: -1
}
},
props: {
width: {
type: Number,
default: 200
},
titleBarHeight: {
type: Number,
default: 40
},
itemBarHeight: {
type: Number,
default: 35
},
title: String,
data: Array,
deleteFuc: Function,
addFuc: Function,
itemOperators: {
type: Array,
default() {
return [
{
icon: 'el-icon-delete',
func: this.deleteFuc
}
];
} }
}, },
props: { enableAsideHidden: {
width: { type: Boolean,
type: Number, default: true
default: 200
},
titleBarHeight: {
type: Number,
default: 40
},
itemBarHeight: {
type: Number,
default: 35
},
title: String,
data: Array,
deleteFuc: Function,
addFuc: Function,
itemOperators: {
type: Array,
default() {
return [
{
icon: 'el-icon-delete',
func: this.deleteFuc
}
];
}
},
enableAsideHidden: {
type: Boolean,
default: true
},
}, },
methods: { },
itemSelected(index, item) { methods: {
this.selectIndex = index; itemSelected(index, item) {
this.$emit('itemSelected', item); this.selectIndex = index;
} this.$emit('itemSelected', item);
} }
} }
}
</script> </script>
<style scoped> <style scoped>
@ -103,7 +105,7 @@
visibility: visible; visibility: visible;
} }
.title-right,.item-right { .title-right, .item-right {
float: right; float: right;
} }
@ -132,11 +134,11 @@
.item-input { .item-input {
border: hidden; border: hidden;
display: inline; display: inline;
background-color:rgba(0,0,0,0); background-color: rgba(0, 0, 0, 0);
} }
.item-input:focus{ .item-input:focus {
outline:none; outline: none;
} }
</style> </style>

View File

@ -37,7 +37,10 @@
<div v-if="timeDates.indexOf(n.columnName)!==-1"> <div v-if="timeDates.indexOf(n.columnName)!==-1">
{{n.columnTitle}}{{ n.originalValue | timestampFormatDate }} {{n.columnTitle}}{{ n.originalValue | timestampFormatDate }}
</div> </div>
<div style="overflow: auto" v-else> <div v-else-if="isJson(n.originalValue)">
{{n.columnTitle}}<pre>{{n.originalValue}}</pre>
</div>
<div style="margin-top: 10px" v-else>
{{n.columnTitle}}{{n.originalValue}} {{n.columnTitle}}{{n.originalValue}}
</div> </div>
</span> </span>
@ -116,6 +119,19 @@
} }
}, },
methods: { methods: {
isJson(jsonStr) {
try {
let numRe = new RegExp("^[0-9]*$");
if (!jsonStr || "null" === jsonStr || numRe.test(jsonStr)) {
return false;
} else {
JSON.parse(jsonStr);
return true;
}
} catch (e) {
return false;
}
},
handleClose() { handleClose() {
this.infoVisible = false; this.infoVisible = false;
}, },
@ -127,10 +143,6 @@
this.result = this.$get("/operating/log/get/" + id, response => { this.result = this.$get("/operating/log/get/" + id, response => {
let data = response.data; let data = response.data;
this.detail = data; this.detail = data;
//let delta = jsondiffpatch.diff(this.d1, this.d2);/
//document.getElementById('visual').innerHTML = formattersHtml.format(delta, this.d1);
// self-explained json
//document.getElementById('annotated').innerHTML = jsondiffpatch.formatters.annotated.format(delta, this.d1);
}) })
}, },
open(id) { open(id) {

@ -1 +1 @@
Subproject commit c85bda6f2fa74e0e696e9f9170742834a7519319 Subproject commit 0af67efb336b3f5f6718c7b2684de4d4985c0aee