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

Update jSynergy.js

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