/** * 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, compare) { if(obj === null){ return null; } if(obj instanceof Array){ for(let o in obj){ obj[o] = sortJson(obj[o], compare); } return obj; }else if(typeof obj == 'object'){ let arr=[]; let newOjb ={}; for(let key in obj){ arr.push(key); } if (compare) { arr.sort(compare); } else { arr.sort(); } for(let a of arr){ newOjb[a]= sortJson(obj[a], compare); } return newOjb; }else { return obj; } }