System Service
Call Automation
systemService.callAutomatic({ automaticId, args });Parameters
| Parameter | Type | Description |
|---|---|---|
| automaticId | String | Automation identifier |
| args | Array | Parameters passed to automation |
| withoutTimeoutLoading | bool | Whether to show system execution loading |
Return Value Automation return value, type is Promise<any>
// Call system automation
systemService
.callAutomatic({
automaticId: "a1",
args: ["123", 1],
})
.then((result) => {
console.log(result);
});Call System Toast Notification
systemService.toast(msg);Parameters
| Parameter | Type | Description |
|---|---|---|
| msg | String | Message to display |
Call System Image Preview Dialog to Preview Images
systemService.previewImage(options);Parameters
| Parameter | Type | Description |
|---|---|---|
| startIndex | Integer | Default index position of the preview image, starting from 0 |
| list | Array<ImageItem> | List of images to preview |
ImageItem structure is as follows
{
id:String,// Image ID, optional parameter
name:String,// Image name, optional parameter
src:String,// Image address, required parameter
}Return Value type is Promise
// Call confirm notification
systemService.previewImage({
startIndex: 0,
list: [{ src: "https://url.to.image" }],
});Call System Confirmation Dialog
systemService.confirm(options);Parameters
| Parameter | Type | Description |
|---|---|---|
| title | String | Dialog title, optional |
| content | String | Prompt content, if not passed, the title parameter value will be used as an alternative display |
| dialogTop | String | Distance from the top of the window, default (15vh) |
| dialogHeight | String | Window height |
| dialogWidth | String | Window width, default (400px) |
| horizontalAlign | String | Horizontal alignment of the prompt contentLeft(left), Center(center), Right(right), Justify(justify), default is Center(center) |
| verticalAlign | String | Vertical alignment of the prompt contentTop(top), Center(center), Bottom(bottom), default is Center(center) |
| showCancel | bool | Whether to display the cancel button |
| cancelText | String | Cancel button text, default (Cancel) |
| confirmText | String | Confirm button text, default (Confirm) |
Return Value type is Promise
// Call confirm notification
systemService
.confirm({
title: "Are you sure you want to perform this operation?",
})
.then((confirm) => {
if (!confirm) {
console.log("Cancelled");
return;
}
console.log("Confirmed");
});TIP
If the content attribute is not passed, the system will use title as the content to display information while hiding the title display
Get Currently Logged-In User
systemService.getUser();Return Value type is Promise<User>
systemService.getUser().then((user) => {
console.log(user);
});Get Current Application Information
systemService.getApp();Return Value type is Promise<Application>
systemService.getApp().then((app) => {
console.log(app);
});Get Token Data of Currently Logged-In User
systemService.getToken();Return Value type is Promise<String>
systemService.getToken().then((token) => {
console.log(token);
});Get Platform Service Address
systemService.getServerUrl();Return Value type is Promise<String>
// If the server configuration sets https://next.informat.cn
systemService.getServerUrl().then((url) => {
console.log(url); //https://next.informat.cn
});Get the Prefix of the Platform Open Address Currently Being Accessed
systemService.getClientUrl();Return Value type is Promise<String>
// If the current browser access address is https://next.informat.cn/web0/app/xxx/table/xxx?id=xxxx
systemService.getClientUrl().then((url) => {
console.log(url); // https://next.informat.cn/
});Close Current Popup
systemService.close();Return Value type is Promise
// Website module opened by automation
systemService.close();Current Popup Call Data Response
Use Open Website Page in automation or Open Link step in the popup. After the interaction is executed, restore automation execution. Subsequent steps can obtain the response set through payload
| Parameter | Type | Description |
|---|---|---|
| data | Object | Set data response, optional |
systemService.payload(data);Return Value type is Promise
// Set empty data response
systemService.payload();
// Set data response
systemService.payload("success");
// Set object-type data response
systemService.payload({ a: 1 });
