UnitIndex.js 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586
  1. MWF.xApplication.Attendance = MWF.xApplication.Attendance || {};
  2. MWF.require("MWF.xAction.org.express.RestActions", null,false);
  3. MWF.xDesktop.requireApp("Attendance", "lp."+MWF.language, null, false);
  4. MWF.xDesktop.requireApp("Attendance", "Common", null, false);
  5. MWF.xApplication.Attendance.UnitIndex = new Class({
  6. Extends: MWF.widget.Common,
  7. Implements: [Options, Events],
  8. options: {
  9. "style": "default"
  10. },
  11. statusColor : {
  12. "normal" : "#4A90E2", //绿色,正常
  13. "levelAsked":"#2BC497", //蓝色,请假
  14. "late":"#F5A623", //黄色,迟到
  15. //"leaveEarly":"#fe8d03", //橙色,早退
  16. "noSign":"#FF8080", //粉红色,未签到
  17. "lackOfTime" : "#AC71E3",//工时不足人次
  18. "abNormalDuty" : "#8B572A"//异常打卡人次
  19. },
  20. initialize: function(node, app, actions, options){
  21. this.setOptions(options);
  22. this.app = app;
  23. this.lp = app.lp;
  24. this.path = "../x_component_Attendance/$UnitIndex/";
  25. this.cssPath = "../x_component_Attendance/$UnitIndex/"+this.options.style+"/css.wcss";
  26. this._loadCss();
  27. this.actions = actions;
  28. this.node = $(node);
  29. this.setDate();
  30. this.today = new Date();
  31. this.userName = layout.desktop.session.user.distinguishedName;
  32. this.data = {};
  33. },
  34. setDate : function( date ){
  35. this.date = date || new Date();
  36. this.year = this.date.getFullYear().toString();
  37. var month = this.date.getMonth()+1;
  38. this.month = month.toString().length == 2 ? month : "0"+month;
  39. },
  40. reload: function(){
  41. this.node.empty();
  42. this.load();
  43. },
  44. load: function(){
  45. this.loadTitleNode();
  46. this.loadContent();
  47. },
  48. loadTitleNode : function(){
  49. var text = this.date.format(this.app.lp.dateFormatMonth);
  50. this.titleNode = new Element("div.titleNode",{
  51. "styles" : this.css.titleNode
  52. }).inject(this.node);
  53. this.titleLeftArrowNode = new Element("div",{
  54. "styles" : this.css.titleLeftArrowNode
  55. }).inject(this.titleNode);
  56. this.titleTextNode = new Element("div",{
  57. "styles" : this.css.titleTextNode,
  58. "text" : text
  59. }).inject(this.titleNode);
  60. this.titleRightArrowNode = new Element("div",{
  61. "styles" : this.css.titleRightArrowNode
  62. }).inject(this.titleNode);
  63. this.titleLeftArrowNode.addEvents({
  64. "mouseover": function(){this.titleLeftArrowNode.setStyles(this.css.titleLeftArrowNode_over);}.bind(this),
  65. "mouseout": function(){this.titleLeftArrowNode.setStyles(this.css.titleLeftArrowNode);}.bind(this),
  66. "mousedown": function(){this.titleLeftArrowNode.setStyles(this.css.titleLeftArrowNode_down);}.bind(this),
  67. "mouseup": function(){this.titleLeftArrowNode.setStyles(this.css.titleLeftArrowNode_over);}.bind(this),
  68. "click": function(){this.changeMonthPrev();}.bind(this)
  69. });
  70. this.titleRightArrowNode.addEvents({
  71. "mouseover": function(){this.titleRightArrowNode.setStyles(this.css.titleRightArrowNode_over);}.bind(this),
  72. "mouseout": function(){this.titleRightArrowNode.setStyles(this.css.titleRightArrowNode);}.bind(this),
  73. "mousedown": function(){this.titleRightArrowNode.setStyles(this.css.titleRightArrowNode_down);}.bind(this),
  74. "mouseup": function(){this.titleRightArrowNode.setStyles(this.css.titleRightArrowNode_over);}.bind(this),
  75. "click": function(){this.changeMonthNext();}.bind(this)
  76. });
  77. this.titleTextNode.addEvents({
  78. "mouseover": function(){this.titleTextNode.setStyles(this.css.titleTextNode_over);}.bind(this),
  79. "mouseout": function(){this.titleTextNode.setStyles(this.css.titleTextNode);}.bind(this),
  80. "mousedown": function(){this.titleTextNode.setStyles(this.css.titleTextNode_down);}.bind(this),
  81. "mouseup": function(){this.titleTextNode.setStyles(this.css.titleTextNode_over);}.bind(this),
  82. "click": function(){this.changeMonthSelect();}.bind(this)
  83. });
  84. this.titleUnitArea = new Element("div.titleUnitArea",{
  85. "style" : "float:left"
  86. }).inject(this.titleNode);
  87. this.loadUnitNode();
  88. },
  89. changeMonthPrev: function(){
  90. this.date.decrement("month", 1);
  91. this.setDate( this.date );
  92. var text = this.date.format(this.app.lp.dateFormatMonth);
  93. this.titleTextNode.set("text", text);
  94. this.reloadContent();
  95. },
  96. changeMonthNext: function(){
  97. this.date.increment("month", 1);
  98. this.setDate( this.date );
  99. var text = this.date.format(this.app.lp.dateFormatMonth);
  100. this.titleTextNode.set("text", text);
  101. this.reloadContent();
  102. },
  103. changeMonthSelect: function(){
  104. if (!this.monthSelector) this.createMonthSelector();
  105. this.monthSelector.show();
  106. },
  107. createMonthSelector: function(){
  108. this.monthSelector = new MWF.xApplication.Attendance.MonthSelector(this.date, this);
  109. },
  110. changeMonthTo: function(d){
  111. this.setDate( d )
  112. var text = this.date.format(this.app.lp.dateFormatMonth);
  113. this.titleTextNode.set("text", text);
  114. this.reloadContent();
  115. },
  116. changeUnitTo : function( d ){
  117. this.unit = d;
  118. this.titleUnitActionTextNode.set("text", d.split("@")[0]);
  119. this.reloadContent();
  120. },
  121. loadUnitNode: function(){
  122. debugger;
  123. this.listUnitWithPerson( function( unitList ){
  124. this.unit = unitList[0] || "";
  125. this.units = unitList;
  126. var flag = true;
  127. if( this.app.isTopUnitManager() ){
  128. var data = {"unitList": this.app.getNameFlag( this.app.manageTopUnits )};
  129. this.app.orgActions.listUnitSubDirect( function( json ){
  130. json.data.each(function( d ){
  131. this.units.push( d.distinguishedName )
  132. }.bind(this))
  133. }.bind(this), null , data, false )
  134. }else if( this.app.isUnitManager() ){
  135. this.units = this.app.manageUnits;
  136. }
  137. this.units = this.units.unique();
  138. this.unit = this.units[0] || this.unit;
  139. if( this.units.length > 1 ){ //(this.units.length==1 && this.units[0]!=this.unit )
  140. this.titleUnitAreaNode = new Element("div.titleUnitAreaNode",{
  141. "styles" : this.css.titleUnitAreaNode
  142. }).inject(this.titleUnitArea)
  143. this.titleUnitActionNode = new Element("div",{
  144. "styles" : this.css.titleUnitActionNode
  145. }).inject(this.titleUnitAreaNode)
  146. this.titleUnitActionTextNode = new Element("div.titleUnitActionTextNode",{
  147. "styles" : this.css.titleUnitActionTextNode,
  148. "text" : this.unit.split("@")[0]
  149. }).inject(this.titleUnitActionNode);
  150. this.titleUnitActionIconNode = new Element("div",{
  151. "styles" : this.css.titleUnitActionIconNode
  152. }).inject(this.titleUnitActionNode);
  153. this.titleUnitActionNode.addEvents({
  154. "mouseover": function(){
  155. this.titleUnitActionTextNode.setStyles(this.css.titleUnitActionTextNode_over);
  156. this.titleUnitActionIconNode.setStyles(this.css.titleUnitActionIconNode_over);
  157. }.bind(this),
  158. "mouseout": function(){
  159. this.titleUnitActionTextNode.setStyles(this.css.titleUnitActionTextNode);
  160. this.titleUnitActionIconNode.setStyles(this.css.titleUnitActionIconNode);
  161. }.bind(this),
  162. "click" : function( ev ){
  163. this.switchUnit( ev.target );
  164. ev.stopPropagation();
  165. }.bind(this)
  166. })
  167. }else{
  168. this.titleUnitNode = new Element("div",{
  169. "styles" : this.css.titleUnitNode,
  170. "text" : this.unit.split("@")[0]
  171. }).inject(this.titleUnitArea);
  172. }
  173. }.bind(this) )
  174. },
  175. listUnitWithPerson : function( callback ){
  176. var data = {"personList": this.app.getNameFlag(this.userName)};
  177. this.app.orgActions.listUnitWithPerson( function( json ){
  178. var unitList = [];
  179. json.data.each(function(d){
  180. unitList.push( d.distinguishedName );
  181. });
  182. if(callback)callback(unitList);
  183. // if( json.data.length > 0 ){
  184. // if(callback)callback( json.data[0].distinguishedName );
  185. // }else{
  186. // if(callback)callback([]);
  187. // }
  188. }.bind(this), null, data , false )
  189. },
  190. switchUnit : function( el ){
  191. var _self = this;
  192. var node = this.titleUnitListNode;
  193. var parentNode = el.getParent();
  194. if(node){
  195. if( node.getStyle("display") == "block" ){
  196. node.setStyle("display","none");
  197. }else{
  198. node.setStyle("display","block");
  199. node.position({
  200. relativeTo: this.titleUnitActionNode,
  201. position: 'bottomCenter',
  202. edge: 'upperCenter'
  203. });
  204. }
  205. }else{
  206. node = this.titleUnitListNode = new Element("div",{
  207. "styles" : this.css.titleUnitListNode
  208. }).inject(this.node);
  209. this.app.content.addEvent("click",function(){
  210. _self.titleUnitListNode.setStyle("display","none");
  211. });
  212. this.units.each(function( d ){
  213. var dNode = new Element("div",{
  214. "text" : d.split('@')[0],
  215. "styles" : this.css.titleUnitSelectNode
  216. }).inject(node);
  217. dNode.store("unit", d );
  218. dNode.addEvents({
  219. "mouseover" : function(){ this.setStyles(_self.css.titleUnitSelectNode_over); },
  220. "mouseout" : function(){ this.setStyles(_self.css.titleUnitSelectNode); },
  221. "click" : function(e){
  222. _self.titleUnitListNode.setStyle("display","none");
  223. this.setStyles(_self.css.titleUnitSelectNode);
  224. _self.changeUnitTo( this.retrieve("unit") );
  225. e.stopPropagation();
  226. }
  227. })
  228. }.bind(this));
  229. node.position({
  230. relativeTo: this.titleUnitActionNode,
  231. position: 'bottomCenter',
  232. edge: 'upperCenter'
  233. });
  234. }
  235. },
  236. reloadContent : function(){
  237. this.pieChartArea.empty();
  238. this.barChartArea.empty();
  239. // this.lineChartArea.empty();
  240. this.loadData(function(){
  241. this.loadStatusColorNode();
  242. this.loadPieChart();
  243. this.loadBarChart();
  244. }.bind(this));
  245. this.loadDetail();
  246. },
  247. loadContent : function(){
  248. this.loadContentNode();
  249. this.loadData(function(){
  250. this.loadStatusColorNode();
  251. this.loadPieChart();
  252. this.loadBarChart();
  253. }.bind(this))
  254. this.loadDetail();
  255. // this.setNodeScroll();
  256. this.setContentSize();
  257. },
  258. reloadChart : function(){
  259. this.pieChartArea.empty();
  260. this.barChartArea.empty();
  261. // this.lineChartArea.empty();
  262. this.loadPieChart();
  263. this.loadBarChart();
  264. },
  265. loadContentNode: function(){
  266. this.elementContentNode = new Element("div.elementContentNode", {
  267. "styles": this.css.elementContentNode
  268. }).inject(this.node);
  269. this.app.addEvent("resize", function(){
  270. this.setContentSize();
  271. this.reloadChart();
  272. }.bind(this));
  273. this.elementContentListNode = new Element("div.elementContentListNode", {
  274. "styles": this.css.elementContentListNode
  275. }).inject(this.elementContentNode);
  276. this.topContentArea = new Element("div.topContentArea",{
  277. "styles" : this.css.topContentArea
  278. }).inject(this.elementContentListNode);
  279. this.topLeftArea = new Element("div.topLeftArea",{
  280. "styles" : this.css.topLeftArea
  281. }).inject(this.topContentArea);
  282. this.topLeftTitleNode = new Element("div.topLeftTitleNode",{
  283. "styles" : this.css.topLeftTitleNode,
  284. "text": this.lp.attendanceSummary
  285. }).inject(this.topLeftArea);
  286. this.topLeftContentNode = new Element("div.topLeftContentNode",{
  287. "styles" : this.css.topLeftContentNode
  288. }).inject(this.topLeftArea);
  289. this.statusColorArea = new Element("div.statusColorArea",{
  290. "styles" : this.css.statusColorArea
  291. }).inject(this.topLeftContentNode)
  292. this.pieChartArea = new Element("div.pieChartArea",{
  293. "styles" : this.css.pieChartArea
  294. }).inject(this.topLeftContentNode)
  295. this.topRightArea = new Element("div.topRightArea",{
  296. "styles" : this.css.topRightArea
  297. }).inject(this.topContentArea);
  298. this.topRightTitleNode = new Element("div.topRightTitleNode",{
  299. "styles" : this.css.topRightTitleNode,
  300. "text": this.lp.attendanceTrend
  301. }).inject(this.topRightArea);
  302. this.topRightContentNode = new Element("div.topRightContentNode",{
  303. "styles" : this.css.topRightContentNode
  304. }).inject(this.topRightArea);
  305. this.barChartArea = new Element("div.barChartArea",{
  306. "styles" : this.css.barChartArea
  307. }).inject(this.topRightContentNode)
  308. // this.middleContentArea = new Element("div.middleContentArea",{
  309. // "styles" : this.css.middleContentArea
  310. // }).inject(this.elementContentListNode)
  311. //
  312. // this.lineChartArea = new Element("div.lineChartArea",{
  313. // "styles" : this.css.lineChartArea
  314. // }).inject(this.middleContentArea)
  315. this.bottomContentArea = new Element("div.bottomContentArea",{
  316. "styles" : this.css.bottomContentArea
  317. }).inject(this.elementContentListNode)
  318. this.detailArea = new Element("div.detailArea",{
  319. "styles" : this.css.detailArea
  320. }).inject(this.bottomContentArea)
  321. },
  322. loadData : function( callback, unit, year, month, async ){
  323. if( !unit )unit = this.unit;
  324. if( !year )year = this.year;
  325. if( !month )month = this.month;
  326. if( this.data[ unit + year + month ] ) {
  327. if(callback)callback();
  328. }else{
  329. this.actions.listStaticMonthUnitSum( unit, year, month, function( json ){
  330. var d = json.data || {};
  331. var data = this.data[ unit + year + month ] = {};
  332. var totals = data.totalData = {
  333. levelAsked : d.onSelfHolidayCount || 0,
  334. noSign : d.absenceDayCount || 0,
  335. lackOfTime : d.lackOfTimeCount || 0,
  336. abNormalDuty : d.abNormalDutyCount || 0,
  337. late : d.lateCount ? d.lateCount : 0,
  338. //leaveEarly : d.leaveEarlyCount ? d.leaveEarlyCount/2 : 0,
  339. normal : d.onDutyEmployeeCount || 0
  340. }
  341. var total = 0;
  342. for( var n in totals ){
  343. total += totals[n];
  344. }
  345. data.rateData = {
  346. levelAsked : (!totals.levelAsked || !total) ? 0 : ((totals.levelAsked/total * 100).toFixed(2) + "%"),
  347. noSign : (!totals.noSign || !total) ? 0 : ((totals.noSign/total * 100).toFixed(2) + "%"),
  348. lackOfTime : (!totals.lackOfTime || !total) ? 0 : ((totals.lackOfTime/total * 100).toFixed(2) + "%"),
  349. abNormalDuty : (!totals.abNormalDuty || !total) ? 0 : ((totals.abNormalDuty/total * 100).toFixed(2) + "%"),
  350. late : (!totals.late || !total) ? 0 : ((totals.late/total * 100).toFixed(2) + "%"),
  351. //leaveEarly : (!totals.leaveEarly || !total) ? 0 : ((totals.leaveEarly/total* 100).toFixed(2) + "%"),
  352. normal : (!totals.normal || !total) ? 0 : ((totals.normal/total* 100).toFixed(2) + "%")
  353. }
  354. if(callback)callback();
  355. }.bind(this), null, async )
  356. }
  357. },
  358. loadStatusColorNode : function(){
  359. this.statusColorArea.empty();
  360. this.statusColorTable = new Element("table",{
  361. "styles" : this.css.statusColorTable
  362. }).inject(this.statusColorArea)
  363. var totalData = this.data[ this.unit+this.year + this.month].totalData;
  364. var rateData = this.data[ this.unit+this.year + this.month].rateData;
  365. for(var status in this.statusColor){
  366. var tr = new Element("tr",{
  367. "styles" : this.css.statusColorTr,
  368. "title": this.lp[status]
  369. }).inject(this.statusColorTable)
  370. var td = new Element("td").inject(tr);
  371. new Element("div",{
  372. "styles" : {
  373. "margin-top": "8px",
  374. "width": "14px",
  375. "height": "14px",
  376. "border-radius": "14px",
  377. "background-color": this.statusColor[status]
  378. }
  379. }).inject(td);
  380. var td = new Element("td").inject(tr);
  381. new Element("div",{
  382. "styles" : {
  383. "margin-top": "8px",
  384. "min-width": "30px",
  385. "padding-left": "4px",
  386. "font-size": "14px",
  387. "color": "#666"
  388. },
  389. "text": this.lp.statusText[status]
  390. }).inject(td);
  391. var td = new Element("td").inject(tr);
  392. new Element("div",{
  393. "styles" : {
  394. "margin-top": "8px",
  395. "min-width": "60px",
  396. "padding-left": "4px",
  397. "font-size": "12px",
  398. "color": "#999"
  399. },
  400. "text": "("+ totalData[status] + ""+ this.app.lp.day+")"
  401. }).inject(td);
  402. //var td = new Element("td",{
  403. // "styles" : this.css.statusTextTd,
  404. // "text" : this.lp[status] +":"+totalData[status]+ " " +this.lp.day +"("+rateData[status]+")"
  405. //}).inject(tr)
  406. }
  407. },
  408. loadPieChart : function(){
  409. //this.pieChartTitle = new Element("div.pieChartTitle",{
  410. // "styles" : this.css.pieChartTitle,
  411. // "text" : this.lp.index.pieChart
  412. //}).inject(this.pieChartArea)
  413. this.pieChartNode = new Element("div.pieChartNode",{
  414. "styles" : this.css.pieChartNode
  415. }).inject(this.pieChartArea)
  416. var data = this.data[this.unit+ this.year + this.month].totalData;
  417. this.pieChart = new MWF.xApplication.Attendance.Echarts(this.pieChartNode, this, data);
  418. this.pieChart.loadUnitPieChart();
  419. },
  420. loadBarChart : function(){
  421. this.barChartNode = new Element("div.barChartNode",{
  422. "styles" : this.css.barChartNode
  423. }).inject(this.barChartArea);
  424. var date = new Date( this.date.getFullYear() , this.date.getMonth(), this.date.getDate() );
  425. date.decrement("month", 1);
  426. var year_1 = date.getFullYear().toString();
  427. var month_1 = date.format( this.lp.dateFormatOnlyMonth );
  428. var data_1 = this.data[ this.unit + year_1 + month_1 ];
  429. date.decrement("month", 1);
  430. var year_2 = date.getFullYear().toString();
  431. var month_2 = date.format( this.lp.dateFormatOnlyMonth );
  432. var data_2 = this.data[ this.unit + year_2 + month_2 ];
  433. if( !data_1 ){
  434. this.loadData( null, this.unit, year_1, month_1, false )
  435. }
  436. if( !data_2 ){
  437. this.loadData( null, this.unit, year_2, month_2, false)
  438. }
  439. var d = [{
  440. year : year_2,
  441. month : month_2,
  442. data : this.data[this.unit+ year_2 + month_2].totalData
  443. },{
  444. year : year_1,
  445. month : month_1,
  446. data : this.data[this.unit+ year_1 + month_1].totalData
  447. },{
  448. year : this.year,
  449. month : this.month,
  450. data : this.data[this.unit+ this.year + this.month].totalData
  451. }];
  452. this.barChart = new MWF.xApplication.Attendance.Echarts(this.barChartNode, this, d );
  453. this.barChart.loadUnitBarChart();
  454. },
  455. loadDetail : function(){
  456. this.detailArea.empty();
  457. this.detailNode = new Element("div",{
  458. "styles" : this.css.detailNode
  459. }).inject(this.detailArea);
  460. this.detailTitleNode = new Element("div",{
  461. "styles" : this.css.detailTitleNode,
  462. "text" : this.lp.attendanceStatisic
  463. }).inject(this.detailNode)
  464. var table = new Element("table", {
  465. "width" : "100%", "border" : "0", "cellpadding" : "5", "cellspacing" : "0", "styles" : this.css.table, "class" : "editTable"
  466. }).inject( this.detailNode );
  467. var tr = new Element("tr", { "styles" : this.css.listHeadNode }).inject(table);
  468. var td = new Element("td", { "styles" : this.css.tableTitle, "text" : this.lp.name }).inject(tr);
  469. var td = new Element("td", { "styles" : this.css.tableTitle, "text" : this.lp.onDutyTimes }).inject(tr);
  470. var td = new Element("td", { "styles" : this.css.tableTitle, "text" : this.lp.offDutyTimes }).inject(tr);
  471. var td = new Element("td", { "styles" : this.css.tableTitle, "text" : this.lp.onDutyDayCount }).inject(tr);
  472. var td = new Element("td", { "styles" : this.css.tableTitle, "text" : this.lp.onSelfHolidayCount }).inject(tr);
  473. var td = new Element("td", { "styles" : this.css.tableTitle, "text" : this.lp.absenceDayCount }).inject(tr);
  474. var td = new Element("td", { "styles" : this.css.tableTitle, "text" : this.lp.lateTimes }).inject(tr);
  475. //var td = new Element("td", { "styles" : this.css.tableTitle, "text" : this.lp.leaveEarlyTimes }).inject(tr);
  476. var td = new Element("td", { "styles" : this.css.tableTitle, "text" : this.lp.lackOfTimeCount }).inject(tr);
  477. var td = new Element("td", { "styles" : this.css.tableTitle, "text" : this.lp.abNormalDutyCount }).inject(tr);
  478. this.actions.listStaticMonthPersonByUnitNested(this.unit, this.year, this.month, function( json ){
  479. var data = json.data || [];
  480. data.sort( function(a, b){
  481. return b.onDutyDayCount - a.onDutyDayCount;
  482. })
  483. data.each(function( d ){
  484. var tr = new Element("tr").inject(table);
  485. var td = new Element("td", { "styles" : this.css.tableValue , "text": d.employeeName.split("@")[0] }).inject(tr);
  486. var td = new Element("td", { "styles" : this.css.tableValue , "text": d.onDutyTimes }).inject(tr);
  487. var td = new Element("td", { "styles" : this.css.tableValue , "text": d.offDutyTimes }).inject(tr);
  488. var td = new Element("td", { "styles" : this.css.tableValue , "text": d.onDutyDayCount }).inject(tr);
  489. var td = new Element("td", { "styles" : this.css.tableValue , "text": d.onSelfHolidayCount }).inject(tr);
  490. var td = new Element("td", { "styles" : this.css.tableValue , "text": d.absenceDayCount }).inject(tr);
  491. var td = new Element("td", { "styles" : this.css.tableValue , "text": d.lateTimes }).inject(tr);
  492. //var td = new Element("td", { "styles" : this.css.tableValue , "text": d.leaveEarlyTimes }).inject(tr);
  493. var td = new Element("td", { "styles" : this.css.tableValue , "text": d.lackOfTimeCount }).inject(tr);
  494. var td = new Element("td", { "styles" : this.css.tableValue , "text": d.abNormalDutyCount }).inject(tr);
  495. }.bind(this))
  496. }.bind(this))
  497. },
  498. listDetailFilterUser :function( callback, name, year, month ){
  499. //{'q_empName':'林玲','q_year':'2016','q_month':'03'}
  500. var filter = {};
  501. if( name )filter.q_empName = name;
  502. if( year )filter.q_year = year;
  503. if( month )filter.q_month = month.toString().length == 2 ? month : "0"+month;
  504. this.actions.listDetailFilterUser( filter, function(json){
  505. if( callback )callback(json.data);
  506. }.bind(this))
  507. },
  508. setContentSize: function(){
  509. var toolbarSize = this.toolbarNode ? this.toolbarNode.getSize() : {"x":0,"y":0};
  510. var titlebarSize = this.titleNode ? this.titleNode.getSize() : {"x":0,"y":0};
  511. var nodeSize = this.node.getSize();
  512. var pt = this.elementContentNode.getStyle("padding-top").toFloat();
  513. var pb = this.elementContentNode.getStyle("padding-bottom").toFloat();
  514. //var filterSize = this.filterNode.getSize();
  515. var filterConditionSize = this.filterConditionNode ? this.filterConditionNode.getSize() : {"x":0,"y":0};
  516. var height = nodeSize.y-toolbarSize.y-pt-pb-filterConditionSize.y-titlebarSize.y-10;
  517. this.elementContentNode.setStyle("height", ""+height+"px");
  518. },
  519. // setNodeScroll: function(){
  520. // var _self = this;
  521. // MWF.require("MWF.widget.ScrollBar", function(){
  522. // new MWF.widget.ScrollBar(this.elementContentNode, {
  523. // "indent": false,"style":"xApp_TaskList", "where": "before", "distance": 30, "friction": 4, "axis": {"x": false, "y": true},
  524. // "onScroll": function(y){
  525. // }
  526. // });
  527. // }.bind(this));
  528. // }
  529. });