fix(环境管理): 修复环境管理环境参数查询报错&添加断言脚本复制脚本

This commit is contained in:
xinxin.wu 2024-04-17 13:19:25 +08:00 committed by 刘瑞斌
parent 8a8e584886
commit cab1b4d1e0
3 changed files with 12 additions and 8 deletions

View File

@ -1,5 +1,5 @@
<template> <template>
<conditionContent v-model:data="condition" :disabled="props.disabled" @delete="deleteItem" /> <conditionContent v-model:data="condition" :disabled="props.disabled" @delete="deleteItem" @copy="emit('copy')" />
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
@ -26,6 +26,7 @@
(e: 'change', val: ScriptItem): void; // (e: 'change', val: ScriptItem): void; //
(e: 'update:data'): void; // (e: 'update:data'): void; //
(e: 'deleteScriptItem', id: string | number): void; // (e: 'deleteScriptItem', id: string | number): void; //
(e: 'copy'): void;
}>(); }>();
const condition = useVModel(props, 'data', emit); const condition = useVModel(props, 'data', emit);

View File

@ -133,6 +133,7 @@
:disabled="props.disabled" :disabled="props.disabled"
@change="handleChange" @change="handleChange"
@delete-script-item="deleteScriptItem" @delete-script-item="deleteScriptItem"
@copy="copyItem"
/> />
</div> </div>
</div> </div>
@ -411,6 +412,12 @@
activeKey.value = item.id; activeKey.value = item.id;
}; };
function copyItem() {
const tmpObj = { ...cloneDeep(getCurrentItemState.value), id: new Date().getTime().valueOf().toString() };
assertions.value.push(tmpObj);
activeKey.value = tmpObj.id;
}
const handleChange = (val: any) => { const handleChange = (val: any) => {
switch (val.assertionType) { switch (val.assertionType) {
case ResponseAssertionType.RESPONSE_HEADER: case ResponseAssertionType.RESPONSE_HEADER:

View File

@ -7,12 +7,8 @@
class="w-[240px]" class="w-[240px]"
@search="handleSearch" @search="handleSearch"
@press-enter="handleSearch" @press-enter="handleSearch"
@clear="handleSearch"
> >
<template #prefix>
<span class="arco-icon-hover">
<icon-search class="cursor-pointer" @click="handleSearch" />
</span>
</template>
</a-input-search> </a-input-search>
<batchAddKeyVal <batchAddKeyVal
:add-type-text="t('project.environmental.env.constantBatchAddTip')" :add-type-text="t('project.environmental.env.constantBatchAddTip')"
@ -172,7 +168,7 @@
innerParams.value = [...backupParams.value]; innerParams.value = [...backupParams.value];
} else { } else {
const result = backupParams.value.filter( const result = backupParams.value.filter(
(item) => item.key.includes(searchValue.value) || item.tags.includes(searchValue.value) (item) => item.key?.includes(searchValue.value) || (item.tags || []).includes(searchValue.value)
); );
innerParams.value = [...result]; innerParams.value = [...result];
} }