PeopleDetail.js 31 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726
  1. MWF.xDesktop.requireApp("Attendance", "Explorer", null, false);
  2. MWF.xDesktop.requireApp("Selector", "package", null, false);
  3. MWF.xApplication.Attendance.PeopleDetail = new Class({
  4. Extends: MWF.widget.Common,
  5. Implements: [Options, Events],
  6. options: {
  7. "style": "default"
  8. },
  9. initialize: function(node, app, actions, options){
  10. this.setOptions(options);
  11. this.app = app;
  12. this.path = "../x_component_Attendance/$PeopleDetail/";
  13. this.cssPath = "../x_component_Attendance/$PeopleDetail/"+this.options.style+"/css.wcss";
  14. this._loadCss();
  15. this.actions = actions;
  16. this.node = $(node);
  17. },
  18. load: function(){
  19. this.loadTab();
  20. },
  21. loadTab : function(){
  22. this.tabNode = new Element("div",{"styles" : this.css.tabNode }).inject(this.node);
  23. this.detailArea = new Element("div",{"styles" : this.css.tabPageContainer }).inject(this.tabNode);
  24. //this.selfHolidayArea = new Element("div",{"styles" : this.css.tabPageContainer }).inject(this.tabNode)
  25. this.detailStaticArea = new Element("div",{"styles" : this.css.tabPageContainer }).inject(this.tabNode);
  26. //this.selfHolidayStaticArea = new Element("div",{"styles" : this.css.tabPageContainer }).inject(this.tabNode)
  27. MWF.require("MWF.widget.Tab", function(){
  28. this.tabs = new MWF.widget.Tab(this.tabNode, {"style": "attendance"});
  29. this.tabs.load();
  30. this.detailPage = this.tabs.addTab(this.detailArea, "个人出勤明细", false);
  31. this.detailPage.contentNodeArea.set("class","detailPage");
  32. this.detailPage.addEvent("show",function(){
  33. if( !this.detailExplorer ){
  34. this.detailExplorer = new MWF.xApplication.Attendance.PeopleDetail.Explorer( this.detailArea, this );
  35. this.detailExplorer.load();
  36. }
  37. }.bind(this));
  38. //this.selfHolidayPage = this.tabs.addTab(this.selfHolidayArea, "个人休假明细", false);
  39. //this.selfHolidayPage.contentNodeArea.set("class","selfHolidayPage");
  40. //this.selfHolidayPage.addEvent("show",function(){
  41. // if( !this.selfHoliday ){
  42. // this.selfHoliday = new MWF.xApplication.Attendance.PeopleDetail.SelfHoliday( this.selfHolidayArea, this );
  43. // this.selfHoliday.load();
  44. // }
  45. //}.bind(this))
  46. this.detailStaticPage = this.tabs.addTab(this.detailStaticArea, "个人出勤率统计", false);
  47. this.detailStaticPage.contentNodeArea.set("class","detailStaticPage");
  48. this.detailStaticPage.addEvent("show",function(){
  49. if( !this.detailStaticExplorer ){
  50. this.detailStaticExplorer = new MWF.xApplication.Attendance.PeopleDetail.DetailStaticExplorer( this.detailStaticArea, this );
  51. this.detailStaticExplorer.load();
  52. }
  53. }.bind(this));
  54. //this.selfHolidayStaticPage = this.tabs.addTab(this.selfHolidayStaticArea, "个人休假统计", false);
  55. //this.selfHolidayStaticPage.contentNodeArea.set("class","selfHolidayStaticPage");
  56. //this.selfHolidayStaticPage.addEvent("show",function(){
  57. // if( !this.selfHolidayStaticExplorer ){
  58. // this.selfHolidayStaticExplorer = new MWF.xApplication.Attendance.PeopleDetail.SelfHolidayStaticExplorer( this.selfHolidayStaticArea, this );
  59. // this.selfHolidayStaticExplorer.load();
  60. // }
  61. //}.bind(this))
  62. this.tabs.pages[0].showTab();
  63. }.bind(this));
  64. }
  65. });
  66. MWF.xApplication.Attendance.PeopleDetail.Explorer = new Class({
  67. Extends: MWF.xApplication.Attendance.Explorer,
  68. Implements: [Options, Events],
  69. initialize: function(node, parent, options){
  70. this.setOptions(options);
  71. this.parent = parent;
  72. this.app = parent.app;
  73. this.css = parent.css;
  74. this.path = parent.path;
  75. this.actions = parent.actions;
  76. this.node = $(node);
  77. this.initData();
  78. if (!this.peopleActions) this.peopleActions = new MWF.xAction.org.express.RestActions();
  79. },
  80. initData: function(){
  81. this.toolItemNodes = [];
  82. },
  83. reload: function(){
  84. this.node.empty();
  85. this.load();
  86. },
  87. load: function(){
  88. this.loadFilter();
  89. this.loadContentNode();
  90. this.setNodeScroll();
  91. },
  92. loadFilter: function(){
  93. this.fileterNode = new Element("div.fileterNode", {
  94. "styles" : this.css.fileterNode
  95. }).inject(this.node);
  96. var html = "<table width='100%' bordr='0' cellpadding='5' cellspacing='0' styles='filterTable'>"+
  97. "<tr>" +
  98. " <td styles='filterTableValue' lable='q_empName'></td>"+
  99. " <td styles='filterTableTitle' item='q_empName'></td>"+
  100. " <td styles='filterTableTitle' lable='cycleYear'></td>"+
  101. " <td styles='filterTableValue' item='cycleYear'></td>" +
  102. " <td styles='filterTableTitle' lable='cycleMonth'></td>"+
  103. " <td styles='filterTableValue' item='cycleMonth'></td>" +
  104. " <td styles='filterTableTitle' lable='date'></td>"+
  105. " <td styles='filterTableValue' item='date'></td>" +
  106. " <td styles='filterTableTitle' lable='isAbsent'></td>"+
  107. " <td styles='filterTableValue' item='isAbsent'></td>" +
  108. " <td styles='filterTableTitle' lable='isLate'></td>"+
  109. " <td styles='filterTableValue' item='isLate'></td>" +
  110. " <td styles='filterTableTitle' lable='isLackOfTime'></td>"+
  111. " <td styles='filterTableValue' item='isLackOfTime'></td>" +
  112. " <td styles='filterTableValue' item='action'></td>" +
  113. "</tr>" +
  114. "</table>";
  115. this.fileterNode.set("html",html);
  116. MWF.xDesktop.requireApp("Template", "MForm", function(){
  117. this.form = new MForm( this.fileterNode, {}, {
  118. isEdited : true,
  119. itemTemplate : {
  120. q_empName : { text : "人员", type : "org", orgType : "person", notEmpty : true, style : {"min-width": "100px" } },
  121. cycleYear : {
  122. text : "年度",
  123. "type" : "select",
  124. "selectValue" : function(){
  125. var years = [];
  126. var year = new Date().getFullYear();
  127. for(var i=0; i<6; i++ ){
  128. years.push( year-- );
  129. }
  130. return years;
  131. },
  132. "event" : {
  133. "change" : function( item, ev ){
  134. var values = this.getDateSelectValue();
  135. item.form.getItem( "date").resetItemOptions( values , values )
  136. }.bind(this)
  137. }
  138. },
  139. cycleMonth : {
  140. text : "月份",
  141. "type" : "select",
  142. "defaultValue" : function(){
  143. var month = (new Date().getMonth() + 1 ).toString();
  144. return month.length == 1 ? "0"+month : month;
  145. },
  146. "selectValue" :["","01","02","03","04","05","06","07","08","09","10","11","12"],
  147. "event" : {
  148. "change" : function( item, ev ){
  149. var values = this.getDateSelectValue();
  150. item.form.getItem( "date").resetItemOptions( values , values )
  151. }.bind(this)
  152. }
  153. },
  154. date : { text : "日期", "type" : "select", "selectValue" : this.getDateSelectValue.bind(this) },
  155. isAbsent : { text: "缺勤", "type" : "select", "selectValue" : ["","true","false"], "selectText" : ["","缺勤","未缺勤"] },
  156. isLate : { text: "迟到", "type" : "select", "selectValue" : ["","true","false"], "selectText" : ["","迟到","未迟到"] },
  157. isLackOfTime : { text: "工时不足", "type" : "select", "selectValue" : ["","true","false"], "selectText" : ["","是","否"] },
  158. action : { "value" : "查询", type : "button", className : "filterButton", event : {
  159. click : function(){
  160. var result = this.form.getResult(true,",",true,true,false);
  161. if( !result )return;
  162. if( typeOf( result.isAbsent ) == "string" )result.isAbsent = this.getBoolean( result.isAbsent );
  163. if( typeOf( result.isLate ) == "string" )result.isLate = this.getBoolean( result.isLate );
  164. if( typeOf( result.isLackOfTime ) == "string" )result.isLackOfTime = this.getBoolean( result.isLackOfTime );
  165. if( result.date && result.date !="" ){
  166. result.q_date = result.cycleYear + "-" + result.cycleMonth + "-" + result.date;
  167. }
  168. this.loadView( result );
  169. }.bind(this)
  170. }}
  171. }
  172. }, this.app, this.css);
  173. this.form.load();
  174. }.bind(this), true);
  175. },
  176. getDateSelectValue : function(){
  177. if( this.form ){
  178. var year = parseInt(this.form.getItem("cycleYear").getValue());
  179. var month = parseInt(this.form.getItem("cycleMonth").getValue())-1;
  180. }else{
  181. var year = (new Date()).getFullYear() ;
  182. var month = (new Date()).getMonth() ;
  183. }
  184. var date = new Date(year, month, 1);
  185. var days = [];
  186. days.push("");
  187. while (date.getMonth() === month) {
  188. var d = date.getDate().toString();
  189. if( d.length == 1 )d = "0"+d;
  190. days.push( d );
  191. date.setDate(date.getDate() + 1);
  192. }
  193. return days;
  194. },
  195. //loadFilter2 : function(){
  196. // this.fileterNode = new Element("div.fileterNode", {
  197. // "styles" : this.css.fileterNode
  198. // }).inject(this.node)
  199. //
  200. // var table = new Element("table", {
  201. // "width" : "100%", "border" : "0", "cellpadding" : "5", "cellspacing" : "0", "styles" : this.css.filterTable, "class" : "filterTable"
  202. // }).inject( this.fileterNode );
  203. // table.setStyle("width","1000px");
  204. // var tr = new Element("tr").inject(table);
  205. //
  206. // this.createPersonTd( tr )
  207. // this.createYearSelectTd( tr )
  208. // this.createMonthSelectTd( tr )
  209. // this.createDateSelectTd( tr )
  210. // this.createIsAbsent(tr)
  211. // this.createIsLate( tr )
  212. // //this.createIsLeaveEarlier( tr )
  213. // this.createLackOfTimeCount(tr)
  214. // this.createActionTd( tr )
  215. //},
  216. //createPersonTd : function(tr){
  217. // var _self = this;
  218. // var td = new Element("td", { "styles" : this.css.filterTableTitle, "text" : "人员" }).inject(tr);
  219. // var td = new Element("td", { "styles" : this.css.filterTableValue }).inject(tr);
  220. // this.q_empName = new MDomItem( td, {
  221. // "name" : "q_empName",
  222. // "event" : {
  223. // "click" : function(el){ _self.selecePerson(); }
  224. // }
  225. // }, true, this.app );
  226. // this.q_empName.load();
  227. //},
  228. //createYearSelectTd : function( tr ){
  229. // var _self = this;
  230. // var td = new Element("td", { "styles" : this.css.filterTableTitle, "text" : "年度" }).inject(tr);
  231. // var td = new Element("td", { "styles" : this.css.filterTableValue }).inject(tr);
  232. // this.cycleYear = new MDomItem( td, {
  233. // "name" : "cycleYear",
  234. // "type" : "select",
  235. // "selectValue" : function(){
  236. // var years = [];
  237. // var year = new Date().getFullYear();
  238. // for(var i=0; i<6; i++ ){
  239. // years.push( year-- );
  240. // }
  241. // return years;
  242. // },
  243. // "event" : {
  244. // "change" : function(){ if(_self.dateSelecterTd)_self.createDateSelectTd() }
  245. // }
  246. // }, true, this.app );
  247. // this.cycleYear.load();
  248. //},
  249. //createMonthSelectTd : function( tr ){
  250. // var _self = this;
  251. // var td = new Element("td", { "styles" : this.css.filterTableTitle, "text" : "月份" }).inject(tr);
  252. // var td = new Element("td", { "styles" : this.css.filterTableValue }).inject(tr);
  253. // this.cycleMonth = new MDomItem( td, {
  254. // "name" : "cycleMonth",
  255. // "type" : "select",
  256. // "defaultValue" : function(){
  257. // var month = (new Date().getMonth() + 1 ).toString();
  258. // return month.length == 1 ? "0"+month : month;
  259. // },
  260. // "selectValue" :["","01","02","03","04","05","06","07","08","09","10","11","12"],
  261. // "event" : {
  262. // "change" : function(){ if(_self.dateSelecterTd)_self.createDateSelectTd() }
  263. // }
  264. // }, true, this.app );
  265. // this.cycleMonth.load();
  266. //},
  267. //createDateSelectTd : function( tr ){
  268. // var _self = this;
  269. // if( tr ){
  270. // var td = new Element("td", { "styles" : this.css.filterTableTitle, "text" : "日期" }).inject(tr);
  271. // this.dateSelecterTd = new Element("td", { "styles" : this.css.filterTableValue }).inject(tr);
  272. // }
  273. // if( this.q_date ){
  274. // this.dateSelecterTd.empty();
  275. // }
  276. // this.q_date = new MDomItem( this.dateSelecterTd, {
  277. // "name" : "q_date",
  278. // "type" : "select",
  279. // "selectValue" : function(){
  280. // var year = parseInt(_self.cycleYear.getValue());
  281. // var month = parseInt(_self.cycleMonth.getValue())-1;
  282. // var date = new Date(year, month, 1);
  283. // var days = [];
  284. // days.push("");
  285. // while (date.getMonth() === month) {
  286. // var d = date.getDate().toString();
  287. // if( d.length == 1 )d = "0"+d
  288. // days.push( d );
  289. // date.setDate(date.getDate() + 1);
  290. // }
  291. // return days;
  292. // }
  293. // }, true, this.app );
  294. // this.q_date.load();
  295. //},
  296. //createIsAbsent: function(tr){
  297. // var td = new Element("td", { "styles" : this.css.filterTableTitle, "text" : "缺勤" }).inject(tr);
  298. // var td = new Element("td", { "styles" : this.css.filterTableValue }).inject(tr);
  299. // this.isAbsent = new MDomItem( td, {
  300. // "name" : "isAbsent",
  301. // "type" : "select",
  302. // "selectValue" : ["","true","false"],
  303. // "selectText" : ["","缺勤","未缺勤"],
  304. // }, true, this.app );
  305. // this.isAbsent.load();
  306. //},
  307. //createLackOfTimeCount: function(tr){
  308. // var td = new Element("td", { "styles" : this.css.filterTableTitle, "text" : "工时不足" }).inject(tr);
  309. // var td = new Element("td", { "styles" : this.css.filterTableValue }).inject(tr);
  310. // this.isLackOfTime = new MDomItem( td, {
  311. // "name" : "isLackOfTime",
  312. // "type" : "select",
  313. // "selectValue" : ["","true","false"],
  314. // "selectText" : ["","是","否"],
  315. // }, true, this.app );
  316. // this.isLackOfTime.load();
  317. //},
  318. //createIsLate: function(tr){
  319. // var td = new Element("td", { "styles" : this.css.filterTableTitle, "text" : "迟到" }).inject(tr);
  320. // var td = new Element("td", { "styles" : this.css.filterTableValue }).inject(tr);
  321. // this.isLate = new MDomItem( td, {
  322. // "name" : "isLate",
  323. // "type" : "select",
  324. // "selectValue" : ["","true","false"],
  325. // "selectText" : ["","迟到","未迟到"],
  326. // }, true, this.app );
  327. // this.isLate.load();
  328. //},
  329. //createActionTd : function( tr ){
  330. // var td = new Element("td", { "styles" : this.css.filterTableValue }).inject(tr);
  331. // var input = new Element("button",{
  332. // "text" : "查询",
  333. // "styles" : this.css.filterButton
  334. // }).inject(td);
  335. // input.addEvent("click", function(){
  336. // if( this.q_empName.getValue().trim() == "" ){
  337. // this.app.notice( "请先选择员工", "error" );
  338. // return;
  339. // }
  340. // var filterData = {
  341. // q_empName : this.q_empName.getValue(),
  342. // cycleYear : this.cycleYear.getValue(),
  343. // cycleMonth : this.cycleMonth.getValue()
  344. // }
  345. // if( this.isAbsent && this.isAbsent.getValue()!="" ){
  346. // filterData.isAbsent = this.getBoolean( this.isAbsent.getValue() );
  347. // }
  348. // if( this.isLeaveEarlier && this.isLeaveEarlier.getValue()!="" ){
  349. // filterData.isLeaveEarlier = this.getBoolean( this.isLeaveEarlier.getValue() );
  350. // }
  351. // if( this.isLate && this.isLate.getValue()!="" ){
  352. // filterData.isLate = this.getBoolean( this.isLate.getValue() );
  353. // }
  354. // if( this.isLackOfTime && this.isLackOfTime.getValue()!="" ){
  355. // filterData.isLackOfTime = this.getBoolean( this.isLackOfTime.getValue() );
  356. // }
  357. // if( this.q_date && this.q_date.getValue()!="" ){
  358. // filterData.q_date = this.cycleYear.getValue() + "-" + this.cycleMonth.getValue() + "-" + this.q_date.getValue();
  359. // }
  360. // this.loadView( filterData );
  361. // }.bind(this))
  362. //},
  363. getBoolean : function( value ){
  364. if( value === "true" )return true;
  365. if( value === "false" )return false;
  366. return value;
  367. },
  368. //selecePerson: function(){
  369. // var options = {
  370. // "type": "person",
  371. // "title": "选择人员",
  372. // "count" : "1",
  373. // "onComplete": function(items){
  374. // var names = [];
  375. // items.each(function(item){
  376. // names.push(item.data.name);
  377. // }.bind(this));
  378. // this.q_empName.setValue( names.join(",") )
  379. // }.bind(this)
  380. // };
  381. // if( !this.app.isAdmin() && this.app.isUnitManager() ){
  382. // options.units = this.app.manageUnits;
  383. // }
  384. // var selector = new MWF.O2Selector(this.app.content, options);
  385. //},
  386. loadContentNode: function(){
  387. this.elementContentNode = new Element("div", {
  388. "styles": this.css.elementContentNode
  389. }).inject(this.node);
  390. this.app.addEvent("resize", function(){this.setContentSize();}.bind(this));
  391. },
  392. loadView : function( filterData ){
  393. this.elementContentNode.empty();
  394. if( this.view )delete this.view;
  395. this.view = new MWF.xApplication.Attendance.PeopleDetail.View(this.elementContentNode, this.app,this );
  396. this.view.filterData = filterData;
  397. this.view.load();
  398. this.setContentSize();
  399. },
  400. setContentSize: function(){
  401. var tabNodeSize = this.parent.tabs ? this.parent.tabs.tabNodeContainer.getSize() : {"x":0,"y":0};
  402. var fileterNodeSize = this.fileterNode ? this.fileterNode.getSize() : {"x":0,"y":0};
  403. var nodeSize = this.parent.node.getSize();
  404. var pt = this.elementContentNode.getStyle("padding-top").toFloat();
  405. var pb = this.elementContentNode.getStyle("padding-bottom").toFloat();
  406. //var filterSize = this.filterNode.getSize();
  407. var height = nodeSize.y-tabNodeSize.y-pt-pb-fileterNodeSize.y-20;
  408. this.elementContentNode.setStyle("height", ""+height+"px");
  409. this.pageCount = (height/40).toInt()+5;
  410. if (this.view && this.view.items.length<this.pageCount){
  411. this.view.loadElementList(this.pageCount-this.view.items.length);
  412. }
  413. }
  414. });
  415. MWF.xApplication.Attendance.PeopleDetail.SelfHoliday = new Class({
  416. Extends: MWF.xApplication.Attendance.PeopleDetail.Explorer,
  417. loadView : function( filterData ){
  418. this.elementContentNode.empty();
  419. if( this.view )delete this.view;
  420. this.view = new MWF.xApplication.Attendance.PeopleDetail.SelfHolidayView(this.elementContentNode, this.app,this );
  421. this.view.filterData = filterData;
  422. this.view.load();
  423. this.setContentSize();
  424. }
  425. });
  426. MWF.xApplication.Attendance.PeopleDetail.DetailStaticExplorer = new Class({
  427. Extends: MWF.xApplication.Attendance.PeopleDetail.Explorer,
  428. loadFilter: function(){
  429. this.fileterNode = new Element("div.fileterNode", {
  430. "styles" : this.css.fileterNode
  431. }).inject(this.node);
  432. var html = "<table width='100%' bordr='0' cellpadding='5' cellspacing='0' style='width: 460px;font-size: 14px;color:#666'>"+
  433. "<tr>" +
  434. " <td styles='filterTableValue' lable='q_empName'></td>"+
  435. " <td styles='filterTableTitle' item='q_empName'></td>"+
  436. " <td styles='filterTableTitle' lable='cycleYear'></td>"+
  437. " <td styles='filterTableValue' item='cycleYear'></td>" +
  438. " <td styles='filterTableTitle' lable='cycleMonth'></td>"+
  439. " <td styles='filterTableValue' item='cycleMonth'></td>" +
  440. " <td styles='filterTableValue' item='action'></td>" +
  441. "</tr>" +
  442. "</table>";
  443. this.fileterNode.set("html",html);
  444. MWF.xDesktop.requireApp("Template", "MForm", function(){
  445. this.form = new MForm( this.fileterNode, {}, {
  446. isEdited : true,
  447. itemTemplate : {
  448. q_empName : { text : "人员", type : "org", orgType : "person", notEmpty : true, style : {"min-width": "100px" } },
  449. cycleYear : {
  450. text : "年度",
  451. "type" : "select",
  452. "selectValue" : function(){
  453. var years = [];
  454. var year = new Date().getFullYear();
  455. for(var i=0; i<6; i++ ){
  456. years.push( year-- );
  457. }
  458. return years;
  459. }
  460. },
  461. cycleMonth : {
  462. text : "月份",
  463. "type" : "select",
  464. "defaultValue" : function(){
  465. var month = (new Date().getMonth() + 1 ).toString();
  466. return month.length == 1 ? "0"+month : month;
  467. },
  468. "selectValue" :["","01","02","03","04","05","06","07","08","09","10","11","12"]
  469. },
  470. action : { "value" : "查询", type : "button", className : "filterButton", event : {
  471. click : function(){
  472. var result = this.form.getResult(true,",",true,true,false);
  473. if( !result )return;
  474. this.loadView( result );
  475. }.bind(this)
  476. }}
  477. }
  478. }, this.app, this.css);
  479. this.form.load();
  480. }.bind(this), true);
  481. },
  482. //loadFilter : function(){
  483. // this.fileterNode = new Element("div.fileterNode", {
  484. // "styles" : this.css.fileterNode
  485. // }).inject(this.node)
  486. //
  487. // var table = new Element("table", {
  488. // "width" : "100%", "border" : "0", "cellpadding" : "5", "cellspacing" : "0", "styles" : this.css.filterTable, "class" : "filterTable"
  489. // }).inject( this.fileterNode );
  490. // table.setStyle("width","460px");
  491. // var tr = new Element("tr").inject(table);
  492. //
  493. // this.createPersonTd(tr)
  494. // this.createYearSelectTd( tr )
  495. // this.createMonthSelectTd( tr )
  496. // this.createActionTd( tr )
  497. //},
  498. //createMonthSelectTd : function( tr ){
  499. // var _self = this;
  500. // var td = new Element("td", { "styles" : this.css.filterTableTitle, "text" : "月份" }).inject(tr);
  501. // var td = new Element("td", { "styles" : this.css.filterTableValue }).inject(tr);
  502. // this.cycleMonth = new MDomItem( td, {
  503. // "name" : "cycleMonth",
  504. // "type" : "select",
  505. // "selectValue" :["","01","02","03","04","05","06","07","08","09","10","11","12"],
  506. // "event" : {
  507. // "change" : function(){ if(_self.dateSelecterTd)_self.createDateSelectTd() }
  508. // }
  509. // }, true, this.app );
  510. // this.cycleMonth.load();
  511. //},
  512. //createActionTd : function( tr ){
  513. // var td = new Element("td", { "styles" : this.css.filterTableValue }).inject(tr);
  514. // var input = new Element("button",{
  515. // "text" : "查询",
  516. // "styles" : this.css.filterButton
  517. // }).inject(td);
  518. // input.addEvent("click", function(){
  519. // if( this.q_empName.getValue().trim() == "" ){
  520. // this.app.notice( "请先选择员工", "error" );
  521. // return;
  522. // }
  523. // var filterData = {
  524. // q_empName : this.q_empName.getValue(),
  525. // cycleYear : this.cycleYear.getValue(),
  526. // cycleMonth : this.cycleMonth.getValue()
  527. // }
  528. // if( this.isAbsent && this.isAbsent.getValue()!="" ){
  529. // filterData.isAbsent = this.isAbsent.getValue();
  530. // }
  531. // if( this.isLeaveEarlier && this.isLeaveEarlier.getValue()!="" ){
  532. // filterData.isLeaveEarlier = this.isLeaveEarlier.getValue();
  533. // }
  534. // if( this.isLate && this.isLate.getValue()!="" ){
  535. // filterData.isLate = this.isLate.getValue();
  536. // }
  537. // if( this.q_date && this.q_date.getValue()!="" ){
  538. // filterData.q_date = this.cycleYear.getValue() + "-" + this.cycleMonth.getValue() + "-" + this.q_date.getValue();
  539. // }
  540. // this.loadView( filterData );
  541. // }.bind(this))
  542. //},
  543. loadView : function( filterData ){
  544. this.elementContentNode.empty();
  545. if( this.view )delete this.view;
  546. this.view = new MWF.xApplication.Attendance.PeopleDetail.DetailStaticView(this.elementContentNode, this.app,this );
  547. this.view.filterData = filterData;
  548. this.view.listItemUrl = this.path+"listItem_detailStatic.json";
  549. this.view.load();
  550. this.setContentSize();
  551. }
  552. });
  553. MWF.xApplication.Attendance.PeopleDetail.SelfHolidayStaticExplorer = new Class({
  554. Extends: MWF.xApplication.Attendance.PeopleDetail.Explorer,
  555. loadView : function( filterData ){
  556. this.elementContentNode.empty();
  557. if( this.view )delete this.view;
  558. this.view = new MWF.xApplication.Attendance.PeopleDetail.SelfHolidayStaticView(this.elementContentNode, this.app,this );
  559. this.view.filterData = filterData;
  560. this.view.load();
  561. this.setContentSize();
  562. }
  563. });
  564. MWF.xApplication.Attendance.PeopleDetail.View = new Class({
  565. Extends: MWF.xApplication.Attendance.Explorer.View,
  566. _createItem: function(data){
  567. return new MWF.xApplication.Attendance.PeopleDetail.Document(this.table, data, this.explorer, this);
  568. },
  569. _getCurrentPageData: function(callback, count){
  570. if(!count)count=20;
  571. var id = (this.items.length) ? this.items[this.items.length-1].data.id : "(0)";
  572. var filter = this.filterData || {};
  573. filter.key = this.sortField || this.sortFieldDefault || "";
  574. filter.order = this.sortType || this.sortTypeDefault || "";
  575. this.actions.listDetailFilterNext( id, count, filter, function(json){
  576. if( callback )callback(json);
  577. }.bind(this));
  578. //this.actions.listDetailFilter( filter, function(json){
  579. // if( callback )callback(json);
  580. //}.bind(this))
  581. },
  582. _removeDocument: function(documentData, all){
  583. },
  584. _createDocument: function(){
  585. },
  586. _openDocument: function( documentData ){
  587. }
  588. });
  589. MWF.xApplication.Attendance.PeopleDetail.SelfHolidayView = new Class({
  590. Extends: MWF.xApplication.Attendance.Explorer.View,
  591. _createItem: function(data){
  592. return new MWF.xApplication.Attendance.PeopleDetail.SelfHolidayDocument(this.table, data, this.explorer, this);
  593. },
  594. _getCurrentPageData: function(callback, count){
  595. var filter = this.filterData || {};
  596. this.actions.listDetailFilter( filter, function(json){
  597. if( callback )callback(json);
  598. }.bind(this))
  599. },
  600. _removeDocument: function(documentData, all){
  601. },
  602. _createDocument: function(){
  603. },
  604. _openDocument: function( documentData ){
  605. }
  606. });
  607. MWF.xApplication.Attendance.PeopleDetail.DetailStaticView = new Class({
  608. Extends: MWF.xApplication.Attendance.Explorer.View,
  609. _createItem: function(data){
  610. return new MWF.xApplication.Attendance.PeopleDetail.DetailStaticDocument(this.table, data, this.explorer, this);
  611. },
  612. _getCurrentPageData: function(callback, count){
  613. var filter = this.filterData || {};
  614. if( filter.cycleMonth == "" )filter.cycleMonth="(0)";
  615. this.actions.listStaticMonthPerson( filter.q_empName, filter.cycleYear,filter.cycleMonth, function(json){
  616. var data = json.data;
  617. data.sort( function( a, b ){
  618. return parseInt( b.statisticYear + b.statisticMonth ) - parseInt( a.statisticYear + a.statisticMonth )
  619. });
  620. json.data = data;
  621. if( callback )callback(json);
  622. }.bind(this))
  623. },
  624. _removeDocument: function(documentData, all){
  625. },
  626. _createDocument: function(){
  627. },
  628. _openDocument: function( documentData ){
  629. }
  630. });
  631. MWF.xApplication.Attendance.PeopleDetail.SelfHolidayStaticView = new Class({
  632. Extends: MWF.xApplication.Attendance.Explorer.View,
  633. _createItem: function(data){
  634. return new MWF.xApplication.Attendance.PeopleDetail.SelfHolidayStaticDocument(this.table, data, this.explorer, this);
  635. },
  636. _getCurrentPageData: function(callback, count){
  637. var filter = this.filterData || {};
  638. this.actions.listPeopleDetailFilter( filter, function(json){
  639. if( callback )callback(json);
  640. }.bind(this))
  641. },
  642. _removeDocument: function(documentData, all){
  643. },
  644. _createDocument: function(){
  645. },
  646. _openDocument: function( documentData ){
  647. }
  648. });
  649. MWF.xApplication.Attendance.PeopleDetail.Document = new Class({
  650. Extends: MWF.xApplication.Attendance.Explorer.Document
  651. });
  652. MWF.xApplication.Attendance.PeopleDetail.SelfHolidayDocument = new Class({
  653. Extends: MWF.xApplication.Attendance.Explorer.Document
  654. });
  655. MWF.xApplication.Attendance.PeopleDetail.DetailStaticDocument = new Class({
  656. Extends: MWF.xApplication.Attendance.Explorer.Document
  657. });
  658. MWF.xApplication.Attendance.PeopleDetail.SelfHolidayStaticDocument = new Class({
  659. Extends: MWF.xApplication.Attendance.Explorer.Document
  660. });