style(接口测试): 接口用例保存并继续添加功能样式调整

--story=1013901 --user=赵勇 【接口测试】接口case新增“保存并继续添加”按钮 https://www.tapd.cn/55049933/s/1439638

Signed-off-by: fit2-zhao <yong.zhao@fit2cloud.com>
This commit is contained in:
fit2-zhao 2023-11-30 14:19:56 +08:00 committed by Craftsman
parent 1de3e7302f
commit 5a7bb17c99
2 changed files with 42 additions and 35 deletions

View File

@ -1,27 +1,28 @@
<template> <template>
<el-header style="width: 100%; padding: 0px"> <el-header style="width: 100%; padding: 0">
<el-card> <el-card>
<el-row> <div style="display: flex">
<el-col :span="1"> <el-tag
<el-tag size="small"
size="mini" style="margin-top: 5px; margin-right: 5px"
:style="{ :style="{
'background-color': getColor(true, api.method), 'background-color': getColor(true, api.method),
border: getColor(true, api.method), border: getColor(true, api.method),
}" }"
class="api-el-tag"> class="api-el-tag">
{{ api.method }} {{ api.method }}
</el-tag> </el-tag>
</el-col> <el-row style="width: 60%">
<el-col :span="9"> <el-col :span="12">
<div class="variable-combine">{{ api.name }}</div> <div class="ellipsis-text">{{ api.name }}</div>
</el-col> </el-col>
<el-col :span="6"> <el-col :span="12">
<div class="variable-combine" style="margin-left: 10px"> <div class="ellipsis-text" style="margin-left: 10px">
{{ api.path === null ? ' ' : api.path }} {{ api.path === null ? ' ' : api.path }}
</div> </div>
</el-col> </el-col>
<el-col :span="4"> </el-row>
<div style="width: 200px; margin-left: auto">
<ms-environment-select <ms-environment-select
:project-id="projectId" :project-id="projectId"
:is-read-only="isReadOnly" :is-read-only="isReadOnly"
@ -29,8 +30,8 @@
@setEnvironment="setEnvironment" @setEnvironment="setEnvironment"
ref="environmentSelect" ref="environmentSelect"
v-if="api.protocol === 'HTTP' || api.protocol === 'TCP'" /> v-if="api.protocol === 'HTTP' || api.protocol === 'TCP'" />
</el-col> </div>
<el-col :span="4"> <div style="width: 240px; margin-right: 20px">
<!-- 保存操作 --> <!-- 保存操作 -->
<el-button <el-button
v-if="!isXpack || !showUpdateRule" v-if="!isXpack || !showUpdateRule"
@ -38,13 +39,11 @@
size="small" size="small"
@click="saveTestCase()" @click="saveTestCase()"
v-prevent-re-click v-prevent-re-click
v-permission="['PROJECT_API_DEFINITION:READ+EDIT_CASE']" v-permission="['PROJECT_API_DEFINITION:READ+EDIT_CASE']">
style="margin-left: -20px">
{{ saveButtonText }} {{ saveButtonText }}
</el-button> </el-button>
<el-dropdown <el-dropdown
v-else v-else
style="margin-left: -17px"
v-permission="[ v-permission="[
'PROJECT_API_DEFINITION:READ+EDIT_CASE', 'PROJECT_API_DEFINITION:READ+EDIT_CASE',
'PROJECT_API_DEFINITION:READ+CREATE_CASE', 'PROJECT_API_DEFINITION:READ+CREATE_CASE',
@ -65,17 +64,16 @@
</el-dropdown> </el-dropdown>
<el-button <el-button
v-if="!isXpack || !showUpdateRule" v-if="!loaded"
type="primary"
size="small" size="small"
@click="saveAndCreate()" @click="saveAndCreate()"
v-prevent-re-click v-prevent-re-click
v-permission="['PROJECT_API_DEFINITION:READ+EDIT_CASE']" v-permission="['PROJECT_API_DEFINITION:READ+EDIT_CASE']"
style="margin-left: 2px"> style="background: #ededf1; color: #323233">
{{ $t('home.dashboard.api_case.save_and_create') }} {{ $t('home.dashboard.api_case.save_and_create') }}
</el-button> </el-button>
</el-col> </div>
</el-row> </div>
</el-card> </el-card>
</el-header> </el-header>
</template> </template>
@ -107,6 +105,12 @@ export default {
useEnvironment: String, useEnvironment: String,
isCaseEdit: Boolean, isCaseEdit: Boolean,
buttonText: String, buttonText: String,
loaded: {
type: Boolean,
default() {
return false;
},
},
condition: { condition: {
type: Object, type: Object,
default() { default() {
@ -202,13 +206,12 @@ export default {
margin-left: 30px; margin-left: 30px;
} }
.variable-combine { .ellipsis-text {
overflow: hidden; overflow: hidden;
text-overflow: ellipsis; text-overflow: ellipsis;
white-space: nowrap; white-space: nowrap;
font-size: 10px; min-width: 100px; /* 设置最小宽度 */
} }
.el-col { .el-col {
height: 32px; height: 32px;
line-height: 32px; line-height: 32px;

View File

@ -19,6 +19,7 @@
:useEnvironment="environment" :useEnvironment="environment"
:is-case-edit="isCaseEdit" :is-case-edit="isCaseEdit"
:button-text="saveButtonText" :button-text="saveButtonText"
:loaded="loaded"
ref="header" ref="header"
v-if="refreshHeader" /> v-if="refreshHeader" />
</template> </template>
@ -620,6 +621,9 @@ export default {
}, },
copyCase(data) { copyCase(data) {
data.type = 'AddCase'; data.type = 'AddCase';
if (!this.api.request) {
this.api.request = data.request;
}
this.apiCaseList.unshift(data); this.apiCaseList.unshift(data);
}, },