fix(项目设置): 修复断言脚本类型无法切换问题

--bug=1037494 --user=赵勇 【接口测试】定义-调试-断言-选择脚本断言提示异常 https://www.tapd.cn/55049933/s/1478627
This commit is contained in:
fit2-zhao 2024-03-21 17:03:14 +08:00 committed by Craftsman
parent daab02a2f9
commit 97ef98d5b4
3 changed files with 13 additions and 18 deletions

View File

@ -6,7 +6,7 @@
height: 'calc(100vh - 490px)',
}"
>
<conditionContent v-model:data="condition" is-build-in />
<conditionContent v-model:data="condition" is-build-in @change="handleChange" />
</a-scrollbar>
</div>
</template>
@ -33,15 +33,15 @@
const emit = defineEmits<{
(e: 'change', val: ScriptItem): void; //
}>();
function handleChange() {
// eslint-disable-next-line no-use-before-define
emit('change', { ...condition.value });
}
const condition = useVModel(props, 'data', emit);
const currentEnvConfig = ref({});
async function initEnvironment() {
try {
if (store.currentId) {
currentEnvConfig.value = await getEnvironment(store.currentId);
} catch (error) {
// eslint-disable-next-line no-console
console.log(error);
}
}
/** 向孙组件提供属性 */

View File

@ -76,13 +76,7 @@
</div>
</VueDraggable>
</a-scrollbar>
<section class="ms-assertion-body-right">
<!-- <a-scrollbar
:style="{
overflow: 'auto',
height: 'calc(100vh - 458px)',
}"
> -->
<section class="ms-assertion-body-right h-full">
<!-- 响应头 -->
<ResponseHeaderTab
v-if="valueKey === ResponseAssertionType.RESPONSE_HEADER"
@ -145,7 +139,7 @@
import { useI18n } from '@/hooks/useI18n';
import { ExecuteAssertionConfig , ExecuteConditionProcessor} from '@/models/apiTest/common';
import { ExecuteAssertionConfig, ExecuteConditionProcessor } from '@/models/apiTest/common';
import { RequestConditionScriptLanguage, ResponseAssertionType, ResponseBodyAssertionType } from '@/enums/apiEnum';
import { ExecuteAssertion, MsAssertionItem } from './type';
@ -344,7 +338,7 @@
id,
processorType: ResponseAssertionType.SCRIPT,
scriptName: t('apiTestDebug.preconditionScriptName'),
enableCommonScript: true,
enableCommonScript: false,
script: '',
scriptId: '',
scriptLanguage: LanguageEnum.BEANSHELL,
@ -402,6 +396,7 @@
getCurrentItemState.value = { ...val };
break;
case ResponseAssertionType.SCRIPT:
getCurrentItemState.value = { ...val };
break;
default:
@ -480,7 +475,7 @@
&-right {
display: flex;
flex-grow: 1;
padding: 16px;
padding: 0;
border: 1px solid var(--color-text-n8);
border-radius: 4px;
background: var(--color-text-fff);

View File

@ -45,7 +45,7 @@
</div>
<!-- 前后置请求结束 -->
<div class="flex items-center justify-between">
<a-radio-group v-model="condition.enableCommonScript" class="mb-[8px]">
<a-radio-group v-model="condition.enableCommonScript" class="mb-[8px]" @change="emit('change')">
<a-radio :value="false">{{ t('apiTestDebug.manual') }}</a-radio>
<a-radio :value="true">{{ t('apiTestDebug.quote') }}</a-radio>
</a-radio-group>
@ -672,7 +672,7 @@ if (!result){
dataIndex: 'variableType',
slotName: 'variableType',
typeOptions: [
//
//
// {
// label: t('apiTestDebug.globalParameter'),
// value: RequestExtractEnvType.GLOBAL,