WorkReportList.js 29 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793
  1. MWF.xApplication.Execution = MWF.xApplication.Execution || {};
  2. MWF.xDesktop.requireApp("Template", "Explorer", null, false);
  3. MWF.require("MWF.widget.Identity", null,false);
  4. MWF.xApplication.Execution.WorkReportList = new Class({
  5. Extends: MWF.widget.Common,
  6. Implements: [Options, Events],
  7. options: {
  8. "style": "default",
  9. "workNavi1" : ""
  10. },
  11. initialize: function (node, app, actions, options) {
  12. this.setOptions(options);
  13. this.app = app;
  14. this.lp = app.lp.WorkReportList;
  15. this.path = "/x_component_Execution/$WorkReportList/";
  16. this.loadCss();
  17. this.actions = actions;
  18. this.node = $(node);
  19. },
  20. loadCss: function () {
  21. this.cssPath = "/x_component_Execution/$WorkReportList/" + this.options.style + "/css.wcss";
  22. this._loadCss();
  23. },
  24. load: function () {
  25. this.tabLocation = "";
  26. this.middleContent = this.app.middleContent;
  27. this.middleContent.setStyles({"margin-top":"0px","border":"0px solid #f00"});
  28. this.createNaviContent();
  29. this.createContentDiv();
  30. this.resizeWindow();
  31. this.app.addEvent("resize", function(){
  32. this.resizeWindow();
  33. }.bind(this));
  34. },
  35. resizeWindow: function(){
  36. var size = this.app.middleContent.getSize();
  37. this.naviDiv.setStyles({"height":(size.y-60)+"px"});
  38. this.naviContentDiv.setStyles({"height":(size.y-180)+"px"});
  39. this.contentDiv.setStyles({"height":(size.y-60)+"px"});
  40. this.rightContentDiv.setStyles({"height":(size.y-40-100)+"px"});
  41. },
  42. createNaviContent: function(){
  43. this.naviDiv = new Element("div.naviDiv",{
  44. "styles":this.css.naviDiv
  45. }).inject(this.middleContent);
  46. this.naviTitleDiv = new Element("div.naviTitleDiv",{
  47. "styles":this.css.naviTitleDiv,
  48. "text":this.lp.title
  49. }).inject(this.naviDiv);
  50. this.naviContentDiv = new Element("div.naviContentDiv",{"styles":this.css.naviContentDiv}).inject(this.naviDiv);
  51. this.naviBottomDiv = new Element("div.naviBottomDiv",{"styles":this.css.naviBottomDiv}).inject(this.naviDiv);
  52. var naviContentLi = new Element("li.naviContentLi",{"styles":this.css.naviContentLi}).inject(this.naviContentDiv)
  53. .addEvents({
  54. "click":function(){
  55. this.app.openTask()
  56. }.bind(this)
  57. });
  58. var naviContentImg = new Element("img.naviContentImg",{
  59. "styles":this.css.naviContentImg,
  60. "src":"/x_component_Execution/$WorkReportList/default/icon/Prototype-100.png"
  61. }).inject(naviContentLi);
  62. var naviContentSpan = new Element("span.naviContentSpan",{
  63. "styles":this.css.naviContentSpan,
  64. "text":this.lp.naviItem.workDeploy
  65. }).inject(naviContentLi);
  66. //var naviContentLi = new Element("li.naviContentLi",{"styles":this.css.naviContentLi}).inject(this.naviContentDiv);
  67. //var naviContentImg = new Element("img.naviContentImg",{
  68. // "styles":this.css.naviContentImg,
  69. // "src":"/x_component_Execution/$WorkReportList/default/icon/Conference-100.png"
  70. //}).inject(naviContentLi);
  71. //var naviContentSpan = new Element("span.naviContentSpan",{
  72. // "styles":this.css.naviContentSpan,
  73. // "text":this.lp.naviItem.workConsult
  74. //}).inject(naviContentLi)
  75. //
  76. //var naviContentLi = new Element("li.naviContentLi",{"styles":this.css.naviContentLi}).inject(this.naviContentDiv);
  77. //var naviContentImg = new Element("img.naviContentImg",{
  78. // "styles":this.css.naviContentImg,
  79. // "src":"/x_component_Execution/$WorkReportList/default/icon/Department-100.png"
  80. //}).inject(naviContentLi);
  81. //var naviContentSpan = new Element("span.naviContentSpan",{
  82. // "styles":this.css.naviContentSpan,
  83. // "text":this.lp.naviItem.workStat
  84. //}).inject(naviContentLi)
  85. },
  86. createContentDiv: function(){
  87. this.contentDiv = new Element("div.contentDiv",{"styles":this.css.contentDiv}).inject(this.middleContent);
  88. this.createCategoryItemDiv();
  89. this.createSearchDiv();
  90. this.createRightContentDiv();
  91. },
  92. createCategoryItemDiv: function(){
  93. this.rightCategoryDiv = new Element("div.rightCategoryDiv",{"styles":this.css.rightCategoryDiv}).inject(this.contentDiv);
  94. this.rightCategoryItemDiv = new Element("div.rightCategoryItemDiv",{"styles":this.css.rightCategoryItemDiv}).inject(this.rightCategoryDiv);
  95. this.drafterLi = new Element("li.drafterLi",{
  96. "styles":this.css.rightCategoryItemLi,
  97. "text": this.lp.drafterTab
  98. }).inject(this.rightCategoryItemDiv)
  99. .addEvents({
  100. "click":function(){
  101. //alert("草稿箱点击");
  102. //this.rightContentDiv.destroy();
  103. //this.createCenterWorkSearchDiv();
  104. this.createView( "drafter" );
  105. }.bind(this)
  106. });
  107. this.todoLi = new Element("li.todoLi",{
  108. "styles":this.css.rightCategoryItemCurrentLi,
  109. "text": this.lp.todoTab
  110. }).inject(this.rightCategoryItemDiv)
  111. .addEvents({
  112. "click":function(){
  113. //alert("待处理点击");
  114. //this.rightContentDiv.destroy();
  115. this.createView( "todo" );
  116. //this.createBaseWorkSearchDiv();
  117. //this.createRightContentDiv("base");
  118. }.bind(this)
  119. });
  120. this.doneLi = new Element("li.doneLi",{
  121. "styles":this.css.rightCategoryItemLi,
  122. "text": this.lp.doneTab
  123. }).inject(this.rightCategoryItemDiv)
  124. .addEvents({
  125. "click":function(){
  126. //alert("已处理点击");
  127. //this.rightContentDiv.destroy();
  128. //this.createBaseWorkSearchDiv();
  129. this.createView( "done" );
  130. }.bind(this)
  131. });
  132. this.archiveLi = new Element("li.archiveLi",{
  133. "styles":this.css.rightCategoryItemLi,
  134. "text": this.lp.archiveTab
  135. }).inject(this.rightCategoryItemDiv)
  136. .addEvents({
  137. "click":function(){
  138. //alert("已处理点击");
  139. //this.rightContentDiv.destroy();
  140. //this.createBaseWorkSearchDiv();
  141. this.createView( "archive" );
  142. }.bind(this)
  143. })
  144. },
  145. createView : function( str ){
  146. this.workNavi1 = str || "todo";
  147. if( str == "done" ){
  148. this.drafterLi.setStyles({"border-bottom":""});
  149. this.todoLi.setStyles({"border-bottom":""});
  150. this.doneLi.setStyles({"border-bottom":"2px solid #124c93"});
  151. this.archiveLi.setStyles({"border-bottom":""});
  152. this.createDoneView();
  153. }else if(str == "drafter"){
  154. this.drafterLi.setStyles({"border-bottom":"2px solid #124c93"});
  155. this.todoLi.setStyles({"border-bottom":""});
  156. this.doneLi.setStyles({"border-bottom":""});
  157. this.archiveLi.setStyles({"border-bottom":""});
  158. this.createDrafterView();
  159. }else if(str=="archive"){
  160. this.drafterLi.setStyles({"border-bottom":""});
  161. this.todoLi.setStyles({"border-bottom":""});
  162. this.doneLi.setStyles({"border-bottom":""});
  163. this.archiveLi.setStyles({"border-bottom":"2px solid #124c93"});
  164. this.createArchiveView();
  165. }else{
  166. this.drafterLi.setStyles({"border-bottom":""});
  167. this.todoLi.setStyles({"border-bottom":"2px solid #124c93"});
  168. this.doneLi.setStyles({"border-bottom":""});
  169. this.archiveLi.setStyles({"border-bottom":""});
  170. this.createTodoView();
  171. }
  172. },
  173. createSearchDiv:function(){
  174. this.rightSearchDiv = new Element("div.rightSearchDiv",{"styles":this.css.rightSearchDiv}).inject(this.contentDiv);
  175. rightSearchBarSpan = new Element("span.rightSearchBarSpan",{
  176. "styles":this.css.rightSearchBarSpan
  177. }).inject(this.rightSearchDiv);
  178. this.rightSearchBarInput = new Element("input",{
  179. "styles":this.css.rightSearchBarInput,
  180. "type":"text"
  181. }).inject(rightSearchBarSpan)
  182. .addEvents({
  183. "keyup": function(e){
  184. if(e.code == 13){
  185. this.searchAction();
  186. }
  187. }.bind(this)
  188. });
  189. this.rightSearchBarSearch = new Element("div.rightSearchBarSearch",{
  190. "styles":this.css.rightSearchBarSearch,
  191. "text" : MWF.xApplication.Execution.LP.workTask.search
  192. }).inject(rightSearchBarSpan)
  193. .addEvents({
  194. "click":function(){
  195. this.searchAction();
  196. }.bind(this)
  197. })
  198. },
  199. searchAction: function(){
  200. var filterData = {};
  201. filterData.title = this.rightSearchBarInput.get("value");
  202. if(this.drafterView) this.createDrafterView(filterData);
  203. if(this.todoView) this.createTodoView(filterData);
  204. if(this.doneView) this.createDoneView(filterData)
  205. },
  206. createRightContentDiv: function(){
  207. if(this.rightContentDiv)this.rightContentDiv.destroy();
  208. this.rightContentDiv = new Element("div.rightContentDiv",{
  209. "styles":this.css.rightContentDiv
  210. }).inject(this.contentDiv);
  211. //MWF.require("MWF.widget.ScrollBar", function () {
  212. // new MWF.widget.ScrollBar(this.rightContentDiv, {
  213. // "indent": false,
  214. // "style": "xApp_TaskList",
  215. // "where": "before",
  216. // "distance": 30,
  217. // "friction": 4,
  218. // "axis": {"x": false, "y": true},
  219. // "onScroll": function (y) {
  220. // var scrollSize = this.rightContentDiv.getScrollSize();
  221. // var clientSize = this.rightContentDiv.getSize();
  222. // var scrollHeight = scrollSize.y - clientSize.y;
  223. // var view = this.baseView || this.centerView;
  224. // if (y + 200 > scrollHeight && view && view.loadElementList) {
  225. // if (! view.isItemsLoaded) view.loadElementList();
  226. // }
  227. // }.bind(this)
  228. // });
  229. //}.bind(this));
  230. this.createView( this.options.workNavi1 );
  231. },
  232. createTodoView: function(filterData){
  233. if( this.drafterView )delete this.drafterView;
  234. if( this.todoView )delete this.todoView;
  235. if( this.doneView )delete this.doneView;
  236. if( this.archiveView) delete this.archiveView;
  237. //if(this.rightContentDiv) this.rightContentDiv.empty();
  238. this.reloadRightContentDiv();
  239. this.rightContentDiv.setStyles({"height":this.app.middleContent.getSize().y-40-100+"px"});
  240. if(this.scrollBar && this.scrollBar.scrollVAreaNode){
  241. this.scrollBar.scrollVAreaNode.destroy()
  242. }
  243. MWF.require("MWF.widget.ScrollBar", function () {
  244. //if(this.scrollBar) this.scrollBar.destroy()
  245. this.scrollBar = new MWF.widget.ScrollBar(this.rightContentDiv, {
  246. "indent": false,
  247. "style": "xApp_TaskList",
  248. "where": "before",
  249. "distance": 30,
  250. "friction": 4,
  251. "axis": {"x": false, "y": true},
  252. "onScroll": function (y) {
  253. var scrollSize = this.rightContentDiv.getScrollSize();
  254. var clientSize = this.rightContentDiv.getSize();
  255. var scrollHeight = scrollSize.y - clientSize.y;
  256. var view = this.todoView;
  257. if (y + 200 > scrollHeight && view && view.loadElementList) {
  258. if (! view.isItemsLoaded) view.loadElementList();
  259. }
  260. }.bind(this)
  261. });
  262. }.bind(this),false);
  263. this.todoView = new MWF.xApplication.Execution.WorkReportList.todoView(this.rightContentDiv, this.app, this, { templateUrl : this.path+"listItem_todo.json",filterData: filterData },{lp: this.lp.view} );
  264. this.todoView.load();
  265. },
  266. createDrafterView: function(filterData){
  267. if( this.drafterView )delete this.drafterView;
  268. if( this.todoView )delete this.todoView;
  269. if( this.doneView )delete this.doneView;
  270. if( this.archiveView) delete this.archiveView;
  271. //if(this.rightContentDiv) this.rightContentDiv.empty();
  272. this.reloadRightContentDiv();
  273. this.rightContentDiv.setStyles({"height":this.app.middleContent.getSize().y-40-100+"px"});
  274. if(this.scrollBar && this.scrollBar.scrollVAreaNode){
  275. this.scrollBar.scrollVAreaNode.destroy()
  276. }
  277. MWF.require("MWF.widget.ScrollBar", function () {
  278. //if(this.scrollBar) this.scrollBar.destroy()
  279. this.scrollBar = new MWF.widget.ScrollBar(this.rightContentDiv, {
  280. "indent": false,
  281. "style": "xApp_TaskList",
  282. "where": "before",
  283. "distance": 30,
  284. "friction": 4,
  285. "axis": {"x": false, "y": true},
  286. "onScroll": function (y) {
  287. var scrollSize = this.rightContentDiv.getScrollSize();
  288. var clientSize = this.rightContentDiv.getSize();
  289. var scrollHeight = scrollSize.y - clientSize.y;
  290. var view = this.drafterView;
  291. if (y + 200 > scrollHeight && view && view.loadElementList) {
  292. if (! view.isItemsLoaded) view.loadElementList();
  293. }
  294. }.bind(this)
  295. });
  296. }.bind(this),false);
  297. this.drafterView = new MWF.xApplication.Execution.WorkReportList.DrafterView(this.rightContentDiv, this.app, this, {
  298. templateUrl : this.path+"listItem_drafter.json",
  299. filterData: filterData
  300. },{lp: this.lp.view} );
  301. this.drafterView.load();
  302. },
  303. reloadRightContentDiv : function(){
  304. if(this.rightContentDiv)this.rightContentDiv.destroy();
  305. this.rightContentDiv = new Element("div.rightContentDiv",{
  306. "styles":this.css.rightContentDiv
  307. }).inject(this.contentDiv);
  308. },
  309. createDoneView: function(filterData){
  310. if( this.drafterView )delete this.drafterView;
  311. if( this.todoView )delete this.todoView;
  312. if( this.doneView )delete this.doneView;
  313. if( this.archiveView) delete this.archiveView;
  314. //if(this.rightContentDiv) this.rightContentDiv.empty();
  315. this.reloadRightContentDiv();
  316. this.rightContentDiv.setStyles({"height":this.app.middleContent.getSize().y-40-100+"px"});
  317. if(this.scrollBar && this.scrollBar.scrollVAreaNode){
  318. this.scrollBar.scrollVAreaNode.destroy()
  319. }
  320. MWF.require("MWF.widget.ScrollBar", function () {
  321. //if(this.scrollBar) this.scrollBar.destroy()
  322. this.scrollBar = new MWF.widget.ScrollBar(this.rightContentDiv, {
  323. "indent": false,
  324. "style": "xApp_TaskList",
  325. "where": "before",
  326. "distance": 30,
  327. "friction": 4,
  328. "axis": {"x": false, "y": true},
  329. "onScroll": function (y) {
  330. var scrollSize = this.rightContentDiv.getScrollSize();
  331. var clientSize = this.rightContentDiv.getSize();
  332. var scrollHeight = scrollSize.y - clientSize.y;
  333. if (y + 200 > scrollHeight && this.doneView && this.doneView.loadElementList) {
  334. if (! this.doneView.isItemsLoaded) this.doneView.loadElementList();
  335. }
  336. }.bind(this)
  337. });
  338. }.bind(this),false);
  339. this.doneView = new MWF.xApplication.Execution.WorkReportList.doneView(this.rightContentDiv, this.app, this, { templateUrl : this.path+"listItem_done.json",filterData: filterData },{lp: this.lp.view} )
  340. this.doneView.load();
  341. },
  342. createArchiveView: function(filterData){
  343. if( this.drafterView )delete this.drafterView;
  344. if( this.todoView )delete this.todoView;
  345. if( this.doneView )delete this.doneView;
  346. if( this.archiveView) delete this.archiveView;
  347. //if(this.rightContentDiv) this.rightContentDiv.empty();
  348. this.reloadRightContentDiv();
  349. this.rightContentDiv.setStyles({"height":this.app.middleContent.getSize().y-40-100+"px"});
  350. if(this.scrollBar && this.scrollBar.scrollVAreaNode){
  351. this.scrollBar.scrollVAreaNode.destroy()
  352. }
  353. MWF.require("MWF.widget.ScrollBar", function () {
  354. //if(this.scrollBar) this.scrollBar.destroy()
  355. this.scrollBar = new MWF.widget.ScrollBar(this.rightContentDiv, {
  356. "indent": false,
  357. "style": "xApp_TaskList",
  358. "where": "before",
  359. "distance": 30,
  360. "friction": 4,
  361. "axis": {"x": false, "y": true},
  362. "onScroll": function (y) {
  363. var scrollSize = this.rightContentDiv.getScrollSize();
  364. var clientSize = this.rightContentDiv.getSize();
  365. var scrollHeight = scrollSize.y - clientSize.y;
  366. if (y + 200 > scrollHeight && this.archiveView && this.archiveView.loadElementList) {
  367. if (! this.archiveView.isItemsLoaded) this.archiveView.loadElementList();
  368. }
  369. }.bind(this)
  370. });
  371. }.bind(this),false);
  372. this.archiveView = new MWF.xApplication.Execution.WorkReportList.archiveView(this.rightContentDiv, this.app, this, { templateUrl : this.path+"listItem_archive.json",filterData: filterData },{lp: this.lp.view} );
  373. this.archiveView.load();
  374. }
  375. });
  376. MWF.xApplication.Execution.WorkReportList.DrafterView = new Class({
  377. Extends: MWF.xApplication.Template.Explorer.ComplexView,
  378. _createDocument: function(data){
  379. return new MWF.xApplication.Execution.WorkReportList.DrafterDocument(this.viewNode, data, this.explorer, this);
  380. },
  381. _getCurrentPageData: function(callback, count){
  382. if (!count)count = 20;
  383. var id = (this.items.length) ? this.items[this.items.length - 1].data.id : "(0)";
  384. if(id=="(0)")this.app.createShade();
  385. var filter = this.options.filterData || {};
  386. this.actions.getWorkReportDrafterNext(id, count, filter,function(json){
  387. if (callback)callback(json);
  388. this.app.destroyShade();
  389. }.bind(this))
  390. },
  391. _removeDocument: function(documentData, all){
  392. this.actions.deleteWortReport(documentData.id, function(json){
  393. if(json.type && json.type == "success"){
  394. this.explorer.createDrafterView();
  395. this.app.notice(this.explorer.lp.prompt.deleteWortReport, "success");
  396. }
  397. }.bind(this),function(xhr,text,error){
  398. var errorText = error;
  399. if (xhr) errorMessage = xhr.responseText;
  400. var e = JSON.parse(errorMessage);
  401. if(e.message){
  402. this.app.notice( e.message,"error");
  403. }else{
  404. this.app.notice( errorText,"error");
  405. }
  406. }.bind(this));
  407. },
  408. _create: function(){
  409. },
  410. _openDocument: function( documentData ){
  411. MWF.xDesktop.requireApp("Execution", "WorkReport", function(){
  412. var data = {
  413. workReportId : documentData.id,
  414. workId : documentData.workId
  415. };
  416. this.workReport = new MWF.xApplication.Execution.WorkReport(this, this.actions,data,{
  417. "isEdited":false,
  418. onReloadView : function( data ){
  419. this.explorer.createDrafterView();
  420. }.bind(this)
  421. } );
  422. this.workReport.load();
  423. }.bind(this));
  424. },
  425. _queryCreateViewNode: function(){
  426. },
  427. _postCreateViewNode: function( viewNode ){
  428. },
  429. _queryCreateViewHead:function(){
  430. },
  431. _postCreateViewHead: function( headNode ){
  432. }
  433. });
  434. MWF.xApplication.Execution.WorkReportList.DrafterDocument = new Class({
  435. Extends: MWF.xApplication.Template.Explorer.ComplexDocument,
  436. action_open:function(){
  437. },
  438. _queryCreateDocumentNode:function( itemData ){
  439. },
  440. _postCreateDocumentNode: function( itemNode, itemData ){
  441. if(itemNode.getElements("div[item='title']")){
  442. itemNode.getElements("div[item='title']").set("title",itemData.title)
  443. }
  444. },
  445. removeCenterWork : function(itemData){
  446. return false;
  447. }
  448. });
  449. MWF.xApplication.Execution.WorkReportList.todoView = new Class({
  450. Extends: MWF.xApplication.Template.Explorer.ComplexView,
  451. _createDocument: function(data){
  452. return new MWF.xApplication.Execution.WorkReportList.todoDocument(this.viewNode, data, this.explorer, this);
  453. },
  454. _getCurrentPageData: function(callback, count){
  455. if (!count)count = 20;
  456. var id = (this.items.length) ? this.items[this.items.length - 1].data.id : "(0)";
  457. if(id=="(0)")this.app.createShade();
  458. var filter = this.options.filterData || {};
  459. this.actions.getWorkReportTodoNext(id, count, filter,function(json){
  460. if (callback)callback(json);
  461. this.app.destroyShade();
  462. }.bind(this))
  463. },
  464. _removeDocument: function(documentData, all){
  465. this.actions.deleteCenterWork(documentData.id, function(json){
  466. if(this.tabLocation == "centerDrafter"){
  467. this.app.workTask.loadCenterWorkList("drafter")
  468. }else if(this.tabLocation == "centerDeploy"){
  469. this.app.workTask.loadCenterWorkList("deploy")
  470. }
  471. this.app.notice(this.app.lp.deleteDocumentOK, "success");
  472. }.bind(this));
  473. },
  474. _create: function(){
  475. },
  476. _openDocument: function( documentData ){
  477. MWF.xDesktop.requireApp("Execution", "WorkReport", function(){
  478. var data = {
  479. workReportId : documentData.workReportId,
  480. workId : documentData.workId
  481. };
  482. this.workReport = new MWF.xApplication.Execution.WorkReport(this, this.actions,data,{
  483. "isEdited":false,
  484. onReloadView : function( data ){
  485. this.explorer.createTodoView();
  486. }.bind(this)
  487. } );
  488. this.workReport.load();
  489. }.bind(this));
  490. },
  491. _queryCreateViewNode: function(){
  492. },
  493. _postCreateViewNode: function( viewNode ){
  494. },
  495. _queryCreateViewHead:function(){
  496. },
  497. _postCreateViewHead: function( headNode ){
  498. }
  499. });
  500. MWF.xApplication.Execution.WorkReportList.todoDocument = new Class({
  501. Extends: MWF.xApplication.Template.Explorer.ComplexDocument,
  502. action_open:function(){
  503. },
  504. _queryCreateDocumentNode:function( itemData ){
  505. },
  506. _postCreateDocumentNode: function( itemNode, itemData ){
  507. if(itemNode.getElements("div[item='title']")){
  508. itemNode.getElements("div[item='title']").set("title",itemData.title)
  509. }
  510. },
  511. removeCenterWork : function(itemData){
  512. return false;
  513. }
  514. });
  515. MWF.xApplication.Execution.WorkReportList.doneView = new Class({
  516. Extends: MWF.xApplication.Template.Explorer.ComplexView,
  517. _createDocument: function(data){
  518. return new MWF.xApplication.Execution.WorkReportList.doneDocument(this.viewNode, data, this.explorer, this);
  519. },
  520. _getCurrentPageData: function(callback, count){
  521. if (!count)count = 20;
  522. var id = (this.items.length) ? this.items[this.items.length - 1].data.id : "(0)";
  523. if(id=="(0)")this.app.createShade();
  524. var filter = this.options.filterData || {};
  525. this.actions.getWorkReportDoneNext(id, count, filter,function(json){
  526. if (callback)callback(json);
  527. this.app.destroyShade();
  528. }.bind(this))
  529. },
  530. _removeDocument: function(documentData, all){
  531. this.actions.deleteCenterWork(documentData.id, function(json){
  532. if(this.tabLocation == "centerDrafter"){
  533. this.app.workTask.loadCenterWorkList("drafter")
  534. }else if(this.tabLocation == "centerDeploy"){
  535. this.app.workTask.loadCenterWorkList("deploy")
  536. }
  537. this.app.notice(this.app.lp.deleteDocumentOK, "success");
  538. }.bind(this));
  539. },
  540. _create: function(){
  541. },
  542. _openDocument: function( documentData ){
  543. MWF.xDesktop.requireApp("Execution", "WorkReport", function(){
  544. var data = {
  545. workReportId : documentData.workReportId,
  546. workId : documentData.workId
  547. };
  548. this.workReport = new MWF.xApplication.Execution.WorkReport(this, this.actions,data,{
  549. "isEdited":false,
  550. onReloadView : function( data ){
  551. this.explorer.createDoneView();
  552. }.bind(this)
  553. } );
  554. this.workReport.load();
  555. }.bind(this));
  556. },
  557. _queryCreateViewNode: function(){
  558. },
  559. _postCreateViewNode: function( viewNode ){
  560. },
  561. _queryCreateViewHead:function(){
  562. },
  563. _postCreateViewHead: function( headNode ){
  564. }
  565. });
  566. MWF.xApplication.Execution.WorkReportList.doneDocument = new Class({
  567. Extends: MWF.xApplication.Template.Explorer.ComplexDocument,
  568. action_open:function(){
  569. MWF.xDesktop.requireApp("Execution", "WorkDeploy", function(){
  570. var isEditedBool = (this.view.tabLocation == "centerDrafter" || this.view.tabLocation == "baseDrafter") ? true : false;
  571. this.workDeploy = new MWF.xApplication.Execution.WorkDeploy(this.view, this.view.app.restActions,{"id":this.data.id},{"isEdited":isEditedBool,"centerWorkId":this.data.id} );
  572. this.workDeploy.load();
  573. }.bind(this))
  574. },
  575. _queryCreateDocumentNode:function( itemData ){
  576. },
  577. _postCreateDocumentNode: function( itemNode, itemData ){
  578. if(itemNode.getElements("div[item='title']")){
  579. itemNode.getElements("div[item='title']").set("title",itemData.title)
  580. }
  581. },
  582. removeCenterWork : function(itemData){
  583. return false;
  584. }
  585. });
  586. MWF.xApplication.Execution.WorkReportList.archiveView = new Class({
  587. Extends: MWF.xApplication.Template.Explorer.ComplexView,
  588. _createDocument: function(data){
  589. return new MWF.xApplication.Execution.WorkReportList.archiveDocument(this.viewNode, data, this.explorer, this);
  590. },
  591. _getCurrentPageData: function(callback, count){
  592. if (!count)count = 20;
  593. var id = (this.items.length) ? this.items[this.items.length - 1].data.id : "(0)";
  594. if(id=="(0)")this.app.createShade();
  595. var filter = this.options.filterData || {};
  596. this.actions.getWorkReportArchiveNext(id, count, filter,function(json){
  597. if (callback)callback(json);
  598. this.app.destroyShade();
  599. }.bind(this))
  600. },
  601. _removeDocument: function(documentData, all){
  602. this.actions.deleteCenterWork(documentData.id, function(json){
  603. if(this.tabLocation == "centerDrafter"){
  604. this.app.workTask.loadCenterWorkList("drafter")
  605. }else if(this.tabLocation == "centerDeploy"){
  606. this.app.workTask.loadCenterWorkList("deploy")
  607. }
  608. this.app.notice(this.app.lp.deleteDocumentOK, "success");
  609. }.bind(this));
  610. },
  611. _create: function(){
  612. },
  613. _openDocument: function( documentData ){
  614. MWF.xDesktop.requireApp("Execution", "WorkReport", function(){
  615. var data = {
  616. workReportId : documentData.workReportId,
  617. workId : documentData.workId
  618. };
  619. this.workReport = new MWF.xApplication.Execution.WorkReport(this, this.actions,data,{
  620. "isEdited":false,
  621. onReloadView : function( data ){
  622. this.explorer.createDoneView();
  623. }.bind(this)
  624. } );
  625. this.workReport.load();
  626. }.bind(this));
  627. },
  628. _queryCreateViewNode: function(){
  629. },
  630. _postCreateViewNode: function( viewNode ){
  631. },
  632. _queryCreateViewHead:function(){
  633. },
  634. _postCreateViewHead: function( headNode ){
  635. }
  636. });
  637. MWF.xApplication.Execution.WorkReportList.archiveDocument = new Class({
  638. Extends: MWF.xApplication.Template.Explorer.ComplexDocument,
  639. action_open:function(){
  640. MWF.xDesktop.requireApp("Execution", "WorkDeploy", function(){
  641. var isEditedBool = (this.view.tabLocation == "centerDrafter" || this.view.tabLocation == "baseDrafter") ? true : false
  642. this.workDeploy = new MWF.xApplication.Execution.WorkDeploy(this.view, this.view.app.restActions,{"id":this.data.id},{"isEdited":isEditedBool,"centerWorkId":this.data.id} );
  643. this.workDeploy.load();
  644. }.bind(this))
  645. },
  646. _queryCreateDocumentNode:function( itemData ){
  647. },
  648. _postCreateDocumentNode: function( itemNode, itemData ){
  649. if(itemNode.getElements("div[item='title']")){
  650. itemNode.getElements("div[item='title']").set("title",itemData.title)
  651. }
  652. },
  653. removeCenterWork : function(itemData){
  654. return false;
  655. }
  656. });