Showing
5 changed files
with
35 additions
and
11 deletions
| ... | ... | @@ -6,6 +6,7 @@ |
| 6 | 6 | <ParamsTable ref="paramsCellTableRef" :method="method" /> |
| 7 | 7 | <ParamsTest |
| 8 | 8 | @testParamsInterface="handleTestParamsInterface" |
| 9 | + @closeTest="onCloseTest" | |
| 9 | 10 | ref="testParamsRequestRef" |
| 10 | 11 | :data="dataMap.mapParamsObj" |
| 11 | 12 | /> |
| ... | ... | @@ -21,6 +22,7 @@ |
| 21 | 22 | <BodyTest |
| 22 | 23 | v-if="bodyType !== 'none'" |
| 23 | 24 | @testBodyInterface="handleTestBodyInterface" |
| 25 | + @closeTest="onCloseTest" | |
| 24 | 26 | ref="testBodyRequestRef" |
| 25 | 27 | :data="dataMap.mapBodyObj" |
| 26 | 28 | /> |
| ... | ... | @@ -29,6 +31,7 @@ |
| 29 | 31 | <HeaderTable ref="editHeaderCellTableRef" :method="method" /> |
| 30 | 32 | <HeaderTest |
| 31 | 33 | @testHeaderInterface="handleTestHeaderInterface" |
| 34 | + @closeTest="onCloseTest" | |
| 32 | 35 | ref="testHeaderRequestRef" |
| 33 | 36 | :data="dataMap.mapHeaderObj" |
| 34 | 37 | /> |
| ... | ... | @@ -107,6 +110,8 @@ |
| 107 | 110 | excuteTestRef.value?.resetValue(true); |
| 108 | 111 | }; |
| 109 | 112 | |
| 113 | + const onCloseTest = () => excuteTestRef.value?.resetValue(true); | |
| 114 | + | |
| 110 | 115 | //if-else-if-else分支优化 |
| 111 | 116 | const dataForTypeMap = [ |
| 112 | 117 | [(type) => type === 'Params', (data) => paramsCellTableRef.value?.setValue(data)], | ... | ... |
| 1 | 1 | <template> |
| 2 | 2 | <div> |
| 3 | 3 | <div class="mt-8"> |
| 4 | - <div> | |
| 5 | - <Button @click="handleTest" type="primary"> 测试接口 </Button> | |
| 4 | + <div class="flex"> | |
| 5 | + <Button @click="handleTest" type="primary"> 打开测试接口 </Button> | |
| 6 | + <Button class="ml-2" @click="onCloseTest" type="primary"> 关闭测试接口 </Button> | |
| 6 | 7 | </div> |
| 7 | 8 | <div v-if="showTestEditCell" class="mt-8"> |
| 8 | 9 | <a-row type="flex" justify="center"> |
| ... | ... | @@ -33,7 +34,7 @@ |
| 33 | 34 | import JsonEditor from '../../SimpleRequest/components/jsonEditor.vue'; |
| 34 | 35 | import { useMessage } from '/@/hooks/web/useMessage'; |
| 35 | 36 | |
| 36 | - const emits = defineEmits(['testBodyInterface']); | |
| 37 | + const emits = defineEmits(['testBodyInterface', 'closeTest']); | |
| 37 | 38 | |
| 38 | 39 | const props = defineProps({ |
| 39 | 40 | data: { |
| ... | ... | @@ -150,6 +151,11 @@ |
| 150 | 151 | testResult.value = ''; |
| 151 | 152 | }; |
| 152 | 153 | |
| 154 | + const onCloseTest = () => { | |
| 155 | + showTestEditCell.value = false; | |
| 156 | + emits('closeTest'); | |
| 157 | + }; | |
| 158 | + | |
| 153 | 159 | defineExpose({ |
| 154 | 160 | setValue, |
| 155 | 161 | handleTest, | ... | ... |
| ... | ... | @@ -5,9 +5,9 @@ |
| 5 | 5 | </div> |
| 6 | 6 | <div class="mt-8"> |
| 7 | 7 | <a-row type="flex" justify="center"> |
| 8 | - <a-col :span="2"> 测试结果 </a-col> | |
| 9 | - <a-col :span="22"> | |
| 8 | + <a-col :span="24"> | |
| 10 | 9 | <a-textarea |
| 10 | + disabled | |
| 11 | 11 | v-if="isWebSocketType === '2'" |
| 12 | 12 | allow-clear |
| 13 | 13 | show-count |
| ... | ... | @@ -16,6 +16,7 @@ |
| 16 | 16 | :rows="8" |
| 17 | 17 | /> |
| 18 | 18 | <a-textarea |
| 19 | + disabled | |
| 19 | 20 | v-else |
| 20 | 21 | allow-clear |
| 21 | 22 | show-count | ... | ... |
| 1 | 1 | <template> |
| 2 | 2 | <div> |
| 3 | 3 | <div class="mt-8"> |
| 4 | - <div> | |
| 5 | - <Button @click="handleTest" type="primary"> 测试接口 </Button> | |
| 4 | + <div class="flex"> | |
| 5 | + <Button @click="handleTest" type="primary"> 打开测试接口 </Button> | |
| 6 | + <Button class="ml-2" @click="onCloseTest" type="primary"> 关闭测试接口 </Button> | |
| 6 | 7 | </div> |
| 7 | 8 | <div v-if="showTestEditCell" class="mt-8"> |
| 8 | 9 | <a-row type="flex" justify="center"> |
| ... | ... | @@ -22,7 +23,7 @@ |
| 22 | 23 | import TestHeaderEditCellTable from './testEditHeaderCellTable.vue'; |
| 23 | 24 | import { useMessage } from '/@/hooks/web/useMessage'; |
| 24 | 25 | |
| 25 | - const emits = defineEmits(['testHeaderInterface']); | |
| 26 | + const emits = defineEmits(['testHeaderInterface', 'closeTest']); | |
| 26 | 27 | |
| 27 | 28 | const props = defineProps({ |
| 28 | 29 | data: { |
| ... | ... | @@ -81,6 +82,11 @@ |
| 81 | 82 | testResult.value = ''; |
| 82 | 83 | }; |
| 83 | 84 | |
| 85 | + const onCloseTest = () => { | |
| 86 | + showTestEditCell.value = false; | |
| 87 | + emits('closeTest'); | |
| 88 | + }; | |
| 89 | + | |
| 84 | 90 | defineExpose({ |
| 85 | 91 | setValue, |
| 86 | 92 | handleTest, | ... | ... |
| 1 | 1 | <template> |
| 2 | 2 | <div> |
| 3 | 3 | <div class="mt-8"> |
| 4 | - <div> | |
| 5 | - <Button @click="handleTest" type="primary"> 测试接口 </Button> | |
| 4 | + <div class="flex"> | |
| 5 | + <Button @click="handleTest" type="primary"> 打开测试接口 </Button> | |
| 6 | + <Button class="ml-2" @click="onCloseTest" type="primary"> 关闭测试接口 </Button> | |
| 6 | 7 | </div> |
| 7 | 8 | <div v-if="showTestEditCell" class="mt-8"> |
| 8 | 9 | <a-row type="flex" justify="center"> |
| ... | ... | @@ -24,7 +25,7 @@ |
| 24 | 25 | import { useUtils } from '../../../hooks/useUtils'; |
| 25 | 26 | import { useMessage } from '/@/hooks/web/useMessage'; |
| 26 | 27 | |
| 27 | - const emits = defineEmits(['testParamsInterface']); | |
| 28 | + const emits = defineEmits(['testParamsInterface', 'closeTest']); | |
| 28 | 29 | |
| 29 | 30 | const props = defineProps({ |
| 30 | 31 | data: { |
| ... | ... | @@ -125,6 +126,11 @@ |
| 125 | 126 | testResult.value = ''; |
| 126 | 127 | }; |
| 127 | 128 | |
| 129 | + const onCloseTest = () => { | |
| 130 | + showTestEditCell.value = false; | |
| 131 | + emits('closeTest'); | |
| 132 | + }; | |
| 133 | + | |
| 128 | 134 | defineExpose({ |
| 129 | 135 | setValue, |
| 130 | 136 | handleTest, | ... | ... |