Commit 9fbe1b08 authored by Samir Sadyhov's avatar Samir Sadyhov 🤔

update interpreter_library

parent 9c413c4f
......@@ -151,6 +151,9 @@ let API = {
tableId: tableId,
data: data
}, "application/json; charset=utf-8");
},
getDictionary: function(dictionaryCode) {
return this.httpGetMethod("rest/api/dictionary/get_by_code?dictionaryCode=" + dictionaryCode);
}
};
......@@ -303,6 +306,30 @@ UTILS.parseAsfTable = function(asfTable){
}
}
function getDictValue(item, id){
return item.values.filter(function(x){if(x.columnID == id) return x})[0].value;
}
UTILS.parseDict = function(dict){
let result = [];
try {
if(!dict) throw new Error('Не передан справочник');
dict.items.forEach(function(item){
let tmp = {};
tmp.itemID = item.itemID;
dict.columns.forEach(function(col){
tmp[col.code] = getDictValue(item, col.columnID)
});
result.push(tmp);
});
return result;
} catch (err) {
return result;
}
}
//выпиливыние из массива повторяющихся елементов
Array.prototype.uniq = function() {
return this.filter(function(v, i, a){ return i == a.indexOf(v) });
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment