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));
}
}
});
source