MWF.xApplication.Execution = MWF.xApplication.Execution || {};
MWF.xDesktop.requireApp("Template", "Explorer", null, false);
MWF.xDesktop.requireApp("Template", "MPopupForm", null, false);
MWF.xDesktop.requireApp("Template", "MForm", null, false);
MWF.xApplication.Execution.CreateMainTask = new Class({
Extends: MPopupForm,
Implements: [Options, Events],
options: {
"style": "default",
"width": "95%",
"height": "95%",
"hasTop": true,
"hasIcon": false,
"hasBottom": true,
"title": "",
"draggable": true,
"closeAction": true,
"isNew": false,
"isEdited": false
},
initialize: function (explorer, actions, data, options) {
this.setOptions(options);
this.explorer = explorer;
this.app = explorer.app;
this.lp = this.app.lp;
this.path = "/x_component_Execution/$CreateMainTask/";
this.cssPath = this.path + this.options.style + "/css.wcss";
this._loadCss();
this.options.title = "";
this.data = data || {};
this.actions = actions;
},
load: function () {
if (this.options.isNew) {
this.create();
} else if (this.options.isEdited) {
this.edit();
} else {
this.open();
}
var vh = this.formContentNode.getSize().y-this.mainTaskDiv.getSize().y
vh = vh-30
//this.subTaskDiv.setStyles({"height":vh+"px"});
},
_open : function(){
this.formMaskNode = new Element("div.formMaskNode", {
"styles": this.css.formMaskNode,
"events": {
"mouseover": function(e){e.stopPropagation();},
"mouseout": function(e){e.stopPropagation();}
}
}).inject(this.app.content );
this.formAreaNode = new Element("div.formAreaNode", {
"styles": this.css.formAreaNode
});
this.createFormNode();
this.formAreaNode.inject(this.formMaskNode, "after");
this.formAreaNode.fade("in");
this.setFormNodeSize();
this.setFormNodeSizeFun = this.setFormNodeSize.bind(this);
this.addEvent("resize", this.setFormNodeSizeFun);
if( this.options.draggable && this.formTopNode ){
var size = this.app.content.getSize();
var nodeSize = this.formAreaNode.getSize();
this.formAreaNode.makeDraggable({
"handle": this.formTopNode,
"limit": {
"x": [0, size.x-nodeSize.x],
"y": [0, size.y-nodeSize.y]
}
});
}
},
createTopNode: function () {
var htmlStr="";
if (!this.formTopNode) {
this.formTopNode = new Element("div.formTopNode", {
"styles": this.css.formTopNode
}).inject(this.formNode);
//this.formTopTextNode = new Element("div", {
// "styles": this.css.formTopTextNode,
// "text": this.options.title
//}).inject(this.formTopNode)
if (this.options.closeAction) {
this.formTopCloseActionNode = new Element("div.formTopCloseActionNode", {"styles": this.css.formTopCloseActionNode}).inject(this.formTopNode);
this.formTopCloseActionNode.addEvent("click", function () {
this.close()
}.bind(this))
}
this.formTopContentNode = new Element("div", {
"styles": this.css.formTopContentNode
}).inject(this.formTopNode)
this._createTopContent();
}
},
_createTopContent: function () {
this.topTitleLi = new Element("li.topTitleLi", {
"styles": this.css.topTitleLi
}).inject(this.formTopContentNode);
htmlStr = "
";
htmlStr += ""+MWF.xApplication.Execution.LP.createMainTask.topTitle+"";
this.topTitleLi.set("html",htmlStr);
this.user = layout.desktop.session.user.name;
this.userGender = layout.desktop.session.user.genderType;
this.department="";
this.restActions = new MWF.xApplication.Execution.Actions.RestActions();
this.restActions.listDepartmentByPerson( function( json ){
this.department = json["data"][0]["display"];
}.bind(this), null, layout.desktop.session.user.name, false);
var nowTime = new Date();
var nowFormat = nowTime.getFullYear()+"-"+(nowTime.getMonth()+1)+"-"+nowTime.getDay()+" "+nowTime.getHours()+":"+nowTime.getMinutes()+":"+nowTime.getSeconds();
this.topInforLi = new Element("li.topInforLi",{
"styles":this.css.topInforLi
}).inject(this.formTopContentNode);
this.topInforDrafterSpan = new Element("span.topInforDrafterSpan",{
"styles":this.css.topInforSpan,
"text":MWF.xApplication.Execution.LP.createMainTask.drafter+this.user
}).inject(this.topInforLi);
this.topInforDeptSpan = new Element("span.topInforDeptSpan",{
"styles":this.css.topInforSpan,
"text":MWF.xApplication.Execution.LP.createMainTask.drafterDept+this.department
}).inject(this.topInforLi);
this.topInforDateSpan = new Element("span.topInforDateSpan",{
"styles":this.css.topInforSpan,
"text":MWF.xApplication.Execution.LP.createMainTask.drafterDate+nowFormat
}).inject(this.topInforLi);
},
_createTableContent: function () {
this.mainTaskDiv = new Element("div.mainTaskDiv", {
"styles": this.css.mainTaskDiv
}).inject(this.formTableArea);
this.createMainTask();
this.createTaskList();
//this.createBottomAction();
},
reloadMainTask: function( data ){
this.mainTaskDiv.empty();
this.createMainTask( data );
},
createMainTask: function( data ) {
if(data){
this.topInforDrafterSpan.set("text",MWF.xApplication.Execution.LP.createMainTask.drafter+data.creatorName)
this.topInforDeptSpan.set("text",MWF.xApplication.Execution.LP.createMainTask.drafterDept+data.creatorOrganizationName)
this.topInforDateSpan.set("text",MWF.xApplication.Execution.LP.createMainTask.drafterDate+data.createTime)
}
data = data || {
processIdentity : this.app.identity,
deployerName : this.app.user,
creatorName : this.app.user
}
if(data.id){
this.centerWorkId = data.id;
}
if(this.data.id){
this.centerWorkId = this.data.id;
this.getMainTask(this.centerWorkId, function( json ){
data = json.data
}.bind(this));
}
//alert(JSON.stringify(data))
this.mainTaskTitleDiv = new Element("div.mainTaskTitleDiv", {
"styles": this.css.mainTaskTitleDiv,
"text": this.lp.createMainTask.mainTask.topTitle
}).inject(this.mainTaskDiv);
this.mainTaskContentDiv = new Element("div.mainTaskContentDiv").inject(this.mainTaskDiv);
var html = "
| " + " | |||||
| " + " | " + " | " + " | " + " | " + " | " + " |
| " + " | |||||