MWF.xDesktop.requireApp("Template", "MPopupForm", null, false); MWF.xApplication.Report.SettingForm = new Class({ Extends: MPopupForm, Implements: [Options, Events], options: { "style": "report", "width": "1000", "height": "600", "minWidth" : 700, "minHeight" : 320, "hasTop": true, "hasIcon": false, "hasTopIcon" : false, "hasTopContent" : false, "maxAction" : true, "hasBottom": true, "draggable": true, "resizeable": true, "closeAction": true }, createTab: function(){ var _self = this; this.tabContainer = new Element("div.formTabContainer",{ styles : this.css.formTabContainer }).inject(this.formNode); var tabNode = new Element("div.formTabNode", { "styles": this.css.formTabNode, "text" : this.lp.systemSetting }).inject(this.tabContainer); tabNode.addEvents({ "mouseover" : function(){ if( _self.currentTabNode != this.node)this.node.setStyles(_self.css.formTabNode_over) }.bind({node : tabNode }), "mouseout" : function(){ if( _self.currentTabNode != this.node)this.node.setStyles(_self.css.formTabNode) }.bind({node : tabNode }), "click":function(){ if( _self.currentTabNode )_self.currentTabNode.setStyles(_self.css.formTabNode); _self.currentTabNode = this.node; this.node.setStyles(_self.css.formTabNode_current); _self.sysContainer.setStyle("display",""); _self.personContainer.setStyle("display","none"); }.bind({ node : tabNode }) }); tabNode.setStyles( this.css.formTabNode_current ); _self.currentTabNode = tabNode; var tabNode = new Element("div.tabNode", { "styles": this.css.formTabNode, "text" : this.lp.personSetting }).inject(this.tabContainer); tabNode.addEvents({ "mouseover" : function(){ if( _self.currentTabNode != this.node)this.node.setStyles(_self.css.formTabNode_over) }.bind({node : tabNode }), "mouseout" : function(){ if( _self.currentTabNode != this.node)this.node.setStyles(_self.css.formTabNode) }.bind({node : tabNode }), "click":function(){ if( _self.currentTabNode )_self.currentTabNode.setStyles(_self.css.formTabNode); _self.currentTabNode = this.node; this.node.setStyles(_self.css.formTabNode_current); _self.sysContainer.setStyle("display","none"); _self.personContainer.setStyle("display",""); }.bind({ node : tabNode }) }) }, createContent: function () { this.formTopTextNode.set( "text", "工作汇报配置" ); this.isAdmin = this.app.common.isAdmin(); //if( this.isAdmin ) { // this.createTab(); //} this.formContentNode = new Element("div.formContentNode", { "styles": this.css.formContentNode }).inject(this.formNode); this.formTableContainer = new Element("div.formTableContainer", { "styles": this.css.formTableContainer }).inject(this.formContentNode); this.formTableArea = new Element("div.formTableArea", { "styles": this.css.formTableArea }).inject(this.formTableContainer); this._createTableContent(); }, _createTableContent: function(){ if( this.isAdmin ){ this.sysContainer = new Element("div.sysContainer").inject(this.formTableArea); this.loadSysSetting( this.sysContainer ); //this.personContainer = new Element("div.personContainer", { styles : {"display":"none"} }).inject( this.formTableArea ); //this.loadPersonSetting( this.personContainer ); }else{ //this.personContainer = new Element("div.personContainer", { styles : {"display":""} }).inject( this.formTableArea ); //this.loadPersonSetting( this.personContainer ); } }, loadPersonSetting: function( container ){ var boxStyle = (this.isEdited || this.isNew) ? "border:1px solid #ccc; border-radius: 4px;overflow: hidden;padding:8px;" : ""; var html = "" + "" + " " + "" + "
" + "
" + "
"; container.set("html", html); MWF.UD.getDataJson("reportConfig", function (json) { MWF.xDesktop.requireApp("Template", "MForm", function () { this.personform = new MForm(container, json, { usesNewVersion : true, isEdited: this.isEdited || this.isNew, style : "meeting", hasColon : true, itemTemplate: { defaultView : { //text : "默认视图", type : "radio", selectValue : ["toList", "toMonth","toDay"], selectText:["列表","月","日"] text : "默认视图", type : "radio", selectValue : ["toList","toDay"], selectText:["列表","日"] } } }, this.app); this.personform.load(); }.bind(this), true); }.bind(this)); }, loadSysSetting: function ( container ) { this.getSysData(); var boxStyle = (this.isEdited || this.isNew) ? "border:1px solid #ccc; border-radius: 4px;overflow: hidden;padding:8px;" : ""; //var html = "" + //"" + //"" + //" " + //"" + //" " + //"" + //" " + //"" + //" " + //"" + //" " + // //"" + //" " + // //"" + // //"" + // //"" + //" " + //"" + //" " + //"" + //" " + // //"" + //" " + //" " + // //"" + //" " + // //"" + //" " + //"" + //" " + //"" + //" " + //"" + // //"" + // //"" + //" " + //"" + //" " + //"" + //" " + //"" + //" " + //"" + //" " + // //"" + // //"" + // //"" + //" " + //"" + //" " + //"" + //" " + //"" + //" " + //"" + //" " + //"
基本设置
" + //" "+ //" "+ //"
月报设置
是否启用:
发起时间:"+ //" " + //" " + //" " + //"
自动启动时间类型:"+ //"
自动启动时间表达式:"+ //"
自动启动时间列表:"+ //"
" + //"
参与应用:"+ //"
" + //"
个人关联流程:"+ //"
组织关联流程:"+ //"
周报设置
是否启用:
发起时间:"+ //" " + //" " + //" " + //"
参与应用:"+ //"
" + //"
个人关联流程:"+ //"
组织关联流程:"+ //"
日报设置
是否启用:
发起时间:"+ //" " + //" " + //"
参与应用:"+ //"
" + //"
个人关联流程:"+ //"
组织关联流程:"+ //"
"; var html = "" + "" + " " + "" + " " + "" + " " + " " + "" + " " + "" + " " + "" + " " + "" + " " + "" + " " + "" + " " + "" + " " + "
是否启用:
自动启动时间类型:"+ "
自动启动时间表达式:"+ "
自动启动时间列表:"+ "
" + "
参与应用:"+ "
" + "
关联流程:"+ "
" + " "+ " "+ "
"; container.set("html", html); this.itemTemplate = { //REPORT_ENABLE: { text : "开启汇报", type : "select", selectValue:["true", "false"], selectText : ["是","否"], notEmpty : true, style : { width : "100px" } }, MONTHREPORT_ENABLE: { text : "开启月汇报", type : "select", selectValue:["true", "false"], selectText : ["是","否"], defaultValue : "false", style : { width : "100px" } }, WEEKREPORT_ENABLE: { text : "开启周汇报", type : "select", selectValue:["true", "false"], selectText : ["是","否"], defaultValue : "false", style : { width : "100px" } }, DAYREPORT_ENABLE: { text : "开启日汇报", type : "select", selectValue:["true", "false"], selectText : ["是","否"], defaultValue : "false", style : { width : "100px" } }, createDate: { text: "发起汇报", tType: "date", style: {width: "200px"} }, createReport: { "text": "手工发起汇报", "value": "手工发起汇报", type: "button", event: { click: function (item, ev) { var date = this.sysform.getItem("createDate").getValue(); if( date == "" ){ this.app.notice("请先选择时间","error"); }else{ this.actions.createImmediately( {"date":date}, function(){ this.app.notice("发起汇报成功!"); this.sysform.getItem("createDate").setValue(""); }.bind(this)) } }.bind(this)} }, REPORT_MONTH_DAYTYPE: { text : "月报发起时间", type : "select", selectValue:["THIS_MONTH","NEXT_MONTH"], selectText:["当月","下月"], style : { width : "100px" }}, REPORT_MONTH_DAY : { text : "每月汇报发起日期", type : "select", selectValue : function(){ var arr = []; for( var i=1; i<=31; i++ )arr.push( i.toString() ); return arr; }, selectText : function(){ var arr = []; for( var i=1; i<=31; i++ )arr.push( i.toString() + "号" ); return arr; }, style : { width : "100px" }}, REPORT_MONTH_TIME : { text : "每月汇报发起时间", tType : "time", style : { width : "200px" }}, REPORT_WEEK_DAYTYPE: { text : "周报", type : "select", selectValue:["THIS_WEEK","NEXT_WEEK"], selectText:["本周","下周"], style : { width : "100px" }}, REPORT_WEEK_DAY: {text : "每周汇报发起日期", type : "select", selectValue : ["0","1","2","3","4","5","6"], selectValue : ["周日","周一","周二","周三","周四","周五","周六"], style : { width : "100px" }}, REPORT_WEEK_TIME : { text : "每周汇报发起时间", tType : "time", style : { width : "200px" } }, REPORT_DAY_DAYTYPE: { text : "日报", type : "select", selectValue:["NONE","TODAY","TOMORROW"], selectText:["无","当天","下一天"], style : { width : "100px" }}, REPORT_DAY_TIME : { text : "每日汇报发起时间", tType : "time", style : { width : "200px" } }, WEEKEND_IGNORE : { text : "忽略周末", type : "select", selectValue:["true", "false"], selectText : ["是","否"], notEmpty : true, style : { width : "100px" } }, HOLIDAY_IGNORE : { text : "忽略假日", type : "select", selectValue:["true", "false"], selectText : ["是","否"], notEmpty : true, style : { width : "100px" } }, REPORT_MONTH_MODULE : { text : "参与月报的应用", type : "checkbox", selectValue : ["CMS","BBS","OKR","WORKFLOW","MEETTING","ATTENDANCE","STRATEGY"], selectText : ["内容管理","论坛","OKR","流程应用","会议管理","考勤","战略"] }, REPORT_WEEK_MODULE : { text : "参与周报的应用", type : "checkbox", selectValue : ["CMS","BBS","OKR","WORKFLOW","MEETTING","ATTENDANCE","STRATEGY"], selectText : ["内容管理","论坛","OKR","流程应用","会议管理","考勤","战略"] }, REPORT_DAY_MODULE : { text : "参与周报的应用", type : "checkbox", selectValue : ["CMS","BBS","OKR","WORKFLOW","MEETTING","ATTENDANCE","STRATEGY"], //"NONE", selectText : ["内容管理","论坛","OKR","流程应用","会议管理","考勤","战略"] }, //MONTH_REPORT_WORKFLOW : { text : "月报流程", type : "org", orgType : "Process", className : "inputPlus" }, PERSONMONTH_REPORT_WORKFLOW : { text : "个人月报流程", type : "org", orgType : "Process", className : "inputPlus" }, UNITMONTH_REPORT_WORKFLOW : { text : "个人月报流程", type : "org", orgType : "Process", className : "inputPlus" }, //WEEK_REPORT_WORKFLOW : { text : "周报流程", type : "org", orgType : "Process", className : "inputPlus" }, PERSONWEEK_REPORT_WORKFLOW : { text : "个人周报流程", type : "org", orgType : "Process", className : "inputPlus" }, UNITWEEK_REPORT_WORKFLOW : { text : "个人周报流程", type : "org", orgType : "Process", className : "inputPlus" }, //DAY_REPORT_WORKFLOW : { text : "日报流程", type : "org", orgType : "Process", className : "inputPlus" }, PERSONDAY_REPORT_WORKFLOW : { text : "个人日报流程", type : "org", orgType : "Process", className : "inputPlus" }, UNITDAY_REPORT_WORKFLOW : { text : "组织日报流程", type : "org", orgType : "Process", className : "inputPlus" }, PERSONREPORT_REMOVE_DUTY : { text : "个人汇报排除职务", type : "org", orgType : "Duty", count:0, className : "inputPlus" }, UNITREPORT_DUTY : { text : "组织汇报指定职务", type : "org", orgType : "Duty", count:0, className : "inputPlus" }, AUTOCREATE_TYPE : { text : "汇报自动生成时间类型", type : "select", selectValue:["EXPRESSION", "CUSTOMDATELIST"], selectText : ["时间表达式","时间列表"], notEmpty : true, style : { width : "100px" }, event :{ change : function( item, ev ){ if( item.getValue() == "EXPRESSION" ){ container.getElement("[item='CRON_EXPRESSION_TR']").setStyle("display",""); container.getElement("[item='CUSTOM_DATELIST_TR']").setStyle("display","none"); }else{ container.getElement("[item='CRON_EXPRESSION_TR']").setStyle("display","none"); container.getElement("[item='CUSTOM_DATELIST_TR']").setStyle("display",""); } }.bind(this) }}, CRON_EXPRESSION : { text : "时间表达式", validRule : { isNotEmpty : function( value , item ){ if( item.form.getItem("AUTOCREATE_TYPE").getValue() == "EXPRESSION" && !value)return false; return true; }.bind(this) }, validMessage : { isNotEmpty : "时间表达式不能为空" }, onPostLoad : function( item ){ MWF.xDesktop.requireApp("Template", "widget.CronPicker", null, false); new MWF.xApplication.Template.widget.CronPicker( this.app.content, item.container, this.app, {}, { position : { //node 固定的位置 x : "right", y : "auto" }, onSelect : function( value ){ item.setValue(value); } } ); } } //CUSTOM_DATELIST : { text : "时间列表" } }; MWF.xDesktop.requireApp("Template", "MForm", function () { this.sysform = new MForm(container, this.data, { isEdited: this.isEdited || this.isNew, style : "report", hasColon : true, itemTemplate: this.itemTemplate }, this.app); this.sysform.load(); }.bind(this), true); var dateList = []; if( this.data ){ this.data.CUSTOM_DATELIST.split(",").each( function(d ){ dateList.push( { CUSTOM_DATELIST : d } ) }) } MWF.xDesktop.requireApp("Template", "MGrid", function () { this.dateGrid = new MGrid( container.getElement("[item='CUSTOM_DATELIST']"), dateList || null , { style: "report", isEdited: this.isEdited || this.isNew, hasOperation : true, minTrCount : 1, tableAttributes : { width : "550px", border : "0" , cellpadding : "5", cellspacing : "0" }, itemTemplate: { CUSTOM_DATELIST: { tType : "datetime", defaultValue: "请选择时间", defaultValueAsEmpty: true, event: { focus: function (item, ev) { if (item.getValue() == "请选择时间")item.setValue("") }.bind(this), blur: function (item, ev) { if (item.getValue() == "")item.setValue("请选择时间") }.bind(this) } } } }, this.app ); this.dateGrid.setThTemplate("序号选择时间"); this.dateGrid.setTrTemplate( "
" ); this.dateGrid.load(); }.bind(this), true); }, _createBottomContent: function () { if (this.isNew || this.isEdited) { this.okActionNode = new Element("button.inputOkButton", { "styles": this.css.inputOkButton, "text": this.lp.save }).inject(this.formBottomNode); this.okActionNode.addEvent("click", function (e) { this.save(e); }.bind(this)); } this.cancelActionNode = new Element("button.inputCancelButton", { "styles": (this.isEdited || this.isNew ) ? this.css.inputCancelButton : this.css.inputCancelButton_long, "text": this.lp.close }).inject(this.formBottomNode); this.cancelActionNode.addEvent("click", function (e) { this.close(e); }.bind(this)); }, getSysData: function(){ this.actions.listSetting( function( json ){ this.decodeSysData( json.data ); }.bind(this), null, false) }, decodeSysData : function( data ){ this.data = {}; this.dataJson = {}; data.each( function(d){ var value = d.configValue; if( typeOf(value) == "string"){ if( value == "NONE" )value = "" }else if( typeOf(value) == "array" ){ for( var i=0; i width && (width = 300); 220 > height && (height = 220); top = top || parseInt((limitHeight - height) / 2, 10); //+appTitleSize.y); left = left || parseInt((limitWidth - width) / 2, 10); this.formAreaNode.setStyles({ "width": "" + width + "px", "height": "" + height + "px", "top": "" + top + "px", "left": "" + left + "px" }); this.formNode.setStyles({ "width": "" + width + "px", "height": "" + height + "px" }); var iconSize = this.formIconNode ? this.formIconNode.getSize() : {x: 0, y: 0}; var topSize = this.formTopNode ? this.formTopNode.getSize() : {x: 0, y: 0}; var bottomSize = this.formBottomNode ? this.formBottomNode.getSize() : {x: 0, y: 0}; var tabSize = this.tabContainer ? this.tabContainer.getSize() : {x: 0, y: 0}; var contentHeight = height - iconSize.y - topSize.y - bottomSize.y - tabSize.y; //var formMargin = formHeight -iconSize.y; this.formContentNode.setStyles({ "height": "" + contentHeight + "px" }); this.formTableContainer.setStyles({ "height": "" + contentHeight + "px" }); } });