fix(接口测试): 批量添加参数问题修复

This commit is contained in:
baiqi 2024-07-11 18:17:12 +08:00 committed by 刘瑞斌
parent cb37911b9f
commit cdd007b79d
1 changed files with 7 additions and 2 deletions

View File

@ -90,8 +90,9 @@
function parseParams() {
if (props.hasStandard && addType.value === 'standard') {
//
batchParamsCode.value = props.params
.filter((e) => e && (!isEmpty(e.key) || !isEmpty(e.value)))
.filter((e) => e && (!isEmpty(e.key) || !isEmpty(e.value)) && e.paramType !== RequestParamsType.FILE)
.map((item) => `${item.key},${item.paramType},${item.required},${item.value}`)
.join('\n');
} else {
@ -167,7 +168,11 @@
const tempObj: Record<string, any> = {}; //
for (let i = 0; i < arr.length; i++) {
if (arr[i] !== '') {
const [key, type, required, value] = arr[i].split(',');
const parts = arr[i].split(',');
//
const [key, type, required] = parts.slice(0, 3);
//
const value = parts.length >= 4 ? parts.slice(3).join(',') : '';
if (key) {
tempObj[key.trim()] = {
id: getGenerateId(),