UnitDetail.js 29 KB

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