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

View File

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

View File

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

View File

@ -5,6 +5,10 @@
<!--操作按钮-->
<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>
<ms-table-button v-if="this.path!='/test/case/add'"
id="inputDelay"
@ -47,8 +51,7 @@
<ms-input-tag :read-only="readOnly" :currentScenario="form" v-if="showInputTag" ref="tag" class="ms-case-input"/>
</el-form-item>
</el-col>
<el-col :span="6">
<!-- <el-col :span="6">
<el-form-item :label="$t('api_test.automation.follow_people')" :label-width="formLabelWidth"
prop="followPeople">
<el-select v-model="form.follows"
@ -62,7 +65,7 @@
</el-option>
</el-select>
</el-form-item>
</el-col>
</el-col>-->
</el-row>
<!-- 自定义字段 -->
@ -199,6 +202,7 @@
comments: [],
result: {},
dialogFormVisible: false,
showFollow:false,
form: {
name: '',
module: 'default-module',
@ -372,9 +376,18 @@
}
this.$get('/test/case/follow/' + this.currentTestCaseInfo.id, response =>{
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: {
currentUser: () => {
return getCurrentUser();
},
openHis() {
this.$refs.changeHistory.open(this.form.id,["测试用例" , "測試用例" , "Test case"]);
},
@ -814,6 +827,21 @@
createCtrlSHandle(event) {
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>
@ -881,4 +909,7 @@
height: 32px;
width: 56px;
}
.icon-style{
}
</style>

View File

@ -185,7 +185,7 @@
</el-table-column>
</template>
<el-table-column
min-width="180"
min-width="200"
:label="$t('commons.operating')">
<template slot="header">
<header-label-operate @exec="customHeader"/>
@ -207,6 +207,12 @@
@exec="openReport(scope.row)"/>
</template>
</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-link type="primary" :underline="false">
<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 MsTag from "@/business/components/common/components/MsTag";
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 TestPlanReportReview from "@/business/components/track/report/components/TestPlanReportReview";
import MsTaskCenter from "@/business/components/task/TaskCenter";
@ -339,6 +345,9 @@ export default {
this.initTableData();
},
methods: {
currentUser: () => {
return getCurrentUser();
},
init() {
this.initTableData();
},
@ -388,6 +397,7 @@ export default {
let data = res.data;
let follow = "";
let followIds = data.map(d => d.id);
let showFollow = false;
if (data) {
data.forEach(d => {
if (follow !== "") {
@ -395,11 +405,15 @@ export default {
} else {
follow = follow + d.name;
}
if(this.currentUser().id===d.id){
showFollow = true;
}
})
}
this.$set(item, "follow", follow);
// id
this.$set(item, "follows", followIds);
this.$set(item, "showFollow", showFollow);
})
});
});
@ -529,6 +543,30 @@ export default {
}, () => {
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',
edit: 'Edit',
copy: 'Copy',
follow:'Follow',
refresh: 'Refresh',
remark: 'Remark',
delete: 'Delete',

View File

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

View File

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