From 967c62f35fc5d4a75d61b42cd3cf0d4764abf167 Mon Sep 17 00:00:00 2001 From: fit2-zhao Date: Thu, 28 Oct 2021 10:09:25 +0800 Subject: [PATCH] =?UTF-8?q?revert(=E6=8E=A5=E5=8F=A3=E6=B5=8B=E8=AF=95):?= =?UTF-8?q?=20=E6=81=A2=E5=A4=8Djson=E6=A0=BC=E5=BC=8F=E8=A7=A3=E6=9E=90?= =?UTF-8?q?=EF=BC=8C=E6=94=AF=E6=8C=81=E5=AF=B9=E8=B1=A1=E5=B5=8C=E5=A5=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../common/json-schema/convert/convert.js | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/frontend/src/business/components/common/json-schema/convert/convert.js b/frontend/src/business/components/common/json-schema/convert/convert.js index 14dee6313c..7831e863b2 100644 --- a/frontend/src/business/components/common/json-schema/convert/convert.js +++ b/frontend/src/business/components/common/json-schema/convert/convert.js @@ -96,7 +96,7 @@ class Convert { let result = {}; // 判断传入object是对象还是数组。 if (isArray(object)) { - result.items = []; + result.items = {}; } else { result.properties = {}; } @@ -112,6 +112,7 @@ class Convert { // 判断当前 element 的值 是否也是对象,如果是就继续递归,不是就赋值给result if (isObject(element)) { // 创建当前属性的基本信息 + result["properties"][key] = this._value2object(element, $id, key) if (isArray(element)) { // 针对空数组和有值的数组做不同处理 if (element.length > 0) { @@ -128,16 +129,7 @@ class Convert { } itemArr.push(item); } - let itemObj = { - items: itemArr, - type: 'array' - } - if (isArray(object)) { - result["items"][key] = itemObj; - }else { - result["properties"][key] = itemObj; - } - + result["properties"][key]["items"] = itemArr; } } else { // 不是数组,递归遍历获取,然后合并对象属性