|
@@ -169,7 +169,7 @@
|
|
|
@change="onChangeRequestBodyType"
|
|
|
/>
|
|
|
<CusFormColumn
|
|
|
- v-if="['RAW_JSON'].includes(state.params.requestBody.type)"
|
|
|
+ v-if="['RAW_JSON', 'RAW_TEXT'].includes(state.params.requestBody.type)"
|
|
|
:span="24"
|
|
|
required
|
|
|
type="textarea"
|
|
@@ -187,13 +187,21 @@
|
|
|
},
|
|
|
message: 'JSON结构异常'
|
|
|
}
|
|
|
- ]"
|
|
|
+ ]"
|
|
|
+ />
|
|
|
+ <CusFormColumn
|
|
|
+ v-else-if="['RAW_XML', 'RAW_HTML'].includes(state.params.requestBody.type)"
|
|
|
+ :span="24"
|
|
|
+ required
|
|
|
+ type="textarea"
|
|
|
+ v-model:param="state.params.requestBody.str"
|
|
|
+ :rows="24"
|
|
|
/>
|
|
|
</CusForm>
|
|
|
- <template v-if="state.params.requestBody.type !== 'NONE'">
|
|
|
+ <template v-if="['FORM_DATA', 'X_WWW_FORM_URLENCODED', 'RAW_JSON', 'RAW_TEXT'].includes(state.params.requestBody.type)">
|
|
|
<div style="margin-bottom: 10px; display: flex">
|
|
|
<CusButton type="main" title="新增" style="margin-right: auto;" @click="state.params.requestBody.data.push({key: '', type: '1', value: '', valueTable: []})"/>
|
|
|
- <template v-if="['RAW_JSON'].includes(state.params.requestBody.type)">
|
|
|
+ <template v-if="['RAW_JSON', 'RAW_TEXT'].includes(state.params.requestBody.type)">
|
|
|
<div class="tips" style="margin: 0 10px">
|
|
|
为了保证数据结构准确,提交时将默认触发“<span style="color: var(--cus-main-color)">逆向生成JSON结构</span>”
|
|
|
</div>
|
|
@@ -220,7 +228,7 @@
|
|
|
:span="24"
|
|
|
v-model:param="scope.row.type"
|
|
|
link="select"
|
|
|
- :options="['RAW_JSON'].includes(state.params.requestBody.type) ? DictionaryStore.requestParamsList.filter(v => v.dictValue != 3) : DictionaryStore.requestParamsList"
|
|
|
+ :options="['RAW_JSON', 'RAW_TEXT'].includes(state.params.requestBody.type) ? DictionaryStore.requestParamsList.filter(v => v.dictValue != 3) : DictionaryStore.requestParamsList"
|
|
|
:clearable="false"
|
|
|
@change="(val) => (scope.row.value = '', scope.row.valueTable = [])"
|
|
|
/>
|
|
@@ -301,7 +309,7 @@
|
|
|
<div style="margin-bottom: 10px; display: flex">
|
|
|
<CusButton type="main" title="新增" style="margin-right: auto;" @click="state.params.responseBody.json.data.push({label: '', key: '', valueType: '1', value: '', formatType: '1', formatRule: ''})"/>
|
|
|
<div class="tips" style="margin-left: 10px">
|
|
|
- 取值类型为JsonPath时,@代表返回的数据(逻辑同上),也可以直接写字段名进行匹配
|
|
|
+ 取值类型为JsonPath时,@代表返回的数据(逻辑同上),也可以直接写$['字段名']进行匹配
|
|
|
</div>
|
|
|
</div>
|
|
|
<div style="flex: 1; overflow: hidden;">
|
|
@@ -716,14 +724,10 @@ const onSubmit = () => {
|
|
|
return
|
|
|
}
|
|
|
}
|
|
|
- if (['RAW_JSON'].includes(state.params.requestBody.type) && state.params.requestBody.data.length > 0) {
|
|
|
+ if (['RAW_JSON', 'RAW_TEXT'].includes(state.params.requestBody.type) && state.params.requestBody.data.length > 0) {
|
|
|
try {
|
|
|
tableToJson()
|
|
|
- } catch (e) {
|
|
|
-
|
|
|
- }
|
|
|
- } else {
|
|
|
- state.params.requestBody.str = ''
|
|
|
+ } catch (e) {}
|
|
|
}
|
|
|
params.requestBody = JSON.stringify({
|
|
|
type: state.params.requestBody.type,
|
|
@@ -734,8 +738,6 @@ const onSubmit = () => {
|
|
|
// responseBody
|
|
|
if (state.params.responseBody.type == '1') {
|
|
|
if (
|
|
|
- !proxy.$util.isValue(state.params.responseBody.json.pathForm.pageNum) ||
|
|
|
- !proxy.$util.isValue(state.params.responseBody.json.pathForm.pageSize) ||
|
|
|
!proxy.$util.isValue(state.params.responseBody.json.pathForm.total) ||
|
|
|
!proxy.$util.isValue(state.params.responseBody.json.pathForm.data) ||
|
|
|
!state.params.responseBody.json.data.every(v => proxy.$util.isValue(v.label) && proxy.$util.isValue(v.key) && proxy.$util.isValue(v.valueType) && proxy.$util.isValue(v.value) && proxy.$util.isValue(v.formatType) && (v.formatType == 1 || v.formatType != 1 && proxy.$util.isValue(v.formatRule)))
|
|
@@ -902,12 +904,14 @@ const tableToJson = () => {
|
|
|
state.params.requestBody.str = JSON.stringify(obj)
|
|
|
}
|
|
|
const onChangeRequestBodyType = (val) => {
|
|
|
- if (['RAW_JSON'].includes(val)) {
|
|
|
+ if (['RAW_JSON', 'RAW_TEXT'].includes(val)) {
|
|
|
state.params.requestBody.data.forEach(v => {
|
|
|
if (v.type == 3) {
|
|
|
v.type = ''
|
|
|
}
|
|
|
})
|
|
|
+ } else {
|
|
|
+ state.params.requestBody.str = ''
|
|
|
}
|
|
|
}
|
|
|
const onClickFormatRuleDictJson = (row, index) => {
|
|
@@ -941,7 +945,7 @@ watch(() => props.show, (n) => {
|
|
|
state.params.requestParams.data = []
|
|
|
state.params.requestHeaders.data = []
|
|
|
state.params.requestBody.type = 'NONE'
|
|
|
- state.params.requestBody.str = 'NONE'
|
|
|
+ state.params.requestBody.str = ''
|
|
|
state.params.requestBody.data = []
|
|
|
state.params.responseBody.type = '1'
|
|
|
state.params.responseBody.json.pathForm = {}
|