diff --git a/frontend/src/business/components/api/definition/components/basis/BatchAddParameter.vue b/frontend/src/business/components/api/definition/components/basis/BatchAddParameter.vue index 8fc3bffe4f..3f9622084a 100644 --- a/frontend/src/business/components/api/definition/components/basis/BatchAddParameter.vue +++ b/frontend/src/business/components/api/definition/components/basis/BatchAddParameter.vue @@ -54,6 +54,7 @@ confirm() { this.dialogVisible = false; this.$emit("batchSave", this.parameters); + this.parameters = ""; } } } diff --git a/frontend/src/business/components/api/definition/components/request/http/ApiHttpRequestForm.vue b/frontend/src/business/components/api/definition/components/request/http/ApiHttpRequestForm.vue index c6c2595558..ccf665b9e0 100644 --- a/frontend/src/business/components/api/definition/components/request/http/ApiHttpRequestForm.vue +++ b/frontend/src/business/components/api/definition/components/request/http/ApiHttpRequestForm.vue @@ -307,7 +307,7 @@ export default { let required = false; keyValues.unshift(new KeyValue({ name: line[0], - required: required, + required: !required, value: line[1], description: line[2], type: "text", diff --git a/frontend/src/business/components/api/test/components/ApiScenarioVariables.vue b/frontend/src/business/components/api/test/components/ApiScenarioVariables.vue index 3ca9d997c4..6ac098e096 100644 --- a/frontend/src/business/components/api/test/components/ApiScenarioVariables.vue +++ b/frontend/src/business/components/api/test/components/ApiScenarioVariables.vue @@ -109,16 +109,13 @@ export default { let params = data.split("\n"); let keyValues = []; params.forEach(item => { - let line = item.split(/,|,/); + let line = item.split(/:|:/); let required = false; - if (line[1] === '必填' || line[1] === 'Required' || line[1] === 'true') { - required = true; - } - keyValues.push(new KeyValue({ + keyValues.unshift(new KeyValue({ name: line[0], required: required, - value: line[2], - description: line[3], + value: line[1], + description: line[2], type: "text", valid: false, file: false, @@ -135,9 +132,19 @@ export default { batchSave(data) { if (data) { let keyValues = this._handleBatchVars(data); - keyValues.forEach(item => { - this.items.unshift(item); - }); + keyValues.forEach(keyValue => { + let isAdd = true; + for (let i in this.items) { + let item = this.items[i]; + if (item.name === keyValue.name) { + item.value = keyValue.value; + isAdd = false; + } + } + if (isAdd) { + this.items.unshift(keyValue); + } + }) } }, },