MinderExplorer.min.js 3.5 KB

1
  1. MWF.xDesktop.requireApp("Template","Explorer",null,false);MWF.xDesktop.requireApp("Template","MPopupForm",null,false);MWF.xDesktop.requireApp("OKR","Minder",null,false);MWF.xApplication.OKR.MinderExplorer=new Class({Extends:MWF.xApplication.Template.Explorer,Implements:[Options,Events],options:{style:"default",hasFilter:false,isAdmin:false,searchKey:""},initialize:function(e,t,i,n){this.setOptions(n);this.app=t;this.path="/x_component_OKR/$MinderExplorer/";this.loadCss();this.actions=i;this.node=$(e);this.initData()},load:function(){this.loadToolbar();if(this.options.hasFilter)this.loadFilter();this.loadContentNode();this.loadView();this.setNodeScroll();this.app.addEvent("resize",function(){this.reloadView()}.bind(this))},reloadView:function(){if(this.viewContainerNode)this.viewContainerNode.empty();if(this.minder)delete this.minder;this.loadView()},loadView:function(){this.actions.getWorksById("010909f1-7a72-49e3-a1be-20adb39cff43",function(e){alert(JSON.stringify(e))});var e={root:{data:{id:"9f92035021ac",created:1463069003,text:"软装修"},children:[{data:{id:"b45yogtullsg",created:1463069010918,text:"包阳台"},children:[{data:{id:"3jl3i3j43",created:1463069010923,text:"凤铝"}},{data:{id:"3jl3i3j44",created:1463069010923,text:"断桥"}}]},{data:{id:"b45yohdlynco",created:1463069012113,text:"衣柜"},children:[{data:{id:"b45yohdlynco",created:1463069012113,text:"主卧"}},{data:{id:"b45yohdlynco",created:1463069012113,text:"次卧"}}]},{data:{id:"b45yohdlynco",created:1463069012113,text:"床"},children:[]},{data:{id:"b45yohdlynco",created:1463069012113,text:"餐桌"},children:[]},{data:{id:"b45yohdlynco",created:1463069012113,text:"灯具"},children:[]},{data:{id:"b45yohdlynco",created:1463069012113,text:"窗帘"},children:[]}]}};this.minder=new MWF.xApplication.OKR.Minder(this.viewContainerNode,this,e,{template:"default",theme:"fresh-blue",onClickKMNode:function(e,t){this.form=new MWF.xApplication.OKR.MinderExplorer.Form(this,t);this.form.edit()}.bind(this)});this.minder.load();this.setContentSize()},createDocument:function(){}});MWF.xApplication.OKR.MinderExplorer.View=new Class({Extends:MWF.xApplication.Template.Explorer.View,_createItem:function(e){return new MWF.xApplication.OKR.MinderExplorer.Document(this.table,e,this.explorer,this)},_getCurrentPageData:function(e,t){this.actions.listPersonSetting(function(t){if(e)e(t)})},_removeDocument:function(e,t){this.actions.deletePersonSetting(e.id,function(e){this.explorer.view.reload();this.app.notice(this.app.lp.deleteDocumentOK,"success")}.bind(this))},_create:function(){var e=new MWF.xApplication.OKR.MinderExplorer.Form(this.explorer);e.create()},_openDocument:function(e){var t=new MWF.xApplication.OKR.MinderExplorer.Form(this.explorer,e);t.edit()}});MWF.xApplication.OKR.MinderExplorer.Document=new Class({Extends:MWF.xApplication.Template.Explorer.Document});MWF.xApplication.OKR.MinderExplorer.Form=new Class({Extends:MPopupForm,_createTableContent:function(){var e="<table width='100%' bordr='0' cellpadding='5' cellspacing='0' styles='formTable'>"+"<tr><td colspan='2' styles='formTableHead'>考勤人员设置</td></tr>"+"<tr><td styles='formTabelTitle' lable='text'></td>"+" <td styles='formTableValue' item='text'></td></tr>";"</table>";this.formTableArea.set("html",e);MWF.xDesktop.requireApp("Template","MForm",function(){this.form=new MForm(this.formTableArea,this.data,{style:"popup",isEdited:this.isEdited||this.isNew,itemTemplate:{text:{text:"主题"}}},this.app);this.form.load()}.bind(this),true)},_ok:function(e,t){this.app.restActions.savePersonSetting(e,function(e){if(t)t(e)}.bind(this))}});