fix(接口测试): 修复只读用户通过ctrl+s可以CASE的缺陷

--bug=1013085 --user=王孝刚 【接口测试】github #13424 只读用户 通过 ctrl s  可以
修改API/CASE/接口自动化场景 https://www.tapd.cn/55049933/s/1155713
This commit is contained in:
wxg0103 2022-05-11 10:07:55 +08:00 committed by 刘瑞斌
parent e348f33650
commit 0382e7c0ff
2 changed files with 16 additions and 10 deletions

View File

@ -43,7 +43,7 @@ import MsTag from "../../../../common/components/MsTag";
import MsEnvironmentSelect from "./MsEnvironmentSelect";
import {API_METHOD_COLOUR} from "../../model/JsonData";
import ApiCaseItem from "@/business/components/api/definition/components/case/ApiCaseItem";
import {getCurrentProjectID} from "@/common/js/utils";
import {hasPermission} from "@/common/js/utils";
export default {
name: "ApiCaseHeader",
@ -88,11 +88,13 @@ export default {
},
methods: {
keyDown(e) {
if (hasPermission('PROJECT_API_DEFINITION:READ+EDIT_CASE')) {
if (!(e.keyCode === 83 && (e.ctrlKey || e.metaKey))) {
return;
}
e.preventDefault();
this.saveTestCase();
}
},
refreshEnvironment() {
this.$refs.environmentSelect.refreshEnvironment();

View File

@ -29,7 +29,7 @@
</el-col>
<el-col :span="2">
<el-select size="mini" v-model="apiCase.priority" class="ms-api-select" @change="changePriority(apiCase)"
:disabled="loaded">
:disabled="readonly">
<el-option v-for="grd in priorities" :key="grd.id" :label="grd.name" :value="grd.id"/>
</el-select>
</el-col>
@ -49,18 +49,20 @@
<el-row>
<el-col :span="8">
<el-select size="small" v-model="apiCase.caseStatus" style="margin-right: 5px"
@change="saveTestCase(apiCase,true)" :disabled="loaded">
@change="saveTestCase(apiCase,true)" :disabled="readonly">
<el-option v-for="item in options" :key="item.id" :label="$t(item.label)" :value="item.id"/>
</el-select>
</el-col>
<el-col :span="16">
<div class="tag-item" @click.stop>
<el-tooltip :content="$t('commons.follow')" placement="bottom" effect="dark" v-if="!showFollow">
<el-tooltip :content="$t('commons.follow')" placement="bottom" effect="dark" v-if="!showFollow"
:disabled="true">
<i class="el-icon-star-off"
style="color: #783987; font-size: 25px; margin-top: 2px; margin-right: 15px;cursor: pointer "
@click="saveFollow"/>
</el-tooltip>
<el-tooltip :content="$t('commons.cancel')" placement="bottom" effect="dark" v-if="showFollow">
<el-tooltip :content="$t('commons.cancel')" placement="bottom" effect="dark" v-if="showFollow"
:disabled="true">
<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"/>
@ -71,7 +73,7 @@
<el-row style="margin-top: 5px">
<div class="tag-item" @click.stop>
<ms-input-tag :currentScenario="apiCase" ref="tag" @keyup.enter.native="saveTestCase(apiCase,true)"
:disabled="loaded"/>
:read-only="readonly"/>
</div>
</el-row>
</el-col>
@ -266,6 +268,7 @@ export default {
isSave: false,
tagCount: 0,
requestCount: 0,
readonly: false
}
},
props: {
@ -308,6 +311,7 @@ export default {
if (requireComponent != null && JSON.stringify(esbDefinition) != '{}' && JSON.stringify(esbDefinitionResponse) != '{}') {
this.isXpack = true;
}
this.readonly = !hasPermission('PROJECT_API_DEFINITION:READ+EDIT_CASE');
if (this.apiCase && this.apiCase.id) {
this.showFollow = false;
this.$get('/api/testcase/follow/' + this.apiCase.id, response => {