AbnormalExport.js 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160
  1. MWF.xDesktop.requireApp("Attendance", "Explorer", null, false);
  2. MWF.xDesktop.requireApp("Selector", "package", null, false);
  3. MWF.xApplication.Attendance.AbnormalExport = new Class({
  4. Extends: MWF.xApplication.Attendance.Explorer,
  5. Implements: [Options, Events],
  6. initialize: function(node, app, actions, options){
  7. this.setOptions(options);
  8. this.app = app;
  9. this.path = "../x_component_Attendance/$AbnormalExport/";
  10. this.cssPath = "../x_component_Attendance/$AbnormalExport/"+this.options.style+"/css.wcss";
  11. this._loadCss();
  12. this.actions = actions;
  13. this.node = $(node);
  14. this.initData();
  15. if (!this.personActions) this.personActions = new MWF.xAction.org.express.RestActions();
  16. },
  17. load: function(){
  18. this.loadToolbar();
  19. this.loadFilter();
  20. this.loadContentNode();
  21. //this.loadView( filterData );
  22. this.setNodeScroll();
  23. },
  24. loadFilter : function(){
  25. this.fileterNode = new Element("div.fileterNode", {
  26. "styles" : this.css.fileterNode
  27. }).inject(this.node);
  28. var table = new Element("table", {
  29. "width" : "100%", "border" : "0", "cellpadding" : "5", "cellspacing" : "0", "styles" : this.css.filterTable, "class" : "filterTable"
  30. }).inject( this.fileterNode );
  31. var tr = new Element("tr").inject(table);
  32. this.createYearSelectTd( tr );
  33. this.createMonthSelectTd( tr );
  34. this.createActionTd( tr );
  35. },
  36. createYearSelectTd : function( tr ){
  37. var _self = this;
  38. var td = new Element("td", { "styles" : this.css.filterTableTitle, "text" : "年度" }).inject(tr);
  39. var td = new Element("td", { "styles" : this.css.filterTableValue }).inject(tr);
  40. this.yearString = new MDomItem( td, {
  41. "name" : "yearString",
  42. "type" : "select",
  43. "selectValue" : function(){
  44. var years = [];
  45. var year = new Date().getFullYear();
  46. for(var i=0; i<6; i++ ){
  47. years.push( year-- );
  48. }
  49. return years;
  50. }
  51. }, true, this.app );
  52. this.yearString.load();
  53. },
  54. createMonthSelectTd : function( tr ){
  55. var _self = this;
  56. var td = new Element("td", { "styles" : this.css.filterTableTitle, "text" : "月份" }).inject(tr);
  57. var td = new Element("td", { "styles" : this.css.filterTableValue }).inject(tr);
  58. this.monthString = new MDomItem( td, {
  59. "name" : "monthString",
  60. "type" : "select",
  61. "selectValue" :["01","02","03","04","05","06","07","08","09","10","11","12"]
  62. }, true, this.app );
  63. this.monthString.load();
  64. },
  65. createActionTd : function( tr ){
  66. var td = new Element("td", { "styles" : this.css.filterTableValue }).inject(tr);
  67. var input = new Element("button",{
  68. "text" : "导出",
  69. "styles" : this.css.filterButton
  70. }).inject(td);
  71. input.addEvent("click", function(){
  72. this.export(this.yearString.getValue(), this.monthString.getValue() );
  73. //this.loadView( filterData );
  74. }.bind(this))
  75. },
  76. setContentSize: function(){
  77. var toolbarSize = this.toolbarNode ? this.toolbarNode.getSize() : {"x":0,"y":0};
  78. var titlebarSize = this.app.titleBar ? this.app.titleBar.getSize() : {"x":0,"y":0};
  79. var filterSize = this.fileterNode ? this.fileterNode.getSize() : {"x":0,"y":0};
  80. var nodeSize = this.node.getSize();
  81. var pt = this.elementContentNode.getStyle("padding-top").toFloat();
  82. var pb = this.elementContentNode.getStyle("padding-bottom").toFloat();
  83. //var filterSize = this.filterNode.getSize();
  84. var filterConditionSize = this.filterConditionNode ? this.filterConditionNode.getSize() : {"x":0,"y":0};
  85. var height = nodeSize.y-toolbarSize.y-pt-pb-filterConditionSize.y-titlebarSize.y-filterSize.y;
  86. this.elementContentNode.setStyle("height", ""+height+"px");
  87. this.pageCount = (height/30).toInt()+5;
  88. if (this.view && this.view.items.length<this.pageCount){
  89. this.view.loadElementList(this.pageCount-this.view.items.length);
  90. }
  91. },
  92. export : function(year, month){
  93. this.actions.exportAbnormalAttachment(year,month);
  94. },
  95. loadView : function( filterData ){
  96. //this.elementContentNode.empty();
  97. //this.view = new MWF.xApplication.Attendance.AbnormalExport.View(this.elementContentNode, this.app,this, this.viewData, this.options.searchKey );
  98. //this.view.filterData = filterData;
  99. //this.view.load();
  100. //this.setContentSize();
  101. },
  102. createDocument: function(){
  103. //if(this.view)this.view._createDocument();
  104. }
  105. });
  106. MWF.xApplication.Attendance.AbnormalExport.View = new Class({
  107. Extends: MWF.xApplication.Attendance.Explorer.View,
  108. _createItem: function(data){
  109. //return new MWF.xApplication.Attendance.AbnormalExport.Document(this.table, data, this.explorer, this);
  110. },
  111. _getCurrentPageData: function(callback, count){
  112. //if(!count )count=20;
  113. //var id = (this.items.length) ? this.items[this.items.length-1].data.id : "(0)";
  114. //var filter = this.filterData || {};
  115. //filter.empName = layout.desktop.session.user.name;
  116. //this.actions.listAppealFilterNext(id, count, filter, function(json){
  117. // var data = json.data;
  118. // data.sort( function( a, b ){
  119. // return parseInt( b.appealDateString.replace(/-/g,"") ) - parseInt( a.appealDateString.replace(/-/g,"") );
  120. // })
  121. // json.data = data;
  122. // if (callback) callback(json);
  123. //});
  124. },
  125. _removeDocument: function(documentData, all){
  126. },
  127. _createDocument: function(){
  128. },
  129. _openDocument: function( documentData ){
  130. }
  131. });
  132. MWF.xApplication.Attendance.AbnormalExport.Document = new Class({
  133. Extends: MWF.xApplication.Attendance.Explorer.Document,
  134. agree : function(){
  135. },
  136. deny : function(){
  137. }
  138. });