ListView.js 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694
  1. MWF.xDesktop.requireApp("Template", "MForm", null, false);
  2. MWF.xApplication.Report.ListView = new Class({
  3. Extends: MWF.widget.Common,
  4. Implements: [Options, Events],
  5. options: {
  6. "style": "default",
  7. "date": null,
  8. "isTodo" : false,
  9. "action" : ""
  10. },
  11. initialize: function(node, app, options){
  12. this.setOptions(options);
  13. this.path = "../x_component_Report/$ListView/";
  14. this.cssPath = "../x_component_Report/$ListView/"+this.options.style+"/css.wcss";
  15. this._loadCss();
  16. this.app = app;
  17. this.container = $(node);
  18. this.date = this.options.date || new Date();
  19. this.load();
  20. },
  21. load: function(){
  22. this.node = new Element("div", {"styles": this.css.node}).inject(this.container);
  23. //this.leftNode = new Element("div", {"styles": this.css.leftNode}).inject(this.node);
  24. this.contentAreaNode = new Element("div.contentAreaNode", {"styles": this.css.contentAreaNode}).inject(this.node);
  25. this.contentNode = new Element("div.contentNode", {"styles": this.css.contentNode}).inject(this.contentAreaNode);
  26. this.filterNode = new Element("div.filterNode", {"styles": this.css.filterNode}).inject(this.contentNode);
  27. this.viewNode = new Element("div.viewNode", {"styles": this.css.viewNode}).inject(this.contentNode);
  28. //this.loadSideBar();
  29. this.resetNodeSizeFun = this.resetNodeSize.bind(this);
  30. this.app.addEvent("resize", this.resetNodeSizeFun );
  31. if( this.options.isTodo ){
  32. this.toTodo();
  33. }else{
  34. this.toApplyAll();
  35. }
  36. this.resetNodeSize();
  37. },
  38. resetNodeSize: function(){
  39. //var size = this.container.getSize();
  40. //if (this.app.reportConfig.hideMenu=="static"){
  41. // var y = size.y-120;
  42. // this.node.setStyle("height", ""+y+"px");
  43. // this.node.setStyle("margin-top", "60px");
  44. //}else{
  45. // var y = size.y-20;
  46. // this.node.setStyle("height", ""+y+"px");
  47. //}
  48. var size = this.container.getSize();
  49. var y = size.y-120;
  50. //this.node.setStyle("margin-top", "60px");
  51. //this.node.setStyle("height", ""+y+"px");
  52. if( !this.app.inContainer )this.viewNode.setStyle("height", ""+y+"px");
  53. //this.leftNode.setStyle("height", ""+size.y-60+"px");
  54. var sideBar = this.app.sideBar ? this.app.sideBar.getSize() : { x : 0, y : 0 };
  55. this.contentAreaNode.setStyle("margin-right",sideBar.x+"px");
  56. },
  57. loadLeftNavi: function(){
  58. var menuNode = new Element("div.menuNode", {"styles": this.css.menuNode, "text": this.app.lp.listNavi.myApply}).inject(this.leftNode);
  59. this.loadNaviItem(this.app.lp.listNavi.wait, "toApplyWait");
  60. this.loadNaviItem(this.app.lp.listNavi.processing, "toApplyProcessing");
  61. this.loadNaviItem(this.app.lp.listNavi.completed, "toApplyCompleted");
  62. this.loadNaviItem(this.app.lp.listNavi.allStatus, "toApplyAll");
  63. var menuNode = new Element("div.menuNode", {"styles": this.css.menuNode, "text": this.app.lp.listNavi.myReport}).inject(this.leftNode);
  64. //this.loadNaviItem(this.app.lp.listNavi.wait, "toAuditWait");
  65. this.loadNaviItem(this.app.lp.listNavi.waitProcessing, "toAuditProcessing");
  66. this.loadNaviItem(this.app.lp.listNavi.allStatus, "toAuditAll");
  67. //this.loadNaviItem(this.app.lp.listNavi.reject, "toReportReject");
  68. if( this.app.common.isAdmin() ){
  69. var menuNode = new Element("div.menuNode", {"styles": this.css.menuNode, "text": this.app.lp.listNavi.manage}).inject(this.leftNode);
  70. //this.loadNaviItem(this.app.lp.listNavi.wait, "toAuditWait");
  71. this.loadNaviItem(this.app.lp.listNavi.all, "toAll");
  72. }
  73. //var menuNode = new Element("div", {"styles": this.css.menuNode, "text": this.app.lp.listNavi.room}).inject(this.leftNode);
  74. },
  75. loadNaviItem: function(text, action){
  76. var itemNode = new Element("div", {"styles": this.css.menuItemNode, "text": text}).inject(this.leftNode);
  77. var _self = this;
  78. itemNode.addEvents({
  79. "mouseover": function(){if (_self.currentNavi != this) this.setStyles(_self.css.menuItemNode_over);},
  80. "mouseout": function(){if (_self.currentNavi != this) this.setStyles(_self.css.menuItemNode);},
  81. "click": function(){
  82. if (_self.currentNavi) _self.currentNavi.setStyles(_self.css.menuItemNode);
  83. _self.currentNavi = this;
  84. this.setStyles(_self.css.menuItemNode_current);
  85. if (_self[action]) _self[action]();
  86. }
  87. });
  88. itemNode.store("action",action);
  89. if( this.options.action == action){
  90. itemNode.click();
  91. }else if( action == "toApplyWait"){
  92. itemNode.click();
  93. }
  94. },
  95. loadFilter: function(options, callback){
  96. var opt = {};
  97. if( options ){
  98. opt = Object.merge( options, { onSearch : function( condition ){
  99. if(callback)callback( condition );
  100. }});
  101. }
  102. //if( this.filter ){
  103. // this.filter.reload( opt );
  104. //}else{
  105. // this.filter = new MWF.xApplication.Report.ReportFileter( this.filterNode, this.app, opt );
  106. //}
  107. if( this.filter ){
  108. this.filter.destroy();
  109. }
  110. this.filter = new MWF.xApplication.Report.ReportFileter( this.filterNode, this.app, opt );
  111. },
  112. toApplyWait: function(){
  113. if (this.currentView) this.currentView.destroy();
  114. this.currentView = new MWF.xApplication.Report.ListView.ApplyWait( this.viewNode, this.app, this, {
  115. templateUrl : this.path + this.options.style+"/listItem.json"
  116. });
  117. this.currentView.load();
  118. },
  119. toApplyProcessing: function(){
  120. if (this.currentView) this.currentView.destroy();
  121. this.currentView = new MWF.xApplication.Report.ListView.ApplyProcessing( this.viewNode, this.app, this, {
  122. templateUrl : this.path + this.options.style+"/listItem_apply_processing.json"
  123. });
  124. this.currentView.load();
  125. },
  126. toApplyCompleted: function(){
  127. if (this.currentView) this.currentView.destroy();
  128. this.currentView = new MWF.xApplication.Report.ListView.ApplyCompleted( this.viewNode, this.app, this, {
  129. templateUrl : this.path + this.options.style+"/listItem.json"
  130. });
  131. this.currentView.load();
  132. },
  133. toTodo: function(){
  134. if (this.currentView) this.currentView.destroy();
  135. this.currentView = new MWF.xApplication.Report.ListView.Todo( this.viewNode, this.app, this, {
  136. templateUrl : this.path + this.options.style+"/listItem_all.json"
  137. });
  138. this.currentView.load();
  139. },
  140. toApplyAll: function(){
  141. if (this.currentView) this.currentView.destroy();
  142. this.currentView = new MWF.xApplication.Report.ListView.ApplyAll( this.viewNode, this.app, this, {
  143. templateUrl : this.path + this.options.style+"/listItem_all.json"
  144. });
  145. this.currentView.load();
  146. },
  147. //toAuditWait: function(){
  148. // if (this.currentView) this.currentView.destroy();
  149. // this.currentView = new MWF.xApplication.Report.ListView.AuditWait(this);
  150. //},
  151. toAuditProcessing: function(){
  152. if (this.currentView) this.currentView.destroy();
  153. this.currentView = new MWF.xApplication.Report.ListView.AuditProcessing( this.viewNode, this.app, this, {
  154. templateUrl : this.path + this.options.style+"/listItem_all.json"
  155. });
  156. this.currentView.load();
  157. },
  158. toAuditAll: function(){
  159. if (this.currentView) this.currentView.destroy();
  160. this.currentView = new MWF.xApplication.Report.ListView.AuditAll( this.viewNode, this.app, this, {
  161. templateUrl : this.path + this.options.style+"/listItem_all.json"
  162. });
  163. this.currentView.load();
  164. },
  165. toAll: function(){
  166. if (this.currentView) this.currentView.destroy();
  167. this.currentView = new MWF.xApplication.Report.ListView.All( this.viewNode, this.app, this, {
  168. templateUrl : this.path + this.options.style+"/listItem_all.json"
  169. });
  170. this.currentView.load();
  171. },
  172. hide: function(){
  173. var fx = new Fx.Morph(this.node, {
  174. "duration": "300",
  175. "transition": Fx.Transitions.Expo.easeOut
  176. });
  177. fx.start({
  178. "opacity": 0
  179. }).chain(function(){
  180. this.node.setStyle("display", "none");
  181. }.bind(this));
  182. },
  183. show: function(){
  184. this.node.setStyles(this.css.node);
  185. var fx = new Fx.Morph(this.node, {
  186. "duration": "800",
  187. "transition": Fx.Transitions.Expo.easeOut
  188. });
  189. this.app.fireAppEvent("resize");
  190. fx.start({
  191. "opacity": 1,
  192. "left": "0px"
  193. }).chain(function(){
  194. this.node.setStyles({
  195. "position": "static",
  196. "width": "auto"
  197. });
  198. }.bind(this));
  199. },
  200. reload: function(){
  201. this.app.reload();
  202. },
  203. recordStatus : function(){
  204. var action = "";
  205. if( this.currentNavi )action = this.currentNavi.retrieve("action");
  206. return {
  207. action : action
  208. };
  209. },
  210. destroy : function(){
  211. if( this.currentView ){
  212. this.currentView.destroy()
  213. }
  214. this.app.removeEvent("resize", this.resetNodeSizeFun );
  215. this.node.destroy();
  216. }
  217. });
  218. MWF.xApplication.Report.ListView.ApplyWait = new Class({
  219. Extends: MWF.xApplication.Template.Explorer.ComplexView,
  220. options : {
  221. "scrollEnable" : true,
  222. "scrollType" : "window"
  223. },
  224. _createDocument: function(data, index){
  225. return new MWF.xApplication.Report.ListView.Document(this.viewNode, data, this.explorer, this, null, index);
  226. },
  227. _getCurrentPageData: function(callback, count){
  228. if(!count)count=30;
  229. var id = (this.items.length) ? this.items[this.items.length - 1].data.id : "(0)";
  230. var filter = this.filterData || this.forceFilterCondition;
  231. if( this.sortType && this.sortField ){
  232. filter.orderField = this.sortField;
  233. filter.orderType = this.sortType;
  234. }
  235. this.actions.listReportNextWithFilter(id, count, filter, function(json){
  236. if( !json.data )json.data = [];
  237. if (callback)callback(json);
  238. });
  239. },
  240. _removeDocument: function(documentData, all){
  241. this.actions.deleteSubject(documentData.id, function(json){
  242. this.reload();
  243. this.app.notice(this.app.lp.deleteDocumentOK, "success");
  244. }.bind(this));
  245. },
  246. _create: function(){},
  247. _openDocument: function( documentData,index ){
  248. //var appId = "ReportDocument"+documentData.id;
  249. //if (this.app.desktop.apps[appId]){
  250. // this.app.desktop.apps[appId].setCurrent();
  251. //}else {
  252. // this.app.desktop.openApplication(null, "ReportDocument", {
  253. // "id" : documentData.id,
  254. // "isEdited" : false,
  255. // "isNew" : false
  256. // });
  257. //}
  258. this.app.common.openReport(documentData, this);
  259. },
  260. _queryCreateViewNode: function(){
  261. this.forceFilterCondition = {
  262. targetList : [this.app.userName],
  263. reportStatus : "汇报者填写"
  264. };
  265. },
  266. _postCreateViewNode: function( viewNode ){
  267. if( !this.filterLoaded ) {
  268. this.explorer.loadFilter({
  269. items: ["reportType", "title", "year", "month", "reportDate", "reportObjType"],
  270. defaultResult: this.forceFilterCondition
  271. }, function (filterData) {
  272. this.filterData = filterData;
  273. this.reload();
  274. }.bind(this));
  275. this.filterLoaded = true;
  276. }
  277. },
  278. _queryCreateViewHead:function(){},
  279. _postCreateViewHead: function( headNode ){},
  280. destroyScroll: function(){
  281. if( this.scrollContainerFun ){
  282. var scrollNode = this.app.scrollNode ? this.app.scrollNode : this.container;
  283. scrollNode.removeEvent("scroll", this.scrollContainerFun );
  284. this.scrollContainerFun = null;
  285. }
  286. },
  287. setScroll: function(){
  288. var scrollNode = this.app.scrollNode ? this.app.scrollNode : this.container;
  289. scrollNode.setStyle("overflow","auto");
  290. this.scrollContainerFun = function(){
  291. if( !this.options.pagingEnable ){
  292. var scrollSize = scrollNode.getScrollSize();
  293. var clientSize = scrollNode.getSize();
  294. var scrollHeight = scrollSize.y - clientSize.y;
  295. if (scrollNode.scrollTop + 150 > scrollHeight ) {
  296. if (! this.isItemsLoaded) this.loadElementList();
  297. }
  298. }
  299. }.bind(this);
  300. scrollNode.addEvent("scroll", this.scrollContainerFun )
  301. }
  302. });
  303. MWF.xApplication.Report.ListView.ApplyProcessing = new Class({
  304. Extends: MWF.xApplication.Report.ListView.ApplyWait,
  305. _getCurrentPageData: function(callback, count){
  306. if(!count)count=30;
  307. var id = (this.items.length) ? this.items[this.items.length - 1].data.id : "(0)";
  308. var filter = this.filterData || this.forceFilterCondition;
  309. if( this.sortType && this.sortField ){
  310. filter.orderField = this.sortField;
  311. filter.orderType = this.sortType;
  312. }
  313. this.actions.listReportNextWithFilter(id, count, filter, function(json){
  314. if( !json.data )json.data = [];
  315. if (callback)callback(json);
  316. });
  317. },
  318. _queryCreateViewNode: function(){
  319. this.forceFilterCondition = {
  320. targetList : [this.app.userName],
  321. reportStatus : "审核中"
  322. };
  323. },
  324. _postCreateViewNode: function( viewNode ){
  325. if( !this.filterLoaded ) {
  326. this.explorer.loadFilter({
  327. items: ["reportType", "title", "year", "month", "reportDate", "reportObjType", "activityList", "currentPersonList"],
  328. defaultResult: this.forceFilterCondition
  329. }, function (filterData) {
  330. this.filterData = filterData;
  331. this.reload();
  332. }.bind(this));
  333. this.filterLoaded = true;
  334. }
  335. }
  336. });
  337. MWF.xApplication.Report.ListView.ApplyCompleted = new Class({
  338. Extends: MWF.xApplication.Report.ListView.ApplyWait,
  339. _getCurrentPageData: function(callback, count){
  340. if(!count)count=30;
  341. var id = (this.items.length) ? this.items[this.items.length - 1].data.id : "(0)";
  342. var filter = this.filterData || this.forceFilterCondition;
  343. if( this.sortType && this.sortField ){
  344. filter.orderField = this.sortField;
  345. filter.orderType = this.sortType;
  346. }
  347. this.actions.listReportNextWithFilter(id, count, filter, function(json){
  348. if( !json.data )json.data = [];
  349. if (callback)callback(json);
  350. });
  351. },
  352. _queryCreateViewNode: function(){
  353. this.forceFilterCondition = {
  354. targetList : [this.app.userName],
  355. reportStatus : "已完成"
  356. };
  357. },
  358. _postCreateViewNode: function( viewNode ){
  359. if( !this.filterLoaded ){
  360. this.explorer.loadFilter({
  361. items : ["reportType","title","year","month","reportDate","reportObjType"],
  362. defaultResult : this.forceFilterCondition
  363. },function( filterData ){
  364. this.filterData = filterData;
  365. this.reload();
  366. }.bind(this));
  367. this.filterLoaded = true;
  368. }
  369. }
  370. });
  371. MWF.xApplication.Report.ListView.ApplyAll = new Class({
  372. Extends: MWF.xApplication.Report.ListView.ApplyWait,
  373. _getCurrentPageData: function(callback, count){
  374. if(!count)count=30;
  375. var id = (this.items.length) ? this.items[this.items.length - 1].data.id : "(0)";
  376. var filter = this.filterData || this.forceFilterCondition;
  377. filter = Object.merge( {
  378. "title":"",
  379. "reportType":"",
  380. "year":"",
  381. "month":"",
  382. "week":"",
  383. "workIds":[],
  384. "reportDate":"",
  385. "createDate":"","targetList":[],
  386. "unitList":[],"activityList":[],"currentPersonList":[],
  387. "orderField":"","reportObjType":"","reportStatus":"",
  388. "orderType":"","permission":""}, filter );
  389. if( this.sortType && this.sortField ){
  390. filter.orderField = this.sortField;
  391. filter.orderType = this.sortType;
  392. }else if(this.sortTypeDefault && this.sortFieldDefault){
  393. filter.orderField = this.sortFieldDefault;
  394. filter.orderType = this.sortTypeDefault;
  395. }
  396. if( !filter.reportStatus ){
  397. filter.reportStatus="";
  398. }
  399. filter.permission = "";
  400. this.actions.listReportNextWithFilter(id, count, filter, function(json){
  401. if( !json.data )json.data = [];
  402. if (callback)callback(json);
  403. });
  404. },
  405. _queryCreateViewNode: function(){
  406. this.forceFilterCondition = {
  407. //targetList : [this.app.userName]
  408. };
  409. },
  410. _postCreateViewNode: function( viewNode ){
  411. if( !this.filterLoaded ){
  412. this.explorer.loadFilter({
  413. items : ["reportType","title","year","month","reportDate","reportObjType","reportStatus", "activityList"],
  414. defaultResult : this.forceFilterCondition
  415. },function( filterData ){
  416. this.filterData = filterData;
  417. this.reload();
  418. }.bind(this));
  419. this.filterLoaded = true;
  420. }
  421. }
  422. });
  423. MWF.xApplication.Report.ListView.Todo = new Class({
  424. Extends: MWF.xApplication.Report.ListView.ApplyWait,
  425. _getCurrentPageData: function(callback, count){
  426. if(!count)count=30;
  427. var id = (this.items.length) ? this.items[this.items.length - 1].data.id : "(0)";
  428. var filter = this.filterData || this.forceFilterCondition;
  429. filter = Object.merge( {
  430. "title":"",
  431. "reportType":"",
  432. "year":"",
  433. "month":"",
  434. "week":"",
  435. "workIds":[],
  436. "reportDate":"",
  437. "createDate":"","targetList":[],
  438. "unitList":[],"activityList":[],"currentPersonList":[],
  439. "orderField":"","reportObjType":"","reportStatus":"",
  440. "orderType":"","permission":""}, filter );
  441. if( this.sortType && this.sortField ){
  442. filter.orderField = this.sortField;
  443. filter.orderType = this.sortType;
  444. }else if(this.sortTypeDefault && this.sortFieldDefault){
  445. filter.orderField = this.sortFieldDefault;
  446. filter.orderType = this.sortTypeDefault;
  447. }
  448. if( !filter.reportStatus ){
  449. //filter.reportStatus="";
  450. }
  451. filter.permission = "作者";
  452. this.actions.listReportNextWithFilter(id, count, filter, function(json){
  453. if( !json.data )json.data = [];
  454. if (callback)callback(json);
  455. });
  456. },
  457. _queryCreateViewNode: function(){
  458. this.forceFilterCondition = {
  459. //targetList : [this.app.userName]
  460. };
  461. },
  462. _postCreateViewNode: function( viewNode ){
  463. //this.explorer.filterNode.setStyle("height","10px");
  464. if( !this.filterLoaded ){
  465. this.explorer.loadFilter({
  466. items : ["reportType","title","year","month","reportDate","reportObjType","reportStatus", "activityList"],
  467. defaultResult : this.forceFilterCondition
  468. },function( filterData ){
  469. this.filterData = filterData;
  470. this.reload();
  471. }.bind(this));
  472. this.filterLoaded = true;
  473. }
  474. }
  475. });
  476. MWF.xApplication.Report.ListView.AuditWait = new Class({
  477. Extends: MWF.xApplication.Report.ListView.ApplyWait,
  478. _getCurrentPageData: function(callback, count){
  479. if(!count)count=30;
  480. var id = (this.items.length) ? this.items[this.items.length - 1].data.id : "(0)";
  481. var filter = this.filterData || this.forceFilterCondition;
  482. if( this.sortType && this.sortField ){
  483. filter.orderField = this.sortField;
  484. filter.orderType = this.sortType;
  485. }
  486. this.actions.listReportNextWithFilter(id, count, filter, function(json){
  487. if( !json.data )json.data = [];
  488. if (callback)callback(json);
  489. });
  490. },
  491. _queryCreateViewNode: function(){
  492. this.forceFilterCondition = {
  493. currentPersonList : [this.app.userName],
  494. reportStatus : "审核中"
  495. };
  496. },
  497. _postCreateViewNode: function( viewNode ){
  498. if( !this.filterLoaded ) {
  499. this.explorer.loadFilter({
  500. items: ["reportType", "title", "year", "month", "reportDate", "targetList", "activityList", "reportObjType"],
  501. defaultResult: this.forceFilterCondition
  502. }, function (filterData) {
  503. this.filterData = filterData;
  504. this.reload();
  505. }.bind(this));
  506. this.filterLoaded = true;
  507. }
  508. }
  509. });
  510. MWF.xApplication.Report.ListView.AuditProcessing = new Class({
  511. Extends: MWF.xApplication.Report.ListView.ApplyWait,
  512. _getCurrentPageData: function(callback, count){
  513. if(!count)count=30;
  514. var id = (this.items.length) ? this.items[this.items.length - 1].data.id : "(0)";
  515. var filter = this.filterData || this.forceFilterCondition;
  516. if( this.sortType && this.sortField ){
  517. filter.orderField = this.sortField;
  518. filter.orderType = this.sortType;
  519. }
  520. if( !filter.reportStatus ){
  521. filter.reportStatus="";
  522. }
  523. this.actions.listReportNextWithFilter(id, count, filter, function(json){
  524. if( !json.data )json.data = [];
  525. if (callback)callback(json);
  526. });
  527. },
  528. _queryCreateViewNode: function(){
  529. this.forceFilterCondition = {
  530. currentPersonList : [this.app.userName],
  531. reportStatus : "审核中"
  532. };
  533. },
  534. _postCreateViewNode: function( viewNode ){
  535. if( !this.filterLoaded ){
  536. this.explorer.loadFilter({
  537. items : ["reportType","title","year","month","reportDate","targetList","activityList","reportObjType"],
  538. defaultResult : this.forceFilterCondition
  539. },function( filterData ){
  540. this.filterData = filterData;
  541. this.reload();
  542. }.bind(this));
  543. this.filterLoaded = true;
  544. }
  545. }
  546. });
  547. MWF.xApplication.Report.ListView.AuditAll = new Class({
  548. Extends: MWF.xApplication.Report.ListView.ApplyWait,
  549. _getCurrentPageData: function(callback, count){
  550. if(!count)count=30;
  551. var id = (this.items.length) ? this.items[this.items.length - 1].data.id : "(0)";
  552. var filter = this.filterData || this.forceFilterCondition;
  553. if( this.sortType && this.sortField ){
  554. filter.orderField = this.sortField;
  555. filter.orderType = this.sortType;
  556. }
  557. if( !filter.reportStatus ){
  558. //filter.reportStatus="";
  559. }
  560. this.actions.listMyAuditNextWithFilter(id, count, filter, function(json){
  561. if( !json.data )json.data = [];
  562. if (callback)callback(json);
  563. });
  564. },
  565. _queryCreateViewNode: function(){
  566. this.forceFilterCondition = {
  567. //currentPersonList : [this.app.userName],
  568. //reportStatus : "已完成"
  569. };
  570. },
  571. _postCreateViewNode: function( viewNode ){
  572. if( !this.filterLoaded ){
  573. this.explorer.loadFilter({
  574. items : ["reportType","title","year","month","reportDate","targetList","activityList","reportStatus","reportObjType","currentPersonList"],
  575. defaultResult : this.forceFilterCondition
  576. },function( filterData ){
  577. this.filterData = filterData;
  578. this.reload();
  579. }.bind(this));
  580. this.filterLoaded = true;
  581. }
  582. }
  583. });
  584. MWF.xApplication.Report.ListView.All = new Class({
  585. Extends: MWF.xApplication.Report.ListView.ApplyWait,
  586. _getCurrentPageData: function(callback, count){
  587. if(!count)count=30;
  588. var id = (this.items.length) ? this.items[this.items.length - 1].data.id : "(0)";
  589. var filter = this.filterData || this.forceFilterCondition;
  590. var flag = false;
  591. if( !filter.reportStatus ){
  592. filter.reportStatus="";
  593. }
  594. //filter.permission = "";
  595. //filter = {"title":"","reportType":"","year":"","month":"","week":"","workIds":[],"reportDate":"","createDate":"","targetList":[],"unitList":[],"activityList":[],"currentPersonList":[],"orderField":"","reportObjType":"","reportStatus":"","orderType":"","permission":""}
  596. if( this.sortType && this.sortField ){
  597. filter.orderField = this.sortField;
  598. filter.orderType = this.sortType;
  599. }
  600. this.actions.listReportNextWithFilter(id, count, filter, function(json){
  601. if( !json.data )json.data = [];
  602. if (callback)callback(json);
  603. });
  604. },
  605. _queryCreateViewNode: function(){
  606. this.forceFilterCondition = {
  607. };
  608. },
  609. _postCreateViewNode: function( viewNode ){
  610. if( !this.filterLoaded ){
  611. this.explorer.loadFilter({
  612. items : ["reportType","title","year","month","reportDate","targetList","activityList","currentPersonList","reportStatus","reportObjType"],
  613. defaultResult : this.forceFilterCondition
  614. },function( filterData ){
  615. this.filterData = filterData;
  616. this.reload();
  617. }.bind(this));
  618. this.filterLoaded = true;
  619. }
  620. }
  621. });
  622. MWF.xApplication.Report.ListView.Document = new Class({
  623. Extends: MWF.xApplication.Template.Explorer.ComplexDocument,
  624. _queryCreateDocumentNode:function( itemData ){
  625. },
  626. _postCreateDocumentNode: function( itemNode, itemData ){
  627. if(this.index % 2 == 1){
  628. itemNode.setStyle("background-color","#f0f0f0");
  629. }
  630. },
  631. open: function (e) {
  632. this.view._openDocument(this.data, this.index);
  633. },
  634. edit : function(){
  635. var appId = "ReportDocument"+this.data.id;
  636. if (this.app.desktop.apps[appId]){
  637. this.app.desktop.apps[appId].setCurrent();
  638. }else {
  639. this.app.desktop.openApplication(null, "ReportDocument", {
  640. "id" : this.data.id,
  641. "isEdited" : true,
  642. "isNew" : false
  643. });
  644. }
  645. },
  646. remove : function(){
  647. },
  648. mouseoverDocument : function(){
  649. this.node.setStyle("background-color","#fff7eb");
  650. },
  651. mouseoutDocument : function(){
  652. if(this.index % 2 == 1){
  653. this.node.setStyle("background-color","#f0f0f0");
  654. }else{
  655. this.node.setStyle("background-color","#fff");
  656. }
  657. }
  658. });