style(缺陷管理): 缺陷管理变更历史样式更改

--bug=1036363 --user=宋天阳  https://www.tapd.cn/55049933/s/1494814
This commit is contained in:
Jianguo-Genius 2024-04-11 17:38:53 +08:00 committed by 刘瑞斌
parent e7b8fad097
commit 6db623ca7c
8 changed files with 32 additions and 9 deletions

View File

@ -10,6 +10,7 @@ import io.metersphere.system.dto.OperationHistoryDTO;
import io.metersphere.system.dto.request.OperationHistoryRequest;
import io.metersphere.system.log.constants.OperationLogModule;
import io.metersphere.system.log.constants.OperationLogType;
import io.metersphere.system.mapper.BaseOperationHistoryMapper;
import io.metersphere.system.mapper.OperationHistoryMapper;
import io.metersphere.system.mapper.UserMapper;
import jakarta.annotation.Resource;
@ -31,6 +32,8 @@ public class BugHistoryService {
@Resource
private OperationHistoryMapper operationHistoryMapper;
@Resource
private BaseOperationHistoryMapper baseOperationHistoryMapper;
/**
* 缺陷变更历史分页列表
@ -50,6 +53,7 @@ public class BugHistoryService {
userExample.createCriteria().andIdIn(userIds);
List<User> users = userMapper.selectByExample(userExample);
Map<String, String> userMap = users.stream().collect(Collectors.toMap(User::getId, User::getName));
Long latestVersionId = baseOperationHistoryMapper.selectLatestIdByOperationId(request.getSourceId());
return history.stream().map(h -> {
OperationHistoryDTO dto = new OperationHistoryDTO();
BeanUtils.copyBean(dto, h);
@ -61,7 +65,7 @@ public class BugHistoryService {
} else if (StringUtils.equals(dto.getType(), OperationLogType.DELETE.name())) {
dto.setType(Translator.get("delete"));
}
dto.setLatest(latestVersionId != null && latestVersionId.longValue() == dto.getId().longValue());
return dto;
}).toList();
}

View File

@ -23,4 +23,6 @@ public class OperationHistoryDTO extends OperationHistory implements Serializabl
// 版本
private String versionName;
//是否是最新
private boolean isLatest;
}

View File

@ -18,4 +18,6 @@ public interface BaseOperationHistoryMapper {
List<OperationHistoryDTO> list(@Param("request") OperationHistoryRequest request);
List<OperationHistoryDTO> listWidthTable(@Param("request") OperationHistoryRequest request, @Param("table") String table);
Long selectLatestIdByOperationId(String bugId);
}

View File

@ -67,4 +67,11 @@
</if>
</where>
</select>
<select id="selectLatestIdByOperationId" resultType="java.lang.Long">
select id
from operation_history
where source_id = #{0}
order by create_time desc
limit 1
</select>
</mapper>

View File

@ -2,6 +2,7 @@
<ms-base-table class="mt-[16px]" v-bind="propsRes" v-on="propsEvent">
<template #changeNumber="{ record }">
<span>{{ record.id }}</span>
<MsTag v-if="record.latest" size="small" class="ml-2">{{ t('bugManagement.history.current') }}</MsTag>
</template>
</ms-base-table>
</template>
@ -10,6 +11,7 @@
import MsBaseTable from '@/components/pure/ms-table/base-table.vue';
import { MsTableColumn } from '@/components/pure/ms-table/type';
import useTable from '@/components/pure/ms-table/useTable';
import MsTag from '@/components/pure/ms-tag/ms-tag.vue';
import { getChangeHistoryList } from '@/api/modules/bug-management';
import { useI18n } from '@/hooks/useI18n';

View File

@ -32,15 +32,19 @@
</div>
<MsBaseTable v-bind="propsRes" ref="tableRef" v-on="propsEvent">
<template #defaultTemplate="{ record }">
<!-- <a-switch
<div v-if="record.enableDefault || isEnableOrdTemplate">
<a-tooltip :content="t('system.orgTemplate.must.open.one')" :mouse-enter-delay="500">
<a-switch
v-model="record.enableDefault"
:disabled="record.enableDefault || isEnableOrdTemplate"
:disabled="true"
size="small"
type="line"
@change="(value) => changeDefault(value, record)"
/> -->
<!-- TODO 这个版本不允许修改默认模版也不允许创建用例模版 -->
/>
</a-tooltip>
</div>
<a-switch
v-else
v-model="record.enableDefault"
:disabled="record.enableDefault || isEnableOrdTemplate"
size="small"

View File

@ -31,6 +31,7 @@ export default {
'system.orgTemplate.fieldLimit': 'You can add a maximum of 20 fields',
'system.orgTemplate.isSystem': 'System',
'system.orgTemplate.isBuiltIn': 'Built-in',
'system.orgTemplate.must.open.one': 'Must have one open default template',
'system.orgTemplate.fieldList': 'Field list',
'system.orgTemplate.addOptions': 'Add an option',
'system.orgTemplate.deleteTip':

View File

@ -31,6 +31,7 @@ export default {
'system.orgTemplate.fieldLimit': '最多可新增 20 个字段',
'system.orgTemplate.isSystem': '系统',
'system.orgTemplate.isBuiltIn': '内置',
'system.orgTemplate.must.open.one': '项目必须有一个开启的默认模版',
'system.orgTemplate.fieldList': '字段列表',
'system.orgTemplate.addOptions': '添加一个选项',
'system.orgTemplate.deleteTip': '该字段在模板中已使用,删除后数据将会丢失,请谨慎操作!',