You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
81 lines
2.2 KiB
81 lines
2.2 KiB
|
1 year ago
|
import { axios, Environment } from 'platform-core';
|
||
|
|
import { AutoCompletionManager } from '@/views/shared/AutoCompletionManager';
|
||
|
|
import { UserDefinedFunctionsManager } from '@/views/shared/UserDefinedFunctionsManager';
|
||
|
|
|
||
|
|
/**
|
||
|
|
* 处理器接口
|
||
|
|
*/
|
||
|
|
abstract class Processor {
|
||
|
|
public static PARAMETER: string = 'parameter';
|
||
|
|
public static INDICATOR: string = 'indicator';
|
||
|
|
public static SCORE_CARD: string = 'scoreCard';
|
||
|
|
|
||
|
|
targetType: string;
|
||
|
|
autoCompletionManager: any;
|
||
|
|
userDefinedFunctionsManager: any;
|
||
|
|
|
||
|
|
constructor(targetType: string) {
|
||
|
|
this.targetType = targetType;
|
||
|
|
this.autoCompletionManager = new AutoCompletionManager();
|
||
|
|
this.userDefinedFunctionsManager = new UserDefinedFunctionsManager();
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* 获取工具栏按钮对象
|
||
|
|
* @param target 目标对象
|
||
|
|
*/
|
||
|
|
abstract getToolbarAction(target: any): any;
|
||
|
|
|
||
|
|
/**
|
||
|
|
* 表格字段显示内容
|
||
|
|
* @param row 表格行数据
|
||
|
|
*/
|
||
|
|
abstract format(row: any): any;
|
||
|
|
|
||
|
|
/**
|
||
|
|
* 获取编辑器对话框字段列表
|
||
|
|
* @param context 上下文对象
|
||
|
|
*/
|
||
|
|
abstract getEditorFields(context?: any): any;
|
||
|
|
|
||
|
|
/**
|
||
|
|
* 获取用于显示查看信息的字段列表
|
||
|
|
* @param context 上下文对象
|
||
|
|
*/
|
||
|
|
abstract getViewerFields(context?: any): any;
|
||
|
|
|
||
|
|
/**
|
||
|
|
* 表单提交前的操作
|
||
|
|
* @param args 参数对象
|
||
|
|
*/
|
||
|
|
abstract beforeEditorDataSubmit(args: any): void;
|
||
|
|
|
||
|
|
/**
|
||
|
|
* 编辑表单打开后的操作
|
||
|
|
* @param args 参数对象
|
||
|
|
*/
|
||
|
|
abstract afterEditorOpen(args: any): void;
|
||
|
|
|
||
|
|
/**
|
||
|
|
* 初始化 code-mirror 代码提示自动完成管理器
|
||
|
|
* @param args 参数对象
|
||
|
|
*/
|
||
|
|
initAutoCompletionManager(args: any) {
|
||
|
|
if (this.targetType === Processor.PARAMETER) {
|
||
|
|
this.autoCompletionManager.load(Environment.apiContextPath('/api/re/common/listParameterAndValueTypeByParameterId/' + args.target.id));
|
||
|
|
} else if (this.targetType === Processor.INDICATOR) {
|
||
|
|
this.autoCompletionManager.load(Environment.apiContextPath('/api/re/common/listParameterAndValueTypeByIndicatorId/' + args.target.id));
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* 初始化用户自定义函数管理器
|
||
|
|
* @param args 参数对象
|
||
|
|
*/
|
||
|
|
initUserDefinedFunctionsManager(args: any) {
|
||
|
|
this.userDefinedFunctionsManager.load();
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
export { Processor };
|