/** * Created by zhang on 2018/9/11. */ async function initCompilationSelect() { try { $('#compilationSels').empty(); let result = await ajaxPost("/stdBillsEditor/getCompilationList"); for(let r of result){ let $option = $(""); $option.val( r._id); $('#compilationSels').append($option); } }catch (err){ alert("取编办信息有误"); console.log(err) } } //对JSON对象排序,按属性key的顺序显示 function sortJson(obj) { if(obj === null){ return null; } if(obj instanceof Array){ for(let o in obj){ obj[o] = sortJson(obj[o]); } return obj; }else if(typeof obj == 'object'){ let arr=[]; let newOjb ={}; for(let key in obj){ arr.push(key); } arr.sort(); for(let a of arr){ newOjb[a]= sortJson(obj[a]); } return newOjb; }else { return obj; } }