style(系统设置): 模板字段删除文案修改,excel导入文案修改
--bug=1036740 --user=宋天阳 【系统设置】组织-模板-字段设置-该字段未被使用-删除提示信息错误 https://www.tapd.cn/55049933/s/1472141;--bug=1035875 --user=宋天阳 【用例管理】功能用例-导入excel文件用例,校验成功后的页面提示信息优化 https://www.tapd.cn/55049933/s/1472137
This commit is contained in:
parent
db88c8d6fd
commit
8824e88d92
|
@ -9,4 +9,5 @@ import java.util.List;
|
|||
@Data
|
||||
public class CustomFieldDTO extends CustomField {
|
||||
private List<CustomFieldOption> options;
|
||||
private boolean used;
|
||||
}
|
||||
|
|
|
@ -0,0 +1,9 @@
|
|||
package io.metersphere.system.mapper;
|
||||
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface ExtTemplateCustomFieldMapper {
|
||||
List<String> selectUsedFieldIds(@Param("fieldIds") List<String> list);
|
||||
}
|
|
@ -0,0 +1,13 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="io.metersphere.system.mapper.ExtTemplateCustomFieldMapper">
|
||||
|
||||
<select id="selectUsedFieldIds" resultType="java.lang.String">
|
||||
SELECT distinct field_id
|
||||
FROM template_custom_field
|
||||
WHERE field_id in
|
||||
<foreach collection="fieldIds" item="fieldId" open="(" close=")" separator=",">
|
||||
#{fieldId}
|
||||
</foreach>
|
||||
</select>
|
||||
</mapper>
|
|
@ -15,6 +15,7 @@ import io.metersphere.system.dto.request.DefaultFunctionalCustomField;
|
|||
import io.metersphere.system.dto.sdk.CustomFieldDTO;
|
||||
import io.metersphere.system.dto.sdk.request.CustomFieldOptionRequest;
|
||||
import io.metersphere.system.mapper.CustomFieldMapper;
|
||||
import io.metersphere.system.mapper.ExtTemplateCustomFieldMapper;
|
||||
import io.metersphere.system.mapper.TemplateCustomFieldMapper;
|
||||
import io.metersphere.system.uid.IDGenerator;
|
||||
import io.metersphere.system.utils.ServiceUtils;
|
||||
|
@ -50,6 +51,8 @@ public class BaseCustomFieldService {
|
|||
protected BaseOrganizationParameterService baseOrganizationParameterService;
|
||||
@Resource
|
||||
protected TemplateCustomFieldMapper templateCustomFieldMapper;
|
||||
@Resource
|
||||
private ExtTemplateCustomFieldMapper extTemplateCustomFieldMapper;
|
||||
|
||||
private static final String CREATE_USER = "CREATE_USER";
|
||||
|
||||
|
@ -57,6 +60,11 @@ public class BaseCustomFieldService {
|
|||
checkScene(scene);
|
||||
List<CustomField> customFields = getByScopeIdAndScene(scopeId, scene);
|
||||
List<String> userIds = customFields.stream().map(CustomField::getCreateUser).toList();
|
||||
List<String> usedFieldIds = new ArrayList<>();
|
||||
if (CollectionUtils.isNotEmpty(customFields)) {
|
||||
usedFieldIds.addAll(extTemplateCustomFieldMapper.selectUsedFieldIds(customFields.stream().map(CustomField::getId).toList()));
|
||||
}
|
||||
|
||||
Map<String, String> userNameMap = userLoginService.getUserNameMap(userIds);
|
||||
List<CustomFieldOption> customFieldOptions = baseCustomFieldOptionService.getByFieldIds(customFields.stream().map(CustomField::getId).toList());
|
||||
Map<String, List<CustomFieldOption>> optionMap = customFieldOptions.stream().collect(Collectors.groupingBy(CustomFieldOption::getFieldId));
|
||||
|
@ -67,6 +75,10 @@ public class BaseCustomFieldService {
|
|||
}
|
||||
CustomFieldDTO customFieldDTO = new CustomFieldDTO();
|
||||
BeanUtils.copyBean(customFieldDTO, item);
|
||||
//判断有没有用到
|
||||
if (usedFieldIds.contains(item.getId())) {
|
||||
customFieldDTO.setUsed(true);
|
||||
}
|
||||
customFieldDTO.setOptions(optionMap.get(item.getId()));
|
||||
if (CustomFieldType.getHasOptionValueSet().contains(customFieldDTO.getType()) && customFieldDTO.getOptions() == null) {
|
||||
customFieldDTO.setOptions(List.of());
|
||||
|
|
|
@ -63,6 +63,7 @@ export interface FieldOption {
|
|||
export interface AddOrUpdateField {
|
||||
id?: string;
|
||||
name: string;
|
||||
used: boolean;
|
||||
scene: SeneType; // 使用场景
|
||||
type: FormItemType;
|
||||
remark: string; // 备注
|
||||
|
|
|
@ -57,7 +57,9 @@
|
|||
</template>
|
||||
</a-popover>
|
||||
</div>
|
||||
<div> {{ t('caseManagement.featureCase.afterFailingToModify', { type: props.validateType }) }}</div>
|
||||
<div v-if="validateResultInfo.failCount > 0">
|
||||
{{ t('caseManagement.featureCase.afterFailingToModify', { type: props.validateType }) }}</div
|
||||
>
|
||||
</div>
|
||||
<template #footer>
|
||||
<div class="flex justify-end">
|
||||
|
|
|
@ -163,6 +163,7 @@
|
|||
});
|
||||
const initFieldForm: AddOrUpdateField = {
|
||||
name: '',
|
||||
used: false,
|
||||
type: undefined,
|
||||
remark: '',
|
||||
scopeId: scopeId.value,
|
||||
|
@ -278,6 +279,7 @@
|
|||
|
||||
const params: AddOrUpdateField = {
|
||||
name,
|
||||
used: false,
|
||||
options,
|
||||
scopeId: scopeId.value,
|
||||
scene,
|
||||
|
|
|
@ -325,10 +325,14 @@
|
|||
const deleteApi = getFieldRequestApi(props.mode).delete;
|
||||
// 删除字段
|
||||
const handlerDelete = (record: AddOrUpdateField) => {
|
||||
let contentStr = t('system.orgTemplate.deleteFiledContentNotUsed');
|
||||
if (record.used) {
|
||||
contentStr = t('system.orgTemplate.deleteFiledContent');
|
||||
}
|
||||
openModal({
|
||||
type: 'error',
|
||||
title: t('system.orgTemplate.deleteTitle', { name: characterLimit(record.name) }),
|
||||
content: t('system.orgTemplate.deleteFiledContent'),
|
||||
content: contentStr,
|
||||
okText: t('common.confirmDelete'),
|
||||
cancelText: t('common.cancel'),
|
||||
okButtonProps: {
|
||||
|
|
|
@ -129,6 +129,7 @@ export default {
|
|||
'After delete, will be effective in the project and delete irrevocable, please careful operation.',
|
||||
'system.orgTemplate.deleteFiledContent':
|
||||
'This field has been used in the template, data will be lost after deletion, please be careful!',
|
||||
'system.orgTemplate.deleteFiledContentNotUsed': 'This field will be lost, please be careful!',
|
||||
'system.orgTemplate.deleteSuccess': 'Delete Successfully',
|
||||
'system.orgTemplate.setInitStateSuccess': 'Set the initial state successfully',
|
||||
'system.orgTemplate.setEndStateSuccess': 'Setting the end status succeeded',
|
||||
|
|
|
@ -123,6 +123,7 @@ export default {
|
|||
'system.orgTemplate.deleteStateTitle': '确定删除 {name} 状态吗?',
|
||||
'system.orgTemplate.deleteStateContent': '删除后,会在项目中立即生效且删除不可撤回,请谨慎操作!',
|
||||
'system.orgTemplate.deleteFiledContent': '该字段在模板中已使用,删除后数据将会丢失,请谨慎操作!',
|
||||
'system.orgTemplate.deleteFiledContentNotUsed': '删除后,字段将从字段列表移除,请谨慎操作!',
|
||||
'system.orgTemplate.deleteSuccess': '删除成功',
|
||||
'system.orgTemplate.setInitStateSuccess': '设置初始态成功',
|
||||
'system.orgTemplate.setEndStateSuccess': '设置结束状态成功',
|
||||
|
|
Loading…
Reference in New Issue