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

View File

@ -133,6 +133,7 @@
:disabled="props.disabled"
@change="handleChange"
@delete-script-item="deleteScriptItem"
@copy="copyItem"
/>
</div>
</div>
@ -411,6 +412,12 @@
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) => {
switch (val.assertionType) {
case ResponseAssertionType.RESPONSE_HEADER:

View File

@ -7,12 +7,8 @@
class="w-[240px]"
@search="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>
<batchAddKeyVal
:add-type-text="t('project.environmental.env.constantBatchAddTip')"
@ -172,7 +168,7 @@
innerParams.value = [...backupParams.value];
} else {
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];
}