function showDictSelect(id, type, all) { var data = getDict(type); var select = $("#" + id); select.empty(); if (all != undefined && all) { select.append(""); } $.each(data, function(dictValue, dictName) { select.append(""); }); return data; } function showDictSelectByReference(id, type, all) { var data = getDict(type); var select = $("#" + id); select.empty(); if (all != undefined && all) { select.append(""); } $.each(data, function(dictValue, dictName) { select.append(""); }); return data; } function showDictSelectBySort(id, type, all) { var data = getDict(type); var select = $("#" + id); select.empty(); if (all != undefined && all) { select.append(""); } $.each(data, function(dictValue, dictName) { select.append(""); }); return data; } function getDict(type) { let params = { type: type } params={ encryptedData:encryptCBC(JSON.stringify(params)) } $.ajax({ type : 'post', url : ctxPath + '/dicts/type', data: params, headers: { "token": tokens }, async : false, success : function(result) { if (result.status === 200) { v = {}; $.each(result.data, function(i, d) { v[d.dictValue] = d.dictName; }); sessionStorage[type] = JSON.stringify(v); } else if (result.status === 500) { layer.alert(result.msg, {icon: 2}) } } }); return JSON.parse(sessionStorage[type]); } function showDictSelect2(id, type, all) { var data = getDict(type); var select = $("#" + id); select.empty(); if (all != undefined && all) { select.append(""); } $.each(data, function(dictValue, dictName) { select.append(""); }); return data; } function showDictSelect3(id, type, all) { var data = getDict(type); var select = $("#" + id); select.empty(); if (all != undefined && all) { select.append(""); } $.each(data, function(dictValue, dictName) { select.append(""); }); return data; } function getDict2(type) { $.ajax({ type : 'get', url : ctxPath + '/dicts?type=' + type, headers: { "token": tokens }, async : false, success : function(data) { v = {}; $.each(data, function(i, d) { v[d.dictValue] = d.dictName; }); sessionStorage[type] = JSON.stringify(v); } }); return JSON.parse(sessionStorage[type]); }