UnitDetail.js 31 KB

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