informat.app Application Information Functions
Overview
Use the informat.app object to perform application-related global operations.
callAutomatic
Call automation
informat.app.callAutomatic({ automaticId, args });| Parameter | Type | Description |
|---|---|---|
| appId | String | ID of the application to which the automation belongs. Defaults to current application if not passed |
| automaticId | String | Automation identifier |
| args | Array | Parameters passed to the automation |
| withoutTimeoutLoading | bool | Whether to show system execution loading |
Return Value Automation call result
// Call system automation
informat.app
.callAutomatic({
// appId: 'msucfeq7305cn',
automaticId: "a1",
args: ["123", 1],
})
.then((result) => {
console.log(result);
});setAutomaticSetting
Set current application automation configuration
informat.app.setAutomaticSetting(setting);| Parameter | Type | Description |
|---|---|---|
| withoutLoading | boolean | Whether to disable system execution loading |
| loadingDelayMs | number | Set system execution loading delay (in milliseconds, default 2000) |
Return Value Whether the setting was successful
informat.app.setAutomaticSetting({
// Whether to disable system execution loading
withoutLoading: false,
// Set system execution loading delay
loadingDelayMs: 1000,
});getAutomaticSetting
Get current application automation configuration
informat.app.getAutomaticSetting();Return Value Type is Promise<Object>
informat.app.getAutomaticSetting().then((setting) => {
console.log(setting);
});resetAutomaticSetting
Reset current application automation configuration to default settings
informat.app.resetAutomaticSetting();Return Value Whether the reset was successful
informat.app.resetAutomaticSetting().then((result) => {
console.log(result);
});resetAllAutomaticSetting
Reset all configured application automation configurations to default settings
informat.app.resetAllAutomaticSetting();Return Value Whether the reset was successful
informat.app.resetAllAutomaticSetting().then((result) => {
console.log(result);
});setAppData
Set App data on the client side
informat.app.setAppData(key, value);| Parameter | Type | Description |
|---|---|---|
| key | String | Data key to set |
| value | Object | Data value to set |
informat.app.setAppData("count", 1000).then((res) => {
console.log("setAppData success");
});getAppData
Get App data with specified key on the client side
informat.app.getAppData(key);| Parameter | Type | Description |
|---|---|---|
| key | String | Data key to get |
Return Value Type is Object
informat.app.getAppData("count").then((res) => {
console.log("getAppData success", res); // getAppData success 1000
});getApp
Get current application information
informat.app.getApp();Return Value Type is Promise<Application>
informat.app.getApp().then((app) => {
console.log(app);
});getAppEnv
Get current application environment variable information
informat.app.getAppEnv();Return Value Type is Promise<Any>
informat.app.getAppEnv().then((env) => {
console.log(env);
});getAppEnvByKey
Get current application environment variable value by Key
informat.app.getAppEnvByKey(key);| Parameter | Type | Description |
|---|---|---|
| key | String | Application environment variable key |
Return Value Type is Promise<Any>
informat.app.getAppEnvByKey("baseUrl").then((value) => {
console.log(value);
});getUser
Get current application user information
informat.app.getUser();Return Value Type is Promise<User>
informat.app.getUser().then((user) => {
console.log(user);
});attachmentUrl
Get data table attachment field file link
informat.app.attachmentUrl(tableKey, fieldKey, fileId);| Parameter | Type | Description |
|---|---|---|
| tableKey | String | Module identifier |
| fieldKey | String | Field identifier |
| fileId | String | File ID |
Return Value Type is String
const attachmentUrl = informat.app.attachmentUrl("testTable", "testField", "xxxx.png");
console.log(attachmentUrl); // https://next.informat.cn/web0/file/fieldkey/gx6wpgysmthb1/testTable/testField/xxxx.png?token=xxxxxxxbaseURL
Get website module root node link
informat.app.baseURL(websiteModuleKey);| Parameter | Type | Description |
|---|---|---|
| websiteModuleKey | String | Website module identifier |
Return Value Type is String
const websiteBaseUrl = informat.app.baseURL("testWebsiteModule");
console.log(websiteBaseUrl); // https://next.informat.cn/web0/website/gx6wpgysmthb1/testWebsiteModulegetRefKeys
Get list of bound platform component identifiers
informat.app.getRefKeys();Return Value Type is Array<String>
getRef
Get components within the platform by refKey
informat.app.getRef(refKey);| Parameter | Type | Description |
|---|---|---|
| refKey | String | Component ref identifier |
Return Value Type is Compoent
const recordSelectDialog = informat.app.getRef("informatAutomaticRecordSelect");
console.log(recordSelectDialog);
if (recordSelectDialog) {
recordSelectDialog.reloadData();
}AutomaticRecordSelectComponent
Open data table record list popup
refKey Calculation Rule
Derived from the Dialog Identifier set in the Open Data Table Record List Popup
interface AutomaticRecordSelectComponent extends Component {
/**
* Reload data
*/
reloadData(): void;
/**
* Close popup
*/
close(): void;
}TableViewComponent
Data table view module
refKey Calculation Rule
Derived from the Module Identifier set in module settings
interface TableViewComponent extends Component {
/**
* Load data,
* @param {Number} [pageIndex] If not passed, defaults to reloading current page data
*/
_loadData(pageIndex?: number): void;
/**
* Set pagination size, this operation only sets the pagination number, does not actively load data. Please call {@link _loadData} to load data
* @param {Number} pageSize Pagination data size
*/
_setPageSize(pageSize?: number): void;
/**
* Open record detail page
* @param recordId
*/
_openRecord(recordId: string): void;
/**
* Reset view filter conditions, reset page number to 1, then reload data
*/
_resetQueryFilterConditions(): void;
/**
* Set view filter condition value,
* @param {string} key Field identifier
* @param {any} value Field value
*/
_setQueryFilterConditionValue(key: string, value: any): void;
/**
* Set view filter condition value calculation function,
* @param {string} key Field identifier
* @param {any} func Calculation function
*/
_setQueryFilterConditionFunc(key: string, func: any): void;
/**
* Set view filter condition value comparison method
* @param {string} key Field identifier
* @param {any} opt Comparison method
*/
_setQueryFilterConditionOpt(key: string, opt: any): void;
/**
* Set selected records in view
* @param {Array<string>} idList Record ID list
* @param {string} mode Selection mode, supports replace: reset, add: append, remove: remove, toggle: toggle selection
*/
_setSelectionIdList(idList: Array<string>, mode: "replace" | "add" | "remove" | "toggle" | string): void;
/**
* Get selected record ID list in view
* @returns Array<string>
*/
_getSelectionIdList(): Array<string>;
/**
* Get data information in view
* @returns Object
*/
_getTableData(): {
/**
* Data table raw record list
*/
tableRawRecordList: Array<Record<string, any>>;
/**
* Data table identifier field record list
*/
tableRecordList: Array<Record<string, any>>;
/**
* View data total count
*/
tableRecordPageTotal: number;
/**
* View current page number
*/
tableRecordPageIndex: number;
/**
* View current page size
*/
tableRecordPageSize: number;
};
/**
* Get table view data information
*/
_getTableGridData(): {
/**
* Get activated row data
*/
activeEditRecord:
| {
row: any;
rowIndex: number;
column: Record<string, any>;
columnIndex: number;
}
| undefined;
editableColumnList: {
edit: boolean;
icon: string;
id: string;
name: string;
type: string;
width: string;
}[];
};
/**
* Activate next editable cell
* @param cellActiveType Activation method for next cell
* @param nextActiveCellEditInfoHandler Custom activated editable cell information. If not passed, system will automatically calculate, defaults to starting from first editable cell of first row
*/
_activeGridNextCellEdit(
cellActiveType: "column" | "row",
nextActiveCellEditInfoHandler?: (data: {
/**
* Get activated row data
*/
activeEditRecord:
| {
row: any;
rowIndex: number;
column: Record<string, any>;
columnIndex: number;
}
| undefined;
/**
* Activation method for next cell
*/
cellActiveType: string;
/**
* Editable column data
*/
editableColumnList: {
edit: boolean;
icon: string;
id: string;
name: string;
type: string;
width: string;
}[];
}) => {
editRowIndex: number;
editColumnIndex: number;
}
): Promise<any>;
/**
* Activate specified cell
* @param recordId Record ID
* @param columnIndex Column ID, defaults to 0 if not passed
*/
_activeGridCellEdit(recordId: string, columnIndex?: number): Promise<any>;
}DashboardModuleComponent
Dashboard module
refKey Calculation Rule
Derived from the Module Identifier set in module settings
interface DashboardModuleComponent extends Component {
/**
* Reload dashboard data
*/
_loadData(): void;
/**
* Set dashboard filter condition value
* @param {string} key Field identifier
* @param {any} value Field value
*/
_setFilterConditionValue(key: string, value: any): void;
/**
* Get card list
*/
_getCardList(): Array<{
/**
* Card ID
*/
id: string;
/**
* Card name
*/
name: string;
/**
* Card type
*/
type: string;
/**
* Whether inside card (tab card, card container, collapsible panel)
*/
isInTab: boolean;
}>;
/**
* Refresh card
* @param {string} cardId
*/
_loadCardData(cardId: string): void;
/**
* Set dashboard card filter condition value
* @param {string} cardId
* @param {string} key
* @param {string} value
*/
_setCardFilterConditionValue(cardId: string, key: string, value: any): void;
}RecordFormComponent
Data form
refKey Calculation Rule
TableForm-{Module Identifier}-{Record ID}
When the record doesn't exist, the Record ID is replaced with an empty string.
For example:
Assuming there's an Employee Table module with identifier staff
Then Record Detail Page (Record ID: zhangsan): TableForm-staff-zhangsan Then Record Create Page: TableForm-staff-
interface RecordFormComponent extends Component {
/**
* Get form data information
*/
_getFormData(): {
/**
* Application information
*/
app: Record<string, any>;
/**
* User information
*/
user: User;
/**
* Form record data
*/
formRecord: Record<string, any>;
/**
* Form module identifier
*/
formModuleKey: string;
};
/**
* Set field value
* @param {string} key Field identifier
* @param {any} value Field value
* @param {string} setType Setting method, only effective for sub-table fields.reset: overwrite, append: append to end, insert: append to start
* @private
*/
_setFieldValue(key: string, value: any, setType?: "reset" | "append" | "insert" | string): void;
/**
* Close current form
*/
_close(): void;
/**
* Reload form
* @private
*/
_reload(): void;
/**
* Validate form
* @param callback Callback function after validation, passing form validation result
*/
_validate(callback?: (valid: boolean) => {}): void;
}RecordFormFieldComponent
Data form field
refKey Calculation Rule
TableForm-{Module Identifier}-{Record ID}-Field-{Field Identifier}
When the record doesn't exist, the Record ID is replaced with an empty string.
For example:
Assuming there's an Employee Table module with identifier staff, and a resume lookup field resumeLookup
Then Record Detail Page (Record ID: zhangsan): TableForm-staff-zhangsan-Field-resumeLookup Then Record Create Page: TableForm-staff--Field-resumeLookup
/**
* Data table field
*/
interface RecordFormFieldComponent extends Component {
/**
* Get form associated list, sub-object, lookup list field data information
*/
_getTableFormData(): {
/**
* Get activated row data
*/
activeEditRecord:
| {
row: any;
rowIndex: number;
column: Record<string, any>;
columnIndex: number;
}
| undefined;
editableColumnList: {
edit: boolean;
icon: string;
id: string;
name: string;
type: string;
width: string;
}[];
};
/**
* Activate next editable cell in form associated list, sub-object, lookup list
* @param cellActiveType Activation method for next cell
* @param nextActiveCellEditInfoHandler Custom activated editable cell information. If not passed, system will automatically calculate, defaults to starting from first editable cell of first row
*/
_activeTableNextCellEdit(
cellActiveType: "column" | "row",
nextActiveCellEditInfoHandler?: (data: {
/**
* Get activated row data
*/
activeEditRecord:
| {
row: any;
rowIndex: number;
column: Record<string, any>;
columnIndex: number;
}
| undefined;
/**
* Activation method for next cell
*/
cellActiveType: string;
/**
* Editable column data
*/
editableColumnList: {
edit: boolean;
icon: string;
id: string;
name: string;
type: string;
width: string;
}[];
}) => {
editRowIndex: number;
editColumnIndex: number;
}
): Promise<any>;
/**
* Activate specified cell in form associated list, sub-object, lookup list
* @param recordId Record ID
* @param columnIndex Column ID, defaults to 0 if not passed
*/
_activeTableCellEdit(recordId: string, columnIndex?: number): Promise<any>;
}onAnyRefMounted
Listen for any component instance mounting
informat.app.onAnyRefMounted(handler);informat.app.onAnyRefMounted((data) => {
console.log("[" + data.refKey + "] onAnyRefMounted", data.data);
});onceAnyRefMounted
Listen once for any component instance mounting
informat.app.onceAnyRefMounted(handler);informat.app.onceAnyRefMounted((data) => {
console.log("[" + data.refKey + "] onceAnyRefMounted", data.data);
});offAnyRefMounted
Remove listener for any component instance mounting
informat.app.offAnyRefMounted(handler);informat.app.onceAnyRefMounted((data) => {
console.log("[" + data.refKey + "] offAnyRefMounted", data.data);
});onRefMounted
Listen for component instance mounting
informat.app.onRefMounted(refKey, handler);// Assuming there's an `Employee Table` module with identifier **staff**
informat.app.onRefMounted("staff", (data) => {
console.log("[" + data.refKey + "] onRefMounted", data.data);
});onceRefMounted
Listen once for component instance mounting
informat.app.onceRefMounted(refKey, handler);// Assuming there's an `Employee Table` module with identifier **staff**
informat.app.onceRefMounted("staff", (data) => {
console.log("[" + data.refKey + "] onceRefMounted", data.data);
});offRefMounted
Remove listener for component instance mounting
informat.app.offRefMounted(refKey, handler);// Assuming there's an `Employee Table` module with identifier **staff**
informat.app.offRefMounted("staff", (data) => {
console.log("[" + data.refKey + "] offRefMounted", data.data);
});onAnyRefDestroy
Listen for any component instance destruction
informat.app.onAnyRefDestroy(handler);informat.app.onAnyRefDestroy((data) => {
console.log("[" + data.refKey + "] onAnyRefDestroy", data.data);
});onceAnyRefDestroy
Listen once for any component instance destruction
informat.app.onceAnyRefDestroy(handler);informat.app.onceAnyRefDestroy((data) => {
console.log("[" + data.refKey + "] onceAnyRefDestroy", data.data);
});offAnyRefDestroy
Remove listener for any component instance destruction
informat.app.offAnyRefDestroy(handler);informat.app.offAnyRefDestroy((data) => {
console.log("[" + data.refKey + "] offAnyRefDestroy", data.data);
});onRefDestroy
Remove listener for any component instance destruction
informat.app.onRefDestroy(refKey, handler);// Assuming there's an `Employee Table` module with identifier **staff**
informat.app.onRefDestroy("staff", (data) => {
console.log("[" + data.refKey + "] onRefDestroy", data.data);
});onceRefDestroy
Listen once for component instance destruction
informat.app.onceRefDestroy(refKey, handler);// Assuming there's an `Employee Table` module with identifier **staff**
informat.app.onceRefDestroy("staff", (data) => {
console.log("[" + data.refKey + "] onceRefDestroy", data.data);
});offRefDestroy
Remove listener for component instance destruction
informat.app.offRefDestroy(refKey, handler);// Assuming there's an `Employee Table` module with identifier **staff**
informat.app.offRefDestroy("staff", (data) => {
console.log("[" + data.refKey + "] offRefDestroy", data.data);
});
