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

source

mwf.xdesktop.requireapp("process.xform", "$module", null, false);
/** @class readlog 阅读记录组件。
 * @o2cn 阅读记录组件
 * @example
 * //可以在脚本中获取该组件
 * //方法1:
 * var log = this.form.get("name"); //获取组件
 * //方法2
 * var log = this.target; //在组件事件脚本中获取
 * @extends mwf.xapplication.process.xform.$module
 * @o2category formcomponents
 * @o2range {process}
 * @hideconstructor
 */
mwf.xapplication.process.xform.readlog = mwf.appreadlog =  new class(
    /** @lends mwf.xapplication.process.xform.readlog# */
    {
        extends: mwf.app$module,
        options: {
            /**
             * 加载数据后事件。
             * @event mwf.xapplication.process.xform.readlog#postloaddata
             * @see {@link https://www.yuque.com/o2oa/ixsnyt/hm5uft#i0zts|组件事件说明}
             * @example
             * //触发该事件的时候可以获取到流程数据readlog
             * var readlog = this.target.readlog;
             * //可以修改readlog达到定制化流程记录的效果
             * do something
             */
            /**
             * 加载每行流程信息以后触发,可以通过this.event获得下列信息:
             * 

             *{
             * "data" : {}, //当前行记录信息,如果是已阅未单条记录(对象),如果是待阅有多条记录(数组)
             * "node" : node, //当前节点
             * "log" : object, //指向阅读记录
             * "type" : "readcompleted"  //"read"表示待阅,"readcompleted"表示已阅
             *}
             
* @event mwf.xapplication.process.xform.readlog#postloadline * @see {@link https://www.yuque.com/o2oa/ixsnyt/hm5uft#i0zts|组件事件说明} */ "moduleevents": ["load", "queryload", "postload", "postloaddata", "postloadline"] }, load: function(){ this.node.empty(); if (!this.json.isdelay){ this.active(); } }, /** * 激活阅读记录。设置了延迟加载的时候,可以通过这个方法来激活 * @example * this.form.get("fieldid").active(); */ active: function(){ this._loadmoduleevents(); if (this.fireevent("queryload")){ this._queryloaded(); this._loaduserinterface(); this._loadstyles(); this._loaddomevents(); //this._loadevents(); this._afterloaded(); this.fireevent("postload"); this.fireevent("load"); } }, _loaduserinterface: function(){ this.node.setstyle("-webkit-user-select", "text"); this.node.setstyles(this.form.css.logactivitynode_record); this.form.app.action.getreadrecord(this.form.businessdata.work.id, function(json){ this.readlog = json.data; this.fireevent("postloaddata"); this.loadreadlog(); }.bind(this)); }, loadreadlog: function(){ switch (this.json.mode){ case "notshow": return ""; case "script": this.loadreadlogbyscript(); break; default: this.loadreadlogdefault(); } }, loadreadlogbyscript: function(){ if (this.json.displayscript && this.json.displayscript.code){ var code = this.json.displayscript.code; this.readlog.each(function(log){ if (!this.json.isshowread && log.type === "read"){ //不显示待阅 }else{ this.form.macro.environment.log = log; this.form.macro.environment.list = null; var r = this.form.macro.exec(code, this); var t = o2.typeof(r); var linenode; if (t==="string"){ linenode = new element("div", { html: r }).inject(this.node); //this.node.appendhtml(r); }else if (t==="element"){ linenode = this.node.appendchild(r); } this.fireevent("postloadline",[{ "data" : log, "node" : linenode, "log" : this, "type" : "readcompleted" }]); } }.bind(this)); } }, loadreadlogdefault: function(){ var text = this.json.textstyle; var readpersons = []; var readlogs = []; this.lineclass = "logtasknode"; this.readlog.each(function(log, i){ if (this.json.textstylescript && this.json.textstylescript.code){ this.form.macro.environment.log = log; this.form.macro.environment.list = null; text = this.form.macro.exec(this.json.textstylescript.code, this); } if (log.type == "readcompleted"){ var div = new element("div", {styles: this.form.css[this.lineclass]}).inject(this.node); var leftdiv = new element("div", {styles: this.form.css.logtaskiconnode_record}).inject(div); var rightdiv = new element("div", {styles: this.form.css.logtasktextnode}).inject(div); var html = text.replace(/{person}/g, o2.name.cn(log.person || "")) .replace(/{datetime}/g, log.completedtime) .replace(/{date}/g, log.completedtime.substring(0.10)) .replace(/{startdatetime}/g, log.starttime) .replace(/{startdate}/g, log.starttime.substring(0.10)) .replace(/{startdatetime}/g, log.starttime) .replace(/{unit}/g, o2.name.cn(log.unit)) .replace(/{department}/g, o2.name.cn(log.unit)) .replace(/{identity}/g, o2.name.cn(log.identity)) .replace(/{activity}/g, o2.name.cn(log.activityname)) .replace(/{title}/g, log.title || "") .replace(/{opinion}/g, log.opinion || ""); rightdiv.appendhtml(html); if (this.lineclass === "logtasknode"){ this.lineclass = "logtasknode_even"; }else{ this.lineclass = "logtasknode"; } this.fireevent("postloadline",[{ "data" : log, "node" : div, "log" : this, "type" : "readcompleted" }]); } if (!!this.json.isshowread && log.type == "read"){ readpersons.push(o2.name.cn(log.person) "(" o2.name.cn(log.unit) ")"); readlogs.push(log); } }.bind(this)); if (readpersons.length){ var div = new element("div", {styles: this.form.css[this.lineclass]}).inject(this.node); var leftdiv = new element("div", {styles: this.form.css.logtaskiconnode_record}).inject(div); var rightdiv = new element("div", {styles: this.form.css.logtasktextnode}).inject(div); leftdiv.setstyle("background-image", ""); rightdiv.appendhtml("
" mwf.xapplication.process.xform.lp.showreadtitle ": " readpersons.join(", ") "
"); this.fireevent("postloadline",[{ "data" : readlogs, "node" : div, "log" : this, "type" : "read" }]); } } });
网站地图