|
|
|
|
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';
|
|
|
|
|
public static FORMAT_TABLE_STYLE: any = { dense: false, bordered: false };
|
|
|
|
|
|
|
|
|
|
targetType: string;
|
|
|
|
|
context: any;
|
|
|
|
|
autoCompletionManager: any;
|
|
|
|
|
userDefinedFunctionsManager: any;
|
|
|
|
|
|
|
|
|
|
constructor(targetType: string, context?: any) {
|
|
|
|
|
this.targetType = targetType;
|
|
|
|
|
this.context = context;
|
|
|
|
|
this.autoCompletionManager = new AutoCompletionManager();
|
|
|
|
|
this.userDefinedFunctionsManager = new UserDefinedFunctionsManager();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 获取工具栏按钮对象
|
|
|
|
|
*/
|
|
|
|
|
abstract getToolbarAction(): any;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 表格字段显示内容
|
|
|
|
|
* @param row 表格行数据
|
|
|
|
|
*/
|
|
|
|
|
abstract format(row: any): any;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 获取编辑器对话框字段列表
|
|
|
|
|
*/
|
|
|
|
|
abstract getEditorFields(): any;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 获取用于显示查看信息的字段列表
|
|
|
|
|
*/
|
|
|
|
|
abstract getViewerFields(): any;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 表单提交前的操作
|
|
|
|
|
* @param args 参数对象
|
|
|
|
|
*/
|
|
|
|
|
abstract beforeEditorDataSubmit(args: any): void;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 编辑表单打开后的操作
|
|
|
|
|
* @param args 参数对象
|
|
|
|
|
*/
|
|
|
|
|
abstract afterEditorOpen(args: any): void;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 初始化 code-mirror 代码提示自动完成管理器
|
|
|
|
|
* @param args 参数对象
|
|
|
|
|
*/
|
|
|
|
|
initAutoCompletionManager() {
|
|
|
|
|
if (this.targetType === Processor.PARAMETER || this.targetType === Processor.SCORE_CARD) {
|
|
|
|
|
this.autoCompletionManager.load(Environment.apiContextPath('/api/re/common/listParameterAndValueTypeByParameterId/' + this.context.target.id));
|
|
|
|
|
} else if (this.targetType === Processor.INDICATOR) {
|
|
|
|
|
this.autoCompletionManager.load(Environment.apiContextPath('/api/re/common/listParameterAndValueTypeByIndicatorId/' + this.context.target.id));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 初始化用户自定义函数管理器
|
|
|
|
|
* @param args 参数对象
|
|
|
|
|
*/
|
|
|
|
|
initUserDefinedFunctionsManager() {
|
|
|
|
|
this.userDefinedFunctionsManager.load();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export { Processor };
|