MWF.xDesktop.requireApp("process.Xform", "$Module", null, false); MWF.xDesktop.requireApp("process.Xform", "ViewSelector", null, false); /** @class StatementSelector 查询视图选择组件。 * @o2cn 查询视图选择 * @example * //可以在脚本中获取该组件 * //方法1: * var statementSelector = this.form.get("fieldId"); //获取组件 * //方法2 * var statementSelector = this.target; //在组件本身的脚本中获取 * @extends MWF.xApplication.process.Xform.ViewSelector * @o2category FormComponents * @o2range {Process|CMS} * @hideconstructor */ MWF.xApplication.process.Xform.StatementSelector = MWF.APPStatementSelector = new Class({ Implements: [Events], Extends: MWF.xApplication.process.Xform.ViewSelector, options: { /** * 视图参数(options)已经准备好,还未加载视图时执行。可以通过this.event得到视图参数,并可修改this.event修改视图的加载。 * @since V8.2 * @event MWF.xApplication.process.Xform.StatementSelector#beforeLoadView * @see {@link https://www.yuque.com/o2oa/ixsnyt/hm5uft#i0zTS|组件事件说明} */ /** * 视图设计已经获取,容器也已经准备好。 * @event MWF.xApplication.process.Xform.StatementSelector#loadViewLayout * @see {@link https://www.yuque.com/o2oa/ixsnyt/hm5uft#i0zTS|组件事件说明} */ /** * 异步加载查询视图后执行。 * @since V8.2 * @event MWF.xApplication.process.Xform.StatementSelector#loadView * @see {@link https://www.yuque.com/o2oa/ixsnyt/hm5uft#i0zTS|组件事件说明} */ /** * 选中查询视图中的一条记录后执行。 * @since V8.2 * @event MWF.xApplication.process.Xform.StatementSelector#select * @see {@link https://www.yuque.com/o2oa/ixsnyt/hm5uft#i0zTS|组件事件说明} */ /** * 取消选中查询视图中的一条记录后执行。 * @since V8.2 * @event MWF.xApplication.process.Xform.StatementSelector#unselect * @see {@link https://www.yuque.com/o2oa/ixsnyt/hm5uft#i0zTS|组件事件说明} */ /** * 打开查询视图中的一条记录后执行。 * @event MWF.xApplication.process.Xform.StatementSelector#openDocument,可以通过this.event得到打开的文档参数 * @see {@link https://www.yuque.com/o2oa/ixsnyt/hm5uft#i0zTS|组件事件说明} */ "moduleEvents": ["load", "beforeLoadView", "loadViewLayout", "loadView", "queryLoad", "postLoad", "select", "unselect", "openDocument"] }, doResult: function(data){ if (this.json.result === "script"){ this.selectedData = data; return (this.json.selectedScript.code) ? this.form.Macro.exec(this.json.selectedScript.code, this) : ""; }else{ Object.each(this.json.selectedSetValues, function(v, k){ var value = ""; data.each(function(d, idx){ // Object.each(d, function(dv, dk){ // if (dk===v) value = (value) ? (value+", "+dv) : dv; // }.bind(this)); var pathList = v.split("."); for( var i=0; i