o2oa api: x-游戏厅捕鱼达人

source

o2.xdesktop.requireapp("process.xform", "$elinput", null, false);
/** @class eldropdown 基于element ui的下拉菜单组件。本组件不往后台存数据。
 * @o2cn 下拉菜单
 * @example
 * //可以在脚本中获取该组件
 * //方法1:
 * var input = this.form.get("name"); //获取组件
 * //方法2
 * var input = this.target; //在组件事件脚本中获取
 * @extends mwf.xapplication.process.xform.$module
 * @o2category formcomponents
 * @o2range {process|cms|portal}
 * @hideconstructor
 * @see {@link https://element.eleme.cn/#/zh-cn/component/dropdown|element ui dropdown 下拉菜单}
 */
mwf.xapplication.process.xform.eldropdown = mwf.appeldropdown =  new class(
    /** @lends o2.xapplication.process.xform.eldropdown# */
    {
    implements: [events],
    extends: mwf.app$elinput,
    options: {
        "moduleevents": ["load", "queryload", "postload"],
        /**
         * split-button 为 true 时,点击左侧按钮的回调
         * @event mwf.xapplication.process.xform.eldropdown#click
         * @see {@link https://element.eleme.cn/#/zh-cn/component/dropdown|下拉菜单组件的events章节}
         */
        /**
         * 点击菜单项触发的事件回调。this.event[0]指向dropdown-item 的指令(选项的command值)
         * @event mwf.xapplication.process.xform.eldropdown#focus
         * @see {@link https://element.eleme.cn/#/zh-cn/component/dropdown|下拉菜单组件的events章节}
         */
        /**
         * 下拉框出现/隐藏时触发。出现则this.event[0]为 true,隐藏则this.event[0]为 false
         * @event mwf.xapplication.process.xform.eldropdown#change
         * @see {@link https://element.eleme.cn/#/zh-cn/component/dropdown|下拉菜单组件的events章节}
         */
        "elevents": ["click", "command", "visible-change"]
    },
    __setreadonly: function(data){
        if (this.isreadonly()) {
            this.node.set("text", data);
            if( this.json.elproperties ){
                this.node.set(this.json.elproperties );
            }
            if (this.json.elstyles){
                this.node.setstyles( this._parsestyles(this.json.elstyles) );
            }
        }
    },
    _loadnode: function(){
        if (this.isreadonly()) this.json.disabled = true;
        this._loadnodeedit();
    },
    _loadnodeedit: function(){
        var id = (this.json.id.indexof("..")!==-1) ? this.json.id.replace(/\.\./g, "_") : this.json.id;
        this.json["$id"] = (id.indexof("-")!==-1) ? id.replace(/-/g, "_") : id;
         this.node.appendhtml(this._createelementhtml(), "before");
        var input = this.node.getprevious();
        this.node.destroy();
        this.node = input;
        this.node.setstyle("opacity", 0);
        this.node.set({
            "id": this.json.id,
            "mwftype": this.json.type
        });
        this.node.addclass("o2_vue");
        this._createvueapp();
    },
    _appendvuedata: function(){
        if (!this.json.size) this.json.size = "";
        if (!this.json.placement) this.json.placement = "bottom-end";
        if (!this.json.trigger) this.json.trigger = "hover";
        if (o2.typeof(this.json.hideonclick)!=="boolean") this.json.hideonclick = true;
        if (o2.typeof(this.json.splitbutton)!=="boolean") this.json.splitbutton = false;
        if (!this.json.buttontype) this.json.buttontype = "";
        if (!this.json.showtimeout) this.json.showtimeout = 250;
        if (!this.json.hidetimeout) this.json.hidetimeout = 150;
        // if(o2.typeof(this.json.disabled)!=="boolean")this.json.disabled = this.isreadonly();
    },
    _aftermounted: function(el){
        this.node = el;
        this.node.setstyle("opacity", 1);
        this.node.set({
            "id": this.json.id,
            "mwftype": this.json.type
        });
        this._loadvuecss();
        this._loaddomevents();
        this._afterloaded();
        this.fireevent("postload");
        this.fireevent("load");
    },
    _createelementhtml: function() {
        var html = "";
        var dattohtml = function (data) {
            var command = data.command ? (" command=\"" data.command "\"") : "";
            var disabled = ( data.disabled && (data.disabled==="true" || data.disabled===true) ) ? " disabled" : "";
            var divided = ( data.divided && (data.divided==="true" || data.divided===true) ) ? " divided" : "";
            var icon = data.icon ? (" icon=\"" data.icon "\"") : "";
            html  = "	" data.label "";
        };
        if(this.json.datatype === "json"){
            this.json.datajson.each(function(d){
                dattohtml(d)
            })
        }else if(this.json.datascript && this.json.datascript.code){
            var data = this.form.macro.exec(((this.json.datascript) ? this.json.datascript.code : ""), this);
            if( data && o2.typeof(data) !== "array" )data = [data];
            if( data )data.each(function(d){
                dattohtml(d)
            })
        }
        html  = "";
        return html;
    },
    getbuttonhtml: function(){
        if( this.json.showbutton ){
            if( this.json.splitbutton ) {
                return this.json.text || mwf.xapplication.process.xform.lp.pleaseselect;
            }else{
                return ""  ( this.json.text || mwf.xapplication.process.xform.lp.pleaseselect )  
                		"" 
                	"";
            }
        }else{
            return " "  ( this.json.text || mwf.xapplication.process.xform.lp.pleaseselect )  
                "" 
                "";
        }
    }
}); 
网站地图