SelfHoliday.js 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593
  1. MWF.xDesktop.requireApp("Attendance", "Explorer", null, false);
  2. MWF.xDesktop.requireApp("Selector", "package", null, false);
  3. MWF.xDesktop.requireApp("Template", "Explorer", null, false);
  4. MWF.xApplication.Attendance.SelfHoliday = new Class({
  5. Extends: MWF.xApplication.Attendance.Explorer,
  6. Implements: [Options, Events],
  7. initialize: function(node, app, actions, options){
  8. this.setOptions(options);
  9. this.app = app;
  10. this.path = "/x_component_Attendance/$SelfHoliday/";
  11. this.cssPath = "/x_component_Attendance/$SelfHoliday/"+this.options.style+"/css.wcss";
  12. this._loadCss();
  13. this.actions = actions;
  14. this.node = $(node);
  15. this.initData();
  16. if (!this.personActions) this.personActions = new MWF.xAction.org.express.RestActions();
  17. },
  18. load: function(){
  19. // this.loadToolbar();
  20. this.loadFilter();
  21. this.loadContentNode();
  22. this.elementContentNode.addEvent("scroll", function () {
  23. var scroll = this.elementContentNode.getScroll();
  24. if(this.fileterNode)this.fileterNode.scrollTo(scroll.x);
  25. }.bind(this));
  26. this.loadView();
  27. this.setNodeScroll();
  28. },
  29. setContentSize: function(){
  30. debugger;
  31. var toolbarSize = this.toolbarNode ? this.toolbarNode.getSize() : {"x":0,"y":0};
  32. var titlebarSize = this.app.titleBar ? this.app.titleBar.getSize() : {"x":0,"y":0};
  33. var nodeSize = this.node.getSize();
  34. // var pt = this.elementContentNode.getStyle("padding-top").toFloat();
  35. // var pb = this.elementContentNode.getStyle("padding-bottom").toFloat();
  36. //var filterSize = this.filterNode.getSize();
  37. var filterConditionSize = this.fileterNode ? this.fileterNode.getSize() : {"x":0,"y":0};
  38. var height = nodeSize.y-toolbarSize.y-filterConditionSize.y-titlebarSize.y - this.getOffsetX(this.fileterNode) - this.getOffsetX(this.elementContentNode);
  39. this.elementContentNode.setStyle("height", ""+height+"px");
  40. this.pageCount = (height/30).toInt()+5;
  41. this._setContentSize();
  42. if (this.view && this.view.items.length<this.pageCount){
  43. this.view.loadElementList(this.pageCount-this.view.items.length);
  44. }
  45. },
  46. loadFilter : function(){
  47. this.fileterNode = new Element("div.fileterNode", {
  48. "styles" : this.app.css.fileterNode
  49. }).inject(this.node);
  50. this._loadFilterContent();
  51. },
  52. exportExcel : function(){
  53. var exportForm = new MWF.xApplication.Attendance.SelfHoliday.ExportExcelForm( this );
  54. exportForm.edit();
  55. },
  56. _loadFilterContent : function(){
  57. var lp = MWF.xApplication.Attendance.LP;
  58. var _self = this;
  59. var html = "<table bordr='0' cellpadding='5' cellspacing='0' styles='formTable' style='width: 1000px;'>"+
  60. "<tr>" +
  61. " <td styles='filterTableTitle' lable='q_topUnitName'></td>"+
  62. " <td styles='filterTableValue' item='q_topUnitName'></td>"+
  63. " <td styles='filterTableTitle' lable='q_unitName'></td>"+
  64. " <td styles='filterTableValue' item='q_unitName'></td>"+
  65. " <td styles='filterTableTitle' lable='q_empName'></td>"+
  66. " <td styles='filterTableValue' item='q_empName'></td>"+
  67. " <td styles='filterTableTitle' lable='startdateString'></td>"+
  68. " <td styles='filterTableValue' item='startdateString'></td>"+
  69. " <td styles='filterTableTitle' lable='enddateString'></td>"+
  70. " <td styles='formTableValue' item='enddateString'></td>"+
  71. " <td styles='filterTableValue' item='action'></td>"+
  72. "</tr>" +
  73. "</table>";
  74. this.fileterNode.set("html",html);
  75. MWF.xDesktop.requireApp("Template", "MForm", function(){
  76. this.filter = new MForm( this.fileterNode, {}, {
  77. style: "attendance",
  78. isEdited : true,
  79. itemTemplate : {
  80. q_topUnitName : { "text" : lp.selectCompany, "type" : "org", "orgType" : "unit", style : {"min-width" : "100px"} , event: {
  81. change : function (item, ev) {
  82. debugger;
  83. }
  84. }
  85. },
  86. q_unitName : { "text" : lp.selectDepartment, "type" : "org", "orgType" : "unit", style : {"min-width" : "100px"} },
  87. q_empName : { "text" : lp.selectPerson, "type" : "org", "orgType" : "person", style : {"min-width" : "100px"} },
  88. startdateString : { "text" : lp.startTime, "tType" : "date", style : {"width" : "100px"} },
  89. enddateString : { "text" : lp.endTime, "tType" : "date", style : {"width" : "100px"}},
  90. action : {
  91. "type" : "button",
  92. "className" : "filterButton",
  93. "clazz":"mainColor_bg",
  94. "value" : lp.query,
  95. "event" : { "click" : function(){
  96. var filterData = _self.filter.getResult( true,",",true,true,false);
  97. this.loadView( filterData );
  98. }.bind(this)}
  99. }
  100. }
  101. }, this.app, this.app.css);
  102. this.filter.load();
  103. }.bind(this), true);
  104. },
  105. loadView : function( filterData ){
  106. this.elementContentNode.empty();
  107. this.view = new MWF.xApplication.Attendance.SelfHoliday.View(this.elementContentNode, this.app,this, this.viewData, this.options.searchKey );
  108. this.view.filterData = filterData;
  109. this.view.load();
  110. this.setContentSize();
  111. },
  112. createDocument: function(){
  113. if(this.view)this.view._createDocument();
  114. }
  115. });
  116. MWF.xApplication.Attendance.SelfHoliday.View = new Class({
  117. Extends: MWF.xApplication.Attendance.Explorer.View,
  118. _createItem: function(data){
  119. return new MWF.xApplication.Attendance.SelfHoliday.Document(this.table, data, this.explorer, this);
  120. },
  121. _getCurrentPageData: function(callback, count){
  122. //this.actions.listSelfHoliday(function(json){
  123. // if (callback) callback(json);
  124. //});
  125. if(!count )count=20;
  126. var id = (this.items.length) ? this.items[this.items.length-1].data.id : "(0)";
  127. var filter = this.filterData || {};
  128. this.actions.listSelfHolidayFilterNext(id, count, filter, function(json){
  129. if (callback) callback(json);
  130. });
  131. },
  132. _removeDocument: function(documentData, all){
  133. this.actions.deleteSelfHoliday(documentData.id, function(json){
  134. this.explorer.view.reload();
  135. this.app.notice(this.app.lp.deleteDocumentOK, "success");
  136. }.bind(this));
  137. },
  138. _createDocument: function(){
  139. var selfHoliday = new MWF.xApplication.Attendance.SelfHoliday.Form(this.explorer);
  140. selfHoliday.create();
  141. },
  142. _openDocument: function( documentData ){
  143. var selfHoliday = new MWF.xApplication.Attendance.SelfHoliday.Form(this.explorer, documentData );
  144. selfHoliday.open();
  145. }
  146. });
  147. MWF.xApplication.Attendance.SelfHoliday.Document = new Class({
  148. Extends: MWF.xApplication.Attendance.Explorer.Document
  149. });
  150. MWF.xApplication.Attendance.SelfHoliday.ExportExcelForm = new Class({
  151. Extends: MWF.xApplication.Attendance.Explorer.PopupForm,
  152. _createTableContent: function(){
  153. var lp = MWF.xApplication.Attendance.LP;
  154. var html = "<table width='100%' bordr='0' cellpadding='5' cellspacing='0' styles='formTable'>"+
  155. "<tr><td colspan='2' styles='formTableHead'>"+lp.exportEmployeeHolidayRecord+"</td></tr>" +
  156. "<tr>" +
  157. " <td styles='formTableTitle' lable='startDate'></td>"+
  158. " <td styles='formTableValue' item='startDate'></td>"+
  159. "</tr>" +
  160. "<tr>" +
  161. " <td styles='formTableTitle' lable='endDate'></td>"+
  162. " <td styles='formTableValue' item='endDate'></td>"+
  163. //" <td styles='formTableValue' item='action'></td>"+
  164. "</tr>" +
  165. "</table>";
  166. this.formTableArea.set("html",html);
  167. MWF.xDesktop.requireApp("Template", "MForm", function(){
  168. this.form = new MForm( this.formTableArea, {q_empName : layout.desktop.session.user.distinguishedName }, {
  169. isEdited : true,
  170. itemTemplate : {
  171. startDate : { "text" : lp.startTime, "tType" : "date" },
  172. endDate : { "text" : lp.endTime, "tType" : "date" }
  173. }
  174. }, this.app );
  175. this.form.load();
  176. }.bind(this), true);
  177. },
  178. _ok: function( data, callback ){
  179. this.app.restActions.exportSelfHoliday( data.startDate, data.endDate, function(json){
  180. if( callback )callback(json);
  181. }.bind(this) );
  182. this.close();
  183. }
  184. });
  185. MWF.xApplication.Attendance.SelfHoliday.Form = new Class({
  186. Extends: MWF.xApplication.Attendance.Explorer.PopupForm,
  187. options : {
  188. "width": 600,
  189. "height": 450,
  190. "hasTop" : true,
  191. "hasBottom" : true,
  192. "title" : "",
  193. "draggable" : true,
  194. "closeAction" : true
  195. },
  196. _createTableContent: function(){
  197. var lp = MWF.xApplication.Attendance.LP;
  198. var html = "<table width='100%' bordr='0' cellpadding='5' cellspacing='0' styles='formTable'>"+
  199. "<tr><td colspan='2' styles='formTableHead'>"+lp.employeeHolidayRecord+"</td></tr>" +
  200. "<tr><td styles='formTabelTitle' lable='unitName'></td>"+
  201. " <td styles='formTableValue' item='unitName'></td></tr>" +
  202. "<tr><td styles='formTabelTitle' lable='employeeName'></td>"+
  203. " <td styles='formTableValue' item='employeeName'></td></tr>" +
  204. "<tr><td styles='formTabelTitle' lable='leaveType'></td>"+
  205. " <td styles='formTableValue' item='leaveType'></td></tr>" +
  206. "<tr><td styles='formTabelTitle' lable='startTime'></td>"+
  207. " <td styles='formTableValue' item='startTime'></td></tr>" +
  208. "<tr><td styles='formTabelTitle' lable='endTime'></td>"+
  209. " <td styles='formTableValue' item='endTime'></td></tr>" +
  210. "<tr><td styles='formTabelTitle' lable='leaveDayNumber'></td>"+
  211. " <td styles='formTableValue' item='leaveDayNumber'></td></tr>" +
  212. "</table>";
  213. this.formTableArea.set("html",html);
  214. MWF.xDesktop.requireApp("Template", "MForm", function(){
  215. this.form = new MForm( this.formTableArea, this.data, {
  216. isEdited : this.isEdited || this.isNew,
  217. itemTemplate : {
  218. unitName : { text : lp.unit, "type" : "org", orgType : "unit", notEmpty : true},
  219. employeeName : { text: lp.employeeName, "type" : "org", orgType : "person" , notEmpty : true },
  220. leaveType : {
  221. text: lp.leaveType1,
  222. "type" : "select", notEmpty : true,
  223. "selectValue" : lp.leaveTypeSelectText1
  224. },
  225. startTime : {
  226. text: lp.startTime, tType : "datetime", notEmpty : true
  227. },
  228. endTime : {
  229. text: lp.endTime, tType : "datetime", notEmpty : true
  230. },
  231. leaveDayNumber : {
  232. text:lp.leaveDayCount, tType : "number", notEmpty : true
  233. }
  234. }
  235. }, this.app);
  236. this.form.load();
  237. }.bind(this), true);
  238. },
  239. _ok: function( data, callback ){
  240. this.app.restActions.saveSelfHoliday(data, function(json){
  241. if( callback )callback(json);
  242. }.bind(this));
  243. }
  244. });
  245. //
  246. //MWF.xApplication.Attendance.SelfHoliday.Form = new Class({
  247. // Extends: MWF.widget.Common,
  248. // Implements: [Options, Events],
  249. // options: {
  250. // "width": "500",
  251. // "height": "400"
  252. // },
  253. // initialize: function( explorer, data ){
  254. // this.explorer = explorer;
  255. // this.app = explorer.app;
  256. // this.data = data || {};
  257. // this.css = this.explorer.css;
  258. //
  259. // this.load();
  260. // },
  261. // load: function(){
  262. //
  263. // },
  264. //
  265. // open: function(){
  266. // this.isNew = false;
  267. // this.isEdited = false;
  268. // this._open();
  269. // },
  270. // create: function(){
  271. // this.isNew = true;
  272. // this._open();
  273. // },
  274. // edit: function(){
  275. // this.isEdited = true;
  276. // this._open();
  277. // },
  278. // _open : function(){
  279. // this.createMarkNode = new Element("div", {
  280. // "styles": this.css.createMarkNode,
  281. // "events": {
  282. // "mouseover": function(e){e.stopPropagation();},
  283. // "mouseout": function(e){e.stopPropagation();}
  284. // }
  285. // }).inject(this.app.content, "after");
  286. //
  287. // this.createAreaNode = new Element("div", {
  288. // "styles": this.css.createAreaNode
  289. // });
  290. //
  291. // this.createNode();
  292. //
  293. // this.createAreaNode.inject(this.createMarkNode, "after");
  294. // this.createAreaNode.fade("in");
  295. //
  296. //
  297. // this.setCreateNodeSize();
  298. // this.setCreateNodeSizeFun = this.setCreateNodeSize.bind(this);
  299. // this.addEvent("resize", this.setCreateNodeSizeFun);
  300. // },
  301. // createNode: function(){
  302. // var _self = this;
  303. // var d = this.data;
  304. // this.createNode = new Element("div", {
  305. // "styles": this.css.createNode
  306. // }).inject(this.createAreaNode);
  307. //
  308. //
  309. // this.createIconNode = new Element("div", {
  310. // "styles": this.isNew ? this.css.createNewNode : this.css.createIconNode
  311. // }).inject(this.createNode);
  312. //
  313. //
  314. // this.createFormNode = new Element("div", {
  315. // "styles": this.css.createFormNode
  316. // }).inject(this.createNode);
  317. //
  318. //
  319. // var table = new Element("table", {
  320. // "width" : "100%", "border" : "0", "cellpadding" : "0", "cellspacing" : "0"
  321. // }).inject( this.createFormNode );
  322. //
  323. // var tr = new Element("tr").inject(table);
  324. // var td = new Element("td", { "colspan":'2', "styles" : this.css.editTableHead, "text" : "员工休假记录" }).inject(tr);
  325. //
  326. // var tr = new Element("tr").inject(table);
  327. // var td = new Element("td", { "styles" : this.css.editTableTitle, "text" : "部门:" }).inject(tr);
  328. // var td = new Element("td", { "styles" : this.css.editTableValue }).inject(tr);
  329. // if( !this.isNew && !this.isEdited ){
  330. // td.set("text", d.unitName )
  331. // }else{
  332. // this.unitName = new MDomItem( td, {
  333. // "name" : "unitName",
  334. // "value" : d.unitName,
  335. // "style" : this.css.inputPersonStyle,
  336. // "event" : {
  337. // "click" : function( mdi){ _self.selectPeople(this, "unit", mdi.get("value").split(",") ) }
  338. // }
  339. // }, true, this.app );
  340. // this.unitName.load();
  341. // }
  342. //
  343. // var tr = new Element("tr").inject(table);
  344. // var td = new Element("td", { "styles" : this.css.editTableTitle, "text" : "员工姓名:" }).inject(tr);
  345. // var td = new Element("td", { "styles" : this.css.editTableValue }).inject(tr);
  346. // if( !this.isNew && !this.isEdited ){
  347. // td.set("text", d.employeeName )
  348. // }else{
  349. // this.employeeName = new MDomItem( td, {
  350. // "name" : "employeeName",
  351. // "value" : d.employeeName,
  352. // "style" : this.css.inputPersonStyle,
  353. // "event" : {
  354. // "click" : function( mdi){ _self.selectPeople(this, "person", mdi.get("value").split(",") ) }
  355. // }
  356. // }, true, this.app );
  357. // this.employeeName.load();
  358. // }
  359. //
  360. // var tr = new Element("tr").inject(table);
  361. // var td = new Element("td", { "styles" : this.css.editTableTitle, "text" : "休假类型:" }).inject(tr);
  362. // var td = new Element("td", { "styles" : this.css.editTableValue }).inject(tr);
  363. // if( !this.isNew && !this.isEdited ){
  364. // td.set("text", d.leaveType )
  365. // }else{
  366. // this.leaveType = new MDomItem( td, {
  367. // "name" : "leaveType",
  368. // "type" : "select",
  369. // "value" : d.leaveType,
  370. // "selectValue" : "带薪年休假,带薪病假,带薪福利假,扣薪事假,其他".split(",")
  371. // }, true, this.app );
  372. // this.leaveType.load();
  373. // }
  374. //
  375. // var tr = new Element("tr").inject(table);
  376. // var td = new Element("td", { "styles" : this.css.editTableTitle, "text" : "开始时间:" }).inject(tr);
  377. // var td = new Element("td", { "styles" : this.css.editTableValue }).inject(tr);
  378. // if( !this.isNew && !this.isEdited ){
  379. // td.set("text", d.startTime )
  380. // }else{
  381. // this.startTime = new MDomItem( td, {
  382. // "name" : "startTime",
  383. // "value" : d.startTime,
  384. // "style" : this.css.inputTimeStyle,
  385. // "event" : {
  386. // "click" : function( mdi){ _self.selectDateTime(this, false, true ) }
  387. // }
  388. // }, true, this.app );
  389. // this.startTime.load();
  390. // }
  391. //
  392. // var tr = new Element("tr").inject(table);
  393. // var td = new Element("td", { "styles" : this.css.editTableTitle, "text" : "结束时间:" }).inject(tr);
  394. // var td = new Element("td", { "styles" : this.css.editTableValue} ).inject(tr);
  395. // if( !this.isNew && !this.isEdited ){
  396. // td.set("text", d.endTime )
  397. // }else{
  398. // this.endTime = new MDomItem( td, {
  399. // "name" : "endTime",
  400. // "value" : d.endTime,
  401. // "style" : this.css.inputTimeStyle,
  402. // "event" : {
  403. // "click" : function( mdi){ _self.selectDateTime(this, false, true ) }
  404. // }
  405. // }, true, this.app );
  406. // this.endTime.load();
  407. // }
  408. //
  409. // var tr = new Element("tr").inject(table);
  410. // var td = new Element("td", { "styles" : this.css.editTableTitle, "text" : "休假天数:" }).inject(tr);
  411. // var td = new Element("td", { "styles" : this.css.editTableValue}).inject(tr);
  412. // if( !this.isNew && !this.isEdited ){
  413. // td.set("text", d.leaveDayNumber )
  414. // }else{
  415. // this.leaveDayNumber = new MDomItem( td, {
  416. // "name" : "leaveDayNumber",
  417. // "value" : d.leaveDayNumber,
  418. // "style" : this.css.inputStyle,
  419. // "event" : {
  420. // "keyup" : function(){ this.value=this.value.replace(/[^\d.]/g,'') }
  421. // }
  422. // }, true, this.app );
  423. // this.leaveDayNumber.load();
  424. // }
  425. //
  426. // if( this.isNew || this.isEdited ){
  427. // this.createOkActionNode = new Element("div", {
  428. // "styles": this.css.createOkActionNode,
  429. // "text": this.app.lp.ok
  430. // }).inject(this.createFormNode);
  431. //
  432. // this.createOkActionNode.addEvent("click", function(e){
  433. // this.okCreate(e);
  434. // }.bind(this));
  435. // }
  436. // this.cancelActionNode = new Element("div", {
  437. // "styles": this.css.createCancelActionNode,
  438. // "text": this.app.lp.cancel
  439. // }).inject(this.createFormNode);
  440. //
  441. // this.cancelActionNode.addEvent("click", function(e){
  442. // this.cancelCreate(e);
  443. // }.bind(this));
  444. //
  445. // },
  446. // setCreateNodeSize: function (width, height, top, left) {
  447. // if (!width)width = this.options && this.options.width ? this.options.width : "50%"
  448. // if (!height)height = this.options && this.options.height ? this.options.height : "50%"
  449. // if (!top) top = this.options && this.options.top ? this.options.top : 0;
  450. // if (!left) left = this.options && this.options.left ? this.options.left : 0;
  451. //
  452. // var allSize = this.app.content.getSize();
  453. // var limitWidth = allSize.x; //window.screen.width
  454. // var limitHeight = allSize.y; //window.screen.height
  455. //
  456. // "string" == typeof width && (1 < width.length && "%" == width.substr(width.length - 1, 1)) && (width = parseInt(limitWidth * parseInt(width, 10) / 100, 10));
  457. // "string" == typeof height && (1 < height.length && "%" == height.substr(height.length - 1, 1)) && (height = parseInt(limitHeight * parseInt(height, 10) / 100, 10));
  458. // 300 > width && (width = 300);
  459. // 220 > height && (height = 220);
  460. // top = top || parseInt((limitHeight - height) / 2, 10);
  461. // left = left || parseInt((limitWidth - width) / 2, 10);
  462. //
  463. // this.createAreaNode.setStyles({
  464. // "width": "" + width + "px",
  465. // "height": "" + height + "px",
  466. // "top": "" + top + "px",
  467. // "left": "" + left + "px"
  468. // });
  469. //
  470. // this.createNode.setStyles({
  471. // "width": "" + width + "px",
  472. // "height": "" + height + "px"
  473. // });
  474. //
  475. // var iconSize = this.createIconNode ? this.createIconNode.getSize() : {x: 0, y: 0};
  476. // var topSize = this.formTopNode ? this.formTopNode.getSize() : {x: 0, y: 0};
  477. // var bottomSize = this.formBottomNode ? this.formBottomNode.getSize() : {x: 0, y: 0};
  478. //
  479. // var contentHeight = height - iconSize.y - topSize.y - bottomSize.y;
  480. // //var formMargin = formHeight -iconSize.y;
  481. // this.createFormNode.setStyles({
  482. // "height": "" + contentHeight + "px"
  483. // });
  484. // },
  485. // cancelCreate: function(e){
  486. // var _self = this;
  487. // if( this.unitName )var unitName = this.unitName.get("value");
  488. // if ( this.isNew && unitName!="" && unitName!="default" ){
  489. // this.app.confirm("warn", e,
  490. // this.app.lp.create_cancel_title,
  491. // this.app.lp.create_cancel, "320px", "100px",
  492. // function(){
  493. // _self.createMarkNode.destroy();
  494. // _self.createAreaNode.destroy();
  495. // this.close();
  496. // },function(){
  497. // this.close();
  498. // }
  499. // );
  500. // }else{
  501. // this.createMarkNode.destroy();
  502. // this.createAreaNode.destroy();
  503. // delete _self;
  504. // }
  505. // },
  506. // okCreate: function(e){
  507. // var data = {
  508. // "id" : (this.data && this.data.id) ? this.data.id : null,
  509. // "unitName": this.unitName.get("value"),
  510. // "employeeName": this.employeeName.get("value"),
  511. // "leaveType": this.leaveType.get("value"),
  512. // "startTime": this.startTime.get("value"),
  513. // "endTime": this.endTime.get("value"),
  514. // "leaveDayNumber": this.leaveDayNumber.get("value")
  515. // };
  516. //
  517. // //alert(JSON.stringify(data))
  518. //
  519. // if (data.unitName && data.employeeName && data.leaveType && data.startTime && data.endTime && data.leaveDayNumber){
  520. // this.app.restActions.saveSelfHoliday(data, function(json){
  521. // if( json.type == "ERROR" ){
  522. // this.app.notice( json.message , "error");
  523. // }else{
  524. // this.createMarkNode.destroy();
  525. // this.createAreaNode.destroy();
  526. // if(this.explorer.view)this.explorer.view.reload();
  527. // this.app.notice( this.isNew ? this.app.lp.createSuccess : this.app.lp.updateSuccess , "success");
  528. // }
  529. // // this.app.processConfig();
  530. // }.bind(this));
  531. // }else{
  532. // this.app.notice( this.app.lp.selfHoliday.inputVaild, "error");
  533. // }
  534. // },
  535. // selectDateTime : function( el, timeOnly, isTme ){
  536. // MWF.require("MWF.widget.Calendar", function(){
  537. // var calendar = new MWF.widget.Calendar( el, {
  538. // "style": "xform",
  539. // "timeOnly": timeOnly,
  540. // "isTime": isTme,
  541. // "target": this.app.content
  542. // });
  543. // calendar.show();
  544. // }.bind(this));
  545. // },
  546. // selectPeople: function(el, type, value ){
  547. // var title
  548. // if( type == "unit" ){
  549. // title = "选择部门"
  550. // }else if( type == "topUnit" ){
  551. // title = "选择公司"
  552. // }else{
  553. // title = "选择个人"
  554. // }
  555. // var options = {
  556. // "type": type,
  557. // "title": title,
  558. // "count" : "1",
  559. // "values": value || [],
  560. // "onComplete": function(items){
  561. // var vs = [];
  562. // items.each(function(item){
  563. // vs.push(item.data.name);
  564. // }.bind(this));
  565. // el.set("value",vs.join( "," ));
  566. // }.bind(this)
  567. // };
  568. // var selector = new MWF.O2Selector(this.app.content, options);
  569. // }
  570. //});