[]
命令类型基类。通过插件实现的命令类型需要从这个类继承。
• new CommandBase()
• CommandExecutor: CommandExecutor
命令执行器
• CommandParam: object
C# 命令类属性的数据。
• runTimePageName: string
运行时页面唯一标识
• get
subCommandInfo(): SubCommandInfo
获取子命令信息,一般用于调用executeSubCommands方法且再次执行当前命令时。
▸ evaluateFormula(formula
): any
计算公式。
属性名 | 类型 | 说明 |
---|---|---|
formula |
string |
公式。 |
any
计算结果。
▸ execute(): void
| Promise
<void
>
执行这个命令。需要在子类实现。
void
| Promise
<void
>
▸ executeCustomCommandObject(command
, initParam
, eventType?
, callbackOnCommandCompleted?
, commandId?
): any
执行自定义命令对象列表。
属性名 | 类型 | 说明 |
---|---|---|
command |
ICustomCommandObject |
命令。 |
initParam |
Object |
上下文参数值。 |
eventType? |
string |
事件类型(可选,用于区分不同命令)。 |
callbackOnCommandCompleted? |
Function |
命令执行完成时回调函数(可选)。 |
commandId? |
string |
- |
any
▸ 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(key
, ...args
): string
获取应用资源
属性名 | 类型 | 说明 |
---|---|---|
key |
string |
资源名称 |
...args |
string [] |
占位符的值 |
string
▸ getBindingDataSourceValue(bindingDataSourceModel
, options
): Promise
<any
>
获取数据库数据。
属性名 | 类型 | 说明 |
---|---|---|
bindingDataSourceModel |
any |
数据源查询模型,从设计器的BindingDataSourceProperty生成。 |
options |
queryDataOption |
查询配置。 |
Promise
<any
>
Promise<any>
▸ Protected
getCellLocation(formula
): CellLocationInfo
将一个公式转换成单元格位置信息。
属性名 | 类型 | 说明 |
---|---|---|
formula |
string |
Excel 公式,比如=A1 。 |
返回单元格的位置,如果公式不是指向单元格,比如=SUM(1,2)
,返回 null。
▸ getFormulaCalcContext(): FormulaCalcContext
获取用于公式计算的数据上下文。
▸ getPluginResource(key
, ...args
): string
获取插件的多语言资源
属性名 | 类型 | 说明 |
---|---|---|
key |
string |
资源名称 |
...args |
string [] |
占位符的值 |
string
▸ log(logText
): void
写日志。
属性名 | 类型 | 说明 |
---|---|---|
logText |
string |
日志内容。 |
void