Необходимо что бы для объекта орг структуры скрывалась вкладки с деталями на странице редактирования. исходный код замещающей страницы позволяет скрыть и добавить вкладку, но при сохранении консоль выдает ошибку :
define("SysAdminUnitPageV2", ["ConfigurationConstants"],
function() {
return {
entitySchemaName: "SysAdminUnit",
attributes: {
"ITShowDetails": {

"dataValueType": this.Terrasoft.DataValueType.BOOLEAN,
"type": this.Terrasoft.ViewModelColumnType.VIRTUAL_COLUMN,
"dependencies": [
{
"columns": ["ITShowDetails"],
"methodName": "showRegionsSalesAreas"

}
]

}

},
details: /**SCHEMA_DETAILS*/{

"ITRegionInOrgStructureDetail": {
"schemaName": "ITRegionInOrgStructureDetail",
"entitySchemaName": "ITRegionInOrgStructure",
"filter": {
"detailColumn": "ITSysAdminUnit",
"masterColumn": "Id"

}

}
}/**SCHEMA_DETAILS*/,
methods: {
onEntityInitialized: function() {
this.callParent(arguments);
this.showRegionsSalesAreas();
},
showRegionsSalesAreas: function() {

var showDetail = this.get("ITShowDetails");
var tabsCollection = this.get("TabsCollection");
var selectTab = tabsCollection.contains("ITRegionsSalesAreas") ?
tabsCollection.get("ITRegionsSalesAreas"):false;
if (showDetail === true && !selectTab) {
tabsCollection.insert(5, "ITRegionsSalesAreas", this.selectTab);

} else if (showDetail === false &&
selectTab) {
this.selectTab = selectTab;
tabsCollection.removeByKey("ITRegionsSalesAreas");

}
this.callParent(arguments);
}
},
diff: /**SCHEMA_DIFF*/[
{
"operation": "insert",
"parentName": "Tabs",
"propertyName": "tabs",
"index": 5,
"name": "ITRegionsSalesAreas",
"values": {
"caption": {"bindTo": "Resources.Strings.RegionsSalesAreasCaption"},
"items": []
}
},
{
"operation": "insert",
"name": "ITRegionInOrgStructureDetail",
"values": {
"itemType": 2,
"markerValue": "added-detail"

},
"parentName": "ITRegionsSalesAreas",
"propertyName": "items",
"index": 0

},
{
"operation": "insert",
"parentName": "Header",
"propertyName": "items",
"name": "ITShowDetails",
"values": {
"layout": {"column": 0, "row": 2, "colSpan": 12}
}

},
{
"operation": "insert",
"parentName": "Header",
"propertyName": "items",
"name": "SysAdminUnitTypeValue",
"values": {
"layout": {"column": 12, "row": 2, "colSpan": 12}
}

}
]/**SCHEMA_DIFF*/

};

});

Скрывает вкладки и добавляет, но при сохранении выдает ошибку в консоль:
less-parser.js:4151 [Deprecation] Synchronous XMLHttpRequest on the main thread is deprecated because of its detrimental effects to the end user's experience. For more help, check https://xhr.spec.whatwg.org/.
xhr @ less-parser.js:4151
loadStyleSheet @ less-parser.js:4043
loadStyleSheets @ less-parser.js:3935
less.refresh @ less-parser.js:3894
(anonymous) @ less-parser.js:3910
(anonymous) @ less-parser.js:4305
less-parser.js:4199 less: parsed http://localhost:82/core/83ba267f0b2f5663dc71a6f8341355dd/combined/all-c... successfully.
less-parser.js:4199 less: css for http://localhost:82/core/83ba267f0b2f5663dc71a6f8341355dd/combined/all-c... generated in 71ms
less-parser.js:4199 less: css generated in 71ms
4all-combined.js:578 Колонка Id не объявлена в ViewModel элемента меню
log @ all-combined.js:578
getMenuItemConfig @ all-combined.js:1519
onAddItem @ all-combined.js:1518
(anonymous) @ all-combined.js:1518
each @ all-combined.js:1
each @ all-combined.js:680
onCollectionDataLoaded @ all-combined.js:1518
setControlPropertyValue @ all-combined.js:526
setControlInitialValue @ all-combined.js:525
(anonymous) @ all-combined.js:522
Terrasoft.utils.array.each @ all-combined.js:231
bind @ all-combined.js:522
bind @ all-combined.js:1105
callParent @ all-combined.js:1
bind @ all-combined.js:1516
bindMenu @ all-combined.js:1526
bind @ all-combined.js:1549
(anonymous) @ all-combined.js:1127
each @ all-combined.js:1
bindItems @ all-combined.js:1127
bind @ all-combined.js:1127
generate @ ConfigurationBootstrap.js:5596
render @ ConfigurationBootstrap.js:5558
safeExecute @ core.js:758
renderModule @ core.js:92
renderChainModule @ core.js:138
processModule @ core.js:145
(anonymous) @ core.js:237
execCb @ require.js:1693
check @ require.js:881
enable @ require.js:1173
init @ require.js:786
(anonymous) @ require.js:1457
4all-combined.js:578 Колонка Id не объявлена в ViewModel элемента меню
log @ all-combined.js:578
getMenuItemConfig @ all-combined.js:1519
onAddItem @ all-combined.js:1518
(anonymous) @ all-combined.js:1518
each @ all-combined.js:1
each @ all-combined.js:680
onCollectionDataLoaded @ all-combined.js:1518
fire @ all-combined.js:1
continueFireEvent @ all-combined.js:1
fireEventArgs @ all-combined.js:1
fireEvent @ all-combined.js:1
loadAll @ all-combined.js:681
(anonymous) @ ConfigurationBootstrap.js:5008
parseResponse @ all-combined.js:966
callParent @ all-combined.js:1
parseResponse @ all-combined.js:983
(anonymous) @ all-combined.js:966
callback @ all-combined.js:954
a.callback @ all-combined.js:941
callback @ all-combined.js:1
onComplete @ all-combined.js:1
onStateChange @ all-combined.js:1
(anonymous) @ all-combined.js:1
all-combined.js:578 Колонка Id не объявлена в ViewModel элемента меню
log @ all-combined.js:578
getMenuItemConfig @ all-combined.js:1519
onAddItem @ all-combined.js:1518
fire @ all-combined.js:1
continueFireEvent @ all-combined.js:1
fireEventArgs @ all-combined.js:1
fireEvent @ all-combined.js:1
onCollectionAdd @ all-combined.js:677
callParent @ all-combined.js:1
onCollectionAdd @ all-combined.js:684
callParent @ all-combined.js:1
onCollectionAdd @ all-combined.js:713
fire @ all-combined.js:1
continueFireEvent @ all-combined.js:1
fireEventArgs @ all-combined.js:1
fireEvent @ all-combined.js:1
doInsert @ all-combined.js:1
insert @ all-combined.js:1
add @ all-combined.js:1
add @ all-combined.js:679
addItem @ all-combined.js:685
loadProfileButtonMenu @ MainHeaderSchema.js:220
onRender @ MainHeaderSchema.js:177
render @ ConfigurationBootstrap.js:22365
callParent @ all-combined.js:1
render @ ConfigurationBootstrap.js:23464
safeExecute @ core.js:758
renderModule @ core.js:92
renderChainModule @ core.js:138
(anonymous) @ ConfigurationBootstrap.js:22294
callback @ all-combined.js:1
(anonymous) @ MainHeaderSchema.js:168
(anonymous) @ ConfigurationBootstrap.js:17229
f @ all-combined.js:470
(anonymous) @ ConfigurationBootstrap.js:17784
querySysSettingsItem @ all-combined.js:948
initGoogleTagManager @ ConfigurationBootstrap.js:17782
f @ all-combined.js:470
(anonymous) @ ConfigurationBootstrap.js:17264
(anonymous) @ ConfigurationBootstrap.js:17274
(anonymous) @ all-combined.js:477
execCb @ require.js:1693
check @ require.js:881
(anonymous) @ require.js:1136
(anonymous) @ require.js:134
(anonymous) @ require.js:1186
each @ require.js:59
emit @ require.js:1185
check @ require.js:936
enable @ require.js:1173
init @ require.js:786
(anonymous) @ require.js:1011
(anonymous) @ require.js:134
requestObject.onreadystatechange @ profile.js:39
all-combined.js:578 Колонка Id не объявлена в ViewModel элемента меню
log @ all-combined.js:578
getMenuItemConfig @ all-combined.js:1519
onAddItem @ all-combined.js:1518
fire @ all-combined.js:1
continueFireEvent @ all-combined.js:1
fireEventArgs @ all-combined.js:1
fireEvent @ all-combined.js:1
onCollectionAdd @ all-combined.js:677
callParent @ all-combined.js:1
onCollectionAdd @ all-combined.js:684
callParent @ all-combined.js:1
onCollectionAdd @ all-combined.js:713
fire @ all-combined.js:1
continueFireEvent @ all-combined.js:1
fireEventArgs @ all-combined.js:1
fireEvent @ all-combined.js:1
doInsert @ all-combined.js:1
insert @ all-combined.js:1
add @ all-combined.js:1
add @ all-combined.js:679
addItem @ all-combined.js:685
loadProfileButtonMenu @ MainHeaderSchema.js:233
onRender @ MainHeaderSchema.js:177
render @ ConfigurationBootstrap.js:22365
callParent @ all-combined.js:1
render @ ConfigurationBootstrap.js:23464
safeExecute @ core.js:758
renderModule @ core.js:92
renderChainModule @ core.js:138
(anonymous) @ ConfigurationBootstrap.js:22294
callback @ all-combined.js:1
(anonymous) @ MainHeaderSchema.js:168
(anonymous) @ ConfigurationBootstrap.js:17229
f @ all-combined.js:470
(anonymous) @ ConfigurationBootstrap.js:17784
querySysSettingsItem @ all-combined.js:948
initGoogleTagManager @ ConfigurationBootstrap.js:17782
f @ all-combined.js:470
(anonymous) @ ConfigurationBootstrap.js:17264
(anonymous) @ ConfigurationBootstrap.js:17274
(anonymous) @ all-combined.js:477
execCb @ require.js:1693
check @ require.js:881
(anonymous) @ require.js:1136
(anonymous) @ require.js:134
(anonymous) @ require.js:1186
each @ require.js:59
emit @ require.js:1185
check @ require.js:936
enable @ require.js:1173
init @ require.js:786
(anonymous) @ require.js:1011
(anonymous) @ require.js:134
requestObject.onreadystatechange @ profile.js:39
all-combined.js:578 Колонка Id не объявлена в ViewModel элемента меню
log @ all-combined.js:578
getMenuItemConfig @ all-combined.js:1519
onAddItem @ all-combined.js:1518
fire @ all-combined.js:1
continueFireEvent @ all-combined.js:1
fireEventArgs @ all-combined.js:1
fireEvent @ all-combined.js:1
onCollectionAdd @ all-combined.js:677
callParent @ all-combined.js:1
onCollectionAdd @ all-combined.js:684
callParent @ all-combined.js:1
onCollectionAdd @ all-combined.js:713
fire @ all-combined.js:1
continueFireEvent @ all-combined.js:1
fireEventArgs @ all-combined.js:1
fireEvent @ all-combined.js:1
doInsert @ all-combined.js:1
insert @ all-combined.js:1
add @ all-combined.js:1
add @ all-combined.js:679
addItem @ all-combined.js:685
loadProfileButtonMenu @ MainHeaderSchema.js:239
onRender @ MainHeaderSchema.js:177
render @ ConfigurationBootstrap.js:22365
callParent @ all-combined.js:1
render @ ConfigurationBootstrap.js:23464
safeExecute @ core.js:758
renderModule @ core.js:92
renderChainModule @ core.js:138
(anonymous) @ ConfigurationBootstrap.js:22294
callback @ all-combined.js:1
(anonymous) @ MainHeaderSchema.js:168
(anonymous) @ ConfigurationBootstrap.js:17229
f @ all-combined.js:470
(anonymous) @ ConfigurationBootstrap.js:17784
querySysSettingsItem @ all-combined.js:948
initGoogleTagManager @ ConfigurationBootstrap.js:17782
f @ all-combined.js:470
(anonymous) @ ConfigurationBootstrap.js:17264
(anonymous) @ ConfigurationBootstrap.js:17274
(anonymous) @ all-combined.js:477
execCb @ require.js:1693
check @ require.js:881
(anonymous) @ require.js:1136
(anonymous) @ require.js:134
(anonymous) @ require.js:1186
each @ require.js:59
emit @ require.js:1185
check @ require.js:936
enable @ require.js:1173
init @ require.js:786
(anonymous) @ require.js:1011
(anonymous) @ require.js:134
requestObject.onreadystatechange @ profile.js:39
core.js:579 Элемент SectionSummaryContainer не найден
writeErrorMessage @ core.js:579
injectedSandbox.loadModule @ core.js:513
loadSummaryModule @ SectionBundleModule.js:69086
loadSummary @ SectionBundleModule.js:69081
onRender @ SectionBundleModule.js:68813
callParent @ all-combined.js:1
onRender @ SysAdminUnitSectionV2.js:748
render @ ConfigurationBootstrap.js:22365
safeExecute @ core.js:758
renderModule @ core.js:92
renderChainModule @ core.js:138
(anonymous) @ ConfigurationBootstrap.js:22294
(anonymous) @ SectionBundleModule.js:68894
f @ all-combined.js:470
(anonymous) @ SectionBundleModule.js:68889
f @ all-combined.js:470
callback @ all-combined.js:1
(anonymous) @ SectionBundleModule.js:71423
(anonymous) @ all-combined.js:477
execCb @ require.js:1693
check @ require.js:881
(anonymous) @ require.js:1136
(anonymous) @ require.js:134
(anonymous) @ require.js:1186
each @ require.js:59
emit @ require.js:1185
check @ require.js:936
enable @ require.js:1173
init @ require.js:786
(anonymous) @ require.js:1011
(anonymous) @ require.js:134
requestObject.onreadystatechange @ profile.js:39
all-combined.js:578 Object {connectionConfig: "{"debugMode":false,"disableCallCentre":false,"isAu…se,"useNotificationSound":false,"useVideo":false}", msgServerAddress: "", assemblyName: "", success: true}
all-combined.js:1 Uncaught TypeError: Cannot read property 'apply' of undefined
at i.callParent (all-combined.js:1)
at i.showRegionsSalesAreas (SysAdminUnitPageV2.js:739)
at i.onEntityInitialized (SysAdminUnitPageV2.js:721)
at i. (SectionBundleModule.js:25284)
at f (all-combined.js:470)
at i. (SectionBundleModule.js:25269)
at i. (all-combined.js:1013)
at i.parseGetEntityResponse (all-combined.js:980)
at i. (all-combined.js:981)
at i.callback (all-combined.js:954)
callParent @ all-combined.js:1
showRegionsSalesAreas @ SysAdminUnitPageV2.js:739
onEntityInitialized @ SysAdminUnitPageV2.js:721
(anonymous) @ SectionBundleModule.js:25284
f @ all-combined.js:470
(anonymous) @ SectionBundleModule.js:25269
(anonymous) @ all-combined.js:1013
parseGetEntityResponse @ all-combined.js:980
(anonymous) @ all-combined.js:981
callback @ all-combined.js:954
a.callback @ all-combined.js:941
callback @ all-combined.js:1
onComplete @ all-combined.js:1
onStateChange @ all-combined.js:1
(anonymous) @ all-combined.js:1
core.js:579 user: Supervisor/7f3b869f-34f3-4f20-ab4d-7480a5fdf647
file: http://localhost:82/core/9081d8eb154840ddc3ec408c11264ff4/combined/all-c...
line: 1
column: 44656
message: Uncaught TypeError: Cannot read property 'apply' of undefined
date: Thu Jun 08 2017 11:52:09 GMT+0300 (RTZ 2 (зима))
stack: TypeError: Cannot read property 'apply' of undefined
at i.callParent (http://localhost:82/core/9081d8eb154840ddc3ec408c11264ff4/combined/all-c...)
at i.showRegionsSalesAreas (http://localhost:82/0/configuration/b1e2814cad734eab60c931de3bb88cc7ru-R...)
at i.onEntityInitialized (http://localhost:82/0/configuration/b1e2814cad734eab60c931de3bb88cc7ru-R...)
at i. (http://localhost:82/0/configuration/db72f11f26ed19bd975b81f534ca9ee9/Sec...)
at f (http://localhost:82/core/9081d8eb154840ddc3ec408c11264ff4/combined/all-c...)
at i. (http://localhost:82/0/configuration/db72f11f26ed19bd975b81f534ca9ee9/Sec...)
at i. (http://localhost:82/core/9081d8eb154840ddc3ec408c11264ff4/combined/all-c...)
at i.parseGetEntityResponse (http://localhost:82/core/9081d8eb154840ddc3ec408c11264ff4/combined/all-c...)
at i. (http://localhost:82/core/9081d8eb154840ddc3ec408c11264ff4/combined/all-c...)
at i.callback (http://localhost:82/core/9081d8eb154840ddc3ec408c11264ff4/combined/all-c...)

Нравится

4 комментария

А если

entitySchemaName: "SysAdminUnit",

убрать, будет работать?

нет, потому что лог поле в схеме объекта SysAdminUnit

Тогда беда. Насколько я помню конфигурация вообще напрямую не работает с SysAdminUnit. Даже UserPageV2 работает через вьюху. Просто так сохранить в SysAdminUnit думаю не получится.

Upd. Ну да, this.entitySchemaName="VwSysAdminUnit" по-умолчанию. В SysAdminUnitRoleBasePageV2 есть метод saveEntity, который черпает столбцы для сохранения из вьюхи и отправляет их в сервис:

var config = {
	serviceName: "AdministrationService",
	methodName: "SaveRole",
	data: dataSend
};

Как минимум надо удалять entitySchemaName="SysAdminUnit" из вашей схемы, добавлять столбец во вью, альтерить sql-командой и уже дальше смотреть, работает или нет

Спасибо, подумаю над этим.

Показать все комментарии