TopUnitDetail.js 29 KB

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