feat: 关注功能-测试计划 功能用例

This commit is contained in:
guoyuqi 2021-11-04 19:27:46 +08:00 committed by 刘瑞斌
parent a7b81665ec
commit 940c4463b3
9 changed files with 119 additions and 17 deletions

View File

@ -118,6 +118,12 @@ public class TestPlanController {
testPlanService.editReportConfig(testPlanDTO); testPlanService.editReportConfig(testPlanDTO);
} }
@PostMapping("/edit/follows/{planId}")
@RequiresPermissions(PermissionConstants.PROJECT_TRACK_PLAN_READ_EDIT)
public void editTestFollows(@PathVariable String planId,@RequestBody List<String> follows) {
testPlanService.editTestFollows(planId,follows);
}
@PostMapping("/delete/{testPlanId}") @PostMapping("/delete/{testPlanId}")
@RequiresPermissions(PermissionConstants.PROJECT_TRACK_PLAN_READ_DELETE) @RequiresPermissions(PermissionConstants.PROJECT_TRACK_PLAN_READ_DELETE)
@MsAuditLog(module = "track_test_plan", type = OperLogConstants.DELETE, beforeEvent = "#msClass.getLogDetails(#testPlanId)", msClass = TestPlanService.class) @MsAuditLog(module = "track_test_plan", type = OperLogConstants.DELETE, beforeEvent = "#msClass.getLogDetails(#testPlanId)", msClass = TestPlanService.class)

View File

@ -228,6 +228,8 @@ public class TestPlanService {
return testPlan; return testPlan;
} }
public List<TestPlan> getTestPlanByName(String name) { public List<TestPlan> getTestPlanByName(String name) {
TestPlanExample example = new TestPlanExample(); TestPlanExample example = new TestPlanExample();
example.createCriteria() example.createCriteria()
@ -254,19 +256,22 @@ public class TestPlanService {
} }
} }
List<String> follows = request.getFollows(); List<String> follows = request.getFollows();
if (StringUtils.isNotBlank(request.getId())) { editTestFollows(request.getId(),follows);
testPlanFollowService.deleteTestPlanFollowByPlanId(request.getId()); return this.editTestPlan(request);
}
public void editTestFollows(String planId, List<String> follows){
if (StringUtils.isNotBlank(planId)) {
testPlanFollowService.deleteTestPlanFollowByPlanId(planId);
if (!CollectionUtils.isEmpty(follows)) { if (!CollectionUtils.isEmpty(follows)) {
for (String follow : follows) { for (String follow : follows) {
TestPlanFollow testPlanFollow = new TestPlanFollow(); TestPlanFollow testPlanFollow = new TestPlanFollow();
testPlanFollow.setTestPlanId(request.getId()); testPlanFollow.setTestPlanId(planId);
testPlanFollow.setFollowId(follow); testPlanFollow.setFollowId(follow);
testPlanFollowService.insert(testPlanFollow); testPlanFollowService.insert(testPlanFollow);
} }
} }
} }
return this.editTestPlan(request);
} }
public TestPlan editTestPlan(TestPlanWithBLOBs testPlan) { public TestPlan editTestPlan(TestPlanWithBLOBs testPlan) {

View File

@ -1,21 +1,29 @@
<template> <template>
<el-row type="flex" align="middle" class="current-user"> <div>
<div class="icon-title"> <el-row type="flex" align="middle" class="current-user">
{{ currentUser.name.substring(0, 1) }} <div class="icon-title" @click="resVisible = true">
</div> {{ currentUser.name.substring(0, 1) }}
<span class="username">{{ currentUser.name }}</span> </div>
</el-row> <span class="username" @click="resVisible = true" style="cursor: pointer">{{ currentUser.name }}</span>
</el-row>
<el-dialog :close-on-click-modal="false" width="80%"
:visible.sync="resVisible" class="api-import" destroy-on-close @close="closeDialog">
<ms-person-router @closeDialog = "closeDialog"/>
</el-dialog>
</div>
</template> </template>
<script> <script>
import {getCurrentUser} from "@/common/js/utils"; import {getCurrentUser} from "@/common/js/utils";
import MsPersonRouter from "@/business/components/settings/components/PersonRouter";
export default { export default {
name: "MsCurrentUser", name: "MsCurrentUser",
components:{MsPersonRouter},
data() { data() {
return { return {
editVisible: false, editVisible: false,
resVisible:false,
id: "123456", id: "123456",
form: {} form: {}
} }
@ -27,6 +35,12 @@ export default {
}, },
submit() { submit() {
this.editVisible = false; this.editVisible = false;
},
closeDialog(){
this.resVisible = false;
},
shawPerson(){
debugger
} }
}, },
computed: { computed: {
@ -53,6 +67,7 @@ export default {
.current-user .edit { .current-user .edit {
opacity: 0; opacity: 0;
} }
.current-user:hover .edit { .current-user:hover .edit {
@ -68,6 +83,7 @@ export default {
text-align: center; text-align: center;
border-radius: 30px; border-radius: 30px;
font-size: 14px; font-size: 14px;
cursor: pointer;
} }
</style> </style>

View File

@ -42,6 +42,9 @@
export default { export default {
name: "MsPersonRouter", name: "MsPersonRouter",
components: {MsMainContainer,MsPersonFromSetting,MsApiKeys,PasswordInfo,ZentaoUserInfo, TapdUserInfo, JiraUserInfo, AzureDevopsUserInfo}, components: {MsMainContainer,MsPersonFromSetting,MsApiKeys,PasswordInfo,ZentaoUserInfo, TapdUserInfo, JiraUserInfo, AzureDevopsUserInfo},
inject: [
'reload',
],
data(){ data(){
let getMenus = function (group) { let getMenus = function (group) {
let menus = []; let menus = [];

View File

@ -5,6 +5,10 @@
<!--操作按钮--> <!--操作按钮-->
<div class="ms-opt-btn"> <div class="ms-opt-btn">
<el-tooltip :content="$t('commons.follow')" placement="bottom" effect="dark">
<i class="el-icon-star-off" style="color: #783987; font-size: 25px; margin-top: 2px; margin-right: 15px;cursor: pointer " @click="saveFollow" v-if="!showFollow"/>
<i class="el-icon-star-on" style="color: #783987; font-size: 25px; margin-top: 2px; margin-right: 15px " @click="saveFollow" v-if="showFollow"/>
</el-tooltip>
<el-link type="primary" style="margin-right: 20px" @click="openHis" v-if="form.id">{{$t('operating_log.change_history')}}</el-link> <el-link type="primary" style="margin-right: 20px" @click="openHis" v-if="form.id">{{$t('operating_log.change_history')}}</el-link>
<ms-table-button v-if="this.path!='/test/case/add'" <ms-table-button v-if="this.path!='/test/case/add'"
id="inputDelay" id="inputDelay"
@ -47,8 +51,7 @@
<ms-input-tag :read-only="readOnly" :currentScenario="form" v-if="showInputTag" ref="tag" class="ms-case-input"/> <ms-input-tag :read-only="readOnly" :currentScenario="form" v-if="showInputTag" ref="tag" class="ms-case-input"/>
</el-form-item> </el-form-item>
</el-col> </el-col>
<!-- <el-col :span="6">
<el-col :span="6">
<el-form-item :label="$t('api_test.automation.follow_people')" :label-width="formLabelWidth" <el-form-item :label="$t('api_test.automation.follow_people')" :label-width="formLabelWidth"
prop="followPeople"> prop="followPeople">
<el-select v-model="form.follows" <el-select v-model="form.follows"
@ -62,7 +65,7 @@
</el-option> </el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
</el-col> </el-col>-->
</el-row> </el-row>
<!-- 自定义字段 --> <!-- 自定义字段 -->
@ -199,6 +202,7 @@
comments: [], comments: [],
result: {}, result: {},
dialogFormVisible: false, dialogFormVisible: false,
showFollow:false,
form: { form: {
name: '', name: '',
module: 'default-module', module: 'default-module',
@ -372,9 +376,18 @@
} }
this.$get('/test/case/follow/' + this.currentTestCaseInfo.id, response =>{ this.$get('/test/case/follow/' + this.currentTestCaseInfo.id, response =>{
this.form.follows = response.data; this.form.follows = response.data;
for (let i = 0; i < response.data.length; i++) {
if(response.data[i]===this.currentUser().id){
this.showFollow = true;
break;
}
}
}) })
}, },
methods: { methods: {
currentUser: () => {
return getCurrentUser();
},
openHis() { openHis() {
this.$refs.changeHistory.open(this.form.id,["测试用例" , "測試用例" , "Test case"]); this.$refs.changeHistory.open(this.form.id,["测试用例" , "測試用例" , "Test case"]);
}, },
@ -814,6 +827,21 @@
createCtrlSHandle(event) { createCtrlSHandle(event) {
handleCtrlSEvent(event, this.saveCase); handleCtrlSEvent(event, this.saveCase);
}, },
saveFollow(){
if(this.showFollow){
this.showFollow = false;
for (let i = 0; i < this.form.follows.length; i++) {
if(this.form.follows[i]===this.currentUser().id){
this.form.follows.splice(i,1)
break;
}
}
}else {
this.showFollow = true;
this.form.follows.push(this.currentUser().id)
}
}
} }
} }
</script> </script>
@ -881,4 +909,7 @@
height: 32px; height: 32px;
width: 56px; width: 56px;
} }
.icon-style{
}
</style> </style>

View File

@ -185,7 +185,7 @@
</el-table-column> </el-table-column>
</template> </template>
<el-table-column <el-table-column
min-width="180" min-width="200"
:label="$t('commons.operating')"> :label="$t('commons.operating')">
<template slot="header"> <template slot="header">
<header-label-operate @exec="customHeader"/> <header-label-operate @exec="customHeader"/>
@ -207,6 +207,12 @@
@exec="openReport(scope.row)"/> @exec="openReport(scope.row)"/>
</template> </template>
</ms-table-operator> </ms-table-operator>
<template>
<el-tooltip :content="$t('commons.follow')" placement="bottom" effect="dark" >
<i v-if="!scope.row.showFollow" class="el-icon-star-off" style="color: #783987; font-size: 25px; cursor: pointer;padding-left: 5px;width: 28px;height: 28px; top: 5px; position: relative" @click="saveFollow(scope.row)"></i>
<i v-if="scope.row.showFollow" class="el-icon-star-on" style="color: #783987; font-size: 30px; cursor: pointer;padding-left: 5px;width: 28px;height: 28px; top: 6px; position: relative" @click="saveFollow(scope.row)"></i>
</el-tooltip>
</template>
<el-dropdown @command="handleCommand($event, scope.row)" class="scenario-ext-btn" v-permission="['PROJECT_TRACK_PLAN:READ+DELETE','PROJECT_TRACK_PLAN:READ+SCHEDULE']"> <el-dropdown @command="handleCommand($event, scope.row)" class="scenario-ext-btn" v-permission="['PROJECT_TRACK_PLAN:READ+DELETE','PROJECT_TRACK_PLAN:READ+SCHEDULE']">
<el-link type="primary" :underline="false"> <el-link type="primary" :underline="false">
<el-icon class="el-icon-more"></el-icon> <el-icon class="el-icon-more"></el-icon>
@ -266,7 +272,7 @@ import HeaderCustom from "@/business/components/common/head/HeaderCustom";
import HeaderLabelOperate from "@/business/components/common/head/HeaderLabelOperate"; import HeaderLabelOperate from "@/business/components/common/head/HeaderLabelOperate";
import MsTag from "@/business/components/common/components/MsTag"; import MsTag from "@/business/components/common/components/MsTag";
import MsTestPlanScheduleMaintain from "@/business/components/track/plan/components/ScheduleMaintain"; import MsTestPlanScheduleMaintain from "@/business/components/track/plan/components/ScheduleMaintain";
import {getCurrentProjectID, getCurrentUserId, hasPermission} from "@/common/js/utils"; import {getCurrentProjectID, getCurrentUser, getCurrentUserId, hasPermission} from "@/common/js/utils";
import PlanRunModeWithEnv from "@/business/components/track/plan/common/PlanRunModeWithEnv"; import PlanRunModeWithEnv from "@/business/components/track/plan/common/PlanRunModeWithEnv";
import TestPlanReportReview from "@/business/components/track/report/components/TestPlanReportReview"; import TestPlanReportReview from "@/business/components/track/report/components/TestPlanReportReview";
import MsTaskCenter from "@/business/components/task/TaskCenter"; import MsTaskCenter from "@/business/components/task/TaskCenter";
@ -339,6 +345,9 @@ export default {
this.initTableData(); this.initTableData();
}, },
methods: { methods: {
currentUser: () => {
return getCurrentUser();
},
init() { init() {
this.initTableData(); this.initTableData();
}, },
@ -388,6 +397,7 @@ export default {
let data = res.data; let data = res.data;
let follow = ""; let follow = "";
let followIds = data.map(d => d.id); let followIds = data.map(d => d.id);
let showFollow = false;
if (data) { if (data) {
data.forEach(d => { data.forEach(d => {
if (follow !== "") { if (follow !== "") {
@ -395,11 +405,15 @@ export default {
} else { } else {
follow = follow + d.name; follow = follow + d.name;
} }
if(this.currentUser().id===d.id){
showFollow = true;
}
}) })
} }
this.$set(item, "follow", follow); this.$set(item, "follow", follow);
// id // id
this.$set(item, "follows", followIds); this.$set(item, "follows", followIds);
this.$set(item, "showFollow", showFollow);
}) })
}); });
}); });
@ -529,6 +543,30 @@ export default {
}, () => { }, () => {
this.$error(this.$t('commons.run_fail')); this.$error(this.$t('commons.run_fail'));
}); });
},
saveFollow(row){
if(row.showFollow){
row.showFollow = false;
for (let i = 0; i < row.follows.length; i++) {
if(row.follows[i]===this.currentUser().id){
row.follows.splice(i,1)
break;
}
}
this.$post('/test/plan/edit/follows/' + row.id, row.follows,() => {
this.initTableData();
});
return
}
if(!row.showFollow){
row.showFollow = true;
row.follows.push(this.currentUser().id);
this.$post('/test/plan/edit/follows/' + row.id, row.follows,() => {
this.initTableData();
});
return
}
} }
} }
}; };

View File

@ -94,6 +94,7 @@ export default {
create: 'Create', create: 'Create',
edit: 'Edit', edit: 'Edit',
copy: 'Copy', copy: 'Copy',
follow:'Follow',
refresh: 'Refresh', refresh: 'Refresh',
remark: 'Remark', remark: 'Remark',
delete: 'Delete', delete: 'Delete',

View File

@ -95,6 +95,7 @@ export default {
create: '新建', create: '新建',
edit: '编辑', edit: '编辑',
copy: '复制', copy: '复制',
follow:'关注',
refresh: '刷新', refresh: '刷新',
remark: '备注', remark: '备注',
delete: '删除', delete: '删除',

View File

@ -95,6 +95,7 @@ export default {
create: '新建', create: '新建',
edit: '編輯', edit: '編輯',
copy: '復製', copy: '復製',
follow:'關注',
refresh: '刷新', refresh: '刷新',
remark: '備註', remark: '備註',
delete: '刪除', delete: '刪除',