Commit a21d770b by 无尘

fix: 修改导入 dubbo 参数

parent 3f3b2bf3
<!DOCTYPE html><html><head><meta charset=utf-8><link rel="shortcut icon" href=./favicon.ico><title>API网关管理平台</title><link href=./static/css/app.869a7198768ff0796ec5f37735202ffa.css rel=stylesheet></head><body style="min-width: 1400px;"><div id=app></div><script src=//web-1251519181.file.myqcloud.com/lib/vue/2.6.6/vue.min.js></script><script src=//web-1251519181.file.myqcloud.com/lib/vue-router/3.0.2/vue-router.min.js></script><script src=//web-1251519181.file.myqcloud.com/lib/vuex/3.1.0/vuex.min.js></script><script src=//web-1251519181.file.myqcloud.com/components/img-preview.2.0.00.js></script><script>// Raven.config('https://3715a345910d4c768e7a1ec14619c2d5@sentry.io/1413672').install();</script><script src=//web-1251519181.file.myqcloud.com/components/input.2.0.15.js></script><script src=//web-1251519181.file.myqcloud.com/components/delete.2.0.01.js></script><script type=text/javascript src=./static/js/manifest.11bbb012edb27dc23a9a.js></script><script type=text/javascript src=./static/js/vendor.71dc162eb690bf6a36a0.js></script><script type=text/javascript src=./static/js/app.8c17e0f45e015cda57f6.js></script></body></html> <!DOCTYPE html><html><head><meta charset=utf-8><link rel="shortcut icon" href=./favicon.ico><title>API网关管理平台</title><link href=./static/css/app.232f584b9d1028a6d0a00f9618c98b36.css rel=stylesheet></head><body style="min-width: 1400px;"><div id=app></div><script src=//web-1251519181.file.myqcloud.com/lib/vue/2.6.6/vue.min.js></script><script src=//web-1251519181.file.myqcloud.com/lib/vue-router/3.0.2/vue-router.min.js></script><script src=//web-1251519181.file.myqcloud.com/lib/vuex/3.1.0/vuex.min.js></script><script src=//web-1251519181.file.myqcloud.com/components/img-preview.2.0.00.js></script><script>// Raven.config('https://3715a345910d4c768e7a1ec14619c2d5@sentry.io/1413672').install();</script><script src=//web-1251519181.file.myqcloud.com/components/input.2.0.15.js></script><script src=//web-1251519181.file.myqcloud.com/components/delete.2.0.01.js></script><script type=text/javascript src=./static/js/manifest.1a16260abcb2a6515673.js></script><script type=text/javascript src=./static/js/vendor.71dc162eb690bf6a36a0.js></script><script type=text/javascript src=./static/js/app.645acae76cd0fc1ae565.js></script></body></html>
\ No newline at end of file \ No newline at end of file
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
!function(e){var n=window.webpackJsonp;window.webpackJsonp=function(r,c,a){for(var f,d,b,i=0,u=[];i<r.length;i++)d=r[i],t[d]&&u.push(t[d][0]),t[d]=0;for(f in c)Object.prototype.hasOwnProperty.call(c,f)&&(e[f]=c[f]);for(n&&n(r,c,a);u.length;)u.shift()();if(a)for(i=0;i<a.length;i++)b=o(o.s=a[i]);return b};var r={},t={24:0};function o(n){if(r[n])return r[n].exports;var t=r[n]={i:n,l:!1,exports:{}};return e[n].call(t.exports,t,t.exports,o),t.l=!0,t.exports}o.e=function(e){var n=t[e];if(0===n)return new Promise(function(e){e()});if(n)return n[2];var r=new Promise(function(r,o){n=t[e]=[r,o]});n[2]=r;var c=document.getElementsByTagName("head")[0],a=document.createElement("script");a.type="text/javascript",a.charset="utf-8",a.async=!0,a.timeout=12e4,o.nc&&a.setAttribute("nonce",o.nc),a.src=o.p+"static/js/"+e+"."+{0:"63d3650fda518fa5d91a",1:"0ebe3ead93207dc78a78",2:"2ca04b4068fe43d1ed0f",3:"02f6ff10c5e83fdc830b",4:"83b134741cef8a1fc258",5:"61455822347fda4022ec",6:"7a4f7f41cea5405e209f",7:"b2a85a42ddd430235a63",8:"81460c8c66d06cfea732",9:"9c96ae683c51b04359d0",10:"638039a7b39908980436",11:"f27d1de28264fbbe30ff",12:"ccbc18453e41490e2dba",13:"b109164d2be44afb7733",14:"9825bb69e60b8030c230",15:"ffd723714f3c604ae809",16:"825722b083bcf8e5877e",17:"4786e13164b8fb55cf3b",18:"ebf8edd37453b58275c4",19:"237102ab58f0569908b0",20:"106676f1ed05cab7702b",21:"9811614945523e2ab002"}[e]+".js";var f=setTimeout(d,12e4);function d(){a.onerror=a.onload=null,clearTimeout(f);var n=t[e];0!==n&&(n&&n[1](new Error("Loading chunk "+e+" failed.")),t[e]=void 0)}return a.onerror=a.onload=d,c.appendChild(a),r},o.m=e,o.c=r,o.d=function(e,n,r){o.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:r})},o.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return o.d(n,"a",n),n},o.o=function(e,n){return Object.prototype.hasOwnProperty.call(e,n)},o.p="./",o.oe=function(e){throw console.error(e),e}}([]); !function(e){var n=window.webpackJsonp;window.webpackJsonp=function(r,c,a){for(var f,b,d,i=0,u=[];i<r.length;i++)b=r[i],t[b]&&u.push(t[b][0]),t[b]=0;for(f in c)Object.prototype.hasOwnProperty.call(c,f)&&(e[f]=c[f]);for(n&&n(r,c,a);u.length;)u.shift()();if(a)for(i=0;i<a.length;i++)d=o(o.s=a[i]);return d};var r={},t={24:0};function o(n){if(r[n])return r[n].exports;var t=r[n]={i:n,l:!1,exports:{}};return e[n].call(t.exports,t,t.exports,o),t.l=!0,t.exports}o.e=function(e){var n=t[e];if(0===n)return new Promise(function(e){e()});if(n)return n[2];var r=new Promise(function(r,o){n=t[e]=[r,o]});n[2]=r;var c=document.getElementsByTagName("head")[0],a=document.createElement("script");a.type="text/javascript",a.charset="utf-8",a.async=!0,a.timeout=12e4,o.nc&&a.setAttribute("nonce",o.nc),a.src=o.p+"static/js/"+e+"."+{0:"63d3650fda518fa5d91a",1:"0ebe3ead93207dc78a78",2:"6bdb1bfe8400a1e9f0fb",3:"02f6ff10c5e83fdc830b",4:"83b134741cef8a1fc258",5:"61455822347fda4022ec",6:"7a4f7f41cea5405e209f",7:"b2a85a42ddd430235a63",8:"81460c8c66d06cfea732",9:"9c96ae683c51b04359d0",10:"638039a7b39908980436",11:"f27d1de28264fbbe30ff",12:"ccbc18453e41490e2dba",13:"b109164d2be44afb7733",14:"9825bb69e60b8030c230",15:"ffd723714f3c604ae809",16:"825722b083bcf8e5877e",17:"4786e13164b8fb55cf3b",18:"ebf8edd37453b58275c4",19:"237102ab58f0569908b0",20:"106676f1ed05cab7702b",21:"9811614945523e2ab002"}[e]+".js";var f=setTimeout(b,12e4);function b(){a.onerror=a.onload=null,clearTimeout(f);var n=t[e];0!==n&&(n&&n[1](new Error("Loading chunk "+e+" failed.")),t[e]=void 0)}return a.onerror=a.onload=b,c.appendChild(a),r},o.m=e,o.c=r,o.d=function(e,n,r){o.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:r})},o.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return o.d(n,"a",n),n},o.o=function(e,n){return Object.prototype.hasOwnProperty.call(e,n)},o.p="./",o.oe=function(e){throw console.error(e),e}}([]);
\ No newline at end of file \ No newline at end of file
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
* @Author: 无尘 * @Author: 无尘
* @Date: 2019-08-14 16:51:07 * @Date: 2019-08-14 16:51:07
* @LastEditors: 无尘 * @LastEditors: 无尘
* @LastEditTime: 2019-09-29 10:46:38 * @LastEditTime: 2019-10-12 17:34:52
--> -->
<!-- <!--
<back-table-right :itemData="itemData" :interfaceType="interfaceType"></back-table-right> <back-table-right :itemData="itemData" :interfaceType="interfaceType"></back-table-right>
...@@ -158,6 +158,7 @@ export default { ...@@ -158,6 +158,7 @@ export default {
} }
if (obj[k].type == 'object' && Object.keys(obj[k].properties).length) { if (obj[k].type == 'object' && Object.keys(obj[k].properties).length) {
tag = await that.handleParentDisable(obj[k].properties); tag = await that.handleParentDisable(obj[k].properties);
break;
} }
if (obj[k].type == 'array' && Object.keys(obj[k].items.properties).length) { if (obj[k].type == 'array' && Object.keys(obj[k].items.properties).length) {
tag = await that.handleParentDisable(obj[k].items.properties); tag = await that.handleParentDisable(obj[k].items.properties);
...@@ -180,6 +181,7 @@ export default { ...@@ -180,6 +181,7 @@ export default {
if (!isRootKey && that.itemData.type == 'array' && Object.keys(that.itemData.items.properties).length) { if (!isRootKey && that.itemData.type == 'array' && Object.keys(that.itemData.items.properties).length) {
trueFlag = await that.handleParentDisable(that.itemData.items.properties); trueFlag = await that.handleParentDisable(that.itemData.items.properties);
} }
// console.log(trueFlag);
if (trueFlag == false) { if (trueFlag == false) {
// console.log(that.itemData); // console.log(that.itemData);
that.itemData.isRootKeyFlag = true; that.itemData.isRootKeyFlag = true;
...@@ -215,7 +217,7 @@ export default { ...@@ -215,7 +217,7 @@ export default {
}, },
findKey(objKey, isRootKey, obj) { findKey(objKey, isRootKey, obj) {
const that = this; const that = this;
// console.log('findKey:', that.$store.state.tempBackData); // console.log('findKey:', that.itemData, isRootKey);
that.changeData(that.itemData, isRootKey); that.changeData(that.itemData, isRootKey);
}, },
/** /**
...@@ -224,7 +226,7 @@ export default { ...@@ -224,7 +226,7 @@ export default {
/* eslint-disable */ /* eslint-disable */
async changeCheck(obj, key) { async changeCheck(obj, key) {
const that = this; const that = this;
// console.log('改变checkbox:', obj, key,that.itemData); // console.log('改变checkbox:', obj, key);
await that.findKey(obj.currentKey, obj.isRootKey, obj) await that.findKey(obj.currentKey, obj.isRootKey, obj)
// 查找父级禁用和不禁用 // 查找父级禁用和不禁用
...@@ -340,6 +342,16 @@ export default { ...@@ -340,6 +342,16 @@ export default {
} }
} }
return arrRet; return arrRet;
},
/**
* 专门处理来自json的数据
*/
async handledisFlag(handleData) {
const that = this;
console.log(handleData);
for(let key in handleData.properties) {
that.changeCheck(handleData.properties[key])
}
} }
}, },
watch: { watch: {
...@@ -347,12 +359,17 @@ export default { ...@@ -347,12 +359,17 @@ export default {
const that = this; const that = this;
that.trData = JSON.parse(JSON.stringify(newData)); that.trData = JSON.parse(JSON.stringify(newData));
// that.handleToArr(); // that.handleToArr();
console.log("right watch1", that.itemData)
} }
}, },
mounted() { mounted() {
const that = this; const that = this;
that.trData = JSON.parse(JSON.stringify(that.itemData)); that.trData = JSON.parse(JSON.stringify(that.itemData));
// that.handleToArr(); // that.handleToArr();
console.log("right watch2", that.itemData)
if (that.itemData.level == 1 && that.itemData.properties.hasOwnProperty('bodyRoot')) {
that.handledisFlag(that.itemData)
}
}, },
beforeDestroy() { beforeDestroy() {
this.tempArr = []; this.tempArr = [];
......
<!-- <!--
* @Descripttion: 当前组件信息
* @version: 1.0.0
* @Author: 无尘
* @Date: 2019-08-12 15:11:33
* @LastEditors: 无尘
* @LastEditTime: 2019-10-12 11:08:57
-->
<!--
<header-param :itemData="itemData"></header-param> <header-param :itemData="itemData"></header-param>
import headerParam from '@/components/createApi/header-param.vue'; import headerParam from '@/components/createApi/header-param.vue';
...@@ -141,7 +149,7 @@ export default { ...@@ -141,7 +149,7 @@ export default {
type: 'object', type: 'object',
isBackendField: 0, //是否后端字段 isBackendField: 0, //是否后端字段
defaultVal: '', //默认值 defaultVal: '', //默认值
isRootKey: 0, //是否是后端参数字段 isRootKey: false, //是否是后端参数字段
isRootKeyFlag: false, // 是否是后端参数字段 check isRootKeyFlag: false, // 是否是后端参数字段 check
rootKey: '', //后端参数字段 rootKey: '', //后端参数字段
objectClass: '', //如果是object 并且是dubbo objectClass: '', //如果是object 并且是dubbo
...@@ -172,7 +180,7 @@ export default { ...@@ -172,7 +180,7 @@ export default {
currentKey: 'field' + length, // 当前的 key currentKey: 'field' + length, // 当前的 key
isBackendField: 0, // 是否后端字段 isBackendField: 0, // 是否后端字段
defaultVal: '', // 默认值 defaultVal: '', // 默认值
isRootKey: 0, // 是否是后端参数字段 isRootKey: false, // 是否是后端参数字段
isRootKeyFlag: false, // 是否是后端参数字段 check isRootKeyFlag: false, // 是否是后端参数字段 check
rootKey: '', // 后端参数字段 rootKey: '', // 后端参数字段
objectClass: '', // 如果是object 并且是dubbo objectClass: '', // 如果是object 并且是dubbo
...@@ -195,7 +203,7 @@ export default { ...@@ -195,7 +203,7 @@ export default {
currentKey: 'field' + length, // 当前的 key currentKey: 'field' + length, // 当前的 key
isBackendField: 0, // 是否后端字段 isBackendField: 0, // 是否后端字段
defaultVal: '', // 默认值 defaultVal: '', // 默认值
isRootKey: 0, // 是否是后端参数字段 isRootKey: false, // 是否是后端参数字段
isRootKeyFlag: false, // 是否是后端参数字段 check isRootKeyFlag: false, // 是否是后端参数字段 check
rootKey: '', // 后端参数字段 rootKey: '', // 后端参数字段
objectClass: '', // 如果是object 并且是dubbo objectClass: '', // 如果是object 并且是dubbo
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
* @Author: 无尘 * @Author: 无尘
* @Date: 2019-08-07 18:01:05 * @Date: 2019-08-07 18:01:05
* @LastEditors: 无尘 * @LastEditors: 无尘
* @LastEditTime: 2019-10-10 14:10:17 * @LastEditTime: 2019-10-12 17:10:32
--> -->
<!-- <!--
<create-backend></create-backend> <create-backend></create-backend>
...@@ -261,7 +261,7 @@ export default { ...@@ -261,7 +261,7 @@ export default {
*/ */
async changeData(data, isRootKey) { async changeData(data, isRootKey) {
const that = this; const that = this;
// console.log('父组件:', data, isRootKey); // console.log('顶级父组件:', data, isRootKey);
// 如果是对象,查看子级有没有选中的字段 // 如果是对象,查看子级有没有选中的字段
let trueFlag = true; let trueFlag = true;
if (!isRootKey && data.type == 'object' && Object.keys(data.properties).length) { if (!isRootKey && data.type == 'object' && Object.keys(data.properties).length) {
...@@ -270,7 +270,7 @@ export default { ...@@ -270,7 +270,7 @@ export default {
if (!isRootKey && data.type == 'array' && Object.keys(data.items.properties).length) { if (!isRootKey && data.type == 'array' && Object.keys(data.items.properties).length) {
trueFlag = await that.handleDisable(data.items.properties); trueFlag = await that.handleDisable(data.items.properties);
} }
// console.log('trueFlag:', trueFlag, !trueFlag); // console.log('trueFlag:', trueFlag);
if (trueFlag == false) { if (trueFlag == false) {
data.isRootKeyFlag = true; data.isRootKeyFlag = true;
} else { } else {
...@@ -288,12 +288,13 @@ export default { ...@@ -288,12 +288,13 @@ export default {
} }
if (obj[k].type == 'object' && Object.keys(obj[k].properties).length) { if (obj[k].type == 'object' && Object.keys(obj[k].properties).length) {
tag = await that.handleDisable(obj[k].properties); tag = await that.handleDisable(obj[k].properties);
break;
} }
if (obj[k].type == 'array' && Object.keys(obj[k].items.properties).length) { if (obj[k].type == 'array' && Object.keys(obj[k].items.properties).length) {
tag = await that.handleDisable(obj[k].items.properties); tag = await that.handleDisable(obj[k].items.properties);
} }
} }
// console.log('return:', tag); // console.log('return:tag:', tag);
return tag; return tag;
}, },
...@@ -323,7 +324,6 @@ export default { ...@@ -323,7 +324,6 @@ export default {
/* eslint-disable */ /* eslint-disable */
async handlebackData() { async handlebackData() {
const that = this; const that = this;
console.log(that.constData)
const paramKeys = [...Object.keys(that.constData.properties)]; const paramKeys = [...Object.keys(that.constData.properties)];
let returnFlag = await isRepeat(paramKeys); let returnFlag = await isRepeat(paramKeys);
if (returnFlag) { if (returnFlag) {
...@@ -480,7 +480,7 @@ export default { ...@@ -480,7 +480,7 @@ export default {
} }
that.backBodyJsonData = JSON.parse(JSON.stringify(frontInfo.bodyJsonData)); that.backBodyJsonData = JSON.parse(JSON.stringify(frontInfo.bodyJsonData));
that.frontBodyJsonData = JSON.parse(JSON.stringify(frontInfo.bodyJsonData)); that.frontBodyJsonData = JSON.parse(JSON.stringify(frontInfo.bodyJsonData));
// console.log(that.backBodyJsonData) console.log(that.backBodyFormData, that.backBodyJsonData)
} }
that.$forceUpdate(); that.$forceUpdate();
}, },
...@@ -505,6 +505,9 @@ export default { ...@@ -505,6 +505,9 @@ export default {
handleStoreData() { handleStoreData() {
const that = this; const that = this;
that.apiInfoData = JSON.parse(JSON.stringify(that.$store.state.backInfo)); that.apiInfoData = JSON.parse(JSON.stringify(that.$store.state.backInfo));
let frontInfo = JSON.parse(JSON.stringify(that.$store.state.frontInfo));
// 后端请求类型修改20190929,前后端默认对应
that.apiInfoData.backendRequestType = frontInfo.requestType;
that.constData = that.apiInfoData.constData; that.constData = that.apiInfoData.constData;
if (!that.apiInfoData.constData) { if (!that.apiInfoData.constData) {
that.constData = { that.constData = {
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
* @Author: 无尘 * @Author: 无尘
* @Date: 2019-08-07 15:46:43 * @Date: 2019-08-07 15:46:43
* @LastEditors: 无尘 * @LastEditors: 无尘
* @LastEditTime: 2019-09-29 12:35:47 * @LastEditTime: 2019-10-12 10:43:15
--> -->
<!-- <!--
<create-base></create-base> <create-base></create-base>
...@@ -130,7 +130,7 @@ export default { ...@@ -130,7 +130,7 @@ export default {
}; };
for (let key in allData.frontParams.properties) { for (let key in allData.frontParams.properties) {
if (allData.frontParams.properties[key].frontOriginType == type && !allData.endParams.properties[key].constFlag) { if (allData.frontParams.properties[key].frontOriginType == type && !allData.endParams.properties[key].constFlag) {
// console.log(allData.frontParams.properties[key].frontOriginType); allData.frontParams.properties[key].isRootKey = allData.frontParams.properties[key].isRootKey == 1 || allData.frontParams.properties[key].isRootKey == true ? true : false;
that.$set(newObj.properties, allData.frontParams.properties[key].currentKey, allData.frontParams.properties[key]); that.$set(newObj.properties, allData.frontParams.properties[key].currentKey, allData.frontParams.properties[key]);
} }
} }
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
* @Author: 无尘 * @Author: 无尘
* @Date: 2019-08-07 17:17:50 * @Date: 2019-08-07 17:17:50
* @LastEditors: 无尘 * @LastEditors: 无尘
* @LastEditTime: 2019-10-11 16:51:35 * @LastEditTime: 2019-10-12 17:34:43
--> -->
<!-- <!--
<create-base></create-base> <create-base></create-base>
...@@ -211,7 +211,7 @@ export default { ...@@ -211,7 +211,7 @@ export default {
type: 'object', type: 'object',
isBackendField: 0, //是否后端字段 isBackendField: 0, //是否后端字段
defaultVal: '', //默认值 defaultVal: '', //默认值
isRootKey: 0, //是否是后端参数字段 isRootKey: false, //是否是后端参数字段
isRootKeyFlag: false, // 禁用标志 isRootKeyFlag: false, // 禁用标志
rootKey: '', //后端参数字段 rootKey: '', //后端参数字段
objectClass: '', //如果是object 并且是dubbo objectClass: '', //如果是object 并且是dubbo
...@@ -267,6 +267,7 @@ export default { ...@@ -267,6 +267,7 @@ export default {
// that.showJsonDialog = true; // that.showJsonDialog = true;
} }
}, },
/** /**
* dubbo 选择返回 * dubbo 选择返回
*/ */
...@@ -294,8 +295,26 @@ export default { ...@@ -294,8 +295,26 @@ export default {
// jsonschema // jsonschema
} }
}, },
/**
* 处理 isRootKey
*/
async handleArrObjData(item, parentIsRootKey) {
const that = this;
for (let childKey in item) {
item[childKey]['isRootKey'] = item[childKey]['isRootKey'] == '' || item[childKey]['isRootKey'] == 0 ? false : true; // 是否是后端参数字段
// 是否禁用,不能选择
item[childKey]['isRootKeyFlag'] = !parentIsRootKey || item[childKey]['isRootKey'] ? false : true;
if (item[childKey].type == 'array' && Object.keys(item[childKey].items.properties).length) {
await that.handleArrObjData(item[childKey].items.properties, item[childKey].isRootKey);
}
if (item[childKey].type == 'object' && Object.keys(item[childKey].properties).length) {
await that.handleArrObjData(item[childKey].properties, item[childKey].isRootKey);
}
}
return item;
},
// 前端通用数据处理 // 前端通用数据处理
handleQuery(allData, type) { async handleQuery(allData, type) {
const that = this; const that = this;
let newObj = { let newObj = {
type: 'object', type: 'object',
...@@ -304,9 +323,20 @@ export default { ...@@ -304,9 +323,20 @@ export default {
required: [] required: []
}; };
for (let key in allData.properties) { for (let key in allData.properties) {
allData.properties[key].isRootKey = allData.properties[key].isRootKey == 1 || allData.properties[key].isRootKey == true ? true : false;
allData.properties[key]['isRootKeyFlag'] = false;
if (allData.properties[key].frontOriginType == type) { if (allData.properties[key].frontOriginType == type) {
that.$set(newObj.properties, allData.properties[key].currentKey, allData.properties[key]); that.$set(newObj.properties, allData.properties[key].currentKey, allData.properties[key]);
} }
// console.log(allData.properties[key]);
// 如果有数组出现
if (allData.properties[key].type == 'array' && Object.keys(allData.properties[key].items.properties).length) {
await that.handleArrObjData(allData.properties[key].items.properties, allData.properties[key].isRootKey);
}
// 如果有对象出现
if (allData.properties[key].type == 'object' && Object.keys(allData.properties[key].properties).length) {
await that.handleArrObjData(allData.properties[key].properties, allData.properties[key].isRootKey);
}
} }
return newObj; return newObj;
}, },
...@@ -320,6 +350,7 @@ export default { ...@@ -320,6 +350,7 @@ export default {
that.headerData = await that.handleQuery(allData, 'header'); that.headerData = await that.handleQuery(allData, 'header');
that.bodyFormData = await that.handleQuery(allData, 'form'); that.bodyFormData = await that.handleQuery(allData, 'form');
that.bodyJsonData = await that.handleQuery(allData, 'body'); that.bodyJsonData = await that.handleQuery(allData, 'body');
// console.log(that.bodyJsonData);
// 如果返回没有 bodyRoot,需要添加默认的 // 如果返回没有 bodyRoot,需要添加默认的
let bodyJsonData = { let bodyJsonData = {
type: 'object', type: 'object',
...@@ -333,7 +364,7 @@ export default { ...@@ -333,7 +364,7 @@ export default {
type: 'object', type: 'object',
isBackendField: 0, //是否后端字段 isBackendField: 0, //是否后端字段
defaultVal: '', //默认值 defaultVal: '', //默认值
isRootKey: 0, //是否是后端参数字段 isRootKey: false, //是否是后端参数字段
isRootKeyFlag: false, // 禁用标志 isRootKeyFlag: false, // 禁用标志
rootKey: '', //后端参数字段 rootKey: '', //后端参数字段
objectClass: '', //如果是object 并且是dubbo objectClass: '', //如果是object 并且是dubbo
...@@ -401,6 +432,7 @@ export default { ...@@ -401,6 +432,7 @@ export default {
if (Object.keys(that.bodyJsonData.properties.bodyRoot.properties).length) { if (Object.keys(that.bodyJsonData.properties.bodyRoot.properties).length) {
that.bodyJsonData.properties.bodyRoot.required = []; that.bodyJsonData.properties.bodyRoot.required = [];
for (const key in that.bodyJsonData.properties.bodyRoot.properties) { for (const key in that.bodyJsonData.properties.bodyRoot.properties) {
that.bodyJsonData.properties.bodyRoot.properties[key]['isRootKey'] = that.bodyJsonData.properties.bodyRoot.properties[key]['isRootKey'] == 0 || that.bodyJsonData.properties.bodyRoot.properties[key]['isRootKey'] == false ? false : true;
if (that.bodyJsonData.properties.bodyRoot.properties[key].check) { if (that.bodyJsonData.properties.bodyRoot.properties[key].check) {
that.bodyJsonData.properties.bodyRoot.required.push(key); that.bodyJsonData.properties.bodyRoot.required.push(key);
} }
...@@ -443,7 +475,7 @@ export default { ...@@ -443,7 +475,7 @@ export default {
that.apiInfoData.queryData = that.queryData; that.apiInfoData.queryData = that.queryData;
that.$store.dispatch('saveFrontInfo', that.apiInfoData); that.$store.dispatch('saveFrontInfo', that.apiInfoData);
that.$emit('submitNext', that.apiInfoData); that.$emit('submitNext', that.apiInfoData);
// console.log('front:', that.apiInfoData); console.log('front:', that.apiInfoData);
}, },
handleStoreData() { handleStoreData() {
const that = this; const that = this;
...@@ -462,7 +494,7 @@ export default { ...@@ -462,7 +494,7 @@ export default {
type: 'object', type: 'object',
isBackendField: 0, //是否后端字段 isBackendField: 0, //是否后端字段
defaultVal: 'val', //默认值 defaultVal: 'val', //默认值
isRootKey: 0, //是否是后端参数字段 isRootKey: false, //是否是后端参数字段
isRootKeyFlag: false, // 禁用标志 isRootKeyFlag: false, // 禁用标志
rootKey: '', //后端参数字段 rootKey: '', //后端参数字段
objectClass: '', //如果是object 并且是dubbo objectClass: '', //如果是object 并且是dubbo
...@@ -486,7 +518,7 @@ export default { ...@@ -486,7 +518,7 @@ export default {
type: 'string', type: 'string',
isBackendField: 0, //是否后端字段 isBackendField: 0, //是否后端字段
defaultVal: 'val', //默认值 defaultVal: 'val', //默认值
isRootKey: 0, //是否是后端参数字段 isRootKey: false, //是否是后端参数字段
isRootKeyFlag: false, // 禁用标志 isRootKeyFlag: false, // 禁用标志
rootKey: '', //后端参数字段 rootKey: '', //后端参数字段
objectClass: '', //如果是object 并且是dubbo objectClass: '', //如果是object 并且是dubbo
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
* @Author: 无尘 * @Author: 无尘
* @Date: 2019-08-16 10:02:07 * @Date: 2019-08-16 10:02:07
* @LastEditors: 无尘 * @LastEditors: 无尘
* @LastEditTime: 2019-09-29 12:38:32 * @LastEditTime: 2019-10-12 14:07:48
--> -->
<!-- <!--
<create-result></create-result> <create-result></create-result>
...@@ -237,6 +237,7 @@ export default { ...@@ -237,6 +237,7 @@ export default {
/** /**
* 处理前端数据 * 处理前端数据
*/ */
/* eslint-disable */
async handleFrontData() { async handleFrontData() {
const that = this; const that = this;
if (!that.apiInfoData.errCode.length) { if (!that.apiInfoData.errCode.length) {
...@@ -256,14 +257,34 @@ export default { ...@@ -256,14 +257,34 @@ export default {
required: [] required: []
}; };
let front = JSON.parse(JSON.stringify(that.$store.state.frontInfo)); let front = JSON.parse(JSON.stringify(that.$store.state.frontInfo));
// 重新设置 isRootKey: true-->1,false--->0
if (Object.keys(front.queryData.properties).length) {
for (const key in front.queryData.properties) {
front.queryData.properties[key].isRootKey = front.queryData.properties[key].isRootKey == 0 || front.queryData.properties[key].isRootKey == false ? 0 : 1;
}
}
if (Object.keys(front.headerData.properties).length) {
for (const key in front.headerData.properties) {
front.headerData.properties[key].isRootKey = front.headerData.properties[key].isRootKey == 0 || front.headerData.properties[key].isRootKey == false ? 0 : 1;
}
}
obj.properties = Object.assign(front.queryData.properties, front.headerData.properties); obj.properties = Object.assign(front.queryData.properties, front.headerData.properties);
if (front.requestType == 'POST' && front.frontBodyType == 'json') { if (front.requestType == 'POST' && front.frontBodyType == 'json') {
if (Object.keys(front.bodyJsonData.properties.bodyRoot.properties).length) { if (Object.keys(front.bodyJsonData.properties.bodyRoot.properties).length) {
front.bodyJsonData.properties.bodyRoot.required = []; front.bodyJsonData.properties.bodyRoot.required = [];
for (const key in front.bodyJsonData.properties.bodyRoot.properties) { for (const key in front.bodyJsonData.properties.bodyRoot.properties) {
front.bodyJsonData.properties.bodyRoot.properties[key]['isRootKey'] = front.bodyJsonData.properties.bodyRoot.properties[key]['isRootKey'] == 0 || front.bodyJsonData.properties.bodyRoot.properties[key]['isRootKey'] == false ? 0 : 1;
if (front.bodyJsonData.properties.bodyRoot.properties[key].check) { if (front.bodyJsonData.properties.bodyRoot.properties[key].check) {
front.bodyJsonData.properties.bodyRoot.required.push(key); front.bodyJsonData.properties.bodyRoot.required.push(key);
} }
// 如果有数组出现
if (front.bodyJsonData.properties.bodyRoot.properties[key].type == 'array' && Object.keys(front.bodyJsonData.properties.bodyRoot.properties[key].items.properties).length) {
await that.handleArrObjData(front.bodyJsonData.properties.bodyRoot.properties[key].items.properties);
}
// 如果有对象出现
if (front.bodyJsonData.properties.bodyRoot.properties[key].type == 'object' && Object.keys(front.bodyJsonData.properties.bodyRoot.properties[key].properties).length) {
await that.handleArrObjData(front.bodyJsonData.properties.bodyRoot.properties[key].properties);
}
} }
} }
obj.properties = Object.assign(front.queryData.properties, front.headerData.properties, front.bodyJsonData.properties); obj.properties = Object.assign(front.queryData.properties, front.headerData.properties, front.bodyJsonData.properties);
...@@ -283,10 +304,23 @@ export default { ...@@ -283,10 +304,23 @@ export default {
} }
return obj; return obj;
}, },
async handleArrObjData(item) {
const that = this;
for (let childKey in item) {
item[childKey]['isRootKey'] = !item[childKey]['isRootKey'] || item[childKey]['isRootKey'] == 0 ? 0 : 1; // 是否是后端参数字段
if (item[childKey].type == 'array' && Object.keys(item[childKey].items.properties).length) {
await that.handleArrObjData(item[childKey].items.properties);
}
if (item[childKey].type == 'object' && Object.keys(item[childKey].properties).length) {
await that.handleArrObjData(item[childKey].properties);
}
}
return item;
},
/** /**
* 处理后端数据 * 处理后端数据
*/ */
handleBackData() { async handleBackData() {
const that = this; const that = this;
let obj = { let obj = {
type: 'object', type: 'object',
...@@ -296,14 +330,34 @@ export default { ...@@ -296,14 +330,34 @@ export default {
}; };
let back = JSON.parse(JSON.stringify(that.$store.state.backInfo)); let back = JSON.parse(JSON.stringify(that.$store.state.backInfo));
let front = JSON.parse(JSON.stringify(that.$store.state.frontInfo)); let front = JSON.parse(JSON.stringify(that.$store.state.frontInfo));
// 重新设置 isRootKey: true-->1,false--->0
if (Object.keys(back.backQueryData.properties).length) {
for (const key in back.backQueryData.properties) {
back.backQueryData.properties[key].isRootKey = back.backQueryData.properties[key].isRootKey == 0 || back.backQueryData.properties[key].isRootKey == false ? 0 : 1;
}
}
if (Object.keys(back.backHeaderData.properties).length) {
for (const key in back.backHeaderData.properties) {
back.backHeaderData.properties[key].isRootKey = back.backHeaderData.properties[key].isRootKey == 0 || back.backHeaderData.properties[key].isRootKey == false ? 0 : 1;
}
}
obj.properties = Object.assign(back.backQueryData.properties, back.backHeaderData.properties, back.constData.properties); obj.properties = Object.assign(back.backQueryData.properties, back.backHeaderData.properties, back.constData.properties);
if (front.requestType == 'POST' && front.frontBodyType == 'json') { if (front.requestType == 'POST' && front.frontBodyType == 'json') {
if (Object.keys(back.backBodyJsonData.properties.bodyRoot.properties).length) { if (Object.keys(back.backBodyJsonData.properties.bodyRoot.properties).length) {
back.backBodyJsonData.properties.bodyRoot.required = []; back.backBodyJsonData.properties.bodyRoot.required = [];
for (const key in back.backBodyJsonData.properties.bodyRoot.properties) { for (const key in back.backBodyJsonData.properties.bodyRoot.properties) {
back.backBodyJsonData.properties.bodyRoot.properties[key]['isRootKey'] = back.backBodyJsonData.properties.bodyRoot.properties[key]['isRootKey'] == 0 || back.backBodyJsonData.properties.bodyRoot.properties[key]['isRootKey'] == false ? 0 : 1;
if (back.backBodyJsonData.properties.bodyRoot.properties[key].check) { if (back.backBodyJsonData.properties.bodyRoot.properties[key].check) {
back.backBodyJsonData.properties.bodyRoot.required.push(key); back.backBodyJsonData.properties.bodyRoot.required.push(key);
} }
// 如果有数组出现
if (back.backBodyJsonData.properties.bodyRoot.properties[key].type == 'array' && Object.keys(back.backBodyJsonData.properties.bodyRoot.properties[key].items.properties).length) {
await that.handleArrObjData(back.backBodyJsonData.properties.bodyRoot.properties[key].items.properties);
}
// 如果有对象出现
if (back.backBodyJsonData.properties.bodyRoot.properties[key].type == 'object' && Object.keys(back.backBodyJsonData.properties.bodyRoot.properties[key].properties).length) {
await that.handleArrObjData(back.backBodyJsonData.properties.bodyRoot.properties[key].properties);
}
} }
} }
obj.properties = Object.assign(back.backQueryData.properties, back.backHeaderData.properties, back.backBodyJsonData.properties, back.constData.properties); obj.properties = Object.assign(back.backQueryData.properties, back.backHeaderData.properties, back.backBodyJsonData.properties, back.constData.properties);
......
<!-- <!--
* @Descripttion: 当前组件信息
* @version: 1.0.0
* @Author: 无尘
* @Date: 2019-08-08 09:34:38
* @LastEditors: 无尘
* @LastEditTime: 2019-10-12 11:01:39
-->
<!--
<header-param :itemData="itemData" :frontOriginType="frontOriginType"></header-param> <header-param :itemData="itemData" :frontOriginType="frontOriginType"></header-param>
import headerParam from '@/components/createApi/header-param.vue'; import headerParam from '@/components/createApi/header-param.vue';
...@@ -117,7 +125,7 @@ export default { ...@@ -117,7 +125,7 @@ export default {
currentKey: 'name', currentKey: 'name',
isBackendField: 0, //是否后端字段 isBackendField: 0, //是否后端字段
defaultVal: '', //默认值 defaultVal: '', //默认值
isRootKey: 0, //是否是后端参数字段 isRootKey: false, //是否是后端参数字段
isRootKeyFlag: false, // 是否是后端参数字段 check isRootKeyFlag: false, // 是否是后端参数字段 check
rootKey: '', //后端参数字段 rootKey: '', //后端参数字段
objectClass: '', //如果是object 并且是dubbo objectClass: '', //如果是object 并且是dubbo
...@@ -166,7 +174,7 @@ export default { ...@@ -166,7 +174,7 @@ export default {
currentKey: 'field' + length, currentKey: 'field' + length,
isBackendField: 0, //是否后端字段 isBackendField: 0, //是否后端字段
defaultVal: 'val', //默认值 defaultVal: 'val', //默认值
isRootKey: 0, //是否是后端参数字段 isRootKey: false, //是否是后端参数字段
isRootKeyFlag: false, // 是否是后端参数字段 check isRootKeyFlag: false, // 是否是后端参数字段 check
rootKey: '', //后端参数字段 rootKey: '', //后端参数字段
objectClass: '', //如果是object 并且是dubbo objectClass: '', //如果是object 并且是dubbo
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment