Commit bde6da39 authored by Irina Oleynik's avatar Irina Oleynik

Создание новой записи реестра

parent db05a72b
```
var synergyHost = AS.OPTIONS.coreUrl + "rest/api/";
var departmentFormCode = "nce_forma_subdivision_card_copy2";
//Поля заполнения
var dataLabels = {
workflow_form_personal_card_rus_adress_1: "",
workflow_form_personal_card_idcard_number: "",
workflow_form_personal_card_idcard_date: "",
workflow_form_personal_card_rus_idcard_govag: "",
workflow_form_personal_card_id: ""
}
//загрузка данных
function loadUserData(id, _callback) {
jQuery.when(AS.FORMS.ApiUtils.simpleAsyncGet("rest/api/personalrecord/forms/" + id))
.then(function(result){
var card = result.filter(x => x.formCode === "workflow_form_personal_card")[0];
jQuery.when(AS.FORMS.ApiUtils.simpleAsyncGet("rest/api/asforms/data/" + card['data-uuid']))
.then(function(result) {
var data = result.data;
//TODO: rewrite
for (var i in data)
{
for (var j in dataLabels)
{
if (j.toString() === data[i].id) {
dataLabels[j] = data[i].value;
}
}
}
_callback();
});
});
}
function getUserId() {
var person = model.getValue();
return person[0].personID;
}
//Заполнение полей по ключам из массива
function fillFields() {
console.log("hello world!");
for (var i in dataLabels)
{
model.playerModel.getModelWithId(i.toString()).setValue(dataLabels[i]);
}
}
var changeFunction = function(_1, _2, value) {
var id = getUserId();
loadUserData(id, fillFields);
}
```
\ No newline at end of file
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