From fa1016566f760d9be554830cd811e1f6ed412379 Mon Sep 17 00:00:00 2001 From: wxg0103 <727495428@qq.com> Date: Fri, 29 Mar 2024 18:48:13 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E9=A1=B9=E7=9B=AE=E7=AE=A1=E7=90=86):=20?= =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E7=8E=AF=E5=A2=83=E7=9B=B8=E5=85=B3bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --bug=1037797 --user=王孝刚 【项目管理】项目管理员查看项目环境管理页面-环境组,报错了 https://www.tapd.cn/55049933/s/1484387 --- .../controller/EnvironmentController.java | 1 - .../project/service/EnvironmentGroupService.java | 7 ++++--- .../store/modules/setting/useProjectEnvStore.ts | 2 +- .../components/envParams/HttpTab.vue | 16 ++++++++++++++-- .../components/envParams/popUp/AddHttpDrawer.vue | 5 ++++- .../environmental/locale/en-US.ts | 1 + .../environmental/locale/zh-CN.ts | 1 + 7 files changed, 25 insertions(+), 8 deletions(-) diff --git a/backend/services/project-management/src/main/java/io/metersphere/project/controller/EnvironmentController.java b/backend/services/project-management/src/main/java/io/metersphere/project/controller/EnvironmentController.java index ca0d833772..7b38af462f 100644 --- a/backend/services/project-management/src/main/java/io/metersphere/project/controller/EnvironmentController.java +++ b/backend/services/project-management/src/main/java/io/metersphere/project/controller/EnvironmentController.java @@ -132,7 +132,6 @@ public class EnvironmentController { @GetMapping("/get-options/{projectId}") @Operation(summary = "项目管理-环境-环境目录-列表") - @RequiresPermissions(PermissionConstants.PROJECT_ENVIRONMENT_READ) @CheckOwner(resourceId = "#projectId", resourceType = "project") public List list(@PathVariable String projectId) { return environmentService.listOption(projectId); diff --git a/backend/services/project-management/src/main/java/io/metersphere/project/service/EnvironmentGroupService.java b/backend/services/project-management/src/main/java/io/metersphere/project/service/EnvironmentGroupService.java index cdc80dde6e..821fa7ff9d 100644 --- a/backend/services/project-management/src/main/java/io/metersphere/project/service/EnvironmentGroupService.java +++ b/backend/services/project-management/src/main/java/io/metersphere/project/service/EnvironmentGroupService.java @@ -21,7 +21,6 @@ import io.metersphere.sdk.util.Translator; import io.metersphere.system.domain.UserRoleRelationExample; import io.metersphere.system.dto.sdk.BaseSystemConfigDTO; import io.metersphere.system.dto.sdk.OptionDTO; -import io.metersphere.system.dto.sdk.enums.MoveTypeEnum; import io.metersphere.system.dto.sdk.request.NodeMoveRequest; import io.metersphere.system.dto.sdk.request.PosRequest; import io.metersphere.system.mapper.UserRoleRelationMapper; @@ -39,7 +38,10 @@ import org.mybatis.spring.SqlSessionUtils; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; -import java.util.*; +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; +import java.util.Map; import java.util.stream.Collectors; @Service @@ -72,7 +74,6 @@ public class EnvironmentGroupService extends MoveNodeService{ environmentGroup.setId(IDGenerator.nextStr()); this.checkEnvironmentGroup(environmentGroup); - environmentGroup.setId(UUID.randomUUID().toString()); environmentGroup.setCreateTime(System.currentTimeMillis()); environmentGroup.setUpdateTime(System.currentTimeMillis()); environmentGroup.setCreateUser(userId); diff --git a/frontend/src/store/modules/setting/useProjectEnvStore.ts b/frontend/src/store/modules/setting/useProjectEnvStore.ts index 1eba50a9dc..5942cfc0b9 100644 --- a/frontend/src/store/modules/setting/useProjectEnvStore.ts +++ b/frontend/src/store/modules/setting/useProjectEnvStore.ts @@ -103,7 +103,7 @@ const useProjectEnvStore = defineStore( currentEnvDetailInfo.value = { projectId: appStore.currentProjectId, name: '', - config: envParamsDefaultConfig, + config: cloneDeep(envParamsDefaultConfig), }; backupEnvDetailInfo.value = { projectId: appStore.currentProjectId, diff --git a/frontend/src/views/project-management/environmental/components/envParams/HttpTab.vue b/frontend/src/views/project-management/environmental/components/envParams/HttpTab.vue index ca5b38e216..3c49b973e1 100644 --- a/frontend/src/views/project-management/environmental/components/envParams/HttpTab.vue +++ b/frontend/src/views/project-management/environmental/components/envParams/HttpTab.vue @@ -14,12 +14,24 @@ >{{ t('project.environmental.addHttp') }}
- + - + diff --git a/frontend/src/views/project-management/environmental/components/envParams/popUp/AddHttpDrawer.vue b/frontend/src/views/project-management/environmental/components/envParams/popUp/AddHttpDrawer.vue index 25d24d3834..28cacfb2aa 100644 --- a/frontend/src/views/project-management/environmental/components/envParams/popUp/AddHttpDrawer.vue +++ b/frontend/src/views/project-management/environmental/components/envParams/popUp/AddHttpDrawer.vue @@ -264,7 +264,7 @@ // 判断是否已存在type为NONE的数据 如果存在则不允许添加 数量大于1 则提示 const noneData = store.currentEnvDetailInfo.config.httpConfig.filter((item) => item.type === 'NONE'); - if (noneData.length >= 1) { + if (noneData.length >= 1 && (props.isCopy || !props.currentId)) { Message.error(t('project.environmental.http.noneDataExist')); return; } @@ -326,6 +326,9 @@ const title = ref(''); watchEffect(() => { title.value = props.currentId ? t('project.environmental.http.edit') : t('project.environmental.http.add'); + if (props.isCopy) { + title.value = t('project.environmental.http.copy'); + } if (props.currentId) { const currentItem = store.currentEnvDetailInfo.config.httpConfig.find( (item) => item.id === props.currentId diff --git a/frontend/src/views/project-management/environmental/locale/en-US.ts b/frontend/src/views/project-management/environmental/locale/en-US.ts index a16f046c15..d06e8caab2 100644 --- a/frontend/src/views/project-management/environmental/locale/en-US.ts +++ b/frontend/src/views/project-management/environmental/locale/en-US.ts @@ -50,6 +50,7 @@ export default { 'project.environmental.http.value': 'Value', 'project.environmental.http.add': 'Add HTTP', 'project.environmental.http.edit': 'Update HTTP', + 'project.environmental.http.copy': 'Copy HTTP', 'project.environmental.http.hostName': 'Host Name', 'project.environmental.http.hostNameRequired': 'Host name is required', 'project.environmental.http.httpHostNamePlaceholder': 'For example: http://127.0.0.1', diff --git a/frontend/src/views/project-management/environmental/locale/zh-CN.ts b/frontend/src/views/project-management/environmental/locale/zh-CN.ts index 742556461e..323efea626 100644 --- a/frontend/src/views/project-management/environmental/locale/zh-CN.ts +++ b/frontend/src/views/project-management/environmental/locale/zh-CN.ts @@ -55,6 +55,7 @@ export default { 'project.environmental.http.value': '值', 'project.environmental.http.add': '添加HTTP', 'project.environmental.http.edit': '更新HTTP', + 'project.environmental.http.copy': '复制HTTP', 'project.environmental.http.hostName': '域名', 'project.environmental.http.hostNameRequired': '域名必填', 'project.environmental.http.httpHostNamePlaceholder': '例如:http://127.0.0.1',