Main.js 112 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756
  1. MWF.xApplication.process.Application.options.multitask = true;
  2. o2.xDesktop.requireApp("Selector", "package", null, false);
  3. MWF.xDesktop.requireApp("Template", "MPopupForm", null, false);
  4. MWF.xDesktop.requireApp("Template", "MForm", null, false);
  5. MWF.xApplication.process.Application.Main = new Class({
  6. Extends: MWF.xApplication.Common.Main,
  7. Implements: [Options, Events],
  8. options: {
  9. "style1": "default",
  10. "style": "default",
  11. "name": "process.Application",
  12. "mvcStyle": "style.css",
  13. "icon": "icon.png",
  14. "application": "",
  15. "id": "",
  16. "navi" : "all",
  17. "title": MWF.xApplication.process.Application.LP.title
  18. },
  19. onQueryLoad: function(){
  20. this.lp = MWF.xApplication.process.Application.LP;
  21. this.action = o2.Actions.load("x_processplatform_assemble_surface");
  22. if (this.status) {
  23. if(this.status.id)this.options.id = this.status.id;
  24. if(this.status.navi){
  25. this.options.navi = this.status.navi;
  26. }
  27. }
  28. this._loadCss();
  29. },
  30. loadApplication: function(callback){
  31. this.initAcl(function (){
  32. this.loadProcessList(function (){
  33. this.action.ApplicationAction.get(this.options.id).then(function (json){
  34. if (json.data){
  35. this.setTitle(this.lp.title+"-"+json.data.name);
  36. this.application = json.data;
  37. var url = this.path+this.options.style+"/view/view.html";
  38. this.content.loadHtml(url, {"bind": {"acl":this.acl,"lp": this.lp,"data":{"application" : this.application}}, "module": this}, function(){
  39. this.setLayout();
  40. this.loadList(this.options.navi);
  41. if (callback) callback();
  42. }.bind(this));
  43. }
  44. }.bind(this));
  45. }.bind(this));
  46. }.bind(this));
  47. },
  48. loadApplicationIcon : function (e){
  49. var node = e.currentTarget;
  50. if (this.application.icon){
  51. node.setStyle("background-image", "url(data:image/png;base64,"+this.application.icon+")");
  52. }else{
  53. node.setStyle("background-image", "url("+"../x_component_process_Application/$Main/default/icon/application.png)");
  54. }
  55. },
  56. initAcl : function (callback){
  57. this.acl = {
  58. }
  59. this.action.ApplicationAction.isManager(this.options.id).then(function (json){
  60. this.acl.isAppManager = json.data.value;
  61. this.action.ProcessAction.listControllableWithApplication(this.options.id).then(function (json){
  62. var processList = json.data.valueList;
  63. if(processList.length>0){
  64. this.acl.isProcessManager = true;
  65. }else {
  66. this.acl.isProcessManager = false;
  67. }
  68. this.acl.processList = json.data.valueList;
  69. if(callback) callback();
  70. }.bind(this));
  71. }.bind(this));
  72. },
  73. loadProcessList : function (callback){
  74. this.action.ProcessAction.listWithPersonWithApplication(this.options.id).then(function (json){
  75. this.processList = json.data;
  76. if(callback) callback();
  77. }.bind(this));
  78. },
  79. createCountData: function(){
  80. var _self = this;
  81. if (!this.countData){
  82. this.countData = {"data": {}};
  83. var createDefineObject = function(p){
  84. return {
  85. "get": function(){return this.data[p]},
  86. "set": function(v){
  87. this.data[p] = v;
  88. _self[p+"CountNode"].set("text", v);
  89. }
  90. }
  91. };
  92. var o = {
  93. "task": createDefineObject("task"),
  94. "taskCompleted": createDefineObject("taskCompleted"),
  95. "read": createDefineObject("read"),
  96. "readCompleted": createDefineObject("readCompleted"),
  97. "draft": createDefineObject("draft"),
  98. };
  99. MWF.defineProperties(this.countData, o);
  100. }
  101. },
  102. loadCount: function(){
  103. this.createCountData();
  104. this.action.WorkAction.countWithPersonAndApplication(layout.session.user.id,this.application.id).then(function(json){
  105. this.countData.task = json.data.task;
  106. this.countData.taskCompleted = json.data.taskCompleted;
  107. this.countData.read = json.data.read;
  108. this.countData.readCompleted = json.data.readCompleted;
  109. }.bind(this));
  110. this.action.DraftAction.listMyPaging(1,1, {"applicationList":[this.application.id]}).then(function(json){
  111. this.countData.draft = json.count;
  112. }.bind(this));
  113. },
  114. loadList: function(type,ev,data){
  115. if (this.currentMenu) this.setMenuItemStyleDefault(this.currentMenu);
  116. this.setMenuItemStyleCurrent(this[type+"MenuNode"]);
  117. this.currentMenu = this[type+"MenuNode"];
  118. this._loadListContent(type);
  119. this.loadCount();
  120. },
  121. _loadListContent: function(type){
  122. this.mainNode.empty();
  123. list = new MWF.xApplication.process.Application[type.capitalize() +"List"](this.mainNode,this, {
  124. "onLoadData": function (){
  125. this.hideSkeleton();
  126. },
  127. "type" : type,
  128. "key" : this.options.key
  129. });
  130. this.currentList = list;
  131. },
  132. setLayout: function(){
  133. var items = this.content.getElements(".menuItem");
  134. items.addEvents({
  135. "mouseover": function(){this.addClass("menuItem_over")},
  136. "mouseout": function(){this.removeClass("menuItem_over")},
  137. "click": function(){}
  138. });
  139. },
  140. startProcess: function(){
  141. this.action.ProcessAction.listWithPersonWithApplication(this.application.id).then(function (json){
  142. var node = new Element("div");
  143. var url = this.path+this.options.style+"/view/dlg/processList.html";
  144. node.loadHtml(url, {"bind": {"lp": this.lp,"processList":json.data}, "module": this}, function(){
  145. this.startProcessDlg = o2.DL.open({
  146. "title": this.lp.startProcess,
  147. "width": "400px",
  148. "height": "260px",
  149. "mask": true,
  150. "content": node,
  151. "container": null,
  152. "positionNode": this.content,
  153. "onQueryClose": function () {
  154. node.destroy();
  155. }.bind(this),
  156. "buttonList": [
  157. ],
  158. "onPostShow": function () {
  159. this.startProcessDlg.reCenter();
  160. }.bind(this)
  161. });
  162. }.bind(this));
  163. }.bind(this));
  164. },
  165. startProcessItemOver: function(e){
  166. var node = e.target;
  167. while (node && !node.hasClass("st_processItem")){ node = node.getParent();}
  168. if (node){
  169. node.addClass("menuItem_over");
  170. node.removeClass("mainColor_bg");
  171. }
  172. },
  173. startProcessItemOut: function(e){
  174. var node = e.target;
  175. while (node && !node.hasClass("st_processItem")){ node = node.getParent();}
  176. if (node){
  177. node.removeClass("menuItem_over");
  178. node.removeClass("mainColor_bg");
  179. }
  180. },
  181. startProcessItemDown: function(e){
  182. var node = e.target;
  183. while (node && !node.hasClass("st_processItem")){ node = node.getParent();}
  184. if (node){
  185. node.removeClass("menuItem_over");
  186. node.addClass("mainColor_bg");
  187. }
  188. },
  189. startProcessItemUp: function(e){
  190. var node = e.target;
  191. while (node && !node.hasClass("st_processItem")){ node = node.getParent();}
  192. if (node){
  193. node.addClass("menuItem_over");
  194. node.removeClass("mainColor_bg");
  195. }
  196. },
  197. startProcessItemClick: function(e, data){
  198. this.startProcessDlg.close();
  199. MWF.xDesktop.requireApp("process.TaskCenter", "ProcessStarter", function(){
  200. var starter = new MWF.xApplication.process.TaskCenter.ProcessStarter(data, this, {
  201. "onStarted": function(workdata, title, processName){
  202. this.afterStartProcess(workdata, title, processName, data);
  203. }.bind(this)
  204. });
  205. starter.load();
  206. }.bind(this));
  207. },
  208. afterStartProcess: function(data, title, processName, processdata){
  209. if (data.work){
  210. this.startProcessDraft(data, title, processName);
  211. }else{
  212. this.startProcessInstance(data, title, processName);
  213. }
  214. },
  215. startProcessDraft: function(data, title, processName){
  216. var work = data.work;
  217. var options = {"draft": work, "appId": "process.Work"+(new o2.widget.UUID).toString(), "desktopReload": false,
  218. "onPostClose": function(){
  219. if (this.currentList.refresh) this.currentList.refresh();
  220. }.bind(this)
  221. };
  222. this.desktop.openApplication(null, "process.Work", options);
  223. },
  224. startProcessInstance: function(data, title, processName){
  225. var workInfors = [];
  226. var currentTask = [];
  227. data.each(function(work){
  228. if (work.currentTaskIndex !== -1) currentTask.push(work.taskList[work.currentTaskIndex].work);
  229. workInfors.push(this.getStartWorkInforObj(work));
  230. }.bind(this));
  231. if (currentTask.length===1){
  232. var options = {"workId": currentTask[0], "appId": "process.Work"+currentTask[0],
  233. "onPostClose": function(){
  234. if (this.currentList.refresh) this.currentList.refresh();
  235. }.bind(this)
  236. };
  237. this.desktop.openApplication(null, "process.Work", options);
  238. if (layout.desktop.message) this.createStartWorkResault(workInfors, title, processName, false);
  239. }else{
  240. if (layout.desktop.message) this.createStartWorkResault(workInfors, title, processName, true);
  241. }
  242. },
  243. getStartWorkInforObj: function(work){
  244. var users = [];
  245. var currentTask = "";
  246. work.taskList.each(function(task, idx){
  247. users.push(task.person+"("+task.department + ")");
  248. if (work.currentTaskIndex===idx) currentTask = task.id;
  249. }.bind(this));
  250. return {"activity": work.fromActivityName, "users": users, "currentTask": currentTask};
  251. },
  252. setMenuItemStyleDefault: function(node){
  253. node.removeClass("mainColor_bg_opacity");
  254. node.getFirst().removeClass("mainColor_color");
  255. node.getLast().removeClass("mainColor_color");
  256. },
  257. setMenuItemStyleCurrent: function(node){
  258. node.addClass("mainColor_bg_opacity");
  259. node.getFirst().addClass("mainColor_color");
  260. node.getLast().addClass("mainColor_color");
  261. },
  262. recordStatus: function(){
  263. return { "id": this.options.id};
  264. }
  265. });
  266. MWF.xApplication.process.Application.List = new Class({
  267. Implements: [Options, Events],
  268. options: {
  269. "type": "all",
  270. "itemHeight": 40,
  271. },
  272. initialize: function (node,app, options) {
  273. this.setOptions(options);
  274. this.app = app;
  275. this.container = node;
  276. this.lp = this.app.lp;
  277. this.css = this.app.css;
  278. this.action = app.action;
  279. this.type = this.options.type;
  280. this.application = app.application;
  281. var url = this.app.path+this.app.options.style+"/view/content.html";
  282. this.container.loadHtml(url, {"bind": {"lp": this.lp,"data":{"type":this.type}}, "module": this}, function(){
  283. this.content = this.listContentNode;
  284. this.bottomNode = this.listBottomNode;
  285. this.pageNode = this.pageNumberAreaNode;
  286. this.init();
  287. this.load();
  288. }.bind(this));
  289. },
  290. loadFilter: function () {
  291. var lp = this.lp;
  292. this.fileterNode = new Element("div.fileterNode", {
  293. "styles": this.css.fileterNode
  294. }).inject(this.searchNode);
  295. var html = "<table bordr='0' cellpadding='0' cellspacing='0' styles='filterTable'>" + //style='width: 900px;'
  296. "<tr>" +
  297. " <td styles='filterTableTitle' lable='title'></td>" +
  298. " <td styles='filterTableValue' item='title'></td>" +
  299. " <td styles='filterTableTitle' lable='activityName'></td>" +
  300. " <td styles='filterTableValue' item='activityName'></td>" +
  301. " <td styles='filterTableTitle' lable='creatorUnitList'></td>" +
  302. " <td styles='filterTableValue' item='creatorUnitList'></td>" +
  303. " <td styles='filterTableTitle' lable='credentialList'></td>" +
  304. " <td styles='filterTableValue' item='credentialList'></td>" +
  305. "</tr>" +
  306. "<tr style='height: 45px;'>" +
  307. " <td styles='filterTableTitle' lable='processName'></td>" +
  308. " <td styles='filterTableValue' item='processName'></td>" +
  309. " <td styles='filterTableTitle' lable='startTime'></td>" +
  310. " <td styles='filterTableValue' item='startTime'></td>" +
  311. " <td styles='filterTableTitle' lable='endTime'></td>" +
  312. " <td styles='filterTableValue' item='endTime'></td>" +
  313. " <td styles='filterTableValue' colspan='2'><div style='float:left' item='action'></div><div item='reset'></div></td>" +
  314. "</tr>" +
  315. "</table>";
  316. this.fileterNode.set("html", html);
  317. this.form = new MForm(this.fileterNode, {}, {
  318. style: "attendance",
  319. isEdited: true,
  320. itemTemplate: {
  321. title: {text: lp.subject, "type": "text", "style": {"min-width": "150px"}},
  322. activityName: {text: lp.activity, "type": "text", "style": {"min-width": "150px"}},
  323. processName: {
  324. text: lp.process,
  325. "type": "text",
  326. "style": {"min-width": "150px"},
  327. "event": {
  328. "click": function (item, ev){
  329. var v = item.getValue();
  330. o2.xDesktop.requireApp("Selector", "package", function(){
  331. var options = {
  332. "type": "Process",
  333. "values": v!==""?[item.getValue().split("|")[1]] : [],
  334. "count": 1,
  335. "onComplete": function (items) {
  336. var arr = [];
  337. var arr2 = [];
  338. items.each(function (data) {
  339. arr.push(data.data);
  340. arr2.push(items[0].data.name+"|"+items[0].data.id);
  341. });
  342. item.setValue(arr2.join(","));
  343. }.bind(this)
  344. };
  345. new o2.O2Selector(this.app.desktop.node, options);
  346. }.bind(this),false);
  347. }.bind(this)}
  348. },
  349. credentialList: {
  350. "text": lp.creator,
  351. "type": "org",
  352. "orgType": "identity",
  353. "orgOptions": {"resultType": "person"},
  354. "style": {"min-width": "150px"},
  355. "orgWidgetOptions": {"disableInfor": true}
  356. },
  357. creatorUnitList: {
  358. "text": lp.createunit,
  359. "type": "org",
  360. "orgType": "unit",
  361. "orgOptions": {"resultType": "person"},
  362. "style": {"min-width": "150px"},
  363. "orgWidgetOptions": {"disableInfor": true}
  364. },
  365. startTime: {
  366. text: lp.begin,
  367. "tType": "date",
  368. "style": {"min-width":"150px"}
  369. },
  370. endTime: {
  371. text: lp.end,
  372. "tType": "date",
  373. "style": {"min-width":"150px"}
  374. },
  375. action: {
  376. "value": this.lp.query, type: "button", className: "filterButton", event: {
  377. click: function () {
  378. var result = this.form.getResult(false, null, false, false, false);
  379. for (var key in result) {
  380. if (!result[key]) {
  381. delete result[key];
  382. } else if (key === "activityName" && result[key].length > 0) {
  383. //result[key] = result[key][0].split("@")[1];
  384. result["activityNameList"] = [result[key]];
  385. delete result[key];
  386. }else if (key === "processName" && result[key] !== "") {
  387. //result[key] = result[key][0].split("@")[1];
  388. result["processList"] = [result[key].split("|")[1]];
  389. delete result[key];
  390. }else if (key === "endTime" && result[key] !== "") {
  391. result[key] = result[key] + " 23:59:59"
  392. }
  393. }
  394. result.applicationList = this.filterList.applicationList;
  395. if(result.credentialList) {
  396. result.creatorPersonList = result.credentialList;
  397. }
  398. this.filterList = result;
  399. this.refresh();
  400. }.bind(this)
  401. }
  402. },
  403. reset: {
  404. "value": this.lp.reset, type: "button", className: "filterButtonGrey", event: {
  405. click: function () {
  406. this.form.reset();
  407. this._initFilter();
  408. this.refresh();
  409. }.bind(this)
  410. }
  411. },
  412. }
  413. }, this.app, this.css);
  414. this.form.load();
  415. },
  416. showSkeleton: function(){
  417. if (this.skeletonNode) this.skeletonNode.inject(this.listContentNode);
  418. },
  419. hideSkeleton: function(){
  420. if (this.skeletonNode) this.skeletonNode.dispose();
  421. },
  422. loadListTitle : function (){
  423. this.listTitleNode.empty();
  424. this.listTitleNode.loadHtml(this.titleTempleteUrl, {"bind": {"lp": this.lp}, "module": this}, function(){
  425. this.currentSortNode = this.sortUpdateTimeNode;
  426. this.currentSortKey = "name";
  427. }.bind(this));
  428. },
  429. selectAll : function (e){
  430. if (e.currentTarget.get("disabled").toString()!="true"){
  431. var itemNode = e.currentTarget.getParent(".listItem");
  432. var iconNode = e.currentTarget.getElement(".selectFlagIcon");
  433. if (itemNode){
  434. if (itemNode.hasClass("mainColor_bg_opacity")){
  435. itemNode.removeClass("mainColor_bg_opacity");
  436. iconNode.removeClass("icon-xuanzhong");
  437. iconNode.removeClass("selectFlagIcon_select");
  438. iconNode.removeClass("mainColor_color");
  439. this.listContentNode.getElements("tr").each(function (tr){
  440. tr.removeClass("mainColor_bg_opacity");
  441. var ss = tr.getElement(".selectFlagIcon");
  442. tr.getElement(".selectFlag").hide();
  443. ss.removeClass("icon-xuanzhong");
  444. ss.removeClass("selectFlagIcon_select");
  445. ss.removeClass("mainColor_color");
  446. })
  447. this.selectedList = [];
  448. }else{
  449. itemNode.addClass("mainColor_bg_opacity");
  450. iconNode.addClass("icon-xuanzhong");
  451. iconNode.addClass("selectFlagIcon_select");
  452. iconNode.addClass("mainColor_color");
  453. this.listContentNode.getElements("tr").each(function (tr){
  454. tr.getElement(".selectFlag").show();
  455. tr.addClass("mainColor_bg_opacity");
  456. var ss = tr.getElement(".selectFlagIcon");
  457. ss.addClass("icon-xuanzhong");
  458. ss.addClass("selectFlagIcon_select");
  459. ss.addClass("mainColor_color");
  460. })
  461. this.selectedList.append(this.dataList);
  462. }
  463. }
  464. }
  465. this._setToolBar();
  466. },
  467. loadItems: function(data){
  468. this.dataList = data;
  469. this.content.loadHtml(this.listTempleteUrl, {"bind": {"lp": this.lp, "type": this.options.type, "data": data}, "module": this}, function(){
  470. this.node = this.content.getFirst();
  471. }.bind(this));
  472. },
  473. init: function(){
  474. this.listHeight = this.content.getSize().y - this.options.itemHeight - 60;
  475. this.size = (this.listHeight/this.options.itemHeight).toInt();
  476. this.size = 15;
  477. this.page = 1;
  478. this.loadFilter();
  479. this._initFilter();
  480. this.filterNameList = {};
  481. },
  482. _initFilter : function(){
  483. this.filterList = {
  484. applicationList : [this.application.id]
  485. };
  486. },
  487. _initTempate: function () {
  488. this.titleTempleteUrl = this.app.path + this.app.options.style + "/view/" + this.type + "/list_title.html";
  489. this.listTempleteUrl = this.app.path + this.app.options.style + "/view/" + this.type + "/list.html";
  490. },
  491. load: function(){
  492. var _self = this;
  493. this._initToolBar();
  494. this._initTempate();
  495. this.loadListTitle();
  496. if(this.toolbarItems.unSelect.length>0){
  497. this.loadToolBar(this.toolbarItems.unSelect);
  498. }else {
  499. this.loadToolBar(this.toolbarItems.default,true);
  500. }
  501. this.selectedList = [];
  502. this.loadData().then(function(data){
  503. _self.hide();
  504. _self.loadPage();
  505. _self.loadItems(data);
  506. });
  507. },
  508. _initToolBar : function (){
  509. this.toolbarItems = {
  510. "default":[
  511. ],
  512. "unSelect":[
  513. ],
  514. "selected":[
  515. ],
  516. "mulSelect":[
  517. ]
  518. }
  519. },
  520. loadToolBar : function (availableTool,disabled){
  521. this.toolBarNode.empty();
  522. this.toolbar = new MWF.xApplication.process.Application.Toolbar(this.toolBarNode, this, {
  523. viewType : this.options.defaultViewType,
  524. type : this.type,
  525. disabled : !!disabled,
  526. availableTool : availableTool
  527. });
  528. this.toolbar.load();
  529. if(availableTool.length===0){
  530. this.toolBarNode.hide();
  531. }else {
  532. this.toolBarNode.show();
  533. }
  534. },
  535. refresh: function(){
  536. this.hide();
  537. this.load();
  538. this.app.loadCount();
  539. },
  540. hide: function(){
  541. if (this.node) this.node.destroy();
  542. },
  543. loadPage: function(){
  544. var totalCount = this.total;
  545. var pages = totalCount/this.size;
  546. var pageCount = pages.toInt();
  547. if (pages !== pageCount) pageCount = pageCount+1;
  548. this.pageCount = pageCount;
  549. var size = this.bottomNode.getSize();
  550. var maxPageSize = 500;//size.x*0.8;
  551. maxPageSize = maxPageSize - 80*2-24*2-10*3;
  552. var maxPageCount = (maxPageSize/34).toInt();
  553. this.loadPageNode(pageCount, maxPageCount);
  554. },
  555. loadPageNode: function(pageCount, maxPageCount){
  556. var pageStart = 1;
  557. var pageEnd = pageCount;
  558. if (pageCount>maxPageCount){
  559. var halfCount = (maxPageCount/2).toInt();
  560. pageStart = Math.max(this.page-halfCount, 1);
  561. pageEnd = pageStart+maxPageCount-1;
  562. pageEnd = Math.min(pageEnd, pageCount);
  563. pageStart = pageEnd - maxPageCount+1;
  564. }
  565. this.pageNode.empty();
  566. var _self = this;
  567. for (var i=pageStart; i<=pageEnd; i++){
  568. var node = new Element("div.pageItem", {
  569. "text": i,
  570. "events": { "click": function(){_self.gotoPage(this.get("text"));} }
  571. }).inject(this.pageNode);
  572. if (i==this.page) node.addClass("mainColor_bg");
  573. }
  574. },
  575. nextPage: function(){
  576. this.page++;
  577. if (this.page>this.pageCount) this.page = this.pageCount;
  578. this.gotoPage(this.page);
  579. },
  580. prevPage: function(){
  581. this.page--;
  582. if (this.page<1) this.page = 1;
  583. this.gotoPage(this.page);
  584. },
  585. firstPage: function(){
  586. this.gotoPage(1);
  587. },
  588. lastPage: function(){
  589. this.gotoPage(this.pageCount);
  590. },
  591. gotoPage: function(page){
  592. this.page = page;
  593. this.hide();
  594. this.showSkeleton();
  595. this.load();
  596. },
  597. loadData: function(){
  598. },
  599. _fixData : function (dataList){
  600. dataList.each(function (data){
  601. data.creatorPersonName = data.creatorPerson.split("@")[0];
  602. data.creatorUnitName = data.creatorUnit.split("@")[0];
  603. }.bind(this));
  604. return dataList;
  605. },
  606. overTaskItem: function(e){
  607. e.currentTarget.addClass("listItem_over");
  608. var iconNode = e.currentTarget.getElement(".selectFlagIcon");
  609. if (iconNode.hasClass("selectFlagIcon_select")){
  610. }else{
  611. e.currentTarget.getElement(".selectFlag").show();
  612. }
  613. },
  614. outTaskItem: function(e){
  615. e.currentTarget.removeClass("listItem_over");
  616. var iconNode = e.currentTarget.getElement(".selectFlagIcon");
  617. if (iconNode.hasClass("selectFlagIcon_select")){
  618. }else{
  619. e.currentTarget.getElement(".selectFlag").hide();
  620. }
  621. },
  622. loadItemIcon: function(application, e){
  623. return
  624. this.app.loadItemIcon(application, e);
  625. },
  626. selectFile: function(id,e, dataList){
  627. var data ;
  628. for(var i = 0 ; i < this.dataList.length;i++){
  629. if(this.dataList[i].id === id){
  630. data = this.dataList[i];
  631. break ;
  632. }
  633. }
  634. if (e.currentTarget.get("disabled").toString()!="true"){
  635. var itemNode = e.currentTarget.getParent(".listItem");
  636. var iconNode = e.currentTarget.getElement(".selectFlagIcon");
  637. if (itemNode){
  638. if (itemNode.hasClass("mainColor_bg_opacity")){
  639. itemNode.removeClass("mainColor_bg_opacity");
  640. iconNode.removeClass("icon-xuanzhong");
  641. iconNode.removeClass("selectFlagIcon_select");
  642. iconNode.removeClass("mainColor_color");
  643. this.unselectedFile(data);
  644. }else{
  645. itemNode.addClass("mainColor_bg_opacity");
  646. iconNode.addClass("icon-xuanzhong");
  647. iconNode.addClass("selectFlagIcon_select");
  648. iconNode.addClass("mainColor_color");
  649. this.selectedFile(data);
  650. }
  651. }
  652. }
  653. this._setToolBar();
  654. },
  655. _setToolBar : function (){
  656. if(this.selectedList.length === 0 ){
  657. if(this.toolbarItems.unSelect.length>0){
  658. this.loadToolBar(this.toolbarItems.unSelect);
  659. }else {
  660. this.loadToolBar(this.toolbarItems.default,true);
  661. }
  662. } else if (this.selectedList.length === 1){
  663. this.loadToolBar(this.toolbarItems.selected);
  664. }else{
  665. this.loadToolBar(this.toolbarItems.mulSelect);
  666. }
  667. },
  668. selectedFile: function(data){
  669. if (!this.selectedList) this.selectedList = [];
  670. var idx = this.selectedList.findIndex(function(t){
  671. return t.id == data.id;
  672. });
  673. if (idx===-1) this.selectedList.push(data);
  674. },
  675. unselectedFile: function(data){
  676. // delete data._;
  677. if (!this.selectedList) this.selectedList = [];
  678. var idx = this.selectedList.findIndex(function(t){
  679. return t.id == data.id;
  680. });
  681. if (idx!==-1) this.selectedList.splice(idx, 1);
  682. },
  683. open : function (work,workCompleted){
  684. var options = {
  685. "workId": work,
  686. "workCompletedId": workCompleted,
  687. "appId": "process.Work" + work
  688. };
  689. layout.desktop.openApplication(null, "process.Work", options);
  690. }
  691. });
  692. MWF.xApplication.process.Application.AllList = new Class({
  693. Extends: MWF.xApplication.process.Application.List,
  694. loadData: function(){
  695. var _self = this;
  696. this.filterList.relateTask = true;
  697. return this.action.ReviewAction.V2ListPaging(this.page, this.size, this.filterList||{}).then(function(json){
  698. _self.fireEvent("loadData");
  699. _self.total = json.count;
  700. return _self._fixData(json.data);
  701. }.bind(this));
  702. },
  703. loadFilter: function () {
  704. var lp = this.lp;
  705. this.fileterNode = new Element("div.fileterNode", {
  706. "styles": this.css.fileterNode
  707. }).inject(this.searchNode);
  708. var html = "<table bordr='0' cellpadding='0' cellspacing='0' styles='filterTable'>" + //style='width: 900px;'
  709. "<tr>" +
  710. " <td styles='filterTableTitle' lable='title'></td>" +
  711. " <td styles='filterTableValue' item='title'></td>" +
  712. " <td styles='filterTableTitle' lable='creatorUnitList'></td>" +
  713. " <td styles='filterTableValue' item='creatorUnitList'></td>" +
  714. " <td styles='filterTableTitle' lable='credentialList'></td>" +
  715. " <td styles='filterTableValue' item='credentialList'></td>" +
  716. " <td styles='filterTableValue'></td>" +
  717. "</tr>" +
  718. "<tr style='height: 45px;'>" +
  719. " <td styles='filterTableTitle' lable='processName'></td>" +
  720. " <td styles='filterTableValue' item='processName'></td>" +
  721. " <td styles='filterTableTitle' lable='startTime'></td>" +
  722. " <td styles='filterTableValue' item='startTime'></td>" +
  723. " <td styles='filterTableTitle' lable='endTime'></td>" +
  724. " <td styles='filterTableValue' item='endTime'></td>" +
  725. " <td styles='filterTableValue' style='width: 150px'><div style='float:left' item='action'></div><div item='reset'></div></td>" +
  726. "</tr>" +
  727. "</table>";
  728. this.fileterNode.set("html", html);
  729. var selectValue = [""];
  730. var selectText = [""];
  731. this.app.processList.each(function(d){
  732. selectValue.push(d.id);
  733. selectText.push(d.name);
  734. })
  735. this.form = new MForm(this.fileterNode, {}, {
  736. style: "attendance",
  737. isEdited: true,
  738. itemTemplate: {
  739. title: {text: lp.subject, "type": "text", "style": {"min-width": "150px"}},
  740. processName: {
  741. "text": lp.process,
  742. "type": "select",
  743. "selectValue" :selectValue,
  744. "selectText" :selectText,
  745. "style": {"min-width": "150px"},
  746. },
  747. credentialList: {
  748. "text": lp.creator,
  749. "type": "org",
  750. "orgType": "identity",
  751. "orgOptions": {"resultType": "person"},
  752. "style": {"min-width": "150px"},
  753. "orgWidgetOptions": {"disableInfor": true}
  754. },
  755. creatorUnitList: {
  756. "text": lp.createunit,
  757. "type": "org",
  758. "orgType": "unit",
  759. "orgOptions": {"resultType": "person"},
  760. "style": {"min-width": "150px"},
  761. "orgWidgetOptions": {"disableInfor": true}
  762. },
  763. startTime: {
  764. text: lp.begin,
  765. "tType": "date",
  766. "style": {"min-width":"150px"}
  767. },
  768. endTime: {
  769. text: lp.end,
  770. "tType": "date",
  771. "style": {"min-width":"150px"}
  772. },
  773. action: {
  774. "value": this.lp.query, type: "button", className: "filterButton", event: {
  775. click: function () {
  776. var result = this.form.getResult(false, null, false, false, false);
  777. for (var key in result) {
  778. if (!result[key]) {
  779. delete result[key];
  780. } else if (key === "activityName" && result[key].length > 0) {
  781. //result[key] = result[key][0].split("@")[1];
  782. result["activityNameList"] = [result[key]];
  783. delete result[key];
  784. }else if (key === "processName" && result[key] !== "") {
  785. //result[key] = result[key][0].split("@")[1];
  786. result["processList"] = [result[key]];
  787. delete result[key];
  788. }else if (key === "endTime" && result[key] !== "") {
  789. result[key] = result[key] + " 23:59:59"
  790. }
  791. }
  792. result.applicationList = this.filterList.applicationList;
  793. if(result.credentialList) {
  794. result.creatorPersonList = result.credentialList;
  795. }
  796. this.filterList = result;
  797. this.refresh();
  798. }.bind(this)
  799. }
  800. },
  801. reset: {
  802. "value": this.lp.reset, type: "button", className: "filterButtonGrey", event: {
  803. click: function () {
  804. this.form.reset();
  805. this._initFilter();
  806. this.refresh();
  807. }.bind(this)
  808. }
  809. },
  810. }
  811. }, this.app, this.css);
  812. this.form.load();
  813. },
  814. _fixData : function (dataList){
  815. dataList.each(function (data){
  816. data.creatorPersonName = data.creatorPerson.split("@")[0];
  817. data.creatorUnitName = data.creatorUnit.split("@")[0];
  818. if(data.completed) {
  819. data.activityName = "结束";
  820. }else {
  821. if(data.taskList.length >0){
  822. data.activityName = data.taskList[0].activityName;
  823. }
  824. }
  825. }.bind(this));
  826. return dataList;
  827. },
  828. });
  829. MWF.xApplication.process.Application.TaskList = new Class({
  830. Extends: MWF.xApplication.process.Application.List,
  831. loadData: function(){
  832. var _self = this;
  833. return this.action.TaskAction.V2ListPaging(this.page, this.size, this.filterList||{}).then(function(json){
  834. _self.fireEvent("loadData");
  835. _self.total = json.count;
  836. return _self._fixData(json.data);
  837. }.bind(this));
  838. },
  839. });
  840. MWF.xApplication.process.Application.TaskDoneList = new Class({
  841. Extends: MWF.xApplication.process.Application.List,
  842. loadData: function(){
  843. var _self = this;
  844. this.filterList = this.filterList||{};
  845. this.filterList.latest = true;
  846. return this.action.TaskCompletedAction.V2ListPaging(this.page, this.size, this.filterList).then(function(json){
  847. _self.fireEvent("loadData");
  848. _self.total = json.count;
  849. return _self._fixData(json.data);
  850. }.bind(this));
  851. },
  852. });
  853. MWF.xApplication.process.Application.ReadList = new Class({
  854. Extends: MWF.xApplication.process.Application.List,
  855. loadData: function(){
  856. var _self = this;
  857. return this.action.ReadAction.V2ListPaging(this.page, this.size, this.filterList||{}).then(function(json){
  858. _self.fireEvent("loadData");
  859. _self.total = json.count;
  860. return _self._fixData(json.data);
  861. }.bind(this));
  862. },
  863. });
  864. MWF.xApplication.process.Application.ReadDoneList = new Class({
  865. Extends: MWF.xApplication.process.Application.List,
  866. loadData: function(){
  867. var _self = this;
  868. return this.action.ReadCompletedAction.V2ListPaging(this.page, this.size, this.filterList||{}).then(function(json){
  869. _self.fireEvent("loadData");
  870. _self.total = json.count;
  871. return _self._fixData(json.data);
  872. }.bind(this));
  873. },
  874. });
  875. MWF.xApplication.process.Application.DraftList = new Class({
  876. Extends: MWF.xApplication.process.Application.List,
  877. loadData: function(){
  878. var _self = this;
  879. return this.action.DraftAction.listMyPaging(this.page, this.size, this.filterList||{}).then(function(json){
  880. _self.fireEvent("loadData");
  881. _self.total = json.count;
  882. return _self._fixData(json.data);
  883. }.bind(this));
  884. },
  885. _fixData : function (dataList){
  886. dataList.each(function(d){
  887. if(d.title === "") d.title = this.lp.unnamed;
  888. }.bind(this));
  889. return dataList;
  890. },
  891. loadFilter: function () {
  892. var lp = this.lp;
  893. this.fileterNode = new Element("div.fileterNode", {
  894. "styles": this.css.fileterNode
  895. }).inject(this.searchNode);
  896. var html = "<table bordr='0' cellpadding='0' cellspacing='0' styles='filterTable'>" + //style='width: 900px;'
  897. "<tr style='height: 45px;'>" +
  898. " <td styles='filterTableTitle' lable='title'></td>" +
  899. " <td styles='filterTableValue' item='title'></td>" +
  900. " <td styles='filterTableTitle' lable='processName'></td>" +
  901. " <td styles='filterTableValue' item='processName'></td>" +
  902. " <td styles='filterTableTitle' lable='startTime'></td>" +
  903. " <td styles='filterTableValue' item='startTime'></td>" +
  904. " <td styles='filterTableTitle' lable='endTime'></td>" +
  905. " <td styles='filterTableValue' item='endTime'></td>" +
  906. " <td styles='filterTableValue' style='width: 200px'><div style='float:left' item='action'></div><div item='reset'></div></td>" +
  907. "</tr>" +
  908. "</table>";
  909. this.fileterNode.set("html", html);
  910. var selectValue = [""];
  911. var selectText = [""];
  912. this.app.processList.each(function(d){
  913. selectValue.push(d.id);
  914. selectText.push(d.name);
  915. })
  916. this.form = new MForm(this.fileterNode, {}, {
  917. style: "attendance",
  918. isEdited: true,
  919. itemTemplate: {
  920. title: {text: lp.subject, "type": "text", "style": {"min-width": "150px"}},
  921. processName: {
  922. "text": lp.process,
  923. "type": "select",
  924. "selectValue" :selectValue,
  925. "selectText" :selectText,
  926. "style": {"min-width": "150px"},
  927. },
  928. startTime: {
  929. text: lp.begin,
  930. "tType": "date",
  931. "style": {"min-width":"150px"}
  932. },
  933. endTime: {
  934. text: lp.end,
  935. "tType": "date",
  936. "style": {"min-width":"150px"}
  937. },
  938. action: {
  939. "value": lp.query, type: "button", className: "filterButton", event: {
  940. click: function () {
  941. var result = this.form.getResult(false, null, false, false, false);
  942. for (var key in result) {
  943. if (!result[key]) {
  944. delete result[key];
  945. } else if (key === "activityName" && result[key].length > 0) {
  946. //result[key] = result[key][0].split("@")[1];
  947. result["activityNameList"] = [result[key]];
  948. delete result[key];
  949. }else if (key === "processName" && result[key] !== "") {
  950. //result[key] = result[key][0].split("@")[1];
  951. result["processList"] = [result[key]];
  952. delete result[key];
  953. }else if (key === "endTime" && result[key] !== "") {
  954. result[key] = result[key] + " 23:59:59"
  955. }
  956. }
  957. this.filterList = result;
  958. this.refresh();
  959. }.bind(this)
  960. }
  961. },
  962. reset: {
  963. "value": lp.reset, type: "button", className: "filterButtonGrey", event: {
  964. click: function () {
  965. this.form.reset();
  966. this._initFilter();
  967. this.refresh();
  968. }.bind(this)
  969. }
  970. },
  971. }
  972. }, this.app, this.css);
  973. this.form.load();
  974. },
  975. open : function (id){
  976. var options = {
  977. "draftId": id,
  978. "appId": "process.Work" + id
  979. };
  980. layout.desktop.openApplication(null, "process.Work", options);
  981. }
  982. });
  983. MWF.xApplication.process.Application.WorkList = new Class({
  984. Extends: MWF.xApplication.process.Application.List,
  985. loadData: function(){
  986. var _self = this;
  987. this.filterList.relateEditionProcess = true;
  988. return this.action.WorkAction.manageListWithApplicationPaging(this.page, this.size, this.application.id,this.filterList||{}).then(function(json){
  989. _self.fireEvent("loadData");
  990. _self.total = json.count;
  991. return _self._fixData(json.data);
  992. }.bind(this));
  993. },
  994. _initToolBar : function (){
  995. this.toolbarItems = {
  996. "default":[
  997. ["delWork","jump","sendRead"],
  998. ["processing","endWork","addReview"],
  999. ["manage"]
  1000. ],
  1001. "unSelect":[
  1002. ],
  1003. "selected":[
  1004. ["delWork","jump","sendRead"],
  1005. ["processing","endWork","addReview"],
  1006. ["manage"]
  1007. ],
  1008. "mulSelect":[
  1009. ["delWork"],
  1010. ["processing","endWork","addReview"]
  1011. ]
  1012. }
  1013. },
  1014. open : function (id){
  1015. var options = {
  1016. "workId": id,
  1017. "appId": "process.Work" + id
  1018. };
  1019. layout.desktop.openApplication(null, "process.Work", options);
  1020. },
  1021. manage : function (id,ev,dataList){
  1022. var data ;
  1023. for(var i = 0 ; i < dataList.length;i++){
  1024. if(dataList[i].id === id){
  1025. data = dataList[i];
  1026. break ;
  1027. }
  1028. }
  1029. this._manage(data);
  1030. },
  1031. _manage : function (data){
  1032. var form;
  1033. form = new MWF.xApplication.process.Application.ManageWorkForm({app: this.app}, data );
  1034. form.open();
  1035. },
  1036. delete : function(id,e){
  1037. var _self = this;
  1038. this.app.confirm("warn", e,"删除确认!!", {
  1039. "html": "<br/>请选择删除方式? <br/><input type='radio' value='soft' name='delete_type'/>软删除(可恢复)" +
  1040. "<br/><input type='radio' value='delete' name='delete_type'/>硬删除(不能恢复)<div class='checkInfor'></div>"
  1041. }, 400, 200, function(){
  1042. var inputs = this.content.getElements("input");
  1043. var flag = "";
  1044. for (var i=0; i<inputs.length; i++){
  1045. if (inputs[i].checked){
  1046. flag = inputs[i].get("value");
  1047. break;
  1048. }
  1049. }
  1050. if (flag){
  1051. _self.action[flag === "soft"?"SnapAction":"WorkAction"][flag === "soft"?"typeAbandoned":"delete"]( id , function(){
  1052. _self.app.notice("成功删除工作。");
  1053. _self.refresh();
  1054. });
  1055. this.close();
  1056. }else{
  1057. this.content.getElement(".checkInfor").set("text", "请选择删除方式!").setStyle("color", "red");
  1058. }
  1059. }, function(){
  1060. this.close();
  1061. });
  1062. }
  1063. });
  1064. MWF.xApplication.process.Application.WorkCompletedList = new Class({
  1065. Extends: MWF.xApplication.process.Application.List,
  1066. loadData: function(){
  1067. var _self = this;
  1068. this.filterList.relateEditionProcess = true;
  1069. return this.action.WorkCompletedAction.manageListWithApplicationPaging(this.page, this.size,this.application.id, this.filterList||{}).then(function(json){
  1070. _self.fireEvent("loadData");
  1071. _self.total = json.count;
  1072. return _self._fixData(json.data);
  1073. }.bind(this));
  1074. },
  1075. _initToolBar : function (){
  1076. this.toolbarItems = {
  1077. "default":[
  1078. ["delCompletedWork"],
  1079. ["rollback","sendRead","addReview"],
  1080. ["manage"]
  1081. ],
  1082. "unSelect":[
  1083. ],
  1084. "selected":[
  1085. ["delCompletedWork"],
  1086. ["rollback","sendRead","addReview"],
  1087. ["manage"]
  1088. ],
  1089. "mulSelect":[
  1090. ["delCompletedWork"],
  1091. ["sendRead","addReview"]
  1092. ]
  1093. }
  1094. },
  1095. open : function (id){
  1096. debugger
  1097. var options = {
  1098. "workCompletedId": id,
  1099. "appId": "process.Work" + id
  1100. };
  1101. layout.desktop.openApplication(null, "process.Work", options);
  1102. },
  1103. manage : function (id,ev,dataList){
  1104. var data ;
  1105. for(var i = 0 ; i < dataList.length;i++){
  1106. if(dataList[i].id === id){
  1107. data = dataList[i];
  1108. break ;
  1109. }
  1110. }
  1111. this._manage(data);
  1112. },
  1113. _manage : function (data){
  1114. var form;
  1115. form = new MWF.xApplication.process.Application.ManageWorkCompletedForm({app: this.app}, data );
  1116. form.open();
  1117. },
  1118. delete : function(id,e){
  1119. var _self = this;
  1120. this.app.confirm("warn", e,"删除确认!!", {
  1121. "html": "<br/>请选择删除方式? <br/><input type='radio' value='soft' name='delete_type'/>软删除(可恢复)" +
  1122. "<br/><input type='radio' value='delete' name='delete_type'/>硬删除(不能恢复)<div class='checkInfor'></div>"
  1123. }, 400, 200, function(){
  1124. var inputs = this.content.getElements("input");
  1125. var flag = "";
  1126. for (var i=0; i<inputs.length; i++){
  1127. if (inputs[i].checked){
  1128. flag = inputs[i].get("value");
  1129. break;
  1130. }
  1131. }
  1132. if (flag){
  1133. _self.action[flag === "soft"?"SnapAction":"WorkCompletedAction"][flag === "soft"?"typeAbandonedWorkCompleted":"manageDelete"]( id , function(){
  1134. _self.app.notice("成功删除工作。");
  1135. _self.refresh();
  1136. });
  1137. this.close();
  1138. }else{
  1139. this.content.getElement(".checkInfor").set("text", "请选择删除方式!").setStyle("color", "red");
  1140. }
  1141. }, function(){
  1142. this.close();
  1143. });
  1144. }
  1145. });
  1146. MWF.xApplication.process.Application.SnapList = new Class({
  1147. Extends: MWF.xApplication.process.Application.List,
  1148. loadData: function(){
  1149. var _self = this;
  1150. return this.action.SnapAction.manageListWithApplicationPaging(this.page, this.size, this.application.id,this.filterList||{}).then(function(json){
  1151. _self.fireEvent("loadData");
  1152. _self.total = json.count;
  1153. return _self._fixData(json.data);
  1154. }.bind(this));
  1155. },
  1156. _initToolBar : function (){
  1157. this.toolbarItems = {
  1158. "default":[
  1159. ["delSnap"],
  1160. ["restore"]
  1161. ],
  1162. "unSelect":[
  1163. ],
  1164. "selected":[
  1165. ["delSnap"],
  1166. ["restore"]
  1167. ],
  1168. "mulSelect":[
  1169. ["delSnap"],
  1170. ["restore"]
  1171. ]
  1172. }
  1173. },
  1174. open : function (id){
  1175. debugger
  1176. var options = {
  1177. "workCompletedId": id,
  1178. "appId": "process.Work" + id
  1179. };
  1180. layout.desktop.openApplication(null, "process.Work", options);
  1181. },
  1182. delete : function(id,e){
  1183. var _self = this;
  1184. this.app.confirm("warn", e, "删除确认", "删除后不能恢复。", 350, 120, function () {
  1185. _self.action.SnapAction.delete( id , function(){
  1186. _self.app.notice("成功删除");
  1187. _self.refresh();
  1188. });
  1189. this.close();
  1190. }, function () {
  1191. this.close();
  1192. });
  1193. }
  1194. });
  1195. MWF.xApplication.process.Application.DictList = new Class({
  1196. Extends: MWF.xApplication.process.Application.List,
  1197. loadData: function(){
  1198. var _self = this;
  1199. return o2.Actions.load("x_processplatform_assemble_designer").ApplicationDictAction.listWithApplication(this.application.id).then(function(json){
  1200. _self.fireEvent("loadData");
  1201. _self.total = json.count;
  1202. return json.data;
  1203. }.bind(this));
  1204. },
  1205. open : function (id){
  1206. debugger
  1207. var options = {
  1208. "id": id,
  1209. "application" : this.app.application.id,
  1210. "appId": "process.DictionaryDesigner" + id
  1211. };
  1212. layout.desktop.openApplication(null, "process.DictionaryDesigner", options);
  1213. },
  1214. loadFilter: function () {
  1215. this.searchNode.setStyle("height","10px");
  1216. },
  1217. });
  1218. MWF.xApplication.process.Application.SerialList = new Class({
  1219. Extends: MWF.xApplication.process.Application.List,
  1220. loadData: function(){
  1221. var _self = this;
  1222. return this.action.SerialNumberAction.list(this.application.id).then(function(json){
  1223. _self.fireEvent("loadData");
  1224. _self.total = json.count;
  1225. return json.data;
  1226. }.bind(this));
  1227. },
  1228. loadFilter: function () {
  1229. this.searchNode.setStyle("height","10px");
  1230. },
  1231. _initToolBar : function (){
  1232. this.toolbarItems = {
  1233. "default":[
  1234. ],
  1235. "unSelect":[
  1236. ["addSerial"]
  1237. ],
  1238. "selected":[
  1239. ["delSerial"],
  1240. ["setSerial"],
  1241. ],
  1242. "mulSelect":[
  1243. ["delSerial"],
  1244. ]
  1245. }
  1246. },
  1247. });
  1248. MWF.xApplication.process.Application.Toolbar = new Class({
  1249. Extends: MWF.widget.Common,
  1250. Implements: [Options, Events],
  1251. options: {
  1252. "style": "default",
  1253. "viewType" : "list",
  1254. "type" : "all",
  1255. "disabled" : false
  1256. },
  1257. initialize : function( container, explorer, options ) {
  1258. this.container = container;
  1259. this.explorer = explorer;
  1260. this.app = explorer.app;
  1261. this.lp = explorer.app.lp;
  1262. this.css = this.app.css;
  1263. this.action = explorer.action;
  1264. this.setOptions(options);
  1265. this._initTools();
  1266. this.type = this.options.type;
  1267. this.availableTool = this.options.availableTool;
  1268. if(this.explorer.selectedList){
  1269. this.data = this.explorer.selectedList[0];
  1270. }
  1271. },
  1272. _initTools : function (){
  1273. this.tools = {
  1274. delWork :{
  1275. action : "delWork",
  1276. text : this.lp.actionList.delete,
  1277. icon : "icon-upload"
  1278. },
  1279. delCompletedWork : {
  1280. action : "delCompletedWork",
  1281. text : this.lp.actionList.delete,
  1282. icon : "icon-upload"
  1283. },
  1284. processing :{
  1285. action : "processing",
  1286. text : this.lp.actionList.processing,
  1287. icon : "icon-upload"
  1288. },
  1289. addReview :{
  1290. action : "addReview",
  1291. text : this.lp.actionList.addReview,
  1292. icon : "icon-upload"
  1293. },
  1294. endWork :{
  1295. action : "endWork",
  1296. text : this.lp.actionList.endWork,
  1297. icon : "icon-upload"
  1298. },
  1299. jump : {
  1300. action : "jump",
  1301. text : this.lp.actionList.jump,
  1302. icon : "icon-upload"
  1303. },
  1304. manage : {
  1305. action : "manage",
  1306. text : this.lp.actionList.manage,
  1307. icon : "icon-upload"
  1308. },
  1309. sendRead : {
  1310. action : "sendRead",
  1311. text : this.lp.actionList.sendRead,
  1312. icon : "icon-upload"
  1313. },
  1314. setSerial : {
  1315. action : "setSerial",
  1316. text : this.lp.actionList.setSerial,
  1317. icon : "icon-upload"
  1318. },
  1319. delSerial : {
  1320. action : "delSerial",
  1321. text : this.lp.actionList.delete,
  1322. icon : "icon-upload"
  1323. },
  1324. addSerial : {
  1325. action : "addSerial",
  1326. text : this.lp.actionList.add,
  1327. icon : "icon-upload"
  1328. },
  1329. rollback : {
  1330. action : "rollback",
  1331. text : this.lp.actionList.rollback,
  1332. icon : "icon-newfolder"
  1333. },
  1334. delSnap : {
  1335. action : "delSnap",
  1336. text : this.lp.actionList.delSnap,
  1337. icon : "icon-rename"
  1338. },
  1339. restore: {
  1340. action : "restore",
  1341. text : this.lp.actionList.restore,
  1342. icon : "icon-shareDownload"
  1343. }
  1344. }
  1345. },
  1346. load : function(){
  1347. this.node = new Element("div").inject( this.container );
  1348. this.availableTool.each( function( group ){
  1349. var toolgroupNode = new Element("div.toolgroupNode").inject( this.node );
  1350. var length = group.length;
  1351. group.each( function( t, i ){
  1352. var className;
  1353. if( length == 1 ){
  1354. className = "toolItemNode_single";
  1355. }else{
  1356. if( i == 0 ){
  1357. className = "toolItemNode_left";
  1358. }else if( i + 1 == length ){
  1359. className = "toolItemNode_right";
  1360. }else{
  1361. className = "toolItemNode_center";
  1362. }
  1363. }
  1364. var tool = this.tools[ t ];
  1365. var toolNode;
  1366. if(this.options.disabled){
  1367. toolNode = new Element( "div", {
  1368. class : className,
  1369. style : "height:30px;line-height:30px;padding-left:12px;padding-right:12px;background: rgb(123 177 240);font-size: 13px;color: #FFFFFF;font-weight: 400;",
  1370. }).inject( toolgroupNode );
  1371. }else {
  1372. toolNode = new Element( "div", {
  1373. class : className,
  1374. style : "cursor:pointer;height:30px;line-height:30px;padding-left:12px;padding-right:12px;background: #4A90E2;font-size: 13px;color: #FFFFFF;font-weight: 400;",
  1375. events : {
  1376. click : function( ev ){ this[tool.action]( ev ) }.bind(this)
  1377. }
  1378. }).inject( toolgroupNode );
  1379. }
  1380. //var iconNode = new Element("icon",{"class":"o2WorkApplication " + tool.icon,"style":"margin-right:6px"}).inject(toolNode);
  1381. var textNode = new Element("span").inject(toolNode);
  1382. textNode.set("text",tool.text);
  1383. }.bind(this))
  1384. }.bind(this));
  1385. this.loadRightNode()
  1386. },
  1387. addSerial: function(){
  1388. var _self = this;
  1389. var data = this.explorer.selectedList[0];
  1390. var form = new MWF.xApplication.process.Application.AddSerSialForm(this.explorer, data, {
  1391. }, {
  1392. app: this.app
  1393. });
  1394. form.edit()
  1395. },
  1396. setSerial : function(){
  1397. var _self = this;
  1398. if (this.explorer.selectedList && this.explorer.selectedList.length){
  1399. var data = this.explorer.selectedList[0];
  1400. var form = new MWF.xApplication.process.Application.SetSerSialForm(this.explorer, data, {
  1401. }, {
  1402. app: this.app
  1403. });
  1404. form.edit()
  1405. }else {
  1406. this.app.notice("请先选择文件","error");
  1407. return;
  1408. }
  1409. },
  1410. delWork : function (e){
  1411. var _self = this;
  1412. var dataList = this.explorer.selectedList;
  1413. this.app.confirm("warn", e,"删除确认!!", {
  1414. "html": "<br/>请选择删除方式? <br/><input type='radio' value='soft' name='delete_type'/>软删除(可恢复)" +
  1415. "<br/><input type='radio' value='delete' name='delete_type'/>硬删除(不能恢复)<div class='checkInfor'></div>"
  1416. }, 400, 200, function(){
  1417. var inputs = this.content.getElements("input");
  1418. var flag = "";
  1419. for (var i=0; i<inputs.length; i++){
  1420. if (inputs[i].checked){
  1421. flag = inputs[i].get("value");
  1422. break;
  1423. }
  1424. }
  1425. if (flag){
  1426. var count = 0;
  1427. dataList.each( function(data){
  1428. if(flag === "soft"){
  1429. _self.action.SnapAction.typeAbandoned( data.id , function(){
  1430. count++;
  1431. if( dataList.length == count ){
  1432. _self.app.notice("成功删除"+count+"个工作。");
  1433. _self.explorer.refresh();
  1434. }
  1435. });
  1436. }else {
  1437. _self.action.WorkAction.delete( data.id , function(){
  1438. count++;
  1439. if( dataList.length == count ){
  1440. _self.app.notice("成功删除"+count+"个工作。");
  1441. _self.explorer.refresh();
  1442. }
  1443. });
  1444. }
  1445. }.bind(this));
  1446. this.close();
  1447. }else{
  1448. this.content.getElement(".checkInfor").set("text", "请选择删除方式!").setStyle("color", "red");
  1449. }
  1450. }, function(){
  1451. this.close();
  1452. });
  1453. },
  1454. processing : function (e){
  1455. var _self = this;
  1456. var dataList = this.explorer.selectedList;
  1457. this.app.confirm("warn", e, "尝试流转确认", "是否尝试流转选中的"+dataList.length+"个文档?", 350, 120, function () {
  1458. var count = 0;
  1459. dataList.each( function(data){
  1460. _self.action.WorkAction.processing( data.id , {},function(){
  1461. count++;
  1462. if( dataList.length == count ){
  1463. _self.app.notice("成功处理"+count+"个文档。");
  1464. _self.explorer.refresh();
  1465. }
  1466. });
  1467. }.bind(this));
  1468. this.close();
  1469. }, function () {
  1470. this.close();
  1471. });
  1472. },
  1473. delCompletedWork : function (e){
  1474. var _self = this;
  1475. var dataList = this.explorer.selectedList;
  1476. this.app.confirm("warn", e,"删除确认!!", {
  1477. "html": "<br/>请选择删除方式? <br/><input type='radio' value='soft' name='delete_type'/>软删除(可恢复)" +
  1478. "<br/><input type='radio' value='delete' name='delete_type'/>硬删除(不能恢复)<div class='checkInfor'></div>"
  1479. }, 400, 280, function(){
  1480. var inputs = this.content.getElements("input");
  1481. var flag = "";
  1482. for (var i=0; i<inputs.length; i++){
  1483. if (inputs[i].checked){
  1484. flag = inputs[i].get("value");
  1485. break;
  1486. }
  1487. }
  1488. if (flag){
  1489. var count = 0;
  1490. dataList.each( function(data){
  1491. if(flag === "soft"){
  1492. _self.action.SnapAction.typeAbandonedWorkCompleted( data.id , function(){
  1493. count++;
  1494. if( dataList.length == count ){
  1495. _self.app.notice("成功删除"+count+"个工作。");
  1496. _self.explorer.refresh();
  1497. }
  1498. });
  1499. }else {
  1500. _self.action.WorkCompletedAction.manageDelete( data.id , function(){
  1501. count++;
  1502. if( dataList.length == count ){
  1503. _self.app.notice("成功删除"+count+"个工作。");
  1504. _self.explorer.refresh();
  1505. }
  1506. });
  1507. }
  1508. }.bind(this));
  1509. this.close();
  1510. }else{
  1511. this.content.getElement(".checkInfor").set("text", "请选择删除方式!").setStyle("color", "red");
  1512. }
  1513. }, function(){
  1514. this.close();
  1515. });
  1516. },
  1517. endWork : function (e){
  1518. var _self = this;
  1519. var dataList = this.explorer.selectedList;
  1520. this.app.confirm("warn", e, "结束确认", "是否结束选中的"+dataList.length+"个文档?", 350, 120, function () {
  1521. var count = 0;
  1522. dataList.each( function(data){
  1523. _self.action.ProcessAction.getComplex(data.process,function (json){
  1524. var endList = json.data.endList;
  1525. var endActivityId = endList[0].id;
  1526. var body = {
  1527. "activity": endActivityId,
  1528. "activityType": "end",
  1529. "mergeWork": true,
  1530. "manualForceTaskIdentityList": null
  1531. };
  1532. _self.action.WorkAction.V2Reroute(data.id, body, function (json) {
  1533. count++;
  1534. if( dataList.length == count ){
  1535. _self.app.notice("成功结束"+count+"个文档。");
  1536. _self.explorer.refresh();
  1537. }
  1538. });
  1539. });
  1540. }.bind(this));
  1541. this.close();
  1542. }, function () {
  1543. this.close();
  1544. });
  1545. },
  1546. delSnap : function (e){
  1547. var _self = this;
  1548. var dataList = this.explorer.selectedList;
  1549. this.app.confirm("warn", e, "删除确认", "是否删除选中的"+dataList.length+"个文档?删除后不能恢复。", 350, 120, function () {
  1550. var count = 0;
  1551. dataList.each( function(data){
  1552. _self.action.SnapAction.delete( data.id , function(){
  1553. count++;
  1554. if( dataList.length == count ){
  1555. _self.app.notice("成功删除"+count+"个文档。");
  1556. _self.explorer.refresh();
  1557. }
  1558. });
  1559. }.bind(this));
  1560. this.close();
  1561. }, function () {
  1562. this.close();
  1563. });
  1564. },
  1565. restore: function (e){
  1566. var _self = this;
  1567. var dataList = this.explorer.selectedList;
  1568. this.app.confirm("warn", e, "恢复确认", "是否恢复选中的"+dataList.length+"个文档?", 350, 120, function () {
  1569. var count = 0;
  1570. dataList.each( function(data){
  1571. _self.action.SnapAction.restore( data.id , function(){
  1572. count++;
  1573. if( dataList.length == count ){
  1574. _self.app.notice("成功恢复"+count+"个文档。");
  1575. _self.explorer.refresh();
  1576. }
  1577. });
  1578. }.bind(this));
  1579. this.close();
  1580. }, function () {
  1581. this.close();
  1582. });
  1583. },
  1584. delSerial : function (e){
  1585. var _self = this;
  1586. var dataList = this.explorer.selectedList;
  1587. this.app.confirm("warn", e, "删除确认", "是否删除选中的"+dataList.length+"个流水号?删除后不能恢复。", 350, 120, function () {
  1588. var count = 0;
  1589. dataList.each( function(data){
  1590. _self.action.SerialNumberAction.delete( data.id , function(){
  1591. count++;
  1592. if( dataList.length == count ){
  1593. _self.app.notice("成功删除"+count+"个流水号。");
  1594. _self.explorer.refresh();
  1595. }
  1596. });
  1597. }.bind(this));
  1598. this.close();
  1599. }, function () {
  1600. this.close();
  1601. });
  1602. },
  1603. sendRead : function (e){
  1604. var dataList = this.explorer.selectedList;
  1605. var ids = [];
  1606. dataList.each(function (data){
  1607. ids.push(data.id);
  1608. }.bind(this));
  1609. debugger
  1610. var _self = this;
  1611. var reviewNode = new Element("div",{"class":"control","style":"margin:10px"});
  1612. var personNode = new Element("textarea",{"class":"textarea","placeholder":"参阅人员选择"});
  1613. personNode.inject(reviewNode);
  1614. personNode.addEvent("click",function(){
  1615. var opt = {
  1616. "type": "identity",
  1617. "count": 0,
  1618. "values": personNode.retrieve("dataList") || [],
  1619. "onComplete": function (dataList) {
  1620. debugger
  1621. var arr = [];
  1622. var arr2 = [];
  1623. dataList.each(function (data) {
  1624. arr.push(data.data);
  1625. arr2.push(data.data.name);
  1626. });
  1627. personNode.set("value", arr2.join(","));
  1628. personNode.store("dataList", arr);
  1629. }.bind(this)
  1630. };
  1631. new MWF.O2Selector(_self.app.content, opt);
  1632. }.bind(this));
  1633. var reviewDlg = o2.DL.open({
  1634. "title": "增加参阅",
  1635. "width": "400px",
  1636. "height": "260px",
  1637. "mask": true,
  1638. "content": reviewNode,
  1639. "container": null,
  1640. "positionNode": _self.app.content,
  1641. "onQueryClose": function () {
  1642. reviewNode.destroy();
  1643. }.bind(this),
  1644. "buttonList": [
  1645. {
  1646. "text": "确认",
  1647. "action": function () {
  1648. var personList = personNode.retrieve("dataList") ;
  1649. var arr = [];
  1650. personList.each(function(person){
  1651. arr.push(person.distinguishedName);
  1652. });
  1653. ids.each(function(workId){
  1654. var data = {
  1655. "notify":true,
  1656. "identityList":arr
  1657. }
  1658. if(_self.type === "work"){
  1659. _self.app.action.ReadAction.createWithWork(workId,data,function (){},null,false);
  1660. }else{
  1661. _self.app.action.ReadAction.createWithWorkCompleted(workId,data,function (){},null,false);
  1662. }
  1663. });
  1664. _self.app.notice("增加成功。","success");
  1665. _self.explorer.refresh();
  1666. reviewDlg.close();
  1667. }.bind(this)
  1668. },
  1669. {
  1670. "text": "关闭",
  1671. "action": function () {
  1672. reviewDlg.close();
  1673. }.bind(this)
  1674. }
  1675. ],
  1676. "onPostShow": function () {
  1677. reviewDlg.reCenter();
  1678. }.bind(this)
  1679. });
  1680. },
  1681. addReview : function (e){
  1682. var dataList = this.explorer.selectedList;
  1683. var ids = [];
  1684. dataList.each(function (data){
  1685. ids.push(data.id);
  1686. }.bind(this));
  1687. debugger
  1688. var _self = this;
  1689. var reviewNode = new Element("div",{"class":"control","style":"margin:10px"});
  1690. var personNode = new Element("textarea",{"class":"textarea","placeholder":"参阅人员选择"});
  1691. personNode.inject(reviewNode);
  1692. personNode.addEvent("click",function(){
  1693. var opt = {
  1694. "type": "person",
  1695. "count": 0,
  1696. "values": personNode.retrieve("dataList") || [],
  1697. "onComplete": function (dataList) {
  1698. var arr = [];
  1699. var arr2 = [];
  1700. dataList.each(function (data) {
  1701. arr.push(data.data);
  1702. arr2.push(data.data.name);
  1703. });
  1704. personNode.set("value", arr2.join(","));
  1705. personNode.store("dataList", arr);
  1706. }.bind(this)
  1707. };
  1708. new MWF.O2Selector(_self.app.content, opt);
  1709. }.bind(this));
  1710. var reviewDlg = o2.DL.open({
  1711. "title": "增加参阅",
  1712. "width": "400px",
  1713. "height": "260px",
  1714. "mask": true,
  1715. "content": reviewNode,
  1716. "container": null,
  1717. "positionNode": _self.app.content,
  1718. "onQueryClose": function () {
  1719. reviewNode.destroy();
  1720. }.bind(this),
  1721. "buttonList": [
  1722. {
  1723. "text": "确认",
  1724. "action": function () {
  1725. var personList = personNode.retrieve("dataList") ;
  1726. var arr = [];
  1727. personList.each(function(person){
  1728. arr.push(person.distinguishedName);
  1729. });
  1730. ids.each(function(workId){
  1731. var data = {
  1732. "personList":arr
  1733. }
  1734. if(_self.type === "work"){
  1735. data.work = workId;
  1736. _self.app.action.ReviewAction.createWithWork(data,function (){},null,false);
  1737. }else{
  1738. data.workCompleted = workId;
  1739. _self.app.action.ReviewAction.createWithWorkCompleted(data,function (){},null,false);
  1740. }
  1741. });
  1742. _self.app.notice("增加成功。","success");
  1743. _self.explorer.refresh();
  1744. reviewDlg.close();
  1745. }.bind(this)
  1746. },
  1747. {
  1748. "text": "关闭",
  1749. "action": function () {
  1750. reviewDlg.close();
  1751. }.bind(this)
  1752. }
  1753. ],
  1754. "onPostShow": function () {
  1755. reviewDlg.reCenter();
  1756. }.bind(this)
  1757. });
  1758. },
  1759. manage : function (){
  1760. var form;
  1761. if(this.type === "workCompleted"){
  1762. form = new MWF.xApplication.process.Application.ManageWorkCompletedForm({app: this.app}, this.explorer.selectedList[0] );
  1763. }else{
  1764. form = new MWF.xApplication.process.Application.ManageWorkForm({app: this.app}, this.explorer.selectedList[0] );
  1765. }
  1766. form.open();
  1767. },
  1768. jump: function(){
  1769. var data = this.explorer.selectedList[0];
  1770. var lp = this.lp;
  1771. this.readyReroute = true;
  1772. var width = 560;
  1773. var height = 210;
  1774. var p = MWF.getCenterPosition(this.app.content, width, height);
  1775. var _self = this;
  1776. var dlg = new MWF.xDesktop.Dialog({
  1777. "title": "调度",
  1778. "style": "user",
  1779. "top": p.y-100,
  1780. "left": p.x,
  1781. "fromTop": p.y-100,
  1782. "fromLeft": p.x,
  1783. "width": width,
  1784. "height": height,
  1785. "url": this.app.path+"default/view/dlg/reroute.html",
  1786. "container": this.app.content,
  1787. "isClose": true,
  1788. "buttonList": [
  1789. {
  1790. "type": "ok",
  1791. "text": MWF.LP.process.button.ok,
  1792. "action": function (d, e) {
  1793. this.doRerouteWork(dlg);
  1794. }.bind(this)
  1795. },
  1796. {
  1797. "type": "cancel",
  1798. "text": MWF.LP.process.button.cancel,
  1799. "action": function () { dlg.close(); }
  1800. }
  1801. ],
  1802. "onPostShow": function(){
  1803. var select = $("rerouteWork_selectActivity");
  1804. _self.action.ProcessAction.getAllowRerouteTo(data.process, function(json){
  1805. if (json.data.agentList) json.data.agentList.each(function(activity){
  1806. new Element("option", {
  1807. "value": activity.id+"#agent",
  1808. "text": activity.name
  1809. }).inject(select);
  1810. }.bind(_self));
  1811. if (json.data.cancelList) json.data.cancelList.each(function(activity){
  1812. new Element("option", {
  1813. "value": activity.id+"#cancel",
  1814. "text": activity.name
  1815. }).inject(select);
  1816. }.bind(_self));
  1817. if (json.data.choiceList) json.data.choiceList.each(function(activity){
  1818. new Element("option", {
  1819. "value": activity.id+"#choice",
  1820. "text": activity.name
  1821. }).inject(select);
  1822. }.bind(_self));
  1823. if (json.data.conditionList) json.data.conditionList.each(function(activity){
  1824. new Element("option", {
  1825. "value": activity.id+"#condition",
  1826. "text": activity.name
  1827. }).inject(select);
  1828. }.bind(_self));
  1829. if (json.data.delayList) json.data.delayList.each(function(activity){
  1830. new Element("option", {
  1831. "value": activity.id+"#delay",
  1832. "text": activity.name
  1833. }).inject(select);
  1834. }.bind(_self));
  1835. if (json.data.embedList) json.data.embedList.each(function(activity){
  1836. new Element("option", {
  1837. "value": activity.id+"#embed",
  1838. "text": activity.name
  1839. }).inject(select);
  1840. }.bind(_self));
  1841. if (json.data.publishList) json.data.publishList.each(function(activity){
  1842. new Element("option", {
  1843. "value": activity.id+"#publish",
  1844. "text": activity.name
  1845. }).inject(select);
  1846. }.bind(_self));
  1847. if (json.data.endList) json.data.endList.each(function(activity){
  1848. new Element("option", {
  1849. "value": activity.id+"#end",
  1850. "text": activity.name
  1851. }).inject(select);
  1852. }.bind(_self));
  1853. if (json.data.invokeList) json.data.invokeList.each(function(activity){
  1854. new Element("option", {
  1855. "value": activity.id+"#invoke",
  1856. "text": activity.name
  1857. }).inject(select);
  1858. }.bind(_self));
  1859. if (json.data.manualList) json.data.manualList.each(function(activity){
  1860. new Element("option", {
  1861. "value": activity.id+"#manual",
  1862. "text": activity.name
  1863. }).inject(select);
  1864. }.bind(_self));
  1865. if (json.data.mergeList) json.data.mergeList.each(function(activity){
  1866. new Element("option", {
  1867. "value": activity.id+"#merge",
  1868. "text": activity.name
  1869. }).inject(select);
  1870. }.bind(_self));
  1871. if (json.data.messageList) json.data.messageList.each(function(activity){
  1872. new Element("option", {
  1873. "value": activity.id+"#message",
  1874. "text": activity.name
  1875. }).inject(select);
  1876. }.bind(_self));
  1877. if (json.data.parallelList) json.data.parallelList.each(function(activity){
  1878. new Element("option", {
  1879. "value": activity.id+"#parallel",
  1880. "text": activity.name
  1881. }).inject(select);
  1882. }.bind(_self));
  1883. if (json.data.serviceList) json.data.serviceList.each(function(activity){
  1884. new Element("option", {
  1885. "value": activity.id+"#service",
  1886. "text": activity.name
  1887. }).inject(select);
  1888. }.bind(_self));
  1889. if (json.data.splitList) json.data.splitList.each(function(activity){
  1890. new Element("option", {
  1891. "value": activity.id+"#split",
  1892. "text": activity.name
  1893. }).inject(select);
  1894. }.bind(_self));
  1895. }.bind(_self));
  1896. var selPeopleButton = this.content.getElement(".rerouteWork_selPeopleButton");
  1897. selPeopleButton.addEvent("click", function () {
  1898. _self.selectReroutePeople(this);
  1899. }.bind(this));
  1900. }
  1901. });
  1902. dlg.show();
  1903. },
  1904. selectReroutePeople: function(dlg){
  1905. var names = dlg.identityList || [];
  1906. var areaNode = dlg.content.getElement(".rerouteWork_selPeopleArea");
  1907. var options = {
  1908. "values": names,
  1909. "type": "identity",
  1910. "count": 0,
  1911. "title": this.explorer.app.lp.reroute,
  1912. "onComplete": function (items) {
  1913. areaNode.empty();
  1914. var identityList = [];
  1915. items.each(function (item) {
  1916. new MWF.widget.O2Identity(item.data, areaNode, { "style": "reset" });
  1917. identityList.push(item.data.distinguishedName);
  1918. }.bind(this));
  1919. dlg.identityList = identityList;
  1920. }.bind(this)
  1921. };
  1922. MWF.xDesktop.requireApp("Selector", "package", function () {
  1923. var selector = new MWF.O2Selector(this.app.content, options);
  1924. }.bind(this));
  1925. },
  1926. doRerouteWork: function(dlg){
  1927. var _self = this;
  1928. var opinion = $("rerouteWork_opinion").get("value");
  1929. var select = $("rerouteWork_selectActivity");
  1930. var activity = select.options[select.selectedIndex].get("value");
  1931. var activityName = select.options[select.selectedIndex].get("text");
  1932. var tmp = activity.split("#");
  1933. activity = tmp[0];
  1934. var type = tmp[1];
  1935. var nameArr = [];
  1936. var names = dlg.identityList || [];
  1937. names.each(function (n) { nameArr.push(n); });
  1938. MWF.require("MWF.widget.Mask", function(){
  1939. this.mask = new MWF.widget.Mask({"style": "desktop", "zIndex": 50000});
  1940. this.mask.loadNode(this.explorer.app.content);
  1941. this.rerouteWorkToActivity(activity, type, opinion, nameArr, function(){
  1942. // this.explorer.actions.getWork(this.data.id, function(workJson){
  1943. // this.data = workJson.data;
  1944. // this.workAreaNode.setStyles(this.css.workItemWorkNode);
  1945. // this.readyReroute = false;
  1946. // this.reload();
  1947. // }.bind(this));
  1948. _self.explorer.refresh();
  1949. dlg.close();
  1950. if (this.mask) {this.mask.hide(); this.mask = null;}
  1951. }.bind(this), function(xhr, text, error){
  1952. var errorText = error+":"+text;
  1953. if (xhr) errorText = xhr.responseText;
  1954. this.app.notice("request json error: "+errorText, "error", dlg.node);
  1955. if (this.mask) {this.mask.hide(); this.mask = null;}
  1956. }.bind(this));
  1957. }.bind(this));
  1958. },
  1959. rerouteWorkToActivity: function(activity, type, opinion, nameArr, success, failure){
  1960. var body = {
  1961. "activity": activity,
  1962. "activityType": type,
  1963. "mergeWork": false,
  1964. "manualForceTaskIdentityList": nameArr
  1965. };
  1966. o2.Actions.load("x_processplatform_assemble_surface").WorkAction.V2Reroute(this.data.id, body, function(){
  1967. if (success) success();
  1968. }.bind(this), function (xhr, text, error) {
  1969. if (failure) failure(xhr, text, error);
  1970. });
  1971. // this.explorer.actions.rerouteWork(this.data.id, activity, type, null, function(json){
  1972. // if (success) success();
  1973. // }.bind(this), function(xhr, text, error){
  1974. // if (failure) failure(xhr, text, error);
  1975. // });
  1976. },
  1977. rollback: function (){
  1978. debugger
  1979. var data = this.explorer.selectedList[0];
  1980. var node = new Element("div", { "styles": this.css.rollbackAreaNode });
  1981. var html = "<div style=\"line-height: 30px; height: 30px; color: #333333; overflow: hidden;float:left;\">请选择文件要回溯到的位置:</div>";
  1982. html += "<div style=\"line-height: 30px; height: 30px; color: #333333; overflow: hidden;float:right;\"><input class='rollback_flowOption' checked type='checkbox' />并尝试继续流转</div>";
  1983. html += "<div style=\"clear:both; margin-bottom:10px; margin-top:10px; overflow-y:auto;\"></div>";
  1984. node.set("html", html);
  1985. var rollbackItemNode = node.getLast();
  1986. this.getRollbackLogs(rollbackItemNode,data.id);
  1987. //node.inject(this.app.content);
  1988. var dlg = o2.DL.open({
  1989. "title": "回溯",
  1990. "style": "user",
  1991. "isResize": false,
  1992. "content": node,
  1993. "width": 600,
  1994. "height" : 400,
  1995. "buttonList": [
  1996. {
  1997. "type": "ok",
  1998. "text": "确定",
  1999. "action": function (d, e) {
  2000. this.doRollback(node, e, dlg ,data.id);
  2001. }.bind(this)
  2002. },
  2003. {
  2004. "type": "cancel",
  2005. "text": "取消",
  2006. "action": function () { dlg.close(); }
  2007. }
  2008. ]
  2009. });
  2010. },
  2011. doRollback: function (node, e, dlg ,workid) {
  2012. var rollbackItemNode = node.getLast();
  2013. var items = rollbackItemNode.getChildren();
  2014. var flowOption = (node.getElement(".rollback_flowOption").checked);
  2015. var _self = this;
  2016. for (var i = 0; i < items.length; i++) {
  2017. if (items[i].retrieve("isSelected")) {
  2018. var text = "您确定要将流程回溯到“{log}”状态吗?(流程回溯会清除此状态之后的所有信息)";
  2019. var log = items[i].retrieve("log");
  2020. var checks = items[i].getElements("input:checked");
  2021. var idList = [];
  2022. checks.each(function (check) {
  2023. var id = check.get("value");
  2024. if (idList.indexOf(id) == -1) idList.push(id);
  2025. });
  2026. text = text.replace("{log}", log.fromActivityName + "(" + log.arrivedTime + ")");
  2027. this.explorer.app.confirm("infor", e, "流程回溯确认", text, 450, 120, function () {
  2028. // console.log(log.id)
  2029. // console.log(flowOption)
  2030. // //console.log(dlg)
  2031. // console.log(idList)
  2032. _self.app.action.WorkCompletedAction.rollback(workid,{ "workLog": log.id },function (json){
  2033. _self.app.notice("回溯成功。");
  2034. _self.explorer.refresh();
  2035. },null,false);
  2036. dlg.close();
  2037. this.close();
  2038. }, function () {
  2039. this.close();
  2040. });
  2041. break;
  2042. }
  2043. }
  2044. },
  2045. getRollbackLogs: function (rollbackItemNode,id) {
  2046. var _self = this;
  2047. var data ;
  2048. this.app.action.WorkLogAction.listRollbackWithWorkOrWorkCompleted(id).then(function (json){
  2049. var dataList = json.data;
  2050. dataList.each(function (log) {
  2051. if (!log.splitting && log.connected) {
  2052. var node = new Element("div", { "styles": this.css.rollbackItemNode }).inject(rollbackItemNode);
  2053. node.store("log", log);
  2054. var iconNode = new Element("div", { "styles": this.css.rollbackItemIconNode }).inject(node);
  2055. var contentNode = new Element("div", { "styles": this.css.rollbackItemContentNode }).inject(node);
  2056. var div = new Element("div", { "styles": { "overflow": "hidden" } }).inject(contentNode);
  2057. var activityNode = new Element("div", { "styles": this.css.rollbackItemActivityNode, "text": log.fromActivityName }).inject(div);
  2058. var timeNode = new Element("div", { "styles": this.css.rollbackItemTimeNode, "text": log.arrivedTime }).inject(div);
  2059. div = new Element("div", { "styles": { "overflow": "hidden" } }).inject(contentNode);
  2060. var taskTitleNode = new Element("div", { "styles": this.css.rollbackItemTaskTitleNode, "text": "办理人: " }).inject(div);
  2061. if (log.taskCompletedList.length) {
  2062. log.taskCompletedList.each(function (o) {
  2063. var text = o2.name.cn(o.person) + "(" + o.completedTime + ")";
  2064. var check = new Element("input", {
  2065. "value": o.identity,
  2066. "type": "checkbox",
  2067. "disabled": true,
  2068. "styles": this.css.rollbackItemTaskCheckNode
  2069. }).inject(div);
  2070. check.addEvent("click", function (e) {
  2071. e.stopPropagation();
  2072. });
  2073. var taskNode = new Element("div", { "styles": this.css.rollbackItemTaskNode, "text": text }).inject(div);
  2074. }.bind(this));
  2075. } else {
  2076. var text = "系统自动处理";
  2077. var taskNode = new Element("div", { "styles": this.css.rollbackItemTaskNode, "text": text }).inject(div);
  2078. }
  2079. node.addEvents({
  2080. "mouseover": function () {
  2081. var isSelected = this.retrieve("isSelected");
  2082. if (!isSelected) this.setStyles(_self.css.rollbackItemNode_over);
  2083. },
  2084. "mouseout": function () {
  2085. var isSelected = this.retrieve("isSelected");
  2086. if (!isSelected) this.setStyles(_self.css.rollbackItemNode)
  2087. },
  2088. "click": function () {
  2089. var isSelected = this.retrieve("isSelected");
  2090. if (isSelected) {
  2091. _self.setRollBackUnchecked(this);
  2092. } else {
  2093. var items = rollbackItemNode.getChildren();
  2094. items.each(function (item) {
  2095. _self.setRollBackUnchecked(item);
  2096. });
  2097. _self.setRollBackChecked(this);
  2098. }
  2099. }
  2100. });
  2101. }
  2102. }.bind(this));
  2103. }.bind(this));
  2104. },
  2105. setRollBackChecked: function (item) {
  2106. item.store("isSelected", true);
  2107. item.setStyles(this.css.rollbackItemNode_current);
  2108. item.getFirst().setStyles(this.css.rollbackItemIconNode_current);
  2109. var node = item.getLast().getFirst();
  2110. node.getFirst().setStyles(this.css.rollbackItemActivityNode_current);
  2111. node.getLast().setStyles(this.css.rollbackItemTimeNode_current);
  2112. node = item.getLast().getLast();
  2113. node.getFirst().setStyles(this.css.rollbackItemTaskTitleNode_current);
  2114. node.getLast().setStyles(this.css.rollbackItemTaskNode_current);
  2115. var checkeds = item.getElements("input");
  2116. if (checkeds){
  2117. checkeds.set("checked", true);
  2118. checkeds.set("disabled", false);
  2119. }
  2120. },
  2121. setRollBackUnchecked: function (item) {
  2122. item.store("isSelected", false);
  2123. item.setStyles(this.css.rollbackItemNode);
  2124. item.getFirst().setStyles(this.css.rollbackItemIconNode);
  2125. var node = item.getLast().getFirst();
  2126. node.getFirst().setStyles(this.css.rollbackItemActivityNode);
  2127. node.getLast().setStyles(this.css.rollbackItemTimeNode);
  2128. node = item.getLast().getLast();
  2129. node.getFirst().setStyles(this.css.rollbackItemTaskTitleNode);
  2130. node.getLast().setStyles(this.css.rollbackItemTaskNode);
  2131. var checkeds = item.getElements("input");
  2132. if (checkeds) {
  2133. checkeds.set("checked", false);
  2134. checkeds.set("disabled", true);
  2135. }
  2136. },
  2137. loadRightNode : function(){
  2138. this.toolabrRightNode = new Element("div.toolabrRightNode",{
  2139. "style": "float:right"
  2140. }).inject(this.node);
  2141. //this.loadSearch();
  2142. },
  2143. loadSearch : function (){
  2144. var searchNode = new Element("div.ft_titleSearchArea",{"style":"width:300px"}).inject(this.toolabrRightNode);
  2145. var searchIconNode = new Element("div.ft_filterIcon",{"html":'<icon class="o2icon-sousuo mainColor_color"></icon>'}).inject(searchNode);
  2146. var searchBtn = new Element("div",{"class":"ft_searchButton mainColor_bg","text":"搜索"}).inject(searchNode);
  2147. var searchInput = new Element("div.ft_titleInputArea").inject(searchNode);
  2148. new Element("input",{"placeholder" : "请输入关键字"}).inject(searchInput);
  2149. },
  2150. getListType : function(){
  2151. return this.viewType || this.options.viewType
  2152. },
  2153. loadListType : function(){
  2154. this.listViewTypeNode = new Element("div", {
  2155. "style" : "font-size:18px;float:left;margin-right:6px",
  2156. "class" : this.options.viewType == "list" ? "mainColor_color" : "",
  2157. events : {
  2158. click : function(){
  2159. this.viewType = "list";
  2160. this.explorer.options.defaultViewType = this.viewType;
  2161. this.explorer.refresh();
  2162. }.bind(this)
  2163. }
  2164. }).inject(this.toolabrRightNode);
  2165. new Element("icon",{"class":"o2Drive icon-list"}).inject(this.listViewTypeNode);
  2166. this.tileViewTypeNode = new Element("div", {
  2167. "style" : "font-size:18px;float:left",
  2168. "class" : this.options.viewType !== "list" ? "mainColor_color" : "",
  2169. events : {
  2170. click : function(){
  2171. this.viewType = "tile";
  2172. this.explorer.options.defaultViewType = this.viewType;
  2173. this.explorer.refresh();
  2174. }.bind(this)
  2175. }
  2176. }).inject(this.toolabrRightNode);
  2177. new Element("icon",{"class":"o2Drive icon-grid"}).inject(this.tileViewTypeNode);
  2178. }
  2179. });
  2180. MWF.xApplication.process.Application.AddSerSialForm = new Class({
  2181. Extends: MPopupForm,
  2182. Implements: [Options, Events],
  2183. options: {
  2184. "style": "attendanceV2",
  2185. "width": 500,
  2186. //"height": 300,
  2187. "height": "350",
  2188. "hasTop": true,
  2189. "hasIcon": false,
  2190. "draggable": true,
  2191. "title" : "新增流水号",
  2192. "id" : ""
  2193. },
  2194. _createTableContent: function () {
  2195. var html = "<table width='100%' bordr='0' cellpadding='7' cellspacing='0' styles='formTable' style='margin-top: 20px; '>" +
  2196. "<tr><td styles='formTableTitleRight' lable='process'></td>" +
  2197. " <td styles='formTableValue1' item='process' colspan='2'></td>" +
  2198. "</tr>" +
  2199. "<tr><td styles='formTableTitleRight' lable='name'></td>" +
  2200. " <td styles='formTableValue1' item='name' colspan='2'></td>" +
  2201. "</tr>" +
  2202. "<tr><td styles='formTableTitleRight' lable='serial'></td>" +
  2203. " <td styles='formTableValue' item='serial' colspan='2'></td></tr>" +
  2204. "</table>";
  2205. this.formTableArea.set("html", html);
  2206. this.form = new MForm(this.formTableArea, this.data || {}, {
  2207. isEdited: true,
  2208. style : "attendance",
  2209. hasColon : true,
  2210. itemTemplate: {
  2211. name: { text : "关键字", notEmpty : true },
  2212. serial: { text : "流水号", notEmpty : true },
  2213. process: {
  2214. "text": "流程",
  2215. "type": "text",
  2216. "notEmpty" : true,
  2217. "defaultValue":this.data.processName,
  2218. "event": {
  2219. "click": function (item, ev){
  2220. var v = item.getValue();
  2221. o2.xDesktop.requireApp("Selector", "package", function(){
  2222. var options = {
  2223. "type": "Process",
  2224. "values": [],
  2225. "count": 1,
  2226. "applicationId" : this.app.application.id,
  2227. "onComplete": function (items) {
  2228. if(items.length>0){
  2229. var d = items[0].data;
  2230. this.data.processId = d.id;
  2231. item.setValue(d.name);
  2232. }
  2233. }.bind(this)
  2234. };
  2235. new o2.O2Selector(this.app.desktop.node, options);
  2236. }.bind(this),false);
  2237. }.bind(this)}
  2238. }
  2239. }
  2240. }, this.app);
  2241. this.form.load();
  2242. },
  2243. _createBottomContent: function () {
  2244. if (this.isNew || this.isEdited) {
  2245. this.okActionNode = new Element("button.inputOkButton", {
  2246. "styles": this.css.inputOkButton,
  2247. "text": "确定"
  2248. }).inject(this.formBottomNode);
  2249. this.okActionNode.addEvent("click", function (e) {
  2250. this.save(e);
  2251. }.bind(this));
  2252. }
  2253. this.cancelActionNode = new Element("button.inputCancelButton", {
  2254. "styles": (this.isEdited || this.isNew || this.getEditPermission() ) ? this.css.inputCancelButton : this.css.inputCancelButton_long,
  2255. "text": "关闭"
  2256. }).inject(this.formBottomNode);
  2257. this.cancelActionNode.addEvent("click", function (e) {
  2258. this.close(e);
  2259. }.bind(this));
  2260. },
  2261. save: function(){
  2262. var data = this.form.getResult(true,null,true,false,true);
  2263. if( data ){
  2264. debugger
  2265. this.app.action.SerialNumberAction.create({
  2266. "application" : this.app.application.id,
  2267. "process" : data.processId,
  2268. "name" : data.name,
  2269. "serial" : data.serial
  2270. }).then(function (){
  2271. this.app.notice("添加成功");
  2272. this.explorer.refresh();
  2273. this.close();
  2274. }.bind(this));
  2275. }
  2276. }
  2277. });
  2278. MWF.xApplication.process.Application.SetSerSialForm = new Class({
  2279. Extends: MPopupForm,
  2280. Implements: [Options, Events],
  2281. options: {
  2282. "style": "attendanceV2",
  2283. "width": 500,
  2284. //"height": 300,
  2285. "height": "200",
  2286. "hasTop": true,
  2287. "hasIcon": false,
  2288. "draggable": true,
  2289. "title" : "设置流水号",
  2290. "id" : ""
  2291. },
  2292. _createTableContent: function () {
  2293. var html = "<table width='100%' bordr='0' cellpadding='7' cellspacing='0' styles='formTable' style='margin-top: 20px; '>" +
  2294. "<tr><td styles='formTableTitle' lable='serial' width='25%'></td>" +
  2295. " <td styles='formTableValue14' item='serial' colspan='3'></td></tr>" +
  2296. "</table>";
  2297. this.formTableArea.set("html", html);
  2298. this.form = new MForm(this.formTableArea, this.data || {}, {
  2299. isEdited: true,
  2300. style : "minder",
  2301. hasColon : true,
  2302. itemTemplate: {
  2303. serial: { text : "流水号", notEmpty : true }
  2304. }
  2305. }, this.app);
  2306. this.form.load();
  2307. },
  2308. _createBottomContent: function () {
  2309. if (this.isNew || this.isEdited) {
  2310. this.okActionNode = new Element("button.inputOkButton", {
  2311. "styles": this.css.inputOkButton,
  2312. "text": "确定"
  2313. }).inject(this.formBottomNode);
  2314. this.okActionNode.addEvent("click", function (e) {
  2315. this.save(e);
  2316. }.bind(this));
  2317. }
  2318. this.cancelActionNode = new Element("button.inputCancelButton", {
  2319. "styles": (this.isEdited || this.isNew || this.getEditPermission() ) ? this.css.inputCancelButton : this.css.inputCancelButton_long,
  2320. "text": "关闭"
  2321. }).inject(this.formBottomNode);
  2322. this.cancelActionNode.addEvent("click", function (e) {
  2323. this.close(e);
  2324. }.bind(this));
  2325. },
  2326. save: function(){
  2327. var data = this.form.getResult(true,null,true,false,true);
  2328. if( data ){
  2329. debugger
  2330. this.app.action.SerialNumberAction.update(data.id,{
  2331. "application" : data.application,
  2332. "process" : data.process,
  2333. "serial" : data.serial
  2334. }).then(function (){
  2335. this.app.notice("更新成功");
  2336. this.explorer.refresh();
  2337. this.close();
  2338. }.bind(this));
  2339. }
  2340. }
  2341. });
  2342. MWF.xApplication.process.Application.ManageWorkForm = new Class({
  2343. Extends: MPopupForm,
  2344. Implements: [Options, Events],
  2345. options: {
  2346. "style": "attendanceV2",
  2347. "width": "1000",
  2348. "height": "700",
  2349. "hasTop": true,
  2350. "hasIcon": false,
  2351. "hasTopIcon" : false,
  2352. "hasTopContent" : false,
  2353. "draggable": true,
  2354. "maxAction" : true,
  2355. "resizeable" : true,
  2356. "closeAction": true,
  2357. "title": MWF.xApplication.process.Application.LP.adminwork,
  2358. "hideBottomWhenReading": true,
  2359. "closeByClickMaskWhenReading": true,
  2360. },
  2361. _postLoad: function(){
  2362. if(this.data.completedTime){
  2363. this.isCompletedWork = true;
  2364. }
  2365. this._createTableContent_();
  2366. },
  2367. _createTableContent: function(){},
  2368. _createTableContent_: function () {
  2369. //this.formTableArea.set("html", this.getHtml());
  2370. this.formTableContainer.setStyle("width","95%");
  2371. this.formTableContainer.setStyle("margin","0px auto 10px");
  2372. this.loadTab();
  2373. },
  2374. loadTab : function (){
  2375. this.tabNode = new Element("div",{"styles" : this.css.tabNode }).inject(this.formTableArea);
  2376. this.taskArea = new Element("div",{"style" : "height:500px;overflow:auto" }).inject(this.tabNode);
  2377. this.taskDoneArea = new Element("div",{"styles" : this.css.tabPageContainer }).inject(this.tabNode);
  2378. this.readArea = new Element("div",{"styles" : this.css.tabPageContainer }).inject(this.tabNode);
  2379. this.readDoneArea = new Element("div",{"styles" : this.css.tabPageContainer }).inject(this.tabNode);
  2380. this.reviewArea = new Element("div",{"styles" : this.css.tabPageContainer }).inject(this.tabNode);
  2381. this.attachementArea = new Element("div",{"styles" : this.css.tabPageContainer }).inject(this.tabNode);
  2382. this.recordArea = new Element("div",{"style" : "height:550px;overflow:auto" }).inject(this.tabNode);
  2383. this.businessDataArea = new Element("div",{"styles" : this.css.tabPageContainer }).inject(this.tabNode);
  2384. MWF.require("MWF.widget.Tab", function(){
  2385. this.tabs = new MWF.widget.Tab(this.tabNode, {"style": "attendance"});
  2386. this.tabs.load();
  2387. this.taskPage = this.tabs.addTab(this.taskArea, this.lp.task, false);
  2388. this.taskPage.addEvent("show",function(){
  2389. if(!this.initTask) this.loadTask();
  2390. }.bind(this));
  2391. this.taskDonePage = this.tabs.addTab(this.taskDoneArea, this.lp.taskDone, false);
  2392. this.taskDonePage.addEvent("show",function(){
  2393. if(!this.initTaskDone) this.loadTaskDone();
  2394. }.bind(this));
  2395. this.readPage = this.tabs.addTab(this.readArea, this.lp.read, false);
  2396. this.readPage.addEvent("show",function(){
  2397. if(!this.initRead) this.loadRead();
  2398. }.bind(this));
  2399. this.readDonePage = this.tabs.addTab(this.readDoneArea, this.lp.readDone, false);
  2400. this.readDonePage.addEvent("show",function(){
  2401. if(!this.initReadDone) this.loadReadDone();
  2402. }.bind(this));
  2403. this.recordPage = this.tabs.addTab(this.recordArea, this.lp.workLog, false);
  2404. this.recordPage.addEvent("show",function(){
  2405. if(!this.initRecord) this.loadRecord();
  2406. }.bind(this));
  2407. this.reviewPage = this.tabs.addTab(this.reviewArea, this.lp.review, false);
  2408. this.reviewPage.addEvent("show",function(){
  2409. if(!this.initReview) this.loadReview();
  2410. }.bind(this));
  2411. this.attachementPage = this.tabs.addTab(this.attachementArea, this.lp.attachment, false);
  2412. this.attachementPage.addEvent("show",function(){
  2413. if(!this.initAttachement) this.loadAttachement();
  2414. }.bind(this));
  2415. this.businessDataPage = this.tabs.addTab(this.businessDataArea,this.lp.businessData, false);
  2416. this.businessDataPage.addEvent("show",function(){
  2417. if(!this.initBusinessData) this.loadBusinessData();
  2418. }.bind(this));
  2419. this.tabs.pages[0].showTab();
  2420. }.bind(this));
  2421. },
  2422. loadTask : function () {
  2423. this.app.action.TaskAction.listWithJob(this.data.job).then(function(json){
  2424. this.taskList = json.data;
  2425. this._loadTask();
  2426. this.initTask = true;
  2427. }.bind(this));
  2428. },
  2429. _loadTask : function (){
  2430. this.taskArea.empty();
  2431. this.taskContentNode = new Element("div").inject(this.taskArea);
  2432. var taskTableNode = new Element("table.table",{
  2433. "border" : 0,
  2434. "cellpadding" : 5,
  2435. "cellspacing" : 0
  2436. }).inject(this.taskContentNode);
  2437. var taskTableTheadNode = new Element("thead").inject(taskTableNode);
  2438. var taskTableTbodyNode = new Element("tbody").inject(taskTableNode);
  2439. var taskTableTheadTrNode = new Element("tr").inject(taskTableTheadNode);
  2440. Array.each([this.lp.currentPerson, this.lp.currentDept, this.lp.activity, this.lp.startTime, this.lp.action], function (text) {
  2441. new Element("th", {"text": text}).inject(taskTableTheadTrNode);
  2442. });
  2443. this.taskList.each(function (task) {
  2444. var trNode = new Element("tr").inject(taskTableTbodyNode);
  2445. trNode.store("data", task);
  2446. Array.each([task.person.split("@")[0], task.unit.split("@")[0], task.activityName, task.startTime], function (text) {
  2447. new Element("td", {
  2448. text: text
  2449. }).inject(trNode);
  2450. });
  2451. var tdOpNode = new Element("td").inject(trNode);
  2452. var restButton = new Element("button", {"text": this.lp.resetAction, "class": "button"}).inject(tdOpNode);
  2453. var deleteButton = new Element("button", {"text": this.lp.remove, "class": "button"}).inject(tdOpNode);
  2454. _self = this;
  2455. deleteButton.addEvent("click", function (e) {
  2456. _self.app.confirm("warn", e, _self.lp.tip, this.lp.tip_remove, 350, 120, function () {
  2457. _self.app.action.TaskAction.manageDelete(task.id,function (){},null,false);
  2458. _self.loadTask();
  2459. this.close();
  2460. }, function(){
  2461. this.close();
  2462. });
  2463. }.bind(this));
  2464. restButton.addEvent("click", function (ev) {
  2465. var opt = {
  2466. "type": "identity",
  2467. "count": 0,
  2468. "title": _self.lp.resetAction,
  2469. "onComplete": function (items) {
  2470. var _self = this;
  2471. var nameArr = [];
  2472. items.each(function(item){
  2473. nameArr.push(item.data.name)
  2474. });
  2475. this.explorer.app.confirm("warn", ev,_self.lp.tip_reset, {
  2476. "html": _self.lp.rest_content.replace("(name)",nameArr.join())
  2477. }, 400, 300, function(){
  2478. var inputs = this.content.getElements("input");
  2479. var opinion = this.content.getElement("textarea").get("value");
  2480. var flag = "";
  2481. for (var i=0; i<inputs.length; i++){
  2482. if (inputs[i].checked){
  2483. flag = inputs[i].get("value");
  2484. break;
  2485. }
  2486. }
  2487. inputs.addEvent("click",function (){
  2488. this.content.getElement("#reset_checkInfor").set("text","");
  2489. }.bind(this));
  2490. if (flag){
  2491. var keep = true;
  2492. if(flag==="no"){
  2493. keep = false;
  2494. }
  2495. var nameList = [];
  2496. items.each(function (identity) {
  2497. nameList.push(identity.data.distinguishedName);
  2498. });
  2499. var data = {
  2500. "routeName":_self.lp.resetAction,
  2501. "opinion":opinion,
  2502. "identityList":nameList,
  2503. "keep" : keep
  2504. }
  2505. _self.app.action.TaskAction.V2Reset(task.id,data,function(json){
  2506. },null,false);
  2507. _self.loadTask();
  2508. this.close();
  2509. }else{
  2510. this.content.getElement("#reset_checkInfor").set("text", _self.lp.tip_keetask).setStyle("color", "red");
  2511. }
  2512. }, function(){
  2513. this.close();
  2514. });
  2515. }.bind(this)
  2516. };
  2517. new MWF.O2Selector(this.app.content, opt);
  2518. }.bind(this));
  2519. }.bind(this));
  2520. },
  2521. loadTaskDone : function () {
  2522. this.app.action.TaskCompletedAction.listWithJob(this.data.job, function (json) {
  2523. this.taskDoneList = json.data;
  2524. this._loadTaskDone();
  2525. this.initTaskDone = true;
  2526. }.bind(this));
  2527. },
  2528. _loadTaskDone : function (){
  2529. var lp = this.lp;
  2530. this.taskDoneArea.empty();
  2531. this.taskDoneContentNode = new Element("div").inject(this.taskDoneArea);
  2532. var taskDoneTableNode = new Element("table.table",{
  2533. "border" : 0,
  2534. "cellpadding" : 5,
  2535. "cellspacing" : 0
  2536. }).inject(this.taskDoneContentNode);
  2537. var taskDoneTableTheadNode = new Element("thead").inject(taskDoneTableNode);
  2538. var taskDoneTableTbodyNode = new Element("tbody").inject(taskDoneTableNode);
  2539. var taskDoneTableTheadTrNode = new Element("tr").inject(taskDoneTableTheadNode);
  2540. Array.each([lp.currentPerson, lp.currentDept, lp.activity, lp.startTime, lp.endTime, lp.routerName, lp.idea, lp.action], function (text) {
  2541. var tmpthNode = new Element("th", {"text": text}).inject(taskDoneTableTheadTrNode);
  2542. if(text===lp.idea){
  2543. tmpthNode.setStyle("width","150px");
  2544. }
  2545. });
  2546. this.taskDoneList.each(function (taskDone) {
  2547. var trNode = new Element("tr").inject(taskDoneTableTbodyNode);
  2548. trNode.store("data", taskDone);
  2549. Array.each([taskDone.person.split("@")[0], taskDone.unit.split("@")[0], taskDone.activityName, taskDone.startTime, taskDone.updateTime, taskDone.routeName, taskDone.opinion], function (text) {
  2550. new Element("td", {
  2551. text: text
  2552. }).inject(trNode);
  2553. });
  2554. var tdOpNode = new Element("td").inject(trNode);
  2555. var setOpinionButton = new Element("button", {"text": lp.idea, "class": "button"}).inject(tdOpNode);
  2556. var deleteButton = new Element("button", {"text": lp.remove, "class": "button"}).inject(tdOpNode);
  2557. deleteButton.addEvent("click", function (e) {
  2558. _self = this;
  2559. this.app.confirm("warn", e, lp.tip, lp.tip_remove, 350, 120, function () {
  2560. _self.app.action.TaskCompletedAction.manageDelete(taskDone.id,function (){},null,false);
  2561. _self.loadTaskDone();
  2562. this.close();
  2563. }, function(){
  2564. this.close();
  2565. });
  2566. }.bind(this));
  2567. setOpinionButton.addEvent("click", function () {
  2568. var ideaNode = new Element("div", {"class": "control", "style": "margin:10px"});
  2569. var textareaNode = new Element("textarea", {"style":"height:80px","class": "textarea", "text": taskDone.opinion});
  2570. textareaNode.inject(ideaNode);
  2571. var ideaDlg = o2.DL.open({
  2572. "title": lp.editIdea,
  2573. "width": "400px",
  2574. "height": "260px",
  2575. "mask": true,
  2576. "content": ideaNode,
  2577. "container": null,
  2578. "positionNode": this.app.content,
  2579. "onQueryClose": function () {
  2580. ideaNode.destroy();
  2581. }.bind(this),
  2582. "buttonList": [
  2583. {
  2584. "text": lp.ok,
  2585. "action": function () {
  2586. this.app.action.TaskCompletedAction.manageOpinion(taskDone.id,{"opinion":textareaNode.get("value")},function(json){
  2587. },null,false);
  2588. this.loadTaskDone();
  2589. ideaDlg.close();
  2590. }.bind(this)
  2591. },
  2592. {
  2593. "text": lp.close,
  2594. "action": function () {
  2595. ideaDlg.close();
  2596. }.bind(this)
  2597. }
  2598. ],
  2599. "onPostShow": function () {
  2600. ideaDlg.reCenter();
  2601. }.bind(this)
  2602. });
  2603. }.bind(this));
  2604. }.bind(this));
  2605. },
  2606. loadRead : function () {
  2607. this.app.action.ReadAction.listWithJob(this.data.job, function (json) {
  2608. this.readList = json.data;
  2609. this._loadRead();
  2610. this.initRead = true;
  2611. }.bind(this));
  2612. },
  2613. _loadRead : function (){
  2614. var lp = this.lp;
  2615. this.readArea.empty();
  2616. this.readContentNode = new Element("div").inject(this.readArea);
  2617. var readTableNode = new Element("table.table",{
  2618. "border" : 0,
  2619. "cellpadding" : 5,
  2620. "cellspacing" : 0
  2621. }).inject(this.readContentNode);
  2622. var readTableTheadNode = new Element("thead").inject(readTableNode);
  2623. var readTableTbodyNode = new Element("tbody").inject(readTableNode);
  2624. var readTableTheadTrNode = new Element("tr").inject(readTableTheadNode);
  2625. Array.each([lp.readPerson, lp.currentDept, lp.activity, lp.startTime, lp.action], function (text) {
  2626. new Element("th", {"text": text}).inject(readTableTheadTrNode);
  2627. });
  2628. this.readList.each(function (read) {
  2629. var trNode = new Element("tr").inject(readTableTbodyNode);
  2630. trNode.store("data", read);
  2631. Array.each([read.person.split("@")[0], read.unit.split("@")[0], read.activityName, read.startTime], function (text) {
  2632. new Element("td", {
  2633. text: text
  2634. }).inject(trNode);
  2635. });
  2636. var tdOpNode = new Element("td").inject(trNode);
  2637. var readButton = new Element("button", {"text": lp.readDone, "class": "button"}).inject(tdOpNode);
  2638. var restButton = new Element("button", {"text": lp.resetAction, "class": "button"}).inject(tdOpNode);
  2639. var deleteButton = new Element("button", {"text": lp.remove, "class": "button"}).inject(tdOpNode);
  2640. deleteButton.addEvent("click", function (e) {
  2641. var _self = this;
  2642. _self.app.confirm("warn", e, lp.tip, lp.tip_remove, 350, 120, function () {
  2643. _self.app.action.ReadAction.manageDelete(read.id,function (){},null,false);
  2644. _self.loadRead();
  2645. this.close();
  2646. }, function(){
  2647. this.close();
  2648. });
  2649. }.bind(this));
  2650. restButton.addEvent("click", function () {
  2651. var opt = {
  2652. "type": "identity",
  2653. "count": 0,
  2654. "title": lp.resetAction,
  2655. "onComplete": function (items) {
  2656. var nameList = [];
  2657. var nameDnList = [];
  2658. items.each(function (identity) {
  2659. nameList.push(identity.data.name);
  2660. nameDnList.push(identity.data.distinguishedName);
  2661. });
  2662. var data = {
  2663. "opinion":lp.resetActionFor + ": " + nameList.join(","),
  2664. "identityList":nameDnList
  2665. }
  2666. this.app.action.ReadAction.manageResetRead(read.id,data,function(json){
  2667. },null,false);
  2668. this.loadRead();
  2669. }.bind(this)
  2670. };
  2671. new MWF.O2Selector(this.app.content, opt);
  2672. }.bind(this));
  2673. readButton.addEvent("click", function () {
  2674. var ideaNode = new Element("div", { "style": "margin:10px"});
  2675. var textareaNode = new Element("textarea", {"class":"textarea","style": "min-width:100%;height: 100px", "text": read.opinion});
  2676. textareaNode.inject(ideaNode);
  2677. var ideaDlg = o2.DL.open({
  2678. "title": lp.readProcess,
  2679. "width": "400px",
  2680. "height": "260px",
  2681. "mask": true,
  2682. "content": ideaNode,
  2683. "container": null,
  2684. "positionNode": this.app.content,
  2685. "onQueryClose": function () {
  2686. ideaNode.destroy();
  2687. }.bind(this),
  2688. "buttonList": [
  2689. {
  2690. "text": lp.ok,
  2691. "action": function () {
  2692. this.app.action.ReadAction.manageProcessing(read.id,{"opinion":textareaNode.get("value")},function(json){
  2693. },null,false);
  2694. this.loadRead();
  2695. ideaDlg.close();
  2696. }.bind(this)
  2697. },
  2698. {
  2699. "text": lp.close,
  2700. "action": function () {
  2701. ideaDlg.close();
  2702. }.bind(this)
  2703. }
  2704. ],
  2705. "onPostShow": function () {
  2706. ideaDlg.reCenter();
  2707. }.bind(this)
  2708. });
  2709. }.bind(this));
  2710. }.bind(this));
  2711. },
  2712. loadReadDone : function () {
  2713. this.app.action.ReadCompletedAction.listWithJob(this.data.job, function (json) {
  2714. this.readDoneList = json.data;
  2715. this._loadReadDone();
  2716. this.initReadDone = true;
  2717. }.bind(this), null, false);
  2718. },
  2719. _loadReadDone : function (){
  2720. var lp = this.lp;
  2721. this.readDoneArea.empty();
  2722. this.readDoneContentNode = new Element("div").inject(this.readDoneArea);
  2723. var readDoneTableNode = new Element("table.table",{
  2724. "border" : 0,
  2725. "cellpadding" : 5,
  2726. "cellspacing" : 0
  2727. }).inject(this.readDoneContentNode);
  2728. var readDoneTableTheadNode = new Element("thead").inject(readDoneTableNode);
  2729. var readDoneTableTbodyNode = new Element("tbody").inject(readDoneTableNode);
  2730. var readDoneTableTheadTrNode = new Element("tr").inject(readDoneTableTheadNode);
  2731. Array.each([lp.currentPerson, lp.currentDept, lp.activity, lp.startTime, lp.endTime, lp.idea, lp.action], function (text) {
  2732. new Element("th", {"text": text}).inject(readDoneTableTheadTrNode);
  2733. });
  2734. this.readDoneList.each(function (readDone) {
  2735. var trNode = new Element("tr").inject(readDoneTableTbodyNode);
  2736. trNode.store("data", readDone);
  2737. Array.each([readDone.person.split("@")[0], readDone.unit.split("@")[0], readDone.activityName, readDone.startTime, readDone.updateTime, readDone.opinion], function (text) {
  2738. new Element("td", {
  2739. text: text
  2740. }).inject(trNode);
  2741. });
  2742. var tdOpNode = new Element("td").inject(trNode);
  2743. var setOpinionButton = new Element("button", {"text": lp.idea, "class": "button"}).inject(tdOpNode);
  2744. var deleteButton = new Element("button", {"text": lp.remove, "class": "button"}).inject(tdOpNode);
  2745. deleteButton.addEvent("click", function (e) {
  2746. _self = this;
  2747. this.app.confirm("warn", e, lp.tip, lp.tip_remove, 350, 120, function () {
  2748. _self.app.action.ReadCompletedAction.manageDelete(readDone.id,function (){},null,false);
  2749. _self.loadReadDone();
  2750. this.close();
  2751. }, function(){
  2752. this.close();
  2753. });
  2754. }.bind(this));
  2755. setOpinionButton.addEvent("click", function () {
  2756. var ideaNode = new Element("div", {"class": "control", "style": "margin:10px"});
  2757. var textareaNode = new Element("textarea", {"class": "textarea", "text": readDone.opinion});
  2758. textareaNode.inject(ideaNode);
  2759. var ideaDlg = o2.DL.open({
  2760. "title": lp.editIdea,
  2761. "width": "400px",
  2762. "height": "260px",
  2763. "mask": true,
  2764. "content": ideaNode,
  2765. "container": null,
  2766. "positionNode": this.app.content,
  2767. "onQueryClose": function () {
  2768. ideaNode.destroy();
  2769. }.bind(this),
  2770. "buttonList": [
  2771. {
  2772. "text": lp.ok,
  2773. "action": function () {
  2774. this.app.action.ReadCompletedAction.manageUpdate(readDone.id,{"opinion":textareaNode.get("value")},function(json){
  2775. },null,false);
  2776. this.loadReadDone();
  2777. ideaDlg.close();
  2778. }.bind(this)
  2779. },
  2780. {
  2781. "text": lp.close,
  2782. "action": function () {
  2783. ideaDlg.close();
  2784. }.bind(this)
  2785. }
  2786. ],
  2787. "onPostShow": function () {
  2788. ideaDlg.reCenter();
  2789. }.bind(this)
  2790. });
  2791. }.bind(this));
  2792. }.bind(this));
  2793. },
  2794. loadRecord : function (){
  2795. this.app.action.RecordAction.listWithJob(this.data.job, function (json) {
  2796. this.recordList = json.data;
  2797. this._loadRecord();
  2798. this.initRecord = true;
  2799. }.bind(this), null, false);
  2800. },
  2801. _loadRecord : function (){
  2802. var lp = this.lp;
  2803. this.recordArea.empty();
  2804. this.recordContentNode = new Element("div").inject(this.recordArea);
  2805. var recordTableNode = new Element("table.table",{
  2806. "border" : 0,
  2807. "cellpadding" : 5,
  2808. "cellspacing" : 0
  2809. }).inject(this.recordContentNode);
  2810. var recordTableTheadNode = new Element("thead").inject(recordTableNode);
  2811. var recordTableTbodyNode = new Element("tbody").inject(recordTableNode);
  2812. var recordTableTheadTrNode = new Element("tr").inject(recordTableTheadNode);
  2813. Array.each([lp.currentPerson, lp.currentDept, lp.activity, lp.startTime, lp.endTime, lp.routerName, lp.idea, lp.action], function (text) {
  2814. var tmpthNode = new Element("th", {"text": text}).inject(recordTableTheadTrNode);
  2815. if(text===lp.idea){
  2816. tmpthNode.setStyle("width","150px");
  2817. }
  2818. });
  2819. this.recordList.each(function (record) {
  2820. if(record.type!=="currentTask"){
  2821. var trNode = new Element("tr").inject(recordTableTbodyNode);
  2822. trNode.store("data", record);
  2823. console.log(record)
  2824. var routeName;
  2825. if(record.type === "reroute"){
  2826. routeName = lp.reroute;
  2827. }else if(record.type === "reset"){
  2828. routeName = lp.resetAction;
  2829. }else {
  2830. routeName = record.properties.routeName;
  2831. }
  2832. Array.each([record.person.split("@")[0], record.unit.split("@")[0], record.fromActivityName, record.properties.startTime, record.updateTime, routeName, record.properties.opinion], function (text) {
  2833. new Element("td", {
  2834. text: text
  2835. }).inject(trNode);
  2836. });
  2837. var tdOpNode = new Element("td").inject(trNode);
  2838. var setOpinionButton = new Element("button", {"text": lp.idea, "class": "button"}).inject(tdOpNode);
  2839. var modifyButton = new Element("button", {"text": lp.modify, "class": "button"}).inject(tdOpNode);
  2840. var copyButton = new Element("button", {"text": lp.copy, "class": "button"}).inject(tdOpNode);
  2841. var deleteButton = new Element("button", {"text": lp.remove, "class": "button"}).inject(tdOpNode);
  2842. deleteButton.addEvent("click", function (e) {
  2843. _self = this;
  2844. this.app.confirm("warn", e, lp.tip, lp.tip_remove, 350, 120, function () {
  2845. _self.app.action.RecordAction.manageDelete(record.id,function(json){
  2846. _self.loadRecord();
  2847. },null,false);
  2848. this.close();
  2849. }, function(){
  2850. this.close();
  2851. });
  2852. }.bind(this));
  2853. setOpinionButton.addEvent("click", function () {
  2854. _self = this;
  2855. var ideaNode = new Element("div", {"class": "control", "style": "margin:10px"});
  2856. var textareaNode = new Element("textarea", {"style":"height:80px","class": "textarea", "text": record.properties.opinion});
  2857. textareaNode.inject(ideaNode);
  2858. var ideaDlg = o2.DL.open({
  2859. "title": lp.editIdea,
  2860. "width": "400px",
  2861. "height": "260px",
  2862. "mask": true,
  2863. "content": ideaNode,
  2864. "container": null,
  2865. "positionNode": this.app.content,
  2866. "onQueryClose": function () {
  2867. ideaNode.destroy();
  2868. }.bind(this),
  2869. "buttonList": [
  2870. {
  2871. "text": lp.ok,
  2872. "action": function () {
  2873. record.properties.opinion = textareaNode.get("value");
  2874. _self.app.action.RecordAction.manageEdit(record.id,record,function(json){
  2875. _self.loadRecord();
  2876. },null,false);
  2877. ideaDlg.close();
  2878. }.bind(this)
  2879. },
  2880. {
  2881. "text": lp.close,
  2882. "action": function () {
  2883. ideaDlg.close();
  2884. }.bind(this)
  2885. }
  2886. ],
  2887. "onPostShow": function () {
  2888. ideaDlg.reCenter();
  2889. }.bind(this)
  2890. });
  2891. }.bind(this));
  2892. modifyButton.addEvent("click", function () {
  2893. var recordNode = new Element("div", {"class": "control", "style": "margin:10px"});
  2894. var textareaNode = new Element("textarea", {"style":"height:350px","class": "textarea", "text": JSON.stringify(record,null,"\t")});
  2895. textareaNode.inject(recordNode);
  2896. var recordDlg = o2.DL.open({
  2897. "title": lp.recordEdit,
  2898. "width": "800px",
  2899. "height": "500",
  2900. "mask": true,
  2901. "content": recordNode,
  2902. "container": null,
  2903. "positionNode": this.app.content,
  2904. "onQueryClose": function () {
  2905. recordNode.destroy();
  2906. }.bind(this),
  2907. "buttonList": [
  2908. {
  2909. "text": lp.ok,
  2910. "action": function () {
  2911. record = JSON.parse(textareaNode.get("value"));
  2912. this.app.action.RecordAction.manageEdit(record.id,record,function(json){
  2913. this.loadRecord();
  2914. }.bind(this),null,false);
  2915. recordDlg.close();
  2916. }.bind(this)
  2917. },
  2918. {
  2919. "text": lp.close,
  2920. "action": function () {
  2921. recordDlg.close();
  2922. }.bind(this)
  2923. }
  2924. ],
  2925. "onPostShow": function () {
  2926. recordDlg.reCenter();
  2927. }.bind(this)
  2928. });
  2929. }.bind(this));
  2930. copyButton.addEvent("click", function () {
  2931. var recordNode = new Element("div", {"class": "control", "style": "margin:10px"});
  2932. var textareaNode = new Element("textarea", {"style":"height:350px","class": "textarea", "text": JSON.stringify(record,null,"\t")});
  2933. textareaNode.inject(recordNode);
  2934. var recordDlg = o2.DL.open({
  2935. "title": lp.recordAdd,
  2936. "width": "800px",
  2937. "height": "500",
  2938. "mask": true,
  2939. "content": recordNode,
  2940. "container": null,
  2941. "positionNode": this.app.content,
  2942. "onQueryClose": function () {
  2943. recordNode.destroy();
  2944. }.bind(this),
  2945. "buttonList": [
  2946. {
  2947. "text": lp.ok,
  2948. "action": function () {
  2949. record = JSON.parse(textareaNode.get("value"));
  2950. this.app.action.RecordAction.manageCreateWithJob(record.job,record,function(json){
  2951. this.loadRecord();
  2952. }.bind(this),null,false);
  2953. recordDlg.close();
  2954. }.bind(this)
  2955. },
  2956. {
  2957. "text": lp.close,
  2958. "action": function () {
  2959. recordDlg.close();
  2960. }.bind(this)
  2961. }
  2962. ],
  2963. "onPostShow": function () {
  2964. recordDlg.reCenter();
  2965. }.bind(this)
  2966. });
  2967. }.bind(this));
  2968. }
  2969. }.bind(this));
  2970. },
  2971. loadReview : function (){
  2972. this.app.action.ReviewAction.listWithJob(this.data.job, function (json) {
  2973. this.reviewList = json.data;
  2974. this._loadReview();
  2975. this.initReview = true;
  2976. }.bind(this), null, false);
  2977. },
  2978. _loadReview : function (){
  2979. var lp = this.lp;
  2980. this.reviewArea.empty();
  2981. this.reviewContentNode = new Element("div").inject(this.reviewArea)
  2982. var reviewTableNode = new Element("table.table",{
  2983. "border" : 0,
  2984. "cellpadding" : 5,
  2985. "cellspacing" : 0
  2986. }).inject(this.reviewContentNode);
  2987. var reviewTableTheadNode = new Element("thead").inject(reviewTableNode);
  2988. var reviewTableTbodyNode = new Element("tbody").inject(reviewTableNode);
  2989. var reviewTableTheadTrNode = new Element("tr").inject(reviewTableTheadNode);
  2990. Array.each([lp.reviewitem, lp.action], function (text) {
  2991. new Element("th", {"text": text}).inject(reviewTableTheadTrNode);
  2992. });
  2993. this.reviewList.each(function (review) {
  2994. var trNode = new Element("tr").inject(reviewTableTbodyNode);
  2995. trNode.store("data", review);
  2996. Array.each([review.person], function (text) {
  2997. new Element("td", {
  2998. text: text
  2999. }).inject(trNode);
  3000. });
  3001. var tdOpNode = new Element("td").inject(trNode);
  3002. var deleteButton = new Element("button", {"text": lp.remove, "class": "button"}).inject(tdOpNode);
  3003. deleteButton.addEvent("click", function (e) {
  3004. _self = this;
  3005. this.app.confirm("warn", e, lp.tip, lp.tip_remove, 350, 120, function () {
  3006. _self.app.action.ReviewAction.manageDelete(review.id,review.application,function(json){
  3007. _self.loadReview();
  3008. },null,false);
  3009. this.close();
  3010. }, function(){
  3011. this.close();
  3012. });
  3013. }.bind(this));
  3014. }.bind(this));
  3015. },
  3016. loadAttachement : function (){
  3017. this.app.action.AttachmentAction.listWithJob(this.data.job, function (json) {
  3018. this.attachmentList = json.data;
  3019. this._loadAttachement();
  3020. this.initAttachement = true;
  3021. }.bind(this), null, false);
  3022. },
  3023. _loadAttachement : function (){
  3024. this.attachementArea.empty();
  3025. this.attachmentContentNode = new Element("div").inject(this.attachementArea)
  3026. var attachmentTableNode = new Element("table.table",{
  3027. "border" : 0,
  3028. "cellpadding" : 5,
  3029. "cellspacing" : 0
  3030. }).inject(this.attachmentContentNode);
  3031. var attachmentTableTheadNode = new Element("thead").inject(attachmentTableNode);
  3032. var attachmentTableTbodyNode = new Element("tbody").inject(attachmentTableNode);
  3033. var attachmentTableTheadTrNode = new Element("tr").inject(attachmentTableTheadNode);
  3034. Array.each(["附件名称", "上传环节", "上传人", "上传时间", "标识","大小" ,"排序","操作"], function (text) {
  3035. new Element("th", {"text": text}).inject(attachmentTableTheadTrNode);
  3036. });
  3037. var siteArr = [];
  3038. this.attachmentList.each(function (attachment) {
  3039. if(!siteArr.contains(attachment.site)) siteArr.push(attachment.site);
  3040. var trNode = new Element("tr").inject(attachmentTableTbodyNode);
  3041. trNode.store("data", attachment);
  3042. Array.each([attachment.name, attachment.activityName, attachment.person.split("@")[0], attachment.createTime ,attachment.site,attachment["length"],attachment.orderNumber], function (text, index) {
  3043. new Element("td", {
  3044. text: index ===5 ? this.getFileSize(text) : text
  3045. }).inject(trNode);
  3046. }.bind(this));
  3047. var tdOpNode = new Element("td").inject(trNode);
  3048. var deleteButton = new Element("button", {"text": "删除", "class": "button"}).inject(tdOpNode);
  3049. deleteButton.addEvent("click", function (e) {
  3050. _self = this;
  3051. this.app.confirm("warn", e, "提示", "确认是否删除", 350, 120, function () {
  3052. _self.app.action.AttachmentAction.delete(attachment.id,function(json){
  3053. _self.loadAttachement();
  3054. },null,false);
  3055. this.close();
  3056. }, function(){
  3057. this.close();
  3058. });
  3059. }.bind(this));
  3060. var downButton = new Element("button", {"text": "下载", "class": "button"}).inject(tdOpNode);
  3061. downButton.addEvent("click", function () {
  3062. var locate = window.location;
  3063. var protocol = locate.protocol;
  3064. var addressObj = layout.serviceAddressList["x_processplatform_assemble_surface"];
  3065. var address = protocol+"//"+addressObj.host+(addressObj.port==80|| addressObj.port === ""? "" : ":"+addressObj.port)+addressObj.context;
  3066. window.open(o2.filterUrl(address) + "/jaxrs/attachment/download/"+ attachment.id +"/stream")
  3067. }.bind(this));
  3068. var sortButton = new Element("button", {"text": "排序", "class": "button"}).inject(tdOpNode);
  3069. sortButton.addEvent("click", function () {
  3070. var sortNode = new Element("div", {"class": "control", "style": "margin:10px"});
  3071. var inputNode = new Element("input", {"class": "input", "text": attachment.orderNumber});
  3072. inputNode.inject(sortNode);
  3073. var sortDlg = o2.DL.open({
  3074. "title": "排序号修改",
  3075. "width": "400px",
  3076. "height": "260px",
  3077. "mask": true,
  3078. "content": sortNode,
  3079. "container": null,
  3080. "positionNode": this.app.content,
  3081. "onQueryClose": function () {
  3082. sortNode.destroy();
  3083. }.bind(this),
  3084. "buttonList": [
  3085. {
  3086. "text": "确认",
  3087. "action": function () {
  3088. var orderNumber = inputNode.get("value");
  3089. this.app.action.AttachmentAction.changeOrderNumber(attachment.id,attachment.id,orderNumber,function( json ){
  3090. this.loadAttachement();
  3091. }.bind(this),null,false);
  3092. sortDlg.close();
  3093. }.bind(this)
  3094. },
  3095. {
  3096. "text": "关闭",
  3097. "action": function () {
  3098. sortDlg.close();
  3099. }.bind(this)
  3100. }
  3101. ],
  3102. "onPostShow": function () {
  3103. sortDlg.reCenter();
  3104. }.bind(this)
  3105. });
  3106. }.bind(this));
  3107. }.bind(this));
  3108. var attachmentUploadDiv = new Element("div").inject(this.attachmentContentNode);
  3109. var siteSelect = new Element("select",{"class":"select","style":"float:left"}).inject(attachmentUploadDiv);
  3110. new Element("option",{value:"",text:""}).inject(siteSelect);
  3111. siteArr.each(function(site){
  3112. new Element("option",{value:site,text:site}).inject(siteSelect);
  3113. });
  3114. siteSelect.addEvent("change",function(){
  3115. uploadSite.set("value",siteSelect.get("value"));
  3116. });
  3117. var uploadSite = new Element("input",{
  3118. "class":"input",
  3119. "placeholder":"对应上传的附件标识",
  3120. "style" :"width:200px;float:left"
  3121. }).inject(attachmentUploadDiv);
  3122. var uploadButton = new Element("button", {"text": "上传", "class": "button"}).inject(attachmentUploadDiv);
  3123. uploadButton.addEvent("click", function () {
  3124. if(uploadSite.get("value")==""){
  3125. this.app.notice("对应上传的附件标识不能为空","error");
  3126. return false;
  3127. }
  3128. var options = {
  3129. "title": "附件区域"
  3130. };
  3131. var site = uploadSite.get("value");
  3132. var uploadAction = this.isCompletedWork?"uploadAttachmentByWorkCompleted":"uploadAttachment";
  3133. o2.require("o2.widget.Upload", null, false);
  3134. var upload = new o2.widget.Upload(this.app.content, {
  3135. "action": o2.Actions.get("x_processplatform_assemble_surface").action,
  3136. "method": uploadAction,
  3137. "parameter": {
  3138. "id": this.data.id
  3139. },
  3140. "data":{
  3141. "site": site
  3142. },
  3143. "onCompleted": function(){
  3144. this.loadAttachement();
  3145. }.bind(this)
  3146. });
  3147. upload.load();
  3148. }.bind(this));
  3149. },
  3150. loadBusinessData : function (){
  3151. this.app.action.DataAction.getWithJob(this.data.job, function (json) {
  3152. this.workData = json.data;
  3153. this._loadBusinessData();
  3154. this.initBusinessData = true;
  3155. }.bind(this), null, false);
  3156. },
  3157. _loadBusinessData : function (){
  3158. var workData = this.workData;
  3159. var workDataContentNode = new Element("div",{"style":"margin:5px"}).inject(this.businessDataArea);
  3160. this.workDataContentNode = workDataContentNode;
  3161. var html = "<table bordr='0' cellpadding='0' cellspacing='0' styles='filterTable'>" +
  3162. "<tr>" +
  3163. " <td styles='filterTableTitle' lable='fieldList'></td>" +
  3164. " <td styles='filterTableTitle' item='fieldList'></td>" +
  3165. " <td styles='filterTableTitle' lable='fieldType'></td>" +
  3166. " <td styles='filterTableTitle' item='fieldType'></td>" +
  3167. " <td styles='filterTableTitle' lable='fieldName'></td>" +
  3168. " <td styles='filterTableTitle' item='fieldName'></td>" +
  3169. "</tr>" +
  3170. "<tr>" +
  3171. " <td styles='filterTableTitle' lable='fieldValue'></td>" +
  3172. " <td styles='filterTableValue' item='fieldValue' colspan=3></td>" +
  3173. " <td styles='filterTableValue' colspan=2><div item='action' ></div></td>" +
  3174. "</tr>" +
  3175. "</table><div item='workData'></div>"
  3176. workDataContentNode.set("html", html);
  3177. this.form = new MForm(workDataContentNode, {}, {
  3178. style: "attendance",
  3179. isEdited: true,
  3180. itemTemplate: {
  3181. fieldList: {
  3182. "text": "字段列表",
  3183. "type": "select",
  3184. "style": {"max-width": "150px"},
  3185. "selectValue": function () {
  3186. var arr = [""];
  3187. arr.append(Object.keys(workData));
  3188. return arr;
  3189. },
  3190. "event": {
  3191. "change": function (item, ev) {
  3192. var type = typeof(workData[item.getValue()]);
  3193. item.form.getItem("fieldType").setValue(type);
  3194. item.form.getItem("fieldName").setValue(item.getValue());
  3195. if(type === "object" || type === "array"){
  3196. item.form.getItem("fieldValue").setValue(JSON.stringify(workData[item.getValue()]));
  3197. }else {
  3198. item.form.getItem("fieldValue").setValue(workData[item.getValue()]);
  3199. }
  3200. }.bind(this)
  3201. }
  3202. },
  3203. fieldType: {
  3204. "text": "字段类型",
  3205. "type": "select",
  3206. "style": {"max-width": "150px"},
  3207. "selectValue": function () {
  3208. var array = ["","array","boolean","string","number","object"];
  3209. return array;
  3210. },
  3211. "event": {
  3212. "change": function (item, ev) {
  3213. }.bind(this)
  3214. }
  3215. },
  3216. fieldName: {text: "字段名", "type": "text", "style": {"min-width": "100px"}},
  3217. fieldValue: {text: "字段值", "type": "textarea", "style": {"width": "100%","margin-left": "10px"}},
  3218. action: {
  3219. "value": "修改", type: "button", className: "filterButton", event: {
  3220. click: function (e) {
  3221. var result = this.form.getResult(false, null, false, false, false);
  3222. var fieldName = result["fieldName"];
  3223. var fieldType = result["fieldType"];
  3224. var fieldValue = result["fieldValue"];
  3225. if (!fieldName) return false;
  3226. workData[fieldName] = (fieldType === "object" ? JSON.parse(fieldValue) : fieldValue);
  3227. _self = this;
  3228. this.app.confirm("warn", e.node, "提示", "确认是否修改", 350, 120, function () {
  3229. if(_self.isCompletedWork){
  3230. _self.app.action.DataAction.updateWithWorkCompleted(_self.data.id,workData,function (json){},null,false);
  3231. }else{
  3232. _self.app.action.DataAction.updateWithWork(_self.data.id,workData,function (json){},null,false);
  3233. }
  3234. _self.app.notice("success");
  3235. _self.loadScriptEditor();
  3236. this.close();
  3237. }, function(){
  3238. this.close();
  3239. });
  3240. }.bind(this)
  3241. }
  3242. }
  3243. }
  3244. }, this.app, this.css);
  3245. this.form.load();
  3246. this.loadScriptEditor();
  3247. },
  3248. loadScriptEditor:function(){
  3249. if( !this.workData )return;
  3250. MWF.require("MWF.widget.JavascriptEditor", null, false);
  3251. var workDataNode = this.formTableContainer.getElement('[item="workData"]');
  3252. this.scriptEditor = new MWF.widget.JavascriptEditor(workDataNode, {
  3253. "forceType": "ace",
  3254. "option": { "mode" : "json" }
  3255. });
  3256. this.scriptEditor.load(function(){
  3257. this.scriptEditor.setValue(JSON.stringify(this.workData, null, "\t"));
  3258. this.scriptEditor.editor.setReadOnly(true);
  3259. this.addEvent("afterResize", function () {
  3260. this.resizeScript();
  3261. }.bind(this))
  3262. this.addEvent("queryClose", function () {
  3263. }.bind(this))
  3264. this.resizeScript();
  3265. }.bind(this));
  3266. },
  3267. resizeScript: function () {
  3268. var size = this.formTableContainer.getSize();
  3269. var tableSize = this.formTableContainer.getElement('table').getSize();
  3270. this.formTableContainer.getElement('[item="workData"]').setStyle("height", size.y - 200);
  3271. if (this.scriptEditor && this.scriptEditor.editor) this.scriptEditor.editor.resize();
  3272. },
  3273. getFileSize: function (size) {
  3274. if (!size)
  3275. return "";
  3276. var num = 1024.00; //byte
  3277. if (size < num)
  3278. return size + "B";
  3279. if (size < Math.pow(num, 2))
  3280. return (size / num).toFixed(2) + "K"; //kb
  3281. if (size < Math.pow(num, 3))
  3282. return (size / Math.pow(num, 2)).toFixed(2) + "M"; //M
  3283. if (size < Math.pow(num, 4))
  3284. return (size / Math.pow(num, 3)).toFixed(2) + "G"; //G
  3285. },
  3286. });
  3287. MWF.xApplication.process.Application.ManageWorkCompletedForm = new Class({
  3288. Extends: MWF.xApplication.process.Application.ManageWorkForm,
  3289. loadTab : function (){
  3290. this.tabNode = new Element("div",{"styles" : this.css.tabNode }).inject(this.formTableArea);
  3291. this.taskDoneArea = new Element("div",{"styles" : this.css.tabPageContainer }).inject(this.tabNode);
  3292. this.readArea = new Element("div",{"styles" : this.css.tabPageContainer }).inject(this.tabNode);
  3293. this.readDoneArea = new Element("div",{"styles" : this.css.tabPageContainer }).inject(this.tabNode);
  3294. this.reviewArea = new Element("div",{"styles" : this.css.tabPageContainer }).inject(this.tabNode);
  3295. this.attachementArea = new Element("div",{"styles" : this.css.tabPageContainer }).inject(this.tabNode);
  3296. this.recordArea = new Element("div",{"styles" : this.css.tabPageContainer }).inject(this.tabNode);
  3297. this.businessDataArea = new Element("div",{"styles" : this.css.tabPageContainer }).inject(this.tabNode);
  3298. MWF.require("MWF.widget.Tab", function(){
  3299. this.tabs = new MWF.widget.Tab(this.tabNode, {"style": "attendance"});
  3300. this.tabs.load();
  3301. this.taskDonePage = this.tabs.addTab(this.taskDoneArea, this.lp.taskDone, false);
  3302. this.taskDonePage.addEvent("show",function(){
  3303. if(!this.initTaskDone) this.loadTaskDone();
  3304. }.bind(this));
  3305. this.readPage = this.tabs.addTab(this.readArea, this.lp.read, false);
  3306. this.readPage.addEvent("show",function(){
  3307. if(!this.initRead) this.loadRead();
  3308. }.bind(this));
  3309. this.readDonePage = this.tabs.addTab(this.readDoneArea, this.lp.readDone, false);
  3310. this.readDonePage.addEvent("show",function(){
  3311. if(!this.initReadDone) this.loadReadDone();
  3312. }.bind(this));
  3313. this.recordPage = this.tabs.addTab(this.recordArea, this.lp.workLog, false);
  3314. this.recordPage.addEvent("show",function(){
  3315. if(!this.initRecord) this.loadRecord();
  3316. }.bind(this));
  3317. this.reviewPage = this.tabs.addTab(this.reviewArea, this.lp.review, false);
  3318. this.reviewPage.addEvent("show",function(){
  3319. if(!this.initReview) this.loadReview();
  3320. }.bind(this));
  3321. this.attachementPage = this.tabs.addTab(this.attachementArea, this.lp.attachment, false);
  3322. this.attachementPage.addEvent("show",function(){
  3323. if(!this.initAttachement) this.loadAttachement();
  3324. }.bind(this));
  3325. this.businessDataPage = this.tabs.addTab(this.businessDataArea, this.lp.businessData, false);
  3326. this.businessDataPage.addEvent("show",function(){
  3327. if(!this.initBusinessData) this.loadBusinessData();
  3328. }.bind(this));
  3329. this.tabs.pages[0].showTab();
  3330. }.bind(this));
  3331. }
  3332. });