Commit 4ad993a1 authored by Sergey Antonovich's avatar Sergey Antonovich 🇯🇵

Update jSynergy.js

parent dbe0319e
......@@ -185,9 +185,9 @@ function __classSynergy() {
// [Метод не доступен из вне] До сохранения данных происходит процедурная манипуляция с данными
function beforeDoSaveFormData() {
let tmp = {
reglinkMeanings: [],
reglinkValueComponents: {}
};
reglinkMeanings: [],
reglinkValueComponents: {}
};
function checkCompReglink(cmp, table) {
if (cmp.type !== 'reglink') {
......@@ -1291,7 +1291,7 @@ function __classSynergy() {
let modifiedComponentsList = __CLIENT__.getModifiedFormdata();
if (modifiedComponentsList.length) {
let config = {
let save = __CLIENT__.api('asforms/data/merge', {
type: 'POST',
headers: {
'Content-Type': 'application/json'
......@@ -1300,13 +1300,20 @@ function __classSynergy() {
uuid: __CLIENT__.getDataUUID(),
data: modifiedComponentsList
})
};
let save = __CLIENT__.api('asforms/data/merge', config);
});
if (save && +save.errorCode === 0) {
console.info('\n\n');
console.info(__LIBRARY_PREFIX__ + '' + JSON.stringify(modifiedComponentsList));
modifiedComponentsList.forEach(function(modifyComponent) {
const compIndex = __CLIENT__.getDefaultFormData().findIndex(function(component) {
return component.id === modifyComponent.id
})
if(compIndex !== -1) {
__CLIENT__.getDefaultFormData()[compIndex] = Object.assign({}, modifyComponent);
}
});
console.info('\n\n' + __LIBRARY_PREFIX__ + '' + JSON.stringify(modifiedComponentsList));
console.info(
__LIBRARY_PREFIX__ + 'Data changed successfully!' +
'\nNumber of components changed: ' + modifiedComponentsList.length +
......@@ -1437,7 +1444,7 @@ function __classSynergy() {
/**
* Проверяет URL на валидность
* @param {String} url
* @param {String} url
*/
isValidURL: function (url) {
const pattern = new RegExp('^(https?:\\/\\/)?' + // protocol
......
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