MWF.xDesktop.requireApp("process.Xform", "$Selector", null, false); MWF.require("MWF.widget.UUID", null, false); /** @class Radio 单选按钮。 * @o2cn 单选按钮 * @example * //可以在脚本中获取该组件 * //方法1: * var field = this.form.get("fieldId"); //获取组件对象 * //方法2 * var field = this.target; //在组件本身的脚本中获取,比如事件脚本、默认值脚本、校验脚本等等 * * var data = field.getData(); //获取值 * field.setData("字符串值"); //设置值 * field.hide(); //隐藏字段 * var id = field.json.id; //获取字段标识 * var flag = field.isEmpty(); //字段是否为空 * @extends MWF.xApplication.process.Xform.$Selector * @o2category FormComponents * @o2range {Process|CMS|Portal} * @hideconstructor */ MWF.xApplication.process.Xform.Radio = MWF.APPRadio = new Class( /** @lends MWF.xApplication.process.Xform.Radio# */ { Implements: [Events], Extends: MWF.APP$Selector, /** * 组件加载后触发。如果选项加载为异步,则异步处理完成后触发此事件 * @event MWF.xApplication.process.Xform.Radio#load * @see {@link https://www.yuque.com/o2oa/ixsnyt/hm5uft#i0zTS|组件事件说明} */ /** * 值改变时触发。可以通过this.event获取修改后的选择项(Dom对象)。 * @event MWF.xApplication.process.Xform.Radio#change * @see {@link https://www.yuque.com/o2oa/ixsnyt/hm5uft#i0zTS|组件事件说明} */ /** * @ignore * @member {Element} descriptionNode * @memberOf MWF.xApplication.process.Xform.Radio# */ loadDescription: function(){}, _loadNode: function(){ if (this.isReadonly()){ this._loadNodeRead(); }else{ this._loadNodeEdit(); } }, _loadMergeReadContentNode: function( contentNode, data ){ this._showValue(contentNode, data.data) }, _loadNodeRead: function(){ this.node.empty(); this.node.set({ "nodeId": this.json.id, "MWFType": this.json.type }); var value = this.getValue(); this._showValue(this.node, value); }, __showValue: function(node, value, optionItems){ if (value){ var texts = ""; for (var i=0; i -1 ? opts.textList[ idx ] : ""; return text; }); }, setExcelData: function(d, type){ var value = d.replace(/ /g,""); //换行符 this.excelData = value; if( type === "value" ){ this.setData(value, true); }else{ var options = this.getOptionsObj(); this.moduleExcelAG = Promise.resolve(options).then(function (opts) { var idx = opts.textList.indexOf( value ); value = idx > -1 ? opts.valueList[ idx ] : ""; this.setData(value, true); this.moduleExcelAG = null; }.bind(this)); } } });