From 4efff28bc256cb9184f052252ecc6e802be70dd0 Mon Sep 17 00:00:00 2001 From: guoyuqi Date: Mon, 8 Nov 2021 14:57:20 +0800 Subject: [PATCH] =?UTF-8?q?feat:=201.15=20=20=E5=85=B3=E6=B3=A8=E4=BC=98?= =?UTF-8?q?=E5=8C=96=E5=88=9D=E7=89=88=E5=AE=8C=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/TestCaseReviewController.java | 6 +++ .../track/service/TestCaseReviewService.java | 2 +- .../automation/scenario/EditApiScenario.vue | 35 +++++++++++-- .../components/case/ApiCaseItem.vue | 33 +++++++++++-- .../complete/EditCompleteHTTPApi.vue | 35 +++++++++++-- .../performance/test/EditPerformanceTest.vue | 39 +++++++++++++-- .../settings/personal/PersonFromSetting.vue | 4 +- .../review/components/TestCaseReviewList.vue | 49 +++++++++++++++++-- 8 files changed, 183 insertions(+), 20 deletions(-) diff --git a/backend/src/main/java/io/metersphere/track/controller/TestCaseReviewController.java b/backend/src/main/java/io/metersphere/track/controller/TestCaseReviewController.java index 5d7246d068..55b2e48348 100644 --- a/backend/src/main/java/io/metersphere/track/controller/TestCaseReviewController.java +++ b/backend/src/main/java/io/metersphere/track/controller/TestCaseReviewController.java @@ -137,4 +137,10 @@ public class TestCaseReviewController { public List listRelateAll(@RequestBody ReviewRelateRequest request) { return testCaseReviewService.listRelateAll(request); } + + @PostMapping("/edit/follows") + @RequiresPermissions(PermissionConstants.PROJECT_TRACK_PLAN_READ_EDIT) + public void editTestFollows(@RequestBody SaveTestCaseReviewRequest testCaseReview) { + testCaseReviewService.editCaseRevieweFollow(testCaseReview); + } } diff --git a/backend/src/main/java/io/metersphere/track/service/TestCaseReviewService.java b/backend/src/main/java/io/metersphere/track/service/TestCaseReviewService.java index aed5db6c78..ec17fb1cf8 100644 --- a/backend/src/main/java/io/metersphere/track/service/TestCaseReviewService.java +++ b/backend/src/main/java/io/metersphere/track/service/TestCaseReviewService.java @@ -263,7 +263,7 @@ public class TestCaseReviewService { testCaseReviewUsersMapper.deleteByExample(example); } - private void editCaseRevieweFollow(SaveTestCaseReviewRequest testCaseReview) { + public void editCaseRevieweFollow(SaveTestCaseReviewRequest testCaseReview) { // 要更新的follows List follows = testCaseReview.getFollowIds(); if (CollectionUtils.isNotEmpty(follows)) { diff --git a/frontend/src/business/components/api/automation/scenario/EditApiScenario.vue b/frontend/src/business/components/api/automation/scenario/EditApiScenario.vue index 739988faf8..521392b16e 100644 --- a/frontend/src/business/components/api/automation/scenario/EditApiScenario.vue +++ b/frontend/src/business/components/api/automation/scenario/EditApiScenario.vue @@ -5,6 +5,10 @@
+ + + + {{ $t('operating_log.change_history') }} - + @@ -337,7 +341,7 @@ import { strMapToObj, handleCtrlSEvent, getCurrentProjectID, - handleCtrlREvent, hasLicense + handleCtrlREvent, hasLicense, getCurrentUser } from "@/common/js/utils"; import "@/common/css/material-icons.css" import OutsideClick from "@/common/js/outside-click"; @@ -459,6 +463,7 @@ export default { plugins: [], clearMessage: "", runScenario: undefined, + showFollow:false } }, watch: { @@ -519,6 +524,9 @@ export default { }, }, methods: { + currentUser: () => { + return getCurrentUser(); + }, setDomain(flag) { if (this.projectEnvMap && this.projectEnvMap.size > 0) { let scenario = { @@ -1400,6 +1408,12 @@ export default { this.$get('/api/automation/follow/' + this.currentScenario.id, response => { // this.$set(this.currentScenario, 'follows', response.data); this.currentScenario.follows = response.data; + for (let i = 0; i < response.data.length; i++) { + if(response.data[i]===this.currentUser().id){ + this.showFollow = true; + break; + } + } }); } this.loading = false; @@ -1601,6 +1615,21 @@ export default { }, showHistory() { this.$refs.taskCenter.openScenarioHistory(this.currentScenario.id); + }, + saveFollow(){ + if(this.showFollow){ + this.showFollow = false; + for (let i = 0; i < this.currentScenario.follows.length; i++) { + if(this.currentScenario.follows[i]===this.currentUser().id){ + this.currentScenario.follows.splice(i,1) + break; + } + } + + }else { + this.showFollow = true; + this.currentScenario.follows.push(this.currentUser().id) + } } } } diff --git a/frontend/src/business/components/api/definition/components/case/ApiCaseItem.vue b/frontend/src/business/components/api/definition/components/case/ApiCaseItem.vue index b6b80786af..7ad470c199 100644 --- a/frontend/src/business/components/api/definition/components/case/ApiCaseItem.vue +++ b/frontend/src/business/components/api/definition/components/case/ApiCaseItem.vue @@ -50,7 +50,7 @@
- - + --> + +
@@ -145,7 +147,7 @@ diff --git a/frontend/src/business/components/api/definition/components/complete/EditCompleteHTTPApi.vue b/frontend/src/business/components/api/definition/components/complete/EditCompleteHTTPApi.vue index 52e5ef43e0..b4909c80ec 100644 --- a/frontend/src/business/components/api/definition/components/complete/EditCompleteHTTPApi.vue +++ b/frontend/src/business/components/api/definition/components/complete/EditCompleteHTTPApi.vue @@ -5,6 +5,10 @@
+ + + + {{ $t('operating_log.change_history') }} @@ -69,7 +73,7 @@ - + { + return getCurrentUser(); + }, openHis(){ this.$refs.changeHistory.open(this.httpForm.id,["接口定义" , "接口定義" , "Api definition"]); }, @@ -402,6 +410,21 @@ } }); }, + saveFollow(){ + if(this.showFollow){ + this.showFollow = false; + for (let i = 0; i < this.httpForm.follows.length; i++) { + if(this.httpForm.follows[i]===this.currentUser().id){ + this.httpForm.follows.splice(i,1) + break; + } + } + + }else { + this.showFollow = true; + this.httpForm.follows.push(this.currentUser().id) + } + } }, created() { @@ -412,6 +435,12 @@ this.httpForm = JSON.parse(JSON.stringify(this.basisData)); this.$get('/api/definition/follow/' + this.basisData.id, response => { this.httpForm.follows = response.data; + for (let i = 0; i < response.data.length; i++) { + if(response.data[i]===this.currentUser().id){ + this.showFollow = true; + break; + } + } }); this.initMockEnvironment(); } diff --git a/frontend/src/business/components/performance/test/EditPerformanceTest.vue b/frontend/src/business/components/performance/test/EditPerformanceTest.vue index 7b2612ebfa..fa811064e5 100644 --- a/frontend/src/business/components/performance/test/EditPerformanceTest.vue +++ b/frontend/src/business/components/performance/test/EditPerformanceTest.vue @@ -3,7 +3,7 @@ - + - + + + + + {{ $t('operating_log.change_history') }} @@ -90,7 +94,7 @@ import PerformancePressureConfig from "./components/PerformancePressureConfig"; import PerformanceAdvancedConfig from "./components/PerformanceAdvancedConfig"; import MsContainer from "../../common/components/MsContainer"; import MsMainContainer from "../../common/components/MsMainContainer"; -import {getCurrentProjectID, getCurrentWorkspaceId, hasPermission} from "@/common/js/utils"; +import {getCurrentProjectID, getCurrentUser, getCurrentWorkspaceId, hasPermission} from "@/common/js/utils"; import MsScheduleConfig from "../../common/components/MsScheduleConfig"; import MsChangeHistory from "../../history/ChangeHistory"; import MsTableOperatorButton from "@/business/components/common/components/MsTableOperatorButton"; @@ -123,6 +127,7 @@ export default { active: '0', testId: '', isReadOnly: false, + showFollow:false, tabs: [{ title: this.$t('load_test.basic_config'), id: '0', @@ -165,6 +170,9 @@ export default { this.getMaintainerOptions(); }, methods: { + currentUser: () => { + return getCurrentUser(); + }, getMaintainerOptions() { this.$post('/user/project/member/tester/list', {projectId: getCurrentProjectID()}, response => { this.maintainerOptions = response.data; @@ -248,6 +256,8 @@ export default { }, getTest(testId) { if (testId) { + this.test.follows = []; + this.showFollow = false; this.testId = testId; this.result = this.$get('/performance/get/' + testId, response => { if (response.data) { @@ -257,6 +267,12 @@ export default { } this.$get('/performance/test/follow/' + testId, response => { this.$set(this.test, 'follows', response.data); + for (let i = 0; i < this.test.follows.length; i++) { + if(this.test.follows[i]===this.currentUser().id){ + this.showFollow = true; + break; + } + } }); } }); @@ -463,6 +479,21 @@ export default { if (tab.index === '1') { this.$refs.pressureConfig.calculateTotalChart(); } + }, + saveFollow(){ + if(this.showFollow){ + this.showFollow = false; + for (let i = 0; i < this.test.follows.length; i++) { + if(this.test.follows[i]===this.currentUser().id){ + this.test.follows.splice(i,1) + break; + } + } + + }else { + this.showFollow = true; + this.test.follows.push(this.currentUser().id) + } } } }; diff --git a/frontend/src/business/components/settings/personal/PersonFromSetting.vue b/frontend/src/business/components/settings/personal/PersonFromSetting.vue index 774893c2a6..c173bc9845 100644 --- a/frontend/src/business/components/settings/personal/PersonFromSetting.vue +++ b/frontend/src/business/components/settings/personal/PersonFromSetting.vue @@ -14,7 +14,7 @@ - + {{$t('commons.cancel')}} {{$t('commons.confirm')}} diff --git a/frontend/src/business/components/track/review/components/TestCaseReviewList.vue b/frontend/src/business/components/track/review/components/TestCaseReviewList.vue index ef4c1cd9ec..86be89d3d9 100644 --- a/frontend/src/business/components/track/review/components/TestCaseReviewList.vue +++ b/frontend/src/business/components/track/review/components/TestCaseReviewList.vue @@ -96,21 +96,23 @@ { + return getCurrentUser(); + }, customHeader() { const list = deepClone(this.tableLabel); this.$refs.headerCustom.open(list); @@ -235,8 +240,17 @@ export default { let arr = res.data; let follow = arr.map(data => data.name).join("、"); let followIds = arr.map(data => data.id); + let showFollow = false; + if (arr) { + arr.forEach(d => { + if(this.currentUser().id===d.id){ + showFollow = true; + } + }) + } this.$set(this.tableData[i], "follow", follow); this.$set(this.tableData[i], "followIds", followIds); + this.$set(this.tableData[i], "showFollow", showFollow); }); } }); @@ -284,6 +298,33 @@ export default { saveSortField(key,orders){ saveLastTableSortField(key,JSON.stringify(orders)); }, + saveFollow(row){ + let param = {}; + param.id = row.id; + if(row.showFollow){ + row.showFollow = false; + for (let i = 0; i < row.followIds.length; i++) { + if(row.followIds[i]===this.currentUser().id){ + row.followIds.splice(i,1) + break; + } + } + param.followIds = row.followIds + this.$post('/test/case/review/edit/follows', param,() => { + this.initTableData(); + }); + return + } + if(!row.showFollow){ + row.showFollow = true; + row.followIds.push(this.currentUser().id); + param.followIds = row.followIds + this.$post('/test/case/review/edit/follows', param,() => { + this.initTableData(); + }); + } + + } } };