fix(接口测试): 接口名称调整

--bug=1046932 --user=白奇 【接口测试】接口定义-创建接口时 定义名称仍在基础信息tab页 https://www.tapd.cn/55049933/s/1583416
This commit is contained in:
baiqi 2024-09-23 11:27:29 +08:00 committed by Craftsman
parent e6d2c2bd00
commit 9d062148cb
2 changed files with 30 additions and 2 deletions

View File

@ -218,6 +218,20 @@
</a-button>
</template>
</div>
<div v-if="props.isDefinition" class="w-full">
<a-input
v-model:model-value="requestVModel.name"
:max-length="255"
:placeholder="t('apiTestManagement.apiNamePlaceholder')"
:style="isNameError ? 'border: 1px solid rgb(var(--danger-6));z-index: 10' : ''"
allow-clear
@input="() => (isNameError = false)"
@change="handleActiveDebugChange"
/>
<div v-if="isNameError" class="name-input-tip">
<span>{{ t('apiTestManagement.apiNameRequired') }}</span>
</div>
</div>
</div>
</div>
<div :class="`${!props.isCase ? 'request-tab-and-response' : ''} flex-1`">
@ -1584,6 +1598,7 @@
const apiBaseFormRef = ref<InstanceType<typeof apiBaseForm>>();
const isUrlError = ref(false);
const isNameError = ref(false);
const tempApiDetail = ref<RequestParam>();
const saveNewApiModalVisible = ref(false);
@ -1592,7 +1607,12 @@
isUrlError.value = true;
return;
}
if (requestVModel.value.name === '') {
isNameError.value = true;
return;
}
isUrlError.value = false;
isNameError.value = false;
if (value === 'saveAsApi') {
const params = makeRequestParams();
tempApiDetail.value = {
@ -1726,6 +1746,14 @@
color: rgb(var(--danger-6));
line-height: 16px;
}
.name-input-tip {
@apply w-full;
margin-top: 4px;
font-size: 12px;
color: rgb(var(--danger-6));
line-height: 16px;
}
.request-tab-and-response {
overflow-x: hidden;
overflow-y: auto;

View File

@ -2,7 +2,7 @@
<!-- TODO:第一版没有模板 -->
<!-- <MsFormCreate v-model:api="fApi" :rule="currentApiTemplateRules" :option="options" /> -->
<a-form ref="formRef" :model="requestVModel" layout="vertical">
<a-form-item
<!-- <a-form-item
field="name"
:label="t('apiTestManagement.apiName')"
class="mb-[16px] w-[60%]"
@ -16,7 +16,7 @@
allow-clear
@change="handleActiveApiChange"
/>
</a-form-item>
</a-form-item> -->
<a-form-item asterisk-position="end" :label="t('common.desc')" class="mb-[16px] w-[60%]">
<a-textarea v-model:model-value="requestVModel.description" :max-length="1000" @change="handleActiveApiChange" />
</a-form-item>