style(接口测试): 引用公共脚本样式修改
--bug=1037464 --user=宋天阳 【接口测试】定义-调试-后置-引用公共脚本样式与设计不一致 https://www.tapd.cn/55049933/s/1489522
This commit is contained in:
parent
675e39f68a
commit
aff509f431
|
@ -206,37 +206,44 @@
|
||||||
{{ t('apiTestDebug.quote') }}
|
{{ t('apiTestDebug.quote') }}
|
||||||
</MsButton>
|
</MsButton>
|
||||||
</div>
|
</div>
|
||||||
<a-radio-group v-model:model-value="commonScriptShowType" size="small" type="button" class="mb-[8px] w-fit">
|
<div v-if="showParameters() || showScript()">
|
||||||
<a-radio value="parameters">{{ t('apiTestDebug.parameters') }}</a-radio>
|
<a-radio-group v-model:model-value="commonScriptShowType" size="small" type="button" class="mb-[8px] w-fit">
|
||||||
<a-radio value="scriptContent">{{ t('apiTestDebug.scriptContent') }}</a-radio>
|
<a-radio v-if="showParameters()" value="parameters">{{ t('apiTestDebug.parameters') }}</a-radio>
|
||||||
</a-radio-group>
|
<a-radio value="scriptContent">{{ t('apiTestDebug.scriptContent') }}</a-radio>
|
||||||
<MsBaseTable v-show="commonScriptShowType === 'parameters'" v-bind="propsRes" v-on="propsEvent">
|
</a-radio-group>
|
||||||
<template #value="{ record }">
|
<MsBaseTable
|
||||||
<a-tooltip :content="t(record.required ? 'apiTestDebug.paramRequired' : 'apiTestDebug.paramNotRequired')">
|
v-if="showParameters()"
|
||||||
<div
|
v-show="commonScriptShowType === 'parameters'"
|
||||||
:class="[
|
v-bind="propsRes"
|
||||||
record.required ? '!text-[rgb(var(--danger-5))]' : '!text-[var(--color-text-brand)]',
|
v-on="propsEvent"
|
||||||
'!mr-[4px] !p-[4px]',
|
|
||||||
]"
|
|
||||||
>
|
|
||||||
<div>*</div>
|
|
||||||
</div>
|
|
||||||
</a-tooltip>
|
|
||||||
{{ record.value }}
|
|
||||||
</template>
|
|
||||||
</MsBaseTable>
|
|
||||||
<div v-show="commonScriptShowType === 'scriptContent'" class="h-[calc(100%-76px)]">
|
|
||||||
<MsCodeEditor
|
|
||||||
v-if="condition.commonScriptInfo"
|
|
||||||
v-model:model-value="condition.commonScriptInfo.script"
|
|
||||||
theme="vs"
|
|
||||||
height="100%"
|
|
||||||
:language="condition.commonScriptInfo.scriptLanguage || LanguageEnum.BEANSHELL_JSR233"
|
|
||||||
:show-full-screen="false"
|
|
||||||
:show-theme-change="false"
|
|
||||||
read-only
|
|
||||||
>
|
>
|
||||||
</MsCodeEditor>
|
<template #value="{ record }">
|
||||||
|
<a-tooltip :content="t(record.required ? 'apiTestDebug.paramRequired' : 'apiTestDebug.paramNotRequired')">
|
||||||
|
<div
|
||||||
|
:class="[
|
||||||
|
record.required ? '!text-[rgb(var(--danger-5))]' : '!text-[var(--color-text-brand)]',
|
||||||
|
'!mr-[4px] !p-[4px]',
|
||||||
|
]"
|
||||||
|
>
|
||||||
|
<div>*</div>
|
||||||
|
</div>
|
||||||
|
</a-tooltip>
|
||||||
|
{{ record.value }}
|
||||||
|
</template>
|
||||||
|
</MsBaseTable>
|
||||||
|
<div v-show="commonScriptShowType === 'scriptContent'" class="h-[calc(100%-76px)]">
|
||||||
|
<MsCodeEditor
|
||||||
|
v-if="condition.commonScriptInfo"
|
||||||
|
v-model:model-value="condition.commonScriptInfo.script"
|
||||||
|
theme="vs"
|
||||||
|
height="100%"
|
||||||
|
:language="condition.commonScriptInfo.scriptLanguage || LanguageEnum.BEANSHELL_JSR233"
|
||||||
|
:show-full-screen="false"
|
||||||
|
:show-theme-change="false"
|
||||||
|
read-only
|
||||||
|
>
|
||||||
|
</MsCodeEditor>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
@ -479,8 +486,14 @@
|
||||||
import useAppStore from '@/store/modules/app';
|
import useAppStore from '@/store/modules/app';
|
||||||
import { hasAnyPermission } from '@/utils/permission';
|
import { hasAnyPermission } from '@/utils/permission';
|
||||||
|
|
||||||
import type { ProtocolItem } from '@/models/apiTest/common';
|
import {
|
||||||
import { ExecuteConditionProcessor, JSONPathExtract, RegexExtract, XPathExtract } from '@/models/apiTest/common';
|
ExecuteConditionProcessor,
|
||||||
|
JSONPathExtract,
|
||||||
|
KeyValueParam,
|
||||||
|
ProtocolItem,
|
||||||
|
RegexExtract,
|
||||||
|
XPathExtract,
|
||||||
|
} from '@/models/apiTest/common';
|
||||||
import { ParamsRequestType } from '@/models/projectManagement/commonScript';
|
import { ParamsRequestType } from '@/models/projectManagement/commonScript';
|
||||||
import { DataSourceItem, EnvConfig } from '@/models/projectManagement/environmental';
|
import { DataSourceItem, EnvConfig } from '@/models/projectManagement/environmental';
|
||||||
import {
|
import {
|
||||||
|
@ -631,14 +644,6 @@ if (!result){
|
||||||
noDisable: true,
|
noDisable: true,
|
||||||
});
|
});
|
||||||
|
|
||||||
watch(
|
|
||||||
() => condition.value.commonScriptInfo,
|
|
||||||
(info) => {
|
|
||||||
propsRes.value.data = info?.params as any[]; // 查看详情的时候需要赋值一下
|
|
||||||
},
|
|
||||||
{ deep: true, immediate: true }
|
|
||||||
);
|
|
||||||
|
|
||||||
const showQuoteDrawer = ref(false);
|
const showQuoteDrawer = ref(false);
|
||||||
function saveQuoteScriptHandler(item: any) {
|
function saveQuoteScriptHandler(item: any) {
|
||||||
// TODO:any
|
// TODO:any
|
||||||
|
@ -889,6 +894,28 @@ if (!result){
|
||||||
emit('change');
|
emit('change');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function showParameters() {
|
||||||
|
if (condition.value.commonScriptInfo && condition.value.commonScriptInfo.params) {
|
||||||
|
let emptyKeyCount = 0;
|
||||||
|
condition.value.commonScriptInfo.params.forEach((item: KeyValueParam) => {
|
||||||
|
if (item.key !== '') {
|
||||||
|
emptyKeyCount++;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
if (emptyKeyCount > 0) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
function showScript() {
|
||||||
|
if (condition.value.commonScriptInfo && condition.value.commonScriptInfo.script !== '') {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 提取参数表格-保存快速提取的配置
|
* 提取参数表格-保存快速提取的配置
|
||||||
*/
|
*/
|
||||||
|
@ -921,7 +948,16 @@ if (!result){
|
||||||
console.log(error);
|
console.log(error);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
watch(
|
||||||
|
() => condition.value.commonScriptInfo,
|
||||||
|
(info) => {
|
||||||
|
propsRes.value.data = info?.params as any[]; // 查看详情的时候需要赋值一下
|
||||||
|
if (!showParameters()) {
|
||||||
|
commonScriptShowType.value = 'scriptContent';
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{ deep: true, immediate: true }
|
||||||
|
);
|
||||||
const hasPreAndPost = computed(() => {
|
const hasPreAndPost = computed(() => {
|
||||||
if (props.showPrePostRequest) {
|
if (props.showPrePostRequest) {
|
||||||
return (
|
return (
|
||||||
|
|
Loading…
Reference in New Issue