fix(缺陷管理): 缺陷管理变更历史增加操作字段展示

--bug=1036361 --user=宋天阳 【缺陷管理】缺陷详情-变更历史-列表无类型字段 https://www.tapd.cn/55049933/s/1471764
This commit is contained in:
song-tianyang 2024-03-07 20:56:26 +08:00 committed by Craftsman
parent f51eb51956
commit ab678d48c9
5 changed files with 20 additions and 3 deletions

View File

@ -1,6 +1,7 @@
package io.metersphere.bug.service; package io.metersphere.bug.service;
import io.metersphere.sdk.util.BeanUtils; import io.metersphere.sdk.util.BeanUtils;
import io.metersphere.sdk.util.Translator;
import io.metersphere.system.domain.OperationHistory; import io.metersphere.system.domain.OperationHistory;
import io.metersphere.system.domain.OperationHistoryExample; import io.metersphere.system.domain.OperationHistoryExample;
import io.metersphere.system.domain.User; import io.metersphere.system.domain.User;
@ -8,10 +9,12 @@ import io.metersphere.system.domain.UserExample;
import io.metersphere.system.dto.OperationHistoryDTO; import io.metersphere.system.dto.OperationHistoryDTO;
import io.metersphere.system.dto.request.OperationHistoryRequest; import io.metersphere.system.dto.request.OperationHistoryRequest;
import io.metersphere.system.log.constants.OperationLogModule; import io.metersphere.system.log.constants.OperationLogModule;
import io.metersphere.system.log.constants.OperationLogType;
import io.metersphere.system.mapper.OperationHistoryMapper; import io.metersphere.system.mapper.OperationHistoryMapper;
import io.metersphere.system.mapper.UserMapper; import io.metersphere.system.mapper.UserMapper;
import jakarta.annotation.Resource; import jakarta.annotation.Resource;
import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
@ -51,6 +54,14 @@ public class BugHistoryService {
OperationHistoryDTO dto = new OperationHistoryDTO(); OperationHistoryDTO dto = new OperationHistoryDTO();
BeanUtils.copyBean(dto, h); BeanUtils.copyBean(dto, h);
dto.setCreateUserName(userMap.get(h.getCreateUser()) == null ? h.getCreateUser() : userMap.get(h.getCreateUser())); dto.setCreateUserName(userMap.get(h.getCreateUser()) == null ? h.getCreateUser() : userMap.get(h.getCreateUser()));
if (StringUtils.equals(dto.getType(), OperationLogType.ADD.name())) {
dto.setType(Translator.get("add"));
} else if (StringUtils.equals(dto.getType(), OperationLogType.UPDATE.name())) {
dto.setType(Translator.get("update"));
} else if (StringUtils.equals(dto.getType(), OperationLogType.DELETE.name())) {
dto.setType(Translator.get("delete"));
}
return dto; return dto;
}).toList(); }).toList();
} }

View File

@ -189,7 +189,7 @@
<div class="w-full"> <div class="w-full">
<slot name="empty"> <slot name="empty">
<div class="flex h-[40px] flex-col items-center justify-center"> <div class="flex h-[40px] flex-col items-center justify-center">
<span class="text-[14px] text-[var(--color-text-4)]">{{ t('msTable.empty') }}</span> <span class="text-[14px] text-[var(--color-text-4)]">{{ t('common.noData') }}</span>
</div> </div>
</slot> </slot>
</div> </div>

View File

@ -2,8 +2,6 @@
<ms-base-table class="mt-[16px]" v-bind="propsRes" v-on="propsEvent"> <ms-base-table class="mt-[16px]" v-bind="propsRes" v-on="propsEvent">
<template #changeNumber="{ record }"> <template #changeNumber="{ record }">
<span>{{ record.id }}</span> <span>{{ record.id }}</span>
<!-- TODO: 先不上 -->
<!-- <a-tag size="small" class="ml-[4px]">{{ t('bugManagement.history.current') }}</a-tag> -->
</template> </template>
</ms-base-table> </ms-base-table>
</template> </template>
@ -30,6 +28,12 @@
dataIndex: 'id', dataIndex: 'id',
width: 200, width: 200,
}, },
{
title: 'bugManagement.history.operation',
dataIndex: 'type',
showTooltip: true,
width: 200,
},
{ {
title: 'bugManagement.history.operationMan', title: 'bugManagement.history.operationMan',
dataIndex: 'createUserName', dataIndex: 'createUserName',

View File

@ -120,6 +120,7 @@ export default {
history: { history: {
changeNumber: 'Change number', changeNumber: 'Change number',
operationMan: 'Operator', operationMan: 'Operator',
operation: 'Operation',
updateTime: 'Update time', updateTime: 'Update time',
restore: 'Restore', restore: 'Restore',
current: 'Current', current: 'Current',

View File

@ -120,6 +120,7 @@ export default {
history: { history: {
changeNumber: '变更序号', changeNumber: '变更序号',
operationMan: '操作人', operationMan: '操作人',
operation: '操作',
updateTime: '更新时间', updateTime: '更新时间',
restore: '恢复', restore: '恢复',
current: '当前', current: '当前',