[]
        
立即下载
(Showing Draft Content)

Forguncy.Forguncy.Plugin.CommandBase

类: CommandBase

Forguncy.Plugin.CommandBase

命令类型基类。通过插件实现的命令类型需要从这个类继承。

构造方法

constructor

new CommandBase()

属性

CommandExecutor

CommandExecutor: CommandExecutor

命令执行器


CommandParam

CommandParam: object

C# 命令类属性的数据。


runTimePageName

runTimePageName: string

运行时页面唯一标识

Accessors

subCommandInfo

get subCommandInfo(): SubCommandInfo

获取子命令信息,一般用于调用executeSubCommands方法且再次执行当前命令时。

返回值

SubCommandInfo

方法

evaluateFormula

evaluateFormula(formula): any

计算公式。

参数

属性名 类型 说明
formula string 公式。

返回值

any

计算结果。


execute

execute(): void | Promise<void>

执行这个命令。需要在子类实现。

返回值

void | Promise<void>


executeCustomCommandObject

executeCustomCommandObject(command, initParam, eventType?, callbackOnCommandCompleted?, commandId?): any

执行自定义命令对象列表。

参数

属性名 类型 说明
command ICustomCommandObject 命令。
initParam Object 上下文参数值。
eventType? string 事件类型(可选,用于区分不同命令)。
callbackOnCommandCompleted? Function 命令执行完成时回调函数(可选)。
commandId? string -

返回值

any


executeSubCommands

executeSubCommands(command, initParams?, returnParams?, needReenter?): any

在当前上下文中执行自定义命令对象列表。

Example

// 在自定义命令中循环调用子命令,如果返回值"Return1"为true,则结果,否则继续
execute() {
    if (this.subCommandInfo?.returnResult["Return1"]) {
        return Forguncy.CommandResult.completed;
    }

    const initParams = { "Param1": "=A1" };
    const returnParams = {
        "returnValues": { "Return1": "=B1" }
    };
    
    const commandObj = this.CommandParam.Function1;
    this.executeSubCommands(commandObj, initParams, returnParams, true);
}

参数

属性名 类型 说明
command ICustomCommandObject 命令。
initParams? Object 上下文参数值(可选)。
returnParams? ReturnParams 返回值信息(可选)。
needReenter? boolean 子命令执行完成后是否需要再次执行当前命令(可选),当前命令可根据返回值结果进行后续操作。

返回值

any


getApplicationResource

getApplicationResource(key, ...args): string

获取应用资源

参数

属性名 类型 说明
key string 资源名称
...args string[] 占位符的值

返回值

string


getBindingDataSourceValue

getBindingDataSourceValue(bindingDataSourceModel, options): Promise<any>

获取数据库数据。

参数

属性名 类型 说明
bindingDataSourceModel any 数据源查询模型,从设计器的BindingDataSourceProperty生成。
options queryDataOption 查询配置。

返回值

Promise<any>

Promise<any>


getCellLocation

Protected getCellLocation(formula): CellLocationInfo

将一个公式转换成单元格位置信息。

参数

属性名 类型 说明
formula string Excel 公式,比如=A1

返回值

CellLocationInfo

返回单元格的位置,如果公式不是指向单元格,比如=SUM(1,2),返回 null。


getFormulaCalcContext

getFormulaCalcContext(): FormulaCalcContext

获取用于公式计算的数据上下文。

返回值

FormulaCalcContext


getPluginResource

getPluginResource(key, ...args): string

获取插件的多语言资源

参数

属性名 类型 说明
key string 资源名称
...args string[] 占位符的值

返回值

string


log

log(logText): void

写日志。

参数

属性名 类型 说明
logText string 日志内容。

返回值

void