mirror of
https://gitee.com/eolink_admin/postcat.git
synced 2024-11-30 10:47:41 +08:00
Merge branch 'preview/new_ui' of https://github.com/eolinker/eoapi into preview/new_ui
This commit is contained in:
commit
538cfc15f5
@ -3,7 +3,7 @@ import { EoMessageService } from 'eo/workbench/browser/src/app/eoui/message/eo-m
|
||||
import { whatType } from '../../../utils';
|
||||
import { flatData } from '../../../utils/tree/tree.utils';
|
||||
import qs from 'qs';
|
||||
import { form2json, parseTree, xml2UiData, isXML } from '../../../utils/data-transfer/data-transfer.utils';
|
||||
import { form2json, parseTree, xml2UiData, xml2json, isXML } from '../../../utils/data-transfer/data-transfer.utils';
|
||||
@Component({
|
||||
selector: 'params-import',
|
||||
templateUrl: './params-import.component.html',
|
||||
@ -13,7 +13,7 @@ export class ParamsImportComponent {
|
||||
@Input() rootType: 'array' | string | 'object' = 'object';
|
||||
@Input() contentType = 'json';
|
||||
@Input() baseData: object[] = [];
|
||||
@Input() modalTitle: string = '';
|
||||
@Input() modalTitle = '';
|
||||
@Output() baseDataChange = new EventEmitter<any>();
|
||||
@Output() beforeHandleImport = new EventEmitter<any>();
|
||||
isVisible = false;
|
||||
@ -98,6 +98,7 @@ export class ParamsImportComponent {
|
||||
return;
|
||||
}
|
||||
paramCode = JSON.parse(JSON.stringify(xml2UiData(this.paramCode)));
|
||||
console.log(paramCode);
|
||||
// console.log('-->', paramCode);
|
||||
}
|
||||
if (this.contentType === 'raw') {
|
||||
@ -119,7 +120,7 @@ export class ParamsImportComponent {
|
||||
paramCode = data || {};
|
||||
}
|
||||
// * tree to array for table render
|
||||
const cacheData = flatData(Object.keys(paramCode).map((it) => parseTree(it, paramCode[it])));
|
||||
const cacheData = flatData(Object.entries(paramCode).map(([key, value]) => parseTree(key, value)));
|
||||
|
||||
// TODO delete useless attribute in cacheData
|
||||
switch (type) {
|
||||
|
@ -61,7 +61,7 @@ export const parseTree = (key, value, level = 0) => {
|
||||
description: '',
|
||||
type: whatType(value),
|
||||
required: true,
|
||||
example: value || '',
|
||||
example: value == null ? '' : value.toString(),
|
||||
listDepth: level,
|
||||
};
|
||||
};
|
||||
@ -166,7 +166,7 @@ export const xml2UiData = (text) => {
|
||||
* @returns
|
||||
*/
|
||||
export const json2XML: (o: object, tab?) => string = (o, tab) => {
|
||||
const toXml = function(v, name, ind) {
|
||||
const toXml = function (v, name, ind) {
|
||||
let xml = '';
|
||||
if (v instanceof Array) {
|
||||
for (let i = 0, n = v.length; i < n; i++) {
|
||||
@ -252,7 +252,7 @@ export const text2UiData: (text: string) => uiData = (text) => {
|
||||
* @param inputOptions
|
||||
* @returns
|
||||
*/
|
||||
export const uiData2Json = function(eoapiArr: ApiEditBody, inputOptions) {
|
||||
export const uiData2Json = function (eoapiArr: ApiEditBody, inputOptions) {
|
||||
inputOptions = inputOptions || {};
|
||||
const result = {};
|
||||
const loopFun = (inputArr, inputObject) => {
|
||||
|
Loading…
Reference in New Issue
Block a user