Дерево страниц
Skip to end of metadata
Go to start of metadata

Постановка задачи

Добавить таблицу с корреспондентами на форму документа.

Список столбцов:

  • Корреспондент - название организации
  • Индекс - почтовый индекс организации
  • Адрес отправки - почтовый адрес
  • ФИО получателя - руководитель организации
  • Телефон - телефон организации

Инструмент: Палитра XML

Статус

ГОТОВО

РазделФормы
Комментарий

Реализация

Результат

Создается схема и подключается к двум формам: форма диалог и форма таблица.

Далее схема подключается к св-ву схемы документа, в котором она будет отображаться.

Создание схемы

Создать схему CorrespondentsTable, в которой описать типы данных

Схема
<?xml version='1.0' encoding='UTF-8'?>
<schemas xmlns="http://www.intertrust.ru/schema/palette/tn-schema">
	<schema recalc="true" name="CorrespondentsTable">
		<!-- Организация -->
		<actor name="Correspondent">
			<storage-field name="Correspondent"/>
		</actor>
		<!-- Индекс -->
		<string name="Index">
			<storage-field name="Index"/>
		</string>
		<!-- Адрес отправки -->
		<string name="SendAddress">
			<storage-field name="SendAddress"/>
		</string>
		<!-- ФИО получателя -->
		<string name="Recipient" array="true">
			<storage-field name="Recipient"/>
		</string>
		<!-- ФИО получателя -->
		<string name="Phone">
			<storage-field name="Phone"/>
		</string>
	</schema>
</schemas>

Создание диалога

Создать форму CorrespondentTableDialogForm для диалога, указав в условие скрытие dialog

Диалог
<?xml version='1.0' encoding='UTF-8'?>
<ui xmlns="http://www.intertrust.ru/schema/palette/tn-ui">
	<form id="CorrespondentTableDialogForm" schema-ref="CorrespondentsTable" projection="default" name="${ui.form.CorrespondentTableDialogForm.name: Kорреспондент}">
		<!-- Вывод информации только для диалога -->
		<properties>
			<hide condition-union="AND">
				<negative-condition-ref ref="dialog"/>
			</hide>
		</properties>
		<component>
			<field attribute-ref="Correspondent" name="${ui.form.CorrespondentTableDialogForm.Correspondent.name:Корреспондент:}">
				<!-- Подключение справочника организаций -->
				<directories limit-livesearch="no-restrictions">
					<directory-ref ref="NONSYS_ORGS_ONLY"/>
				</directories>
			</field>
			<field attribute-ref="Index" name="${ui.form.CorrespondentTableDialogForm.Index.name:Индекс:}"/>
			<field attribute-ref="SendAddress" name="${ui.form.CorrespondentTableDialogForm.SendAddress.name:Адрес отправки:}"/>
			<field attribute-ref="Recipient" name="${ui.form.CorrespondentTableDialogForm.field.Recipient.name:ФИО получателя:}">
				<directories manual-input="true">
					<!-- Подключение справочника сотрдуников организаций -->
					<directory-select-org attribute-ref="Correspondent" ref="PERSONS"/>
				</directories>
			</field>
			<field attribute-ref="Phone" name="${ui.form.CorrespondentTableDialogForm.Phone.name:Телефон получателя:}"/>
		</component>
	</form>
</ui>

Создание таблицы

Создать форму CorrespondentTableForm для диалога, указав в условие скрытие table

Таблица
<?xml version='1.0' encoding='UTF-8'?>
<ui	xmlns="http://www.intertrust.ru/schema/palette/tn-ui">
	<form id="CorrespondentsTableForm" schema-ref="CorrespondentsTable" name="${ui.form.CorrespondentsTable.name:Таблица корреспондентов}" projection="default">
		<!-- Вывод информации только для таблицы-->
		<properties>
			<hide condition-union="AND">
				<negative-condition-ref ref="table"/>
			</hide>
		</properties>
		<appearance field-layout="horizontal" style="tunTableWithBorders"/>
		<component>
			<!--Колонка Корреспондент -->
			<section id="Correspondent" name="${ui.form.CorrespondentsTableForm.section.Correspondent.name:Корреспондент}">
				<component>
					<field attribute-ref="Correspondent"/>
				</component>
			</section>
		 	<!--Колонка Индекс -->
			<section id="Index" name="${ui.form.CorrespondentsTableForm.section.Index.name:Индекс}">
				<component>
					<field attribute-ref="Index"/>
				</component>
			</section>
			<section id="SendAddress" name="${ui.form.CorrespondentsTableForm.section.SendAddress.name:Адрес отправки}">
				<component>
					<field attribute-ref="SendAddress"/>
				</component>
			</section>
			<section id="Recipient" name="${ui.form.CorrespondentsTableForm.section.Recipient.name:ФИО получателя}">
				<component>
					<field attribute-ref="Recipient"/>
				</component>
			</section>
			<section id="Phone" name="${ui.form.CorrespondentsTableForm.section.Phone.name:Телефон получателя}">
				<component>
					<field attribute-ref="Phone"/>
				</component>
			</section>
		 	<!--Кнопка "Добавить" -->
			<button name="${ui.form.CorrespondentsTableForm.button.Add.name:Добавить}">
				<properties>
					<hide condition-union="AND">
						<negative-condition-ref ref="table_edit"/>
					</hide>
				</properties>
				<appearance align="right">
					<label-style>
						<style id="tunIconAdd" />
						<style id="tunUnderline" />
						<style id="tunClickableRed" />
					</label-style>
				</appearance>
				<action>
					<system name="add" />
				</action>
			</button>
		 	<!-- Кнопка "Удалить" -->
			<button>
				<properties>
					<hide>
						<condition-ref ref="table_read"/>
					</hide>
				</properties>
				<appearance align="right">
					<label-style unit="symbol" width="2">
						<style id="tunIconDelete" />
					</label-style>
				</appearance>
				<action>
					<system name="delete" />
				</action>
			</button>
		 	<!-- Кнопка "Редактировать" -->
			<button>
				<properties>
					<hide>
						<condition-ref ref="table_read"/>
					</hide>
				</properties>
				<appearance align="right">
					<label-style unit="symbol" width="2">
						<style id="tunIconEdit" />
					</label-style>
				</appearance>
				<action>
					<system name="update"/>
				</action>
			</button>
		</component>
	</form>
</ui>

Подключение таблицы к схеме документа

Подключить схему таблицы CorrespondentsTable к схеме 

Схема документа
<?xml version='1.0' encoding='UTF-8'?>
<schemas xmlns="http://www.intertrust.ru/schema/palette/tn-schema">
	<schema name="{schema name}">
		<!-- ... -->
		<schema-ref name="correspondents" ref="CorrespondentsTable" array="true" null-empty="true"/>
		<!-- ... -->
	</schema>
</schemas>

Подключение таблицы к форме 

Подключить к форме документа поле из схемы correspondents и указать параметр визуализации table

Форма документа
<?xml version='1.0' encoding='UTF-8'?>
<ui xmlns="http://www.intertrust.ru/schema/palette/tn-ui">
    <form schema-ref="{schema name}" id="{form name}" projection="default" showtabs="true">
        <component>
			<!-- ... -->
			<field attribute-ref="correspondents" name="${ui.form.correspondents.name:Корреспондент:}"  recalc="true" >
				<appearance location="table"/>
            </field>
		 	<!-- ... -->
 		</component>
	</form>
</ui>