feat: 1.15 关注优化初版完成

This commit is contained in:
guoyuqi 2021-11-08 14:57:20 +08:00 committed by 刘瑞斌
parent 0926947cb8
commit 4efff28bc2
8 changed files with 183 additions and 20 deletions

View File

@ -137,4 +137,10 @@ public class TestCaseReviewController {
public List<TestReviewDTOWithMetric> 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);
}
}

View File

@ -263,7 +263,7 @@ public class TestCaseReviewService {
testCaseReviewUsersMapper.deleteByExample(example);
}
private void editCaseRevieweFollow(SaveTestCaseReviewRequest testCaseReview) {
public void editCaseRevieweFollow(SaveTestCaseReviewRequest testCaseReview) {
// 要更新的follows
List<String> follows = testCaseReview.getFollowIds();
if (CollectionUtils.isNotEmpty(follows)) {

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-right: 15px;cursor: pointer;position: relative; top: 5px; " @click="saveFollow" v-if="!showFollow"/>
<i class="el-icon-star-on" style="color: #783987; font-size: 28px; margin-right: 15px;cursor: pointer;position: relative; top: 5px; " @click="saveFollow" v-if="showFollow"/>
</el-tooltip>
<el-link type="primary" style="margin-right: 20px" @click="openHis" v-if="path === '/api/automation/update'">{{ $t('operating_log.change_history') }}</el-link>
<el-button id="inputDelay" type="primary" size="small" v-prevent-re-click @click="editScenario"
@ -58,7 +62,7 @@
</el-select>
</el-form-item>
</el-col>
<el-col :span="7">
<!-- <el-col :span="7">
<el-form-item :label="$t('api_test.automation.follow_people')" prop="followPeople">
<el-select v-model="currentScenario.follows"
clearable multiple
@ -72,7 +76,7 @@
</el-option>
</el-select>
</el-form-item>
</el-col>
</el-col>-->
</el-row>
<el-row>
<el-col :span="7">
@ -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)
}
}
}
}

View File

@ -50,7 +50,7 @@
</el-col>
<el-col :span="16">
<div class="tag-item" @click.stop>
<el-select v-model="apiCase.follows" multiple clearable
<!-- <el-select v-model="apiCase.follows" multiple clearable
:placeholder="$t('api_test.automation.follow_people')" filterable size="small"
@change="saveTestCase(apiCase,true)" style="width: 100%" :disabled="loaded">
<el-option
@ -59,7 +59,9 @@
:label="item.id + ' (' + item.name + ')'"
:value="item.id">
</el-option>
</el-select>
</el-select>-->
<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: 28px; margin-top: 2px; margin-right: 15px;cursor: pointer " @click="saveFollow" v-if="showFollow"/>
</div>
</el-col>
</el-row>
@ -145,7 +147,7 @@
</template>
<script>
import {_getBodyUploadFiles, getCurrentProjectID, getUUID} from "@/common/js/utils";
import {_getBodyUploadFiles, getCurrentProjectID, getCurrentUser, getUUID} from "@/common/js/utils";
import {API_STATUS, PRIORITY} from "../../model/JsonData";
import MsTag from "../../../../common/components/MsTag";
import MsTipButton from "../../../../common/components/MsTipButton";
@ -224,6 +226,7 @@ export default {
isShowInput: false,
methodColorMap: new Map(API_METHOD_COLOUR),
saveLoading: false,
showFollow:false,
beforeRequest: {},
}
},
@ -268,8 +271,15 @@ export default {
this.isXpack = true;
}
if (this.apiCase && this.apiCase.id) {
this.showFollow = false;
this.$get('/api/testcase/follow/' + this.apiCase.id, response => {
this.apiCase.follows = response.data;
for (let i = 0; i < response.data.length; i++) {
if(response.data[i]===this.currentUser().id){
this.showFollow = true;
break;
}
}
});
}
if (this.currentApi && this.currentApi.request) {
@ -277,6 +287,9 @@ export default {
}
},
methods: {
currentUser: () => {
return getCurrentUser();
},
hasPermission,
openHis(row) {
this.$refs.changeHistory.open(row.id, ["接口定义用例", "接口定義用例", "Api definition case"]);
@ -499,6 +512,20 @@ export default {
showHistory(id) {
this.$emit("showHistory", id);
},
saveFollow(){
if(this.showFollow){
this.showFollow = false;
for (let i = 0; i < this.apiCase.follows.length; i++) {
if(this.apiCase.follows[i]===this.currentUser().id){
this.apiCase.follows.splice(i,1)
break;
}
}
}else {
this.showFollow = true;
this.apiCase.follows.push(this.currentUser().id)
}
}
}
}
</script>

View File

@ -5,6 +5,10 @@
<el-form :model="httpForm" :rules="rule" ref="httpForm" label-width="80px" label-position="right">
<!-- 操作按钮 -->
<div style="float: right;margin-right: 20px" 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-right: 5px; position: relative; top: 5px; cursor: pointer " @click="saveFollow" v-if="!showFollow"/>
<i class="el-icon-star-on" style="color: #783987; font-size: 28px; margin-right: 5px; position: relative; top: 5px; cursor: pointer " @click="saveFollow" v-if="showFollow"/>
</el-tooltip>
<el-link type="primary" style="margin-right: 20px" @click="openHis" v-if="httpForm.id">
{{ $t('operating_log.change_history') }}
</el-link>
@ -69,7 +73,7 @@
<ms-input-tag :currentScenario="httpForm" ref="tag"/>
</el-form-item>
</el-col>
<el-col :span="8">
<!-- <el-col :span="8">
<el-form-item :label="$t('api_test.automation.follow_people')" prop="followPeople">
<el-select v-model="httpForm.follows"
clearable multiple
@ -83,7 +87,7 @@
</el-option>
</el-select>
</el-form-item>
</el-col>
</el-col>-->
<el-col :span="8">
<el-form-item :label="$t('commons.description')" prop="description">
<el-input class="ms-http-textarea"
@ -144,7 +148,7 @@
import MsJsr233Processor from "../../../automation/scenario/component/Jsr233Processor";
import MsSelectTree from "../../../../common/select-tree/SelectTree";
import MsChangeHistory from "../../../../history/ChangeHistory";
import {getCurrentProjectID, getUUID} from "@/common/js/utils";
import {getCurrentProjectID, getCurrentUser, getUUID} from "@/common/js/utils";
import MsFormDivider from "@/business/components/common/components/MsFormDivider";
import ApiOtherInfo from "@/business/components/api/definition/components/complete/ApiOtherInfo";
@ -177,6 +181,7 @@
},
httpForm: {environmentId: "", path: "", tags: []},
isShowEnable: true,
showFollow:false,
maintainerOptions: [],
currentModule: {},
reqOptions: REQ_METHOD,
@ -304,6 +309,9 @@
}
},
methods: {
currentUser: () => {
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();
}

View File

@ -3,7 +3,7 @@
<ms-main-container>
<el-card v-loading="result.loading">
<el-row>
<el-col :span="6">
<el-col :span="12">
<el-form :inline="true">
<el-form-item :label="$t('load_test.name') ">
<el-input :disabled="isReadOnly" :placeholder="$t('load_test.input_name')" v-model="test.name"
@ -13,7 +13,7 @@
</el-form-item>
</el-form>
</el-col>
<el-col :span="6">
<!-- <el-col :span="6">
<el-form>
<el-form-item :label="$t('api_test.automation.follow_people')">
<el-select v-model="test.follows"
@ -29,8 +29,12 @@
</el-form-item>
</el-form>
</el-col>
</el-col>-->
<el-col :span="12">
<el-tooltip :content="$t('commons.follow')" placement="bottom" effect="dark">
<i class="el-icon-star-off" style="color: #783987; font-size: 25px; margin-right: 15px;cursor: pointer;position: relative; top: 5px; " @click="saveFollow" v-if="!showFollow"/>
<i class="el-icon-star-on" style="color: #783987; font-size: 28px; margin-right: 15px;cursor: pointer;position: relative; top: 5px; " @click="saveFollow" v-if="showFollow"/>
</el-tooltip>
<el-link type="primary" size="small" style="margin-right: 20px" @click="openHis" v-if="test.id">
{{ $t('operating_log.change_history') }}
</el-link>
@ -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)
}
}
}
};

View File

@ -14,7 +14,7 @@
<el-form-item :label="$t('commons.phone')" prop="phone">
<el-input v-model="form.phone" autocomplete="off"/>
</el-form-item>
<el-form-item label="所属工作空间" v-if="workspaceList.length>0">
<!-- <el-form-item label="所属工作空间" v-if="workspaceList.length>0">
<span v-for="(item,index) in workspaceList" :key = item.id >
<span>{{item.name}}</span><span v-if="index<workspaceList.length-1"> | </span>
</span>
@ -23,7 +23,7 @@
<span v-for="(item,index) in projectList" :key = item.id >
<span>{{item.name}}</span><span v-if="index<projectList.length-1"> | </span>
</span>
</el-form-item>
</el-form-item>-->
<el-form-item>
<el-button @click="cancel">{{$t('commons.cancel')}}</el-button>
<el-button type="primary" @click="updateUser('updateUserForm')" @keydown.enter.native.prevent>{{$t('commons.confirm')}}</el-button>

View File

@ -96,21 +96,23 @@
</el-table-column>
</template>
<el-table-column
min-width="100"
min-width="120"
:label="$t('commons.operating')">
<template slot="header">
<header-label-operate @exec="customHeader"/>
</template>
<template v-slot:default="scope">
<div>
<ms-table-operator :edit-permission="['PROJECT_TRACK_REVIEW:READ+EDIT']"
:delete-permission="['PROJECT_TRACK_REVIEW:READ+DELETE']"
@editClick="handleEdit(scope.row)"
@deleteClick="handleDelete(scope.row)">
</ms-table-operator>
<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; padding-left: 5px;top: 5px; position: relative; cursor: pointer;width: 28px;height: 28px;" @click="saveFollow(scope.row)"></i>
<i v-if="scope.row.showFollow" class="el-icon-star-on" style="color: #783987; font-size: 30px;padding-left: 5px; top: 5px; position: relative; cursor: pointer;width: 28px;height: 28px; " @click="saveFollow(scope.row)"></i>
</el-tooltip>
</div>
</template>
</el-table-column>
<header-custom ref="headerCustom" :initTableData="initTableData" :optionalFields=headerItems
@ -132,7 +134,7 @@ import MsDialogFooter from "../../../common/components/MsDialogFooter";
import MsTableHeader from "../../../common/components/MsTableHeader";
import MsCreateBox from "../../../settings/CreateBox";
import MsTablePagination from "../../../common/pagination/TablePagination";
import {getCurrentProjectID, getCurrentWorkspaceId} from "@/common/js/utils";
import {getCurrentProjectID, getCurrentUser, getCurrentWorkspaceId} from "@/common/js/utils";
import {_filter, _sort, deepClone, getLabel, getLastTableSortField,saveLastTableSortField} from "@/common/js/tableUtils";
import PlanStatusTableItem from "../../common/tableItems/plan/PlanStatusTableItem";
import {Test_Case_Review} from "@/business/components/common/model/JsonData";
@ -196,6 +198,9 @@ export default {
},
},
methods: {
currentUser: () => {
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();
});
}
}
}
};
</script>