ReadCompletedList.js 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. MWF.xDesktop.requireApp("process.TaskCenter", "TaskCompletedList", null, false);
  2. MWF.xApplication.process.TaskCenter.ReadCompletedList = new Class({
  3. Extends: MWF.xApplication.process.TaskCenter.TaskCompletedList,
  4. _getCurrentPageData: function(callback, count){
  5. this.app.getAction(function(){
  6. if (this.filterData){
  7. this.filterListNode.empty();
  8. var data = {};
  9. Object.each(this.filterData, function(v, key){
  10. if (key!="key"){
  11. if (v) {
  12. //data[this.app.options.filterMap[key]] = v.value;
  13. if (!data[this.app.options.filterMap[key]]) data[this.app.options.filterMap[key]] = [];
  14. data[this.app.options.filterMap[key]].push(v.value);
  15. this.createFilterItemNode(key, v);
  16. }
  17. }else{
  18. data.key = v;
  19. }
  20. }.bind(this));
  21. if (this.filterData.key){
  22. this.createFilterItemNode("key", {"name": this.filterData.key});
  23. }
  24. var id = (this.items.length) ? this.items[this.items.length-1].data.id : "(0)";
  25. this.app.action.listReadedFilter(function(json){
  26. if (callback) callback(json);
  27. }, null, id, count || this.pageCount, data);
  28. }else{
  29. var id = (this.items.length) ? this.items[this.items.length-1].data.id : "(0)";
  30. this.app.action.listReadedNext(function(json){
  31. if (callback) callback(json);
  32. }, null, id, count || this.pageCount);
  33. }
  34. }.bind(this));
  35. },
  36. _getApplicationCount: function(callback){
  37. this.app.getAction(function(){
  38. this.app.action.listReadedApplication(function(json){
  39. if (callback) callback(json);
  40. }.bind(this));
  41. }.bind(this));
  42. },
  43. _createItem: function(task){
  44. return new MWF.xApplication.process.TaskCenter.ReadCompletedList.Item(task, this)
  45. },
  46. _getFilterCount: function(callback){
  47. this.app.action.listReadedFilterCount(function(json){
  48. if (callback) callback(json);
  49. });
  50. }
  51. });
  52. MWF.xApplication.process.TaskCenter.ReadCompletedList.Item = new Class({
  53. Extends: MWF.xApplication.process.TaskCenter.TaskCompletedList.Item,
  54. setFlowChart: function(data){
  55. var idx = 0;
  56. data.workLogTokenList = {};
  57. data.workLogList.each(function(worklog){
  58. data.workLogTokenList[worklog.fromActivityToken] = worklog;
  59. if (!worklog.taskCompletedList) worklog.taskCompletedList = [];
  60. if (!worklog.taskList) worklog.taskList = [];
  61. if (worklog.taskCompletedList.length || worklog.taskList.length){
  62. this.createFlowInforWorklogNode(worklog.fromActivityName, worklog.taskCompletedList, worklog.taskList || [], idx, false);
  63. idx++;
  64. }
  65. }.bind(this));
  66. return idx;
  67. },
  68. _getSimpleJobByTaskComplete: function(callback){
  69. this.list.app.action.getSimpleJobByReaded(function(json){
  70. if (callback) callback(json.data);
  71. }.bind(this), null, this.data.id);
  72. }
  73. });