creatio-snippetsdefСтандартный шаблон define Templatedefine("SchemaName", [ "SchemaNameResources" ], function(resources) { return { entitySchemaName: "EntitySchemaName", mixins: {}, attributes: {}, details: /**SCHEMA_DETAILS*/ {} /**SCHEMA_DETAILS*/ , messages: {}, methods: {}, rules: {}, businessRules: /**SCHEMA_BUSINESS_RULES*/ {} /**SCHEMA_BUSINESS_RULES*/ , modules: /**SCHEMA_MODULES*/ {} /**SCHEMA_MODULES*/ , diff: /**SCHEMA_DIFF*/ [] /**SCHEMA_DIFF*/ }; }); defModalBoxШаблон модального окна Templatedefine("SchemaName", [ "SchemaNameResources", "ModalBox", ], function(resources) { return { mixins: {}, attributes: {}, details: {}, messages: {}, methods: { defRodШаблон детали "Только для чтения" Templatedefine("SchemaName", [ "SchemaNameResources" ], function(resources) { return { entitySchemaName: "EntitySchemaName", mixins: {}, attributes: {}, messages: {}, methods: { defEdШаблон детали c ред. реестром Templatedefine("SchemaName", [ "SchemaNameResources", "ConfigurationGrid", "ConfigurationGridGenerator", "ConfigurationGridUtilities" ], function(resources) { return { entitySchemaName: "EntitySchemaName", attributes: { "IsEditable": { "dataValueType": Terrasoft.DataValueType.BOOLEAN, "type": Terrasoft.ViewModelColumnType.VIRTUAL_COLUMN, "value": true } }, mixins: { ConfigurationGridUtilities: "Terrasoft.ConfigurationGridUtilities" }, methods: {}, diff: /**SCHEMA_DIFF*/ [ { "operation": "merge", "name": "DataGrid", "values": { "className": "Terrasoft.ConfigurationGrid", "generator": "ConfigurationGridGenerator.generatePartial", "generateControlsConfig": { "bindTo": "generateActiveRowControlsConfig" }, "changeRow": { "bindTo": "changeRow" }, "unSelectRow": { "bindTo": "unSelectRow" }, "onGridClick": { "bindTo": "onGridClick" }, "activeRowActions": [ { "className": "Terrasoft.Button", "style": Terrasoft.controls.ButtonEnums.style.TRANSPARENT, "tag": "save", "markerValue": "save", "imageConfig": { "bindTo": "Resources.Images.SaveIcon" } }, { "className": "Terrasoft.Button", "style": Terrasoft.controls.ButtonEnums.style.TRANSPARENT, "tag": "cancel", "markerValue": "cancel", "imageConfig": { "bindTo": "Resources.Images.CancelIcon" } }, { "className": "Terrasoft.Button", "style": Terrasoft.controls.ButtonEnums.style.TRANSPARENT, "tag": "card", "markerValue": "card", "imageConfig": { "bindTo": "Resources.Images.CardIcon" } }, { "className": "Terrasoft.Button", "style": Terrasoft.controls.ButtonEnums.style.TRANSPARENT, "tag": "copy", "markerValue": "copy", "imageConfig": { "bindTo": "Resources.Images.CopyIcon" } }, { "className": "Terrasoft.Button", "style": Terrasoft.controls.ButtonEnums.style.TRANSPARENT, "tag": "remove", "markerValue": "remove", "imageConfig": { "bindTo": "Resources.Images.RemoveIcon" } } ], "initActiveRowKeyMap": { "bindTo": "initActiveRowKeyMap" }, "activeRowAction": { "bindTo": "onActiveRowAction" }, "multiSelect": { "bindTo": "MultiSelect" } } } ] /**SCHEMA_DIFF*/ }; }); defEd2Шаблон детали c ред. реестром v2 Templatedefine("SchemaName", [ "SchemaNameResources", "ConfigurationGrid", "ConfigurationGridGenerator", "ConfigurationGridUtilitiesV2" ], function(resources) { return { entitySchemaName: "EntitySchemaName", attributes: { "IsEditable": { dataValueType: Terrasoft.DataValueType.BOOLEAN, type: Terrasoft.ViewModelColumnType.VIRTUAL_COLUMN, value: true } }, mixins: { ConfigurationGridUtilitiesV2: "Terrasoft.ConfigurationGridUtilitiesV2" }, methods: { onActiveRowAction: function(buttonTag, primaryColumnValue) { this.mixins.ConfigurationGridUtilitiesV2.onActiveRowAction.call(this, buttonTag, primaryColumnValue); } }, diff: /**SCHEMA_DIFF*/[ { "operation": "merge", "name": "DataGrid", "values": { "className": "Terrasoft.ConfigurationGrid", "generator": "ConfigurationGridGenerator.generatePartial", "generateControlsConfig": {"bindTo": "generateActiveRowControlsConfig"}, "changeRow": {"bindTo": "changeRow"}, "unSelectRow": {"bindTo": "unSelectRow"}, "onGridClick": {"bindTo": "onGridClick"}, "activeRowActions": [ { "className": "Terrasoft.Button", "style": Terrasoft.controls.ButtonEnums.style.TRANSPARENT, "tag": "save", "markerValue": "save", "imageConfig": {"bindTo": "Resources.Images.SaveIcon"} }, { "className": "Terrasoft.Button", "style": Terrasoft.controls.ButtonEnums.style.TRANSPARENT, "tag": "cancel", "markerValue": "cancel", "imageConfig": {"bindTo": "Resources.Images.CancelIcon"} }, { "className": "Terrasoft.Button", "style": Terrasoft.controls.ButtonEnums.style.TRANSPARENT, "tag": "card", "markerValue": "card", "imageConfig": {"bindTo": "Resources.Images.CardIcon"} }, { "className": "Terrasoft.Button", "style": Terrasoft.controls.ButtonEnums.style.TRANSPARENT, "tag": "remove", "markerValue": "remove", "imageConfig": {"bindTo": "Resources.Images.RemoveIcon"} } ], "initActiveRowKeyMap": {"bindTo": "initActiveRowKeyMap"}, "activeRowAction": {"bindTo": "onActiveRowAction"}, "multiSelect": {"bindTo": "MultiSelect"} } } ]/**SCHEMA_DIFF*/ }; }); defExtШаблон Ext класса Templatedefine("SchemaName", [ "SchemaNameResources" ], function(resources) { Ext.define("Terrasoft.configuration.SchemaName", { alternateClassName: "Terrasoft.SchemaName" }); defExtOvrdШаблон замещения Ext класса Templatedefine("SchemaName", [ "SchemaNameResources", "OverrideSchemaName" ], function(resources) { Ext.define("Terrasoft.configuration.SchemaName", { override: "Terrasoft.OverrideSchemaName" }); }); defExtConstШаблон Ext констант Templatedefine("SchemaName", [ "SchemaNameResources" ], function(resources) { Ext.define("Terrasoft.configuration.SchemaName", { alternateClassName: "Terrasoft.SchemaName", singleton: true, defExtMixinШаблон Ext миксина Templatedefine("SchemaName", [ "SchemaNameResources" ], function(resources) { Ext.define("Terrasoft.configuration.mixins.SchemaName", { alternateClassName: "Terrasoft.SchemaName", }); attrVBooleanВиртуальный булевый атрибут Template"AttributeName": { "dataValueType": Terrasoft.DataValueType.BOOLEAN, "type": Terrasoft.ViewModelColumnType.VIRTUAL_COLUMN, "value": false }, attrVLookupВиртуальный справочный атрибут Template"AttributeName": { "type": Terrasoft.ViewModelColumnType.VIRTUAL_COLUMN, "dataValueType": Terrasoft.DataValueType.LOOKUP, "referenceSchemaName": "Contact", "isLookup": true }, attrVCollectionВиртуальный атрибут коллекции Template"AttributeName": { "type": Terrasoft.ViewModelColumnType.VIRTUAL_COLUMN, "dataValueType": Terrasoft.DataValueType.COLLECTION, "value": Ext.create("Terrasoft.Collection"), "isCollection": true }, attrVTextВиртуальный атрибут строки Template"AttributeName": { "dataValueType": Terrasoft.DataValueType.TEXT, "type": Terrasoft.ViewModelColumnType.VIRTUAL_COLUMN, "value": Terrasoft.emptyString }, attrVIntegerВиртуальный атрибут числа Template"AttributeName": { "dataValueType": Terrasoft.DataValueType.INTEGER, "type": Terrasoft.ViewModelColumnType.VIRTUAL_COLUMN, "value": 0 }, attrVFloatВиртуальный атрибут числа Template"AttributeName": { "dataValueType": Terrasoft.DataValueType.FLOAT, "type": Terrasoft.ViewModelColumnType.VIRTUAL_COLUMN, "value": 0.0 }, attrVDateTimeВиртуальный атрибут числа Template"AttributeName": { "dataValueType": Terrasoft.DataValueType.DATE_TIME, "type": Terrasoft.ViewModelColumnType.VIRTUAL_COLUMN, "value": new Date() }, attrVDateВиртуальный атрибут числа Template"AttributeName": { "dataValueType": Terrasoft.DataValueType.DATE, "type": Terrasoft.ViewModelColumnType.VIRTUAL_COLUMN, "value": new Date() }, attrVTimeВиртуальный атрибут числа Template"AttributeName": { "dataValueType": Terrasoft.DataValueType.TIME, "type": Terrasoft.ViewModelColumnType.VIRTUAL_COLUMN, "value": new Date() }, msgPublishОтправка сообщения Template"MessageName": { "mode": Terrasoft.MessageMode.PTP, "direction": Terrasoft.MessageDirectionType.PUBLISH }, msgSubscribeПодпись сообщения Template"MessageName": { "mode": Terrasoft.MessageMode.PTP, "direction": Terrasoft.MessageDirectionType.SUBSCRIBE }, msgBidirectionalДвустороннее сообщение Template"MessageName": { "mode": Terrasoft.MessageMode.PTP, "direction": Terrasoft.MessageDirectionType.BIDIRECTIONAL }, detailОбьявление детали Template"DetailName": { "schemaName": "DetailName", "entitySchemaName": "EntitySchemaName", "filter": { "detailColumn": "EntitySchemaName", "masterColumn": "Id" } } constПодпись константы /** @constant */ prtПодпись protected /** * @protected */ inherСсылка на родителя @inheritdoc # ovrdПодпись override /** * @inheritdoc # * @override */ ovrdmПодпись override с методом /** * @inheritdoc # * @override */ : function() { }, rgРегион /** @Region: */ /** @EndRegion: */ bindБиндинг { "bindTo": "" } bindResБиндинг ресурса { "bindTo": "Resources.Strings." } callServiceВызов сервиса Template/** * @protected */ callServiceNameServiceMethod: function(callback, scope) { this.showBodyMask(); callServiceFastБыстрый вызов сервиса Templatevar ServiceMethodConfig = { recordId: Terrasoft.GUID_EMPTY }; callbackВызов callback Ext.callback(callback, this, []); esqSelectЗапрос чтения данных Template/** * @protected */ selectQueryNameAsync: function() { return new Promise(resolve => this.selectQueryName(resolve, this)); }, esqDeleteЗапроос удаления данных Template/** * @protected */ deleteQueryName: function(id, callback, scope) { var query = this.getDeleteQueryNameQuery(id); esqUpdateЗапрос обновления данных Template/** * @protected */ updateQueryName: function(id, callback, scope) { var query = this.getUpdateQueryNameQuery(id); esqInsertЗапрос добавления данных Template/** * @protected */ insertQueryName: function(id, callback, scope) { var query = this.getInsertQueryNameQuery(id); esqFДобавить фильтр esq.filters.add("uuid", esqFprop); esqCTТип сравнения Terrasoft.ComparisonType.EQUAL; esqFPropФильтр параметра Terrasoft.createColumnFilterWithParameter( Terrasoft.ComparisonType.EQUAL, "Id", Terrasoft.GUID_EMPTY ) esqFGroupГруппа фильтра Templatevar filterGroup = Terrasoft.createFilterGroup(); esqFBetweenBetween фильтр Terrasoft.createColumnBetweenFilterWithParameters( "", , ) esqFBetweenDateBetween фильтр даты Terrasoft.createColumnBetweenFilterWithParameters( "CreatedOn", Terrasoft.startOfDay(new Date()), Terrasoft.endOfDay(new Date()) ) esqFInIn фильтр Terrasoft.createColumnInFilterWithParameters( "Id", array ) esqFNullФильтр на пустоту Terrasoft.createColumnIsNullFilter("Id") esqFNotNullФильтр на заполненность Terrasoft.createColumnIsNotNullFilter("Id") esqFExistsExists фильтр Terrasoft.createExistsFilter("[Account:Owner:Id].Id") esqFNotExistsNot exists фильтр Terrasoft.createNotExistsFilter("[Account:Owner:Id].Id") !resultОбработка ошибки запроса Templateif (!result.success) { this.showInformationDialog(result.errorInfo.message); return; } esqAllColumnВыбор всех колонок ESQ esq.allColumns = true; esqRowCountВыбор кол-ва записей ESQ esq.rowCount = 1; rndGuidРандомный Guid e87e2d82-15d6-4802-b8b9-7bee25e4ed95 diffRemoveDiff удаление Template{ "operation": "remove", "name": "Field" }, diffMergeDiff merge Template{ "operation": "merge", "name": "Field", "values": { "layout": { "colSpan": 24, "column": 0, "row": 1 }, "enabled": { "bindTo": "" }, "isRequired": { "bindTo": "" }, } }, diffMoveDiff move Template{ "operation": "move", "name": "Field", "parentName": "Parent", "propertyName": "items", "index": 0, }, diffFieldDiff insert field Template{ "operation": "insert", "name": "Field", "parentName": "Header", "propertyName": "items", "values": { "bindTo": "Field", "layout": { "colSpan": 24, "column": 0, "row": 0 }, "enabled": true, "isRequired": false, "visible": true } }, diffTabDiff insert tab Template{ "operation": "insert", "name": "NameTab", "parentName": "Tabs", "propertyName": "tabs", "values": { "caption": { "bindTo": "Resources.Strings.NameTabCaption" }, "items": [], "order": 1 } }, diffContainerDiff insert container Template{ "operation": "insert", "name": "NameContainer", "parentName": "Parent", "propertyName": "items", "values": { "itemType": Terrasoft.ViewItemType.CONTAINER, "items": [] } }, diffGridLayoutDiff insert grid layout Template{ "operation": "insert", "name": "NameGridLayout", "parentName": "Parent", "propertyName": "items", "values": { "itemType": Terrasoft.ViewItemType.GRID_LAYOUT, "collapseEmptyRow": true, "items": [] } }, diffControlGroupDiff insert control group Template{ "operation": "insert", "name": "NameControlGroup", "parentName": "Parent", "propertyName": "items", "values": { "itemType": Terrasoft.ViewItemType.CONTROL_GROUP, "caption": { "bindTo": "Resources.Strings.NameControlGroupCaption" }, "items": [] } }, diffDetailDiff insert detail Template{ "operation": "insert", "name": "DetailName", "parentName": "Parent", "propertyName": "items", "values": { "itemType": Terrasoft.ViewItemType.DETAIL } }, diffButtonDiff insert button Template{ "operation": "insert", "name": "NameButton", "parentName": "LeftContainer", "propertyName": "items", "values": { "itemType": Terrasoft.ViewItemType.BUTTON, "caption": { "bindTo": "Resources.Strings.NameButtonCaption" }, "visible": { "bindTo" : "IsNameVisible" }, "enable": { "bindTo" : "IsNameEnable" }, "click": { "bindTo": "onNameClick" }, "classes": { "textClass": ["actions-button-margin-right"], "wrapperClass": ["actions-button-margin-right"] }, "tag": "Name", "style": Terrasoft.controls.ButtonEnums.style.GREEN } }, diffSectionButtonDiff insert button (для секции) Template{ "operation": "insert", "name": "NameButton", "parentName": "CombinedModeActionButtonsCardLeftContainer", "propertyName": "items", "values": { "itemType": Terrasoft.ViewItemType.BUTTON, "caption": {"bindTo": "Resources.Strings.NameButtonCaption"}, "visible": { "bindTo": "IsNameVisible" }, "enable": { "bindTo": "IsNameEnable" }, "click": {"bindTo": "onCardAction"}, "tag": "onNameClick", "style": Terrasoft.controls.ButtonEnums.style.GREEN, "classes": { "textClass": ["actions-button-margin-right"] } } }, diffDetailButtonDiff insert detail button (в детали) Template{ "operation": "insert", "name": "NameButton", "parentName": "Detail", "propertyName": "tools", "values": { "itemType": Terrasoft.ViewItemType.BUTTON, "caption": { "bindTo": "Resources.Strings.NameButtonCaption" }, "visible": { "bindTo": "IsNameVisible" }, "enabled": { "bindTo": "IsNameEnabled" }, "click": { "bindTo": "onNameClick" } } }, methodSectionResetVisibleРаздел. Сброс атрибутов отображения кнопок страницы. Нужно для сброса установленных со страницы значений отображения Template/** * @inheritdoc BaseDataView#openCard * @overridden */ openCard: function() { this.resetVisibleAttributes(); this.callParent(arguments); }, methodGetSetУстановка атрибута отображения Template/** * @protected */ getIsNameVisible: function() { return true; }, onEntityInitializedЗаготовка onEntityInitialized Template/** * @inheritdoc BasePageV2#onEntityInitialized * @overridden */ onEntityInitialized: function() { this.callParent(arguments); }, initCallbackЗаготовка init с callback Template/** * @inheritdoc BasePageV2#init * @overridden */ init: function(callback, scope) { this.callParent([function() { Ext.callback(callback, scope); }, this]); }, initЗаготовка init Template/** * @inheritdoc BasePageV2#init * @overridden */ init: function() { this.callParent(arguments); }, onDiscardChangesClickЗаготовка onDiscardChangesClick Template/** * @inheritdoc BasePageV2#onDiscardChangesClick * @overridden */ onDiscardChangesClick: function(callback, scope) { this.callParent([function() { Ext.callback(callback, scope); }, this]); }, onSavedЗаготовка onSaved Template/** * @inheritdoc BasePageV2#onSaved * @overridden */ onSaved: function() { this.callParent(arguments); }, subscribeDetailEventsПодпись на сообщения детали Template/** * @inheritdoc BaseEntityPage#subscribeDetailEvents * @overridden */ subscribeDetailEvents: function(detailConfig, detailName) { this.callParent(arguments); var detailId = this.getDetailId(detailName); getDetailInfoЗаготовка getDetailInfo Template/** * @inheritdoc BasePageV2#getDetailInfo * @overridden */ getDetailInfo: function(detail) { var info = this.callParent(arguments); if (detail.detailName === "...") { /// code... } destroyЗаготовка destroy Template/** * @inheritdoc BaseSchemaModuleV2#destroy * @overridden */ destroy: function() { /// code... this.callParent(arguments); }, subscribeSandboxEventsПодпись на сообщения Template/** * @inheritdoc BasePageV2#subscribeSandboxEvents * @overridden */ subscribeSandboxEvents: function() { this.callParent(arguments); this_asyncValidateВызов и обработка asyncValidate Templatethis.asyncValidate(function(result) { if (!result.success) { this.showInformationDialog(result.message); return; } asyncValidateРасширение asyncValidate Template/** * @inheritdoc BasePageV2#asyncValidate * @overridden */ asyncValidate: function(callback, scope) { this.callParent([function(response) { if (!this.validateResponse(response)) { return; } asyncValidateChainРасширение asyncValidate с chain Template/** * @inheritdoc BasePageV2#asyncValidate * @overridden */ asyncValidate: function(callback, scope) { this.callParent([function(response) { if (!this.validateResponse(response)) { return; } |