Skip to content

System Service

Call Automation

javascript
systemService.callAutomatic({ automaticId, args });

Parameters

ParameterTypeDescription
automaticIdStringAutomation identifier
argsArrayParameters passed to automation
withoutTimeoutLoadingboolWhether to show system execution loading

Return Value Automation return value, type is Promise<any>

javascript
// Call system automation
systemService
  .callAutomatic({
    automaticId: "a1",
    args: ["123", 1],
  })
  .then((result) => {
    console.log(result);
  });

Call System Toast Notification

javascript
systemService.toast(msg);

Parameters

ParameterTypeDescription
msgStringMessage to display

Call System Image Preview Dialog to Preview Images

javascript
systemService.previewImage(options);

Parameters

ParameterTypeDescription
startIndexIntegerDefault index position of the preview image, starting from 0
listArray<ImageItem>List of images to preview

ImageItem structure is as follows

js
{
    id:String,// Image ID, optional parameter
    name:String,// Image name, optional parameter
    src:String,// Image address, required parameter
}

Return Value type is Promise

javascript
// Call confirm notification
systemService.previewImage({
  startIndex: 0,
  list: [{ src: "https://url.to.image" }],
});

Call System Confirmation Dialog

javascript
systemService.confirm(options);

Parameters

ParameterTypeDescription
titleStringDialog title, optional
contentStringPrompt content, if not passed, the title parameter value will be used as an alternative display
dialogTopStringDistance from the top of the window, default (15vh)
dialogHeightStringWindow height
dialogWidthStringWindow width, default (400px)
horizontalAlignStringHorizontal alignment of the prompt content
Left(left), Center(center), Right(right), Justify(justify), default is Center(center)
verticalAlignStringVertical alignment of the prompt content
Top(top), Center(center), Bottom(bottom), default is Center(center)
showCancelboolWhether to display the cancel button
cancelTextStringCancel button text, default (Cancel)
confirmTextStringConfirm button text, default (Confirm)

Return Value type is Promise

javascript
// 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

javascript
systemService.getUser();

Return Value type is Promise<User>

javascript
systemService.getUser().then((user) => {
  console.log(user);
});

Get Current Application Information

javascript
systemService.getApp();

Return Value type is Promise<Application>

javascript
systemService.getApp().then((app) => {
  console.log(app);
});

Get Token Data of Currently Logged-In User

javascript
systemService.getToken();

Return Value type is Promise<String>

javascript
systemService.getToken().then((token) => {
  console.log(token);
});

Get Platform Service Address

javascript
systemService.getServerUrl();

Return Value type is Promise<String>

javascript
// 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

javascript
systemService.getClientUrl();

Return Value type is Promise<String>

javascript
// 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

javascript
systemService.close();

Return Value type is Promise

javascript
// 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

ParameterTypeDescription
dataObjectSet data response, optional
javascript
systemService.payload(data);

Return Value type is Promise

javascript
// Set empty data response
systemService.payload();
// Set data response
systemService.payload("success");
// Set object-type data response
systemService.payload({ a: 1 });