Recentemente, criei um sistema de gerenciamento de usuários, que possui requisitos de projeto e requer o uso de JS para gerar um formulário com indentação. Isso está realmente me atropelando. Esta função é realizada procurando informações relevantes. O editor a seguir faz anotações para o código de implementação, que é conveniente para pesquisas futuras. Ao mesmo tempo, também espero que amigos que tenham as mesmas necessidades que eu possam fazer uma referência. Se houver um método melhor, deixe -me uma mensagem, obrigado!
JS faz o seguinte formulário:
JSON
[{"ID": 302, "ServiceId": 15, "Nome": "Data", "Type": "JsonObject", "Paramdesc": "Return Query informação "," valor ":" "," Comentário ":" "," ParentId ":-1," Childreparam ": [{" ID ": 305," ServiceId ": 15," Nome ":" Info "," Type ":" JsonObject ", ParamDesc": "Query conteúdo "," valor ":" "," Comentário ":" "," ParentId ": 302," Childreparam ": [{" id ": 312," ID de serviço ": 15," nome ":" entinvlist "," tipo ":" lista "," paramdesc ":" enterprise investimento estrangeiro " Situação "," Valor ":" "," Comentário ":" "," ParentId ": 305," Childreparam ": [{" ID ": 343," ServiceId ": 15," Nome ":" Regno "," Type ":" String "," ParamDesc ":" Regregistration número "," valor ":" "," Comentário ":" "," Parentid ": 312," Childreparam ": null}, {" id ": 342," ServiceId ": 15," Nome ":" R egcapcur "," Type "," String "," ParamDesc ":" Capital registrado Moeda "," Valor ":" "," Comentário ":" "," Parentid ": 312," Childreparam ": NULL}, {" ID ": 341," ServiceId ": 15," Nome ":" RegCap "," Type ":" String "," ParamDesc ":" RegCap (10.000 yuan), "Valor": "", "Comentário": "", "ParentId": 312, "Childreparam": NULL}, {"ID": 340, "ServiceId": 15, "Nome": "Ent_nam e", "Tipo": "String", "ParamDesc": "Representante legal:" Representante Legal Nome "," Valor ":" "," Comentário ":" "," ParentId ": 312," Childreparam ": NULL}, {" ID ": 339," ServiceId ": 15," Nome ":" FundedRatio "," Type ":" String "," ParamDesc ":" Contribuição razão "," valor ":" "," Comentário ":" "," Parentid ": 312," Childreparam ": NULL}, {" ID ": 338," ServiceId ": 15," Nome ":" Esdate "," Tipo E ":" String "," ParamDesc ":" Abertura DATA "," VALOR ":" "," Comentário ":" "," ParentId ": 312," Childreparam ": NULL}, {" ID ": 337," ServiceId ": 15," Nome ":" Error "," Tipo ":" String "," Paramdesc ":" Capital (10.000 yuan) "," valor ":" "," Comentário ":" "," Parentid ": 312," Childreparam ": null}, {" id ": 336," ServiceId ": 15," Nome ":" Enttype "," Type ":" Strin g "," Paramdesc ":" Enterprise (instituição "," Tipo "," Valor ":" "," Comentário ":" "," ParentId ": 312," Childreparam ": NULL}, {" ID ": 345," ServiceId ": 15," Nome ":" RevDate "," Type ":" String "," Paramdesc ":" Revod Data "," Valor ":" "," Comentário ":" "," Parentid ": 312," Childreparam ": NULL}, {" ID ": 344," ServiceId ": 15," Nome ":" Regorg "," Type ":" String "," Paramd esc ":" Registro Autoridade "," Valor ":" "," Comentário ":" "," Parentid ": 312," Childreparam ": NULL}, {" ID ": 334," ServiceId ": 15," Nome ":" Moeda "," Tipo ":" String "," Paramdesc ":" Capital subscrito moeda "," valor ":" "," Comentário ":" "," Parentid ": 312," Childreparam ": null}, {" id ": 335," ServiceId ": 15," Nome ":" EntStatus "," Tipo ":" String "Paramdesc": "ententstatus", "Type": "(tipo": "paramcesc" ": Status "," Valor ":", "Comentário": "", "ParentId": 312, "Childreparam": NULL}, {"ID": 333, "ServiceId": 15, "Nome": "Candato", "Tipo": "String", "Paramdesc": "Login data "," valor ":" "," Comentário ":" "," Parentid ": 312," Childreparam ": NULL}]}, {" id ": 346," ServiceId ": 15," Nome ":" Ent_Name "," Type "," String "," ParamDesc ":" ENT ":" valor "::" "," Comentário ":" "," ParentId ": 305," Childreparam ": null}, {" id ": 311," ServiceId ": 15," Nome ":" Basic "," Type ":" JsonObject "," Paramdesc ":" Basic Informação "," valor ":" "," Comentário ":" "," Parentid ": 305," Childreparam ": [{" ID ": 326," ServiceId ": 15," Nome ":" OpScope "," Type ":" String "," Paramdesc ":" Business (Business) Scope "," Valor ":" "," com ment ":" "," ParentId ": 311," Childreparam ": null}, {" id ": 327," ServiceId ": 15," Nome ":" opto "," Type ":" String "," ParamDesc ":" Operação termo para Yyyy-mm-dd "," value ":" "," comentário ":" "," parentid ": 311," Childreparam ": null}, {" id ": 324," serviceId ": 15," nome da indústria ":" IndustryPhy "," "Tipo" "String", "Paramdesc": "Nome da indústria nacional", "Value": "" Tipo "" "String", "Paramdesc": "Código da indústria nacional", " Comentário ":" "," ParentId ": 311," Childreparam ": null}, {" id ": 325," ServiceId ": 15," Nome ":" OpFrom "," Type ":" String "," ParamDesc ":" O operação do termo é de de Yyyy-mm-dd "," valor ":" "," comentário ":" "," parentid ": 311," childreparam ": null}, {" id ": 322," serviceId ": 15," nome ":" string "," string "e" string "e", o nome "é o nome", o que é o que é o que é o que é o que é o que é o que é o que é o que é o que é o que é o que é o que é o que é o que é o que é o que você está fazendo com o objetivoR com clareza o par de. nomeado "," valor ":", "Comentário": "", "ParentId": 311, "Childreparam": null}, {"Id": 323, "ServiceId": 15, "Nome": "Industryco", "Type": "String", "ParamDesc": "Categoria da indústria Código "," Valor ":" "," Comentário ":" "," Parentid ": 311," Childrenparam ": NULL}, {" ID ": 320," ServiceId ": 15," Nome ":" Enttype "," Tipo ":" String "," Paramdesc ":" Enterprise (Instituição) Tipo "Tipo de Liabilização Limitada, etc Yyyy-mm-dd "," value ":" "," comentário ":" "," parentid ": 311," Childreparam ": null}, {" id ": 332," serviceId ": 15," nome ":" revDate "," tipo ":" string "," paramdesc ":" "DATED" Yyyy-mm-dd "," value ":" "," comentário ":" "," parentid ": 311," Childreparam ": null}, {" id ": 330," serviceId ": 15," nome ":" regno "," type ":" string "," paramdesc ":" registro " número "," valor ":" "," Comentário ":" "," ParentId ": 311," Childreparam ": null}, {" id ": 331," ServiceId ": 15," Nome ":" Regorg "," Tipo ":" String "," PartDesc ":" Registration Authority "," Va Lue ":" "," Comentário ":" "," ParentId ": 311," Childrenparam ": NULL}, {" ID ": 328," ServiceId ": 15," Nome ":" RegCap "," Type ":" String "," PartDesc ":" Capital Registed Unit: 10.000 yuan "," Valor ":" "," Comentário ":" "," Parentid ": 311," Childreparam ": null}, {" id ": 329," ServiceId ": 15," Nome ":" RegCapcur "," Type "," String "," ParamDesc ":" Currency RMB, USCCur "," Type, "String", "ParamDesc": "Currency RMB, USC, etc. E ":" "," Comentário ":", "Parentid": 311, "Childreparam": NULL}, {"ID": 313, "ServiceId": 15, "Nome": "OpscoandForm", "Type": "String", "ParamDesc": "Escopo e Método de Operação", (Business) "," Value ":" "," Comentário ":" "," ParentId ": 311," Childreparam ": NULL}, {" ID ": 315," ServiceId ": 15," Nome ":" Ancheyear "," Type ":" String "," Paramdesc ":" Last Annual Inspeção YYYyyyyyyyyyyyyyy: "String", "Paramdesc": "Last Annual Yyyyyyy": " "," valor ":" "," Comentário ":" "," ParentId ": 311," Childreparam ": null}, {" id ": 314," ServiceId ": 15," Nome ":" ABUITEM "," Tipo ":" String "," ParamDesc ":" licenciado negócio Projeto "," Valor ":" "," Comentário ":" "," ParentId ": 311," Childreparam ": NULL}, {" ID ": 317," Ser vice -vice ": 15," Nome ":" Cbuitem "," Type ":" String "," ParamDesc ":" Business General Projeto "," Valor ":" "," Comentário ":" "," ParentId ": 311," Childreparam ": NULL}, {" ID ": 316," ServiceId ": 15," Nome ":" Candato "," Tipo ":" String "," Paramdesc ":" Data de logout yyyy-mm-dd "," Val ue ":" "," Comentário ":" "," ParentId ": 311," Childrenparam ": null}, {" id ": 319," ServiceId ": 15," Nome ":" EntStatus "," Type ":" String "," Paramdesc ":" Status da operação em operação, revogação, cancelamento, "String", Paramdesc ":" Status da operação, revogação, cancelamento, " Outros "," Valor ":" "," Comment ":", "ParentId": 311, "Childreparam": NULL}, {"ID": 318 , "ServiceId": 15, "Name": "Dom", "Type": "String", "Paramdesc": "Endereço", "Valor": "", "Comment": "", "ParentId": 311, "ChildrenParam": NULL} "]}}, {" Id ": 304," ServiceId ":" Nome "": ""]} "Result" "" "" "],"): "Id": 304: "ServiceId": "NULL" ":"]} "result," {"Id": 304, " resultado "," valor ":" corresponde | não_match | Not_found "," Comment ":", "ParentId": 302, "Childreparam": NULL}, {"ID": 303, "ServiceId": 15, "Nome": "Status", "Type": "Boolean", "ParamDesc": "Return Return Status "," Valor ":", "Comentário": "", "Parentid": 302, "Childreparam": null}]}, {"id": 306, "ServiceId": 15, "Nome": "API_STATUS", "Type": "JsonObject", "Paramdesc": "Return Status Código "," Valor: "", "Comentário": "", "Parentid":-1, "Childrenparam": [{"ID": 307, "ServiceId": 15, "Nome": "Status", "Tipo" ":" Boolean, "Paramdesc": "Interface Return Status," "": "", ", comentário": "Pare", paramc ":" interface Return Status, "" ":" ",", comentário ":" Pare ntid ": 306," Childreparam ": null}, {" id ": 309," ServiceId ": 15," Nome ":" Descrição "," Tipo ":" String "," ParamDesc ":" Return Status Descrição "," Valor ":" "," Comment ":", "ParentId": 306, "Childreparam": NULL}, {"ID": 308, "ServiceId": 15, "Nome": "Code", "Type": "St Ring", "ParamDesc": "Status Code "," Value ":" "," Comentário ":" "," Parentid ": 306," Childreparam ": NULL}, {" ID ": 310," ServiceId ": 15," Nome ":" Serial_no "," Type ":" String "," ParamDesc ":" Flow número "," valor ":" "," Comentário ":" "," Parentid ": 306," Childreparam ": null}]}]]JS
// API Página Parâmetro de saída Descrição var apitohtml_outParamfn = function (json, returnExample) {var html = '' var mustarr = ['requerir', 'opcional'] var paramhtml = ': var dados = $ .parsejson (json); Descrição da atribuição de parâmetros // Comentário: Parâmetro Outra Descrição // ChildrenParam: Lista de parâmetros da criança console.log ('------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- c = [] dataFormatfn2 (dados, flagi) // estatísticas O número de subclasses // cada nó adiciona o atributo len para contar a soma do nó filho e a função da criança DataFormatfn2 (dados) {for (var i = 0; i <data.length; i ++) {bbb [i] = 0bbb [i] = dataFormatfn (dados [i], 0, bbb [i], c)}; // dados para htmlparamhtml = jsontohtml (dados, 0);} função datafn (dados, flagi, b, c) { data.childrenparam.length) || 1 // Debugger // console.log (dados) c = c || [] if (data.childrenparam) {for (var i = 0; i <data.childrenparam.lengthren; i ++) {b ++ data.len+= flagfn (Data), data), datafnPernnParam; data.len}else{return (data.childrenParam && data.childrenParam.length) ||0}}console.log(bbb)console.log(data)var flagI = 0// After moving to dataformataFn2, execute // paramHtml = jsontohtml(data,flagI);function jsontohtml (dados, flagi, len) {var paramhtml = ''; var nbsparr = ['', '<b> ⅰ </b>', '<b>' </b> ',' <b> ⅲ </b> ',' <b> ⅵ </b> ',' <b> ⅴ </b> ',' <b> ⅵ </b> ',' <b> ⅶ </b> ',' <b> ⅷ </b> ',' <b> ⅸ </b> ',' <b> ⅹ </b> '] para (var i = 0; i <data.length; i ++) {var str2 = '' var span = 1if (i == 0 && flagi> 0 && len> 1) {span = (10-flagi) str2 = '<td rowspan = "'+(len)+'"> </td>'} {staning = (10-span = 10-flan = ''+(len)+'> + '/<td colspan = "' + span + '"> <br>' + nbsparr [flagi] + dados [i] .name + '</nobr> </td>/<td>' + dados [i] .tyPe + '</td>/<td>' + dados [i] .paramdsc + '</td>/<td>' + dados [i] .paramdsc + ' +'</td>/<td>' +dados [i] .Comment +'</td>/</tr>' if (data [i] .childrenparam) {paramhtml += jsontohtml (dados [i] .childrenparam, flagi +1, dados [i] .len)} {{]. paramHtml}console.log('--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- Colspan = "10"> <bir> Nome em inglês </BOBR> </th>/<the> <Born> Tipo de parâmetro </BOBR> </th>/<th> <hbr> Definição chinesa </br> </th>/<th> <blr> Descrição da Descrição </BONBR> </th>/<th> <th> Instruções </brodr> </th>/</tr>/</thead>/<tbody>/' + paramhtml +'/</tbody>/</itlast>/</div>/</dd> '$ ('#outparam dl '). html (html);} htang loctyp ht htn). charset = "utf-8"> <title> js gera tabela penteado </ititle> </head> <body> <div id = "outparam"> <dl> </dl> </div> </body> </html> código <! tabela </ititle> <link rel = "Stylesheet" type = "text/css" media = "screen" href = "http://cdn.bootcss.com/bootstrap/3.6/css/bootstrap.min.css"> </wead> <body> <diDr = "ousparam"> "> <////clodbod> <diVss/BOOTSTAP.Min. src = "http://cdn.bootcss.com/jquery/1.12.4/jquery.min.js"> </script> <cript> var json = '[{"id": 302, "ServiceId": 15, "Nome": "Data", "Type": " informação "," valor ":" "," Comentário ":" "," ParentId ":-1," Childreparam ": [{" ID ": 305," ServiceId ": 15," Nome ":" Info "," Type ":" JsonObject ", ParamDesc": "Query content "," valor ":" "," Comentário ":" "," Parentid ": 302," Childreparam ": [{" id ": 312," se rviceId ": 15," Nome ":" Entinvlist "," Type ":" List "," PartDesc ":" Enterprise Investment estrangeiro Situação "," Valor ":" "," Comentário ":" "," ParentId ": 305," Childreparam ": [{" ID ": 343," ServiceId ": 15," Nome ":" Regno "," Type ":" String "," ParamDesc ":" Regregistration número "," valor ":" "," Comentário ":" "," ParentId ": 312," Childreparam ": null}, {" id ": 342," ServiceId ": 15", nam e":"regCapCur","type":"String","paramDesc":"regcapCurrent","value":"","comment":"","parentId":312,"childrenParam":null},{"id":341,"serviceId":15,"name":"regCap","type":"String","paramDesc":"regcap (10,000 yuan), "Valor": "", "Comentário": "", "Parentid": 312, "Childreparam": NULL}, {"ID": 340, "ServiceId": 15, "Nome": "en t_name", "Type", "String", "ParamDesc": "Representante legal Nome "," Valor ":" "," Comentário ":" "," ParentId ": 312," Childreparam ": NULL}, {" ID ": 339," ServiceId ": 15," Nome ":" FundedRatio "," Type ":" String "," ParamDesc ":" Contribuição razão "," valor ":" "," Comentário ":" "," ParentId ": 312," Childreparam ": null}, {" id ": 338," ServiceId ": 15," Nome ":" Esdate "," Type ":" String "," Paramdesc ":" Aberto DATA "," VALOR ":" "," Comentário ":" "," ParentId ": 312," Childreparam ": NULL}, {" ID ": 337," ServiceId ": 15," Nome ":" Error "," Tipo ":" String "," Paramdesc ":" Capital (10.000 yuan) "," valor ":" "," Comentário ":" "," Parentid ": 312," Childreparam ": null}, {" Id ": 336," ServiceId ": 15," Nome ":" Enttype "," Type ":" S Twist "," Paramdesc ":" Enterprise (institucional), Tipo "," Valor ":" "," Comentário ":" "," ParentId ": 312," Childreparam ": NULL}, {" ID ": 345," ServiceId ": 15," Nome ":" RevDate "," Type ":" String "," Paramdesc ":" Revod Data "," Valor ":" "," Comentário ":" "," Parentid ": 312," Childreparam ": NULL}, {" ID ": 344," ServiceId ": 15," Nome ":" Regorg "," Type ":" String ", PA Ramdesc": "Registro Autoridade "," Valor ":" "," Comentário ":" "," Parentid ": 312," Childreparam ": NULL}, {" ID ": 334," ServiceId ": 15," Nome ":" Moeda "," Tipo ":" String "," Paramdesc ":" Capital subscrito Moeda "," Valor ":" "," Comentário ":" "," Parentid ": 312," Childreparam ": NULL}, {" Id ": 335," ServiceId ": 15," Nome ":" EntStatus "," Type ":" String "," Paramdesc " : "ent_name", "tipo": "paramdesc": "", "ParentId": 312, "Childreparam": null}, {"id": 333, "ServiceId": 15, "Nome": "Candato", "Type": "String", "ParamDesc": "Login data "," valor ":" "," Comentário ":" "," Parentid ": 312," Childreparam ": null}]}, {" id ": 346," ServiceId ": 15," Nome ":" Ent_Name "," Type "," String "," ParamDesc ":" Ent ":" Va Lue ":" "," Comment ":" "," ParentId ": 305," Childreparam ": NULL}, {" ID ": 311," ServiceId ": 15," Nome ":" Basic "," Type ":" JsonObject "," ParamDesc ":" Enterprise informação "," valor ":" "," Comentário ":" "," ParentId ": 305," Childreparam ": [{" ID ": 326," ServiceId ": 15," Nome ":" OpScope "," Type ":" String "," Paramdesc ": Operação (Business) Scope", "Valor": "", "C." C. oment ":" "," ParentId ": 311," Childreparam ": null}, {" id ": 327," serviceId ": 15," nome ":" opto "," tipo ":" string "," paramdesc ":" termo de operação para Yyyy-mm-dd "," value ":" "," Comentário ":" "," Parentid ": 311," Childreparam ": NULL}, {" ID ": 324," ServiceId ": 15," Nome ":" Industryphy "," Type ":" String "," Paramdesc ":" Indústria nacional " Código "," valor ":" "" "" "" "valor": "" """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" , "Comentário": "", "ParentId": 311, "Childreparam": null}, {"id": 325, "ServiceId": 15, "Nome": "OpFrom", "Type": "String", "Paramdesc": "Termo de operação é de de Yyyy-mm-dd "," valor ":" "," comentário ":" "," parentid ": 311," Childrenparam ": null}, {" id ": 322," serviceId ": 15," nome ":" FRNAME "," Tipo ":" String, "Paramd": "Declarado": o nome do autônomo "," Tipo ":" String, "" Nome "," Valor ":", "Comentário": "", "ParentId": 311, "Childreparam": NULL}, {"ID": 323, "ServiceId": 15, "Nome": "Industryco", "Type": "String", "PartDesc": "Categoria da indústria Código "," Valor ":" "," Comentário ":" "," Parentid ": 311," Childrenparam ": NULL}, {" ID ": 320," ServiceId ": 15," Nome ":" Enttype "," Tipo ":" String "," Paramdesc ":" Entent (Instituição) Tipo de Liabilização Limitada, empresas de liabilidade, " etc Yyyy-mm-dd "," value ":" "," Comentário ":" "," Parentid ": 311," Childreparam ": null}, {" id ": 332," ServiceId ": 15," Nome ":" RevDate "," Type ":" String "," Paramdesc ":" Hang Date Yyyy-mm-dd "," value ":" "," comentário ":" "," parentid ": 311," Childreparam ": null}, {" id ": 330," serviceId ": 15," nome ":" regno "," type ":" string "," paramdesc ":" registro " número "," valor ":" "," Comentário ":" "," ParentId ": 311," Childreparam ": null}, {" id ": 331," ServiceId ": 15," Nome ":" Regorg "," Tipo ":" String "," PartDesc ":" Registration Authority "," V. v alaue ":" "," Comment ":" "," ParentId ": 311," Childreparam ": NULL}, {" ID ": 328," ServiceId ": 15," Nome ":" Regcap "," Type ":" String "," ParamDesc ":" RegCap Unit: 10.000 yuan "," valor ":" "," Comentário ":" "," Parentid ": 311," Childreparam ": null}, {" id ": 329," ServiceId ": 15," Nome ":" RegCapCur "," Type "," String "," Paramdesc ":" Currency RMB, dólar etc. " ue ":" "," Comentário ":" "," Parentid ": 311," Childrenparam ": null}, {" id ": 313," ServiceId ": 15," Nome ":" OpscoandForm "," Tipo ":" String "," Paramdesc ":" Escopo e Método de Operação ", (Business) "," Value ":" "," Comment ":" "," ParentId ": 311," Childreparam ": NULL}, {" Id ": 315," ServiceId ": 15," Nome ":" Ancheyear "," Tipo ":" String "," Paramdesc ":" Last Inspeção Anual YYY "," "," valor ":" "," Comentário ":" "," ParentId ": 311," Childreparam ": null}, {" id ": 314," ServiceId ": 15," Nome ":" ABUITEM "," Tipo ":" String "," ParamDesc ":" licenciado negócio Projeto "," Valor ":" "," Comentário ":" "," ParentId ": 311," Childreparam ": NULL}, {" ID ": 317," Ser vice -vice ": 15," Nome ":" Cbuitem "," Type ":" String "," ParamDesc ":" Business General Projeto "," Valor ":" "," Comentário ":" "," ParentId ": 311," Childreparam ": NULL}, {" ID ": 316," ServiceId ": 15," Nome ":" Candato "," Tipo ":" String "," Paramdesc ":" Data de logout yyyy-mm-dd "," Val ue ":" "," Comentário ":" "," ParentId ": 311," Childrenparam ": null}, {" id ": 319," ServiceId ": 15," Nome ":" EntStatus "," Type ":" String "," Paramdesc ":" Status da operação em operação, revogação, cancelamento, "String", Paramdesc ":" Status da operação, revogação, cancelamento, " Outros "," Valor ":" "," Comment ":", "ParentId": 311, "Childreparam": NULL}, {"ID": 318 , "ServiceId": 15, "Name": "Dom", "Type": "String", "Paramdesc": "Endereço", "Valor": "", "Comment": "", "ParentId": 311, "ChildrenParam": NULL} "]}}, {" Id ": 304," ServiceId ":" Nome "": ""]} "Result" "" "" "],"): "Id": 304: "ServiceId": "NULL" ":"]} "result," {"Id": 304, " Resultado "," Valor ":" Match | status "," valor ":" "," Comentário ":" "," Parentid ": 302," Childreparam ": null}]}, {" id ": 306," ServiceId ": 1 5," Nome ":" API_STATUS "," Type ":" JsonObject "," Paramdesc ":" Return Status Código "," Valor ":" "," Comentário ":" "," Parentid ":-1," Childrenparam ": [{" ID ": 307," ServiceId ": 15," Nome ":" Status "," Type ":" Boolean "," Paramdesc ":" Interface Return Status, "" "" "", ",", comentário ":" ID ": 306," Childrenparam ": null}, {" id ": 309," ServiceId ": 15," Nome ":" Descrição "," Tipo ":" String "," Paramdesc ":" Status de retorno Descrição "," valor ":" "," Comentário ":" "," ParentId ": 306," Childreparam ": NULL}, {" ID ": 308," ServiceId ": 15," Nome ":" Code "," Type ":" Strin G "," Paramdesc ":" Status Code "," Value ":" "," Comentário ":" "," Parentid ": 306," Childreparam ": NULL}, {" ID ": 310," ServiceId ": 15," Nome ":" Serial_no "," Type ":" String "," ParamDesc ":" Flow Número "," Valor ":" "," Comment ":", "ParentId": 306, "ChildrenParam": NULL}]}] '; // Parâmetro de saída da página da API Descrição var apitohtml_outParamfn = function (JSON) {var html =' var Mustarr = ['requerir,' '', opção '] $ .parsejson (json); console.log (dados) // nome: parâmetro Nome em inglês // Tipo: parâmetro Tipo // paramdesc: parâmetro definição chinesa // valor: atribuição de parâmetros Descrição // Comentário: Parâmetro OUTRA Descrição // Childrenparam: Lista de parâmetros filho console.log('----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- c = [] dataFormatfn2 (dados, flagi) // estatísticas O número de subclasses // cada nó adiciona o atributo len para contar a soma do nó filho e a função da criança DataFormatfn2 (dados) {for (var i = 0; i <data.length; i ++) {bbb [i] = 0bbb [i] = dataFormatfn (dados [i], 0, bbb [i], c)}; // dados para htmlparamhtml = jsontohtml (dados, 0);} função datafn (dados, flagi, b, c) { data.childrenparam.length) || 1 // Debugger // console.log (dados) c = c || [] if (data.childrenparam) {for (var i = 0; i <data.childrenparam.lengthren; i ++) {b ++ data.len+= flagfn (Data), data), datafnPernnParam; data.len} else {return (data.childrenparam && data.childrenparam.length) || 0}} console.log (bbb) console.log (dados) var flagi = 0 // execute a dataFormatafn2 // paramhtml = jsontohtml (datas); flagi); paramhtml = ''; var nbsparr = ['', '<b> ⅰ </b>', '<b>' </b> ',' <b> ⅲ </b> ',' <b> ⅵ </b> ',' <b> ⅴ </b> ',' <b> ⅵ </b> ',' <b> ⅶ </b> ',' <b> ⅷ </b> ',' <b> ⅸ </b> ',' <b> ⅹ </b> '] para (var i = 0; i <data.length; i ++) {var str2 = '' var span = 1if (i == 0 && flagi> 0 && len> 1) {span = (10-flagi) str2 = '<td rowspan = "'+(len)+'"> </td>'} {staning = (10-span = 10-flan = ''+(len)+'> + '/<td colspan = "' + span + '"> <br>' + nbsparr [flagi] + dados [i] .name + '</nobr> </td>/<td>' + dados [i] .tyPe + '</td>/<td>' + dados [i] .paramdsc + '</td>/<td>' + dados [i] .paramdsc + ' +'</td>/<td>' +dados [i] .Comment +'</td>/</tr>' if (data [i] .childrenparam) {paramhtml += jsontohtml (dados [i] .childrenparam, flagi +1, dados [i] .len)} {{]. paramhtml} console.log ('---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- Colspan = "10"> <bir> Nome em inglês </BOBR> </th>/<the> <Born> Tipo de parâmetro </BOBR> </th>/<th> <hbr> Definição chinesa </br> </th>/<th> <blr> Descrição da Descrição </BONBR> </th>/<th> <th> Instruções </borr> </th>/</tt>/</t>/</thead>/<tbody>/' + paramhtml +'/</tbody>/</ tabela>/</div>/</dd> '$ ('#outparam dl '). html (html);} apitohtml_outParamfn (json) </script> </body> </html>