页面树结构

版本比较

标识

  • 该行被添加。
  • 该行被删除。
  • 格式已经改变。

...

在扩展包中创建vision\js\freequery\sysresource目录,在该目录下创建Parameter.js.patch文件,重写Parameter.prototype.initControlsForPage2方法,将上一步创建的类名添加到对应的js对象中,即可将自定义参数函数添加到函数选择的备选项中。(如何重写js方法 代码parameter.js

代码块
languagejs
titleParamter.js.patch
collapsetrue
Parameter.prototype.initControlsForPage2_old190425 = Parameter.prototype.initControlsForPage2;
Parameter.prototype.initControlsForPage2 = function() {
	var ret = this.initControlsForPage2_old190425.apply(this, arguments); // 先执行原方法逻辑
	if(!this.ControlType || this.ControlType.selectedId != "DROPDOWNTREE"){
		this.standbyFuncCombo.insertItem("GetParamDemo", "GetParamDemo"); // 添加到参数备选值函数选择的备选项中
	} 
	this.defaultFuncCombo.insertItem("GetParamDemoUnique", "GetParamDemoUnique"); // 添加到参数默认值函数选择的备选项中
	return ret;
}

...

(1)创建参数,设置参数备选值与默认值时,选择自定义的参数函数。
 
(2)创建可视化查询,加入上一步的参数,此时参数的默认值与备选值,将会取到自定义参数函数的返回值。
 

3 示例扩展包资源

扩展包:,扩展包源码:。扩展包:ParamFunctionDemo.ext,扩展包源码:ParamFunctionDemo.ext