PeopleDetail.js 32 KB

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