diff --git a/frontend/src/views/api-test/components/condition/content.vue b/frontend/src/views/api-test/components/condition/content.vue
index b9a0b16724..92f686620b 100644
--- a/frontend/src/views/api-test/components/condition/content.vue
+++ b/frontend/src/views/api-test/components/condition/content.vue
@@ -206,37 +206,44 @@
{{ t('apiTestDebug.quote') }}
-
- {{ t('apiTestDebug.parameters') }}
- {{ t('apiTestDebug.scriptContent') }}
-
-
-
-
-
-
- {{ record.value }}
-
-
-
-
+
+ {{ t('apiTestDebug.parameters') }}
+ {{ t('apiTestDebug.scriptContent') }}
+
+
-
+
+
+
+
+ {{ record.value }}
+
+
+
+
+
+
@@ -479,8 +486,14 @@
import useAppStore from '@/store/modules/app';
import { hasAnyPermission } from '@/utils/permission';
- import type { ProtocolItem } from '@/models/apiTest/common';
- import { ExecuteConditionProcessor, JSONPathExtract, RegexExtract, XPathExtract } from '@/models/apiTest/common';
+ import {
+ ExecuteConditionProcessor,
+ JSONPathExtract,
+ KeyValueParam,
+ ProtocolItem,
+ RegexExtract,
+ XPathExtract,
+ } from '@/models/apiTest/common';
import { ParamsRequestType } from '@/models/projectManagement/commonScript';
import { DataSourceItem, EnvConfig } from '@/models/projectManagement/environmental';
import {
@@ -631,14 +644,6 @@ if (!result){
noDisable: true,
});
- watch(
- () => condition.value.commonScriptInfo,
- (info) => {
- propsRes.value.data = info?.params as any[]; // 查看详情的时候需要赋值一下
- },
- { deep: true, immediate: true }
- );
-
const showQuoteDrawer = ref(false);
function saveQuoteScriptHandler(item: any) {
// TODO:any
@@ -889,6 +894,28 @@ if (!result){
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);
}
});
-
+ watch(
+ () => condition.value.commonScriptInfo,
+ (info) => {
+ propsRes.value.data = info?.params as any[]; // 查看详情的时候需要赋值一下
+ if (!showParameters()) {
+ commonScriptShowType.value = 'scriptContent';
+ }
+ },
+ { deep: true, immediate: true }
+ );
const hasPreAndPost = computed(() => {
if (props.showPrePostRequest) {
return (