Проброс данных для коммуникационной панели под кейсом

Подписаться на сообщение загрузки модуля из схемы EmailMessagePublisherPage

messages: {
			"SendListenerEmailData": {
				mode: this.Terrasoft.MessageMode.PTP,
				direction: this.Terrasoft.MessageDirectionType.PUBLISH
			},
			"EmailMessagePageLoaded": {
				mode: this.Terrasoft.MessageMode.PTP,
				direction: this.Terrasoft.MessageDirectionType.SUBSCRIBE
			},
		},
		methods: {
			init: function(){
				this.callParent(arguments);
				this.sandbox.subscribe("EmailMessagePageLoaded", this.onEmailMessagePageLoaded, this, [this.getEmailMessagePublisherModuleId()]);
			},
 
			onEmailMessagePageLoaded: function(args){
				debugger;
				if (this.$EntitySchemaName === "NrbCase") {
					Terrasoft.chain(
						function (next) {
							var esq = Ext.create("Terrasoft.EntitySchemaQuery", { rootSchemaName: "NrbConfigurator", rowCount: 1 });
							esq.addColumn("NrbMailboxForComunicationWithClient");
							esq.getEntityCollection(function (result) {
								if (!result.success || result.collection.count == 0) {
									throw new Error("Запись конфигуратора не найдена");
								}
								var getMailFromConfigurator = result.collection.first();
								var senderEmailConfigurator = getMailFromConfigurator.values.NrbMailboxForComunicationWithClient;
								next(senderEmailConfigurator);
							}, this);
						},
						function (next, senderEmailConfigurator) {
							data = {
								entitySchemaName: this.$EntitySchemaName,
								title: this.getMasterEntityParameterValue("Number"),
								recepientEmail: this.getMasterEntityParameterValue("NrbContactEmail"),
								contact: this.getMasterEntityParameterValue("Contact"),
								nrbObject: this.getMasterEntityParameterValue("NrbServiceObject"),
								senderEmail: senderEmailConfigurator
							}
							this.sandbox.publish("SendListenerEmailData", data, [this.getEmailMessagePublisherModuleId()]);
						}, this
					);
				}
			},

И опубликовать сообщение SendListenerEmailData

Переопределить схему EmailMessagePublisherPage

define("EmailMessagePublisherPage", ["EmailMessagePublisherPageResources"],
		function(resources) {
			return {
				entitySchemaName: "Activity",
				mixins: {
				},
				messages: {},
				attributes: {},
				methods: {
                  	setListenerEmailData: function(data) {
                      	this.callParent(arguments);
                      	debugger;
                        if(data.entitySchemaName == "NrbCase"){
							this.$Title = data.title;
                          	this.$Recepient = data.recepientEmail;
                          	this.$NrbObject = data.nrbObject.value || {};
                          	this.$Sender = data.senderEmail;
                          	this.$Contact = data.contact;
 
                        }
					},
                },
				diff: /**SCHEMA_DIFF*/[]/**SCHEMA_DIFF*/
			};
		});

 

Нравится

Поделиться

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