From 521f8e9963aeb05280e2ba79fd83505a0e084b0a Mon Sep 17 00:00:00 2001 From: wxg0103 <727495428@qq.com> Date: Thu, 18 Nov 2021 19:34:49 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E7=B3=BB=E7=BB=9F=E8=AE=BE=E7=BD=AE):=20?= =?UTF-8?q?=E6=89=B9=E9=87=8F=E6=B7=BB=E5=8A=A0=E5=85=A8=E5=B1=80=E5=8F=98?= =?UTF-8?q?=E9=87=8F=E9=94=99=E8=AF=AF=20--bug=3D1008074=20--user=3D?= =?UTF-8?q?=E7=8E=8B=E5=AD=9D=E5=88=9A=20=E3=80=90=E7=B3=BB=E7=BB=9F?= =?UTF-8?q?=E8=AE=BE=E7=BD=AE=E3=80=91=E6=89=B9=E9=87=8F=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E5=85=A8=E5=B1=80=E5=8F=98=E9=87=8F=E9=94=99=E8=AF=AF=20https:?= =?UTF-8?q?//www.tapd.cn/55049933/s/1070140?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/basis/BatchAddParameter.vue | 1 + .../request/http/ApiHttpRequestForm.vue | 2 +- .../test/components/ApiScenarioVariables.vue | 27 ++++++++++++------- 3 files changed, 19 insertions(+), 11 deletions(-) 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); + } + }) } }, },