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

source

o2.xdesktop.requireapp("process.xform", "$elinput", null, false);
mwf.xdesktop.requireapp("process.xform", "$selector", null, false);
if( !o2.app$elselector ){
    o2.xapplication.process.xform.$elselector = o2.app$elselector = new class({
        implements: [events],
        extends: mwf.app$elinput
    });
    object.assign(o2.app$elselector.prototype, o2.app$selector.prototype);
}
/** @class elautocomplete 基于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
 */
mwf.xapplication.process.xform.elautocomplete = mwf.appelautocomplete =  new class(
    /** @lends o2.xapplication.process.xform.elautocomplete# */
    {
    implements: [events],
    extends: mwf.app$elselector,
    options: {
        "moduleevents": ["load", "queryload", "postload"],
        /**
         * 当 input失去焦点且值有修改是触发,或点击建议面板的选项后且值有修改时触发。this.event[0]为组件值
         * @event mwf.xapplication.process.xform.elautocomplete#change
         * @see {@link https://element.eleme.io/#/zh-cn/component/input#dai-shu-ru-jian-yi|input组件的带输入建议章节}
         */
        /**
         * 点击建议面板的选项后时触发。this.event[0]为选中的选项
         * @event mwf.xapplication.process.xform.elautocomplete#select
         * @see {@link https://element.eleme.io/#/zh-cn/component/input#input-methods|input组件的input method章节}
         */
        "elevents": ["select", "change"]
    },
    /**
     * @summary 组件的配置信息,同时也是vue组件的data。
     * @member mwf.xapplication.process.xform.elautocomplete#json {jsonobject}
     * @example
     *  //可以在脚本中获取此对象,下面两行代码是等价的,它们获取的是同一个对象
     * var json = this.form.get("elinput").json;       //获取组件的json对象
     * var json = this.form.get("elinput").vm.$data;   //获取vue组件的data数据,
     *
     * //通过json对象操作element组件
     * json.size = "mini";      //改变输入框大小
     * json.disabled = true;     //设置输入框为禁用
     */
    _appendvuedata: function(){
        this.form.macro.environment.data.check(this.json.id);
        this.json[this.json.id] = this._getbusinessdata();
        if (!this.json.placement) this.json.placement = "bottom-start";
        if (!this.json.popperclass) this.json.popperclass = "";
        if (!this.json.triggeronfocus && this.json.triggeronfocus!==false) this.json.triggeronfocus = true;
        if (!this.json.prefixicon) this.json.prefixicon = "";
        if (!this.json.suffixicon) this.json.suffixicon = "";
        if (!this.json.description) this.json.description = "";
    },
    _createeventfunction: function(methods, k){
        methods["$loadelevent_" k.camelcase()] = function(){
            var flag = true;
            if (k==="change") {
                this.validationmode();
                this._setbusinessdata(this.getinputdata());
                if( !this.validation() )flag = false;
            }
            if (this.json.events && this.json.events[k] && this.json.events[k].code){
                this.form.macro.fire(this.json.events[k].code, this, arguments);
            }
            if(k==="select"){
                this.validationmode();
                var arr = [];
                var d = this._getbusinessdata();
                if( arguments[0] && arguments[0].value )arr.push(arguments[0].value);
                if( (d||"") !== (arr[0] || "")){
                    if (this.json.events && this.json.events["change"] && this.json.events["change"].code){
                        this.form.macro.fire(this.json.events["change"].code, this, arr);
                    }
                }
                this._setbusinessdata(arr[0]);
                this.validation();
            }
            if( flag )this.fireevent(k, arguments);
        }.bind(this);
    },
    appendvueextend: function(app){
        if (!app.methods) app.methods = {};
        // app.methods.$loadelevent = function(ev){
        //     this.validationmode();
        //     if (this.json.events && this.json.events[ev] && this.json.events[ev].code){
        //         this.form.macro.fire(this.json.events[ev].code, this, event);
        //     }
        // }.bind(this);
        if (!this.json.itemtype || this.json.itemtype==='values'){
            app.methods.$fetchsuggestions = function(qs, cb){
                if (this.json.itemvalues){
                    var items = this.json.itemvalues.filter(function(v){
                        return !qs || v.indexof(qs)!=-1;
                    }).map(function(v){
                        return {"value": v};
                    });
                    cb(items);
                    //return items;
                }
                return [];
            }.bind(this);
        }else if(this.json.itemtype==='script'){
            if (this.json.itemscript && this.json.itemscript.code){
                var fetchsuggestions = this.form.macro.exec(this.json.itemscript.code, this);
                if (o2.typeof(fetchsuggestions)==="function"){
                    app.methods.$fetchsuggestions = function(){
                        fetchsuggestions.apply(this, arguments);
                    }.bind(this);
                }
            }
        }else{
            var options;
            promise.resolve(this.getoptions()).then(function (opt) {
                options = opt;
            });
            app.methods.$fetchsuggestions = function(qs, cb){
                if (options){
                    var items = options.filter(function(v){
                        return !qs || v.indexof(qs)!=-1;
                    }).map(function(v){
                        return {"value": v};
                    });
                    cb(items);
                    //return items;
                }
                return [];
            }.bind(this);
        }
        // app.methods.$fetchsuggestions = function(qs, cb){
        //     if (this.json.itemtype!=='script'){
        //         if (this.json.itemvalues){
        //             var items = this.json.itemvalues.filter(function(v){
        //                 return !qs || v.indexof(qs)!=-1;
        //             }).map(function(v){
        //                 return {"value": v};
        //             });
        //             cb(items);
        //             return;
        //         }
        //         cb();
        //     }else{
        //         this.form.macro.environment.querystring = qs;
        //         var list = this.form.macro.exec(this.json.itemscript.code, this);
        //         promise.resolve(list).then(function(items){
        //             cb(items);
        //             delete this.form.macro.environment.querystring;
        //         }).catch(function(){
        //             cb();
        //             delete this.form.macro.environment.querystring;
        //         });
        //     }
        // }.bind(this);
    },
    _createelementhtml: function(){
        var html = "
网站地图