PeopleDetail.js 33 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759
  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. " <td styles='filterTableValue' item='export'></td>" +
  466. "</tr>" +
  467. "</table>";
  468. this.fileterNode.set("html",html);
  469. MWF.xDesktop.requireApp("Template", "MForm", function(){
  470. this.form = new MForm( this.fileterNode, {}, {
  471. isEdited : true,
  472. itemTemplate : {
  473. q_empName : { text : "人员", type : "org", orgType : "person", notEmpty : true, style : {"min-width": "100px" } },
  474. cycleYear : {
  475. text : "年度",
  476. "type" : "select",
  477. "selectValue" : function(){
  478. var years = [];
  479. var year = new Date().getFullYear();
  480. for(var i=0; i<6; i++ ){
  481. years.push( year-- );
  482. }
  483. return years;
  484. }
  485. },
  486. cycleMonth : {
  487. text : "月份",
  488. "type" : "select",
  489. "defaultValue" : function(){
  490. var month = (new Date().getMonth() + 1 ).toString();
  491. return month.length == 1 ? "0"+month : month;
  492. },
  493. "selectValue" :["","01","02","03","04","05","06","07","08","09","10","11","12"]
  494. },
  495. action : { "value" : "查询", type : "button", className : "filterButton", event : {
  496. click : function(){
  497. var result = this.form.getResult(true,",",true,true,false);
  498. if( !result )return;
  499. this.loadView( result );
  500. }.bind(this)
  501. }},
  502. export : { "value" : "导出", type : "button", className : "filterButton", event : {
  503. click : function(){
  504. var result = this.form.getResult(true,",",true,true,false);
  505. if( !result )return;
  506. debugger;
  507. this.actions.exportPersonStatisticAttachment(result.q_empName,result.cycleYear,result.cycleMonth,true);
  508. }.bind(this)
  509. }}
  510. }
  511. }, this.app, this.css);
  512. this.form.load();
  513. }.bind(this), true);
  514. },
  515. //loadFilter : function(){
  516. // this.fileterNode = new Element("div.fileterNode", {
  517. // "styles" : this.css.fileterNode
  518. // }).inject(this.node)
  519. //
  520. // var table = new Element("table", {
  521. // "width" : "100%", "border" : "0", "cellpadding" : "5", "cellspacing" : "0", "styles" : this.css.filterTable, "class" : "filterTable"
  522. // }).inject( this.fileterNode );
  523. // table.setStyle("width","460px");
  524. // var tr = new Element("tr").inject(table);
  525. //
  526. // this.createPersonTd(tr)
  527. // this.createYearSelectTd( tr )
  528. // this.createMonthSelectTd( tr )
  529. // this.createActionTd( tr )
  530. //},
  531. //createMonthSelectTd : function( tr ){
  532. // var _self = this;
  533. // var td = new Element("td", { "styles" : this.css.filterTableTitle, "text" : "月份" }).inject(tr);
  534. // var td = new Element("td", { "styles" : this.css.filterTableValue }).inject(tr);
  535. // this.cycleMonth = new MDomItem( td, {
  536. // "name" : "cycleMonth",
  537. // "type" : "select",
  538. // "selectValue" :["","01","02","03","04","05","06","07","08","09","10","11","12"],
  539. // "event" : {
  540. // "change" : function(){ if(_self.dateSelecterTd)_self.createDateSelectTd() }
  541. // }
  542. // }, true, this.app );
  543. // this.cycleMonth.load();
  544. //},
  545. //createActionTd : function( tr ){
  546. // var td = new Element("td", { "styles" : this.css.filterTableValue }).inject(tr);
  547. // var input = new Element("button",{
  548. // "text" : "查询",
  549. // "styles" : this.css.filterButton
  550. // }).inject(td);
  551. // input.addEvent("click", function(){
  552. // if( this.q_empName.getValue().trim() == "" ){
  553. // this.app.notice( "请先选择员工", "error" );
  554. // return;
  555. // }
  556. // var filterData = {
  557. // q_empName : this.q_empName.getValue(),
  558. // cycleYear : this.cycleYear.getValue(),
  559. // cycleMonth : this.cycleMonth.getValue()
  560. // }
  561. // if( this.isAbsent && this.isAbsent.getValue()!="" ){
  562. // filterData.isAbsent = this.isAbsent.getValue();
  563. // }
  564. // if( this.isLeaveEarlier && this.isLeaveEarlier.getValue()!="" ){
  565. // filterData.isLeaveEarlier = this.isLeaveEarlier.getValue();
  566. // }
  567. // if( this.isLate && this.isLate.getValue()!="" ){
  568. // filterData.isLate = this.isLate.getValue();
  569. // }
  570. // if( this.q_date && this.q_date.getValue()!="" ){
  571. // filterData.q_date = this.cycleYear.getValue() + "-" + this.cycleMonth.getValue() + "-" + this.q_date.getValue();
  572. // }
  573. // this.loadView( filterData );
  574. // }.bind(this))
  575. //},
  576. loadView : function( filterData ){
  577. this.elementContentNode.empty();
  578. if( this.view )delete this.view;
  579. this.view = new MWF.xApplication.Attendance.PeopleDetail.DetailStaticView(this.elementContentNode, this.app,this );
  580. this.view.filterData = filterData;
  581. this.view.listItemUrl = this.path+"listItem_detailStatic.json";
  582. this.view.load();
  583. this.setContentSize();
  584. }
  585. });
  586. MWF.xApplication.Attendance.PeopleDetail.SelfHolidayStaticExplorer = new Class({
  587. Extends: MWF.xApplication.Attendance.PeopleDetail.Explorer,
  588. loadView : function( filterData ){
  589. this.elementContentNode.empty();
  590. if( this.view )delete this.view;
  591. this.view = new MWF.xApplication.Attendance.PeopleDetail.SelfHolidayStaticView(this.elementContentNode, this.app,this );
  592. this.view.filterData = filterData;
  593. this.view.load();
  594. this.setContentSize();
  595. }
  596. });
  597. MWF.xApplication.Attendance.PeopleDetail.View = new Class({
  598. Extends: MWF.xApplication.Attendance.Explorer.View,
  599. _createItem: function(data){
  600. return new MWF.xApplication.Attendance.PeopleDetail.Document(this.table, data, this.explorer, this);
  601. },
  602. _getCurrentPageData: function(callback, count){
  603. if(!count)count=20;
  604. var id = (this.items.length) ? this.items[this.items.length-1].data.id : "(0)";
  605. var filter = this.filterData || {};
  606. filter.key = this.sortField || this.sortFieldDefault || "";
  607. filter.order = this.sortType || this.sortTypeDefault || "";
  608. this.actions.listDetailFilterNext( id, count, filter, function(json){
  609. if( callback )callback(json);
  610. }.bind(this));
  611. //this.actions.listDetailFilter( filter, function(json){
  612. // if( callback )callback(json);
  613. //}.bind(this))
  614. },
  615. _removeDocument: function(documentData, all){
  616. },
  617. _createDocument: function(){
  618. },
  619. _openDocument: function( documentData ){
  620. }
  621. });
  622. MWF.xApplication.Attendance.PeopleDetail.SelfHolidayView = new Class({
  623. Extends: MWF.xApplication.Attendance.Explorer.View,
  624. _createItem: function(data){
  625. return new MWF.xApplication.Attendance.PeopleDetail.SelfHolidayDocument(this.table, data, this.explorer, this);
  626. },
  627. _getCurrentPageData: function(callback, count){
  628. var filter = this.filterData || {};
  629. this.actions.listDetailFilter( filter, function(json){
  630. if( callback )callback(json);
  631. }.bind(this))
  632. },
  633. _removeDocument: function(documentData, all){
  634. },
  635. _createDocument: function(){
  636. },
  637. _openDocument: function( documentData ){
  638. }
  639. });
  640. MWF.xApplication.Attendance.PeopleDetail.DetailStaticView = new Class({
  641. Extends: MWF.xApplication.Attendance.Explorer.View,
  642. _createItem: function(data){
  643. return new MWF.xApplication.Attendance.PeopleDetail.DetailStaticDocument(this.table, data, this.explorer, this);
  644. },
  645. _getCurrentPageData: function(callback, count){
  646. var filter = this.filterData || {};
  647. if( filter.cycleMonth == "" )filter.cycleMonth="(0)";
  648. this.actions.listStaticMonthPerson( filter.q_empName, filter.cycleYear,filter.cycleMonth, function(json){
  649. var data = json.data;
  650. data.sort( function( a, b ){
  651. return parseInt( b.statisticYear + b.statisticMonth ) - parseInt( a.statisticYear + a.statisticMonth )
  652. });
  653. json.data = data;
  654. if( callback )callback(json);
  655. }.bind(this))
  656. },
  657. _removeDocument: function(documentData, all){
  658. },
  659. _createDocument: function(){
  660. },
  661. _openDocument: function( documentData ){
  662. }
  663. });
  664. MWF.xApplication.Attendance.PeopleDetail.SelfHolidayStaticView = new Class({
  665. Extends: MWF.xApplication.Attendance.Explorer.View,
  666. _createItem: function(data){
  667. return new MWF.xApplication.Attendance.PeopleDetail.SelfHolidayStaticDocument(this.table, data, this.explorer, this);
  668. },
  669. _getCurrentPageData: function(callback, count){
  670. var filter = this.filterData || {};
  671. this.actions.listPeopleDetailFilter( filter, function(json){
  672. if( callback )callback(json);
  673. }.bind(this))
  674. },
  675. _removeDocument: function(documentData, all){
  676. },
  677. _createDocument: function(){
  678. },
  679. _openDocument: function( documentData ){
  680. }
  681. });
  682. MWF.xApplication.Attendance.PeopleDetail.Document = new Class({
  683. Extends: MWF.xApplication.Attendance.Explorer.Document
  684. });
  685. MWF.xApplication.Attendance.PeopleDetail.SelfHolidayDocument = new Class({
  686. Extends: MWF.xApplication.Attendance.Explorer.Document
  687. });
  688. MWF.xApplication.Attendance.PeopleDetail.DetailStaticDocument = new Class({
  689. Extends: MWF.xApplication.Attendance.Explorer.Document
  690. });
  691. MWF.xApplication.Attendance.PeopleDetail.SelfHolidayStaticDocument = new Class({
  692. Extends: MWF.xApplication.Attendance.Explorer.Document
  693. });