MyAppeal.js 30 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704
  1. MWF.xDesktop.requireApp("Attendance", "Explorer", null, false);
  2. MWF.xDesktop.requireApp("Selector", "package", null, false);
  3. MWF.xDesktop.requireApp("Template", "MForm", null, false);
  4. MWF.xApplication.Attendance.MyAppeal = 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/$MyAppeal/";
  11. this.cssPath = "../x_component_Attendance/$MyAppeal/"+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.topWrapNode = new Element("div", {"style": "width:100%;overflow:hidden;background:rgb(240, 240, 240);"}).inject(this.node);
  20. this.topNode = new Element("div", {
  21. "styles" : this.css.topNode
  22. }).inject(this.topWrapNode);
  23. this.topNode.setStyle("width", "900px");
  24. this.loadToolbar();
  25. this.loadFilter();
  26. this.loadContentNode();
  27. this.elementContentNode.addEvent("scroll", function () {
  28. var scroll = this.elementContentNode.getScroll();
  29. if(this.topWrapNode)this.topWrapNode.scrollTo(scroll.x);
  30. }.bind(this));
  31. var month = (new Date().getMonth()+1).toString();
  32. if( month.length == 1 )month = "0"+month;
  33. var filterData = {
  34. "status" : "999",
  35. "yearString" : new Date().getFullYear().toString(),
  36. "monthString" : month
  37. };
  38. this.loadView( filterData );
  39. this.setNodeScroll();
  40. },
  41. loadToolbar: function(){
  42. this.toolbarNode = new Element("div", {"styles": this.css.toolbarNode || this.app.css.toolbarNode});
  43. this.toolbarNode.inject(this.topNode);
  44. var toolbarUrl = this.path+"toolbar.json";
  45. MWF.getJSON(toolbarUrl, function(json){
  46. json.each(function(tool){
  47. this.createToolbarItemNode(tool);
  48. }.bind(this));
  49. }.bind(this));
  50. //this.createSearchElementNode();
  51. },
  52. loadFilter: function(){
  53. var lp = MWF.xApplication.Attendance.LP;
  54. this.fileterNode = new Element("div.fileterNode", {
  55. "styles" : this.css.fileterNode
  56. }).inject(this.topNode);
  57. var html = "<table bordr='0' cellpadding='5' cellspacing='0' style='font-size: 14px;color:#666;'>"+
  58. "<tr>" +
  59. " <td styles='filterTableTitle' lable='yearString'></td>"+
  60. " <td styles='filterTableValue' item='yearString'></td>" +
  61. " <td styles='filterTableTitle' lable='monthString'></td>"+
  62. " <td styles='filterTableValue' item='monthString'></td>" +
  63. " <td styles='filterTableTitle' lable='status'></td>"+
  64. " <td styles='filterTableValue' item='status'></td>" +
  65. " <td styles='filterTableTitle' lable='appealReason'></td>"+
  66. " <td styles='filterTableValue' item='appealReason'></td>" +
  67. " <td styles='filterTableValue' item='action'></td>" +
  68. "</tr>" +
  69. "</table>";
  70. this.fileterNode.set("html",html);
  71. MWF.xDesktop.requireApp("Template", "MForm", function(){
  72. this.form = new MForm( this.fileterNode, {}, {
  73. style: "attendance",
  74. isEdited : true,
  75. itemTemplate : {
  76. yearString : {
  77. text : lp.annuaal,
  78. "type" : "select",
  79. "selectValue" : function(){
  80. var years = [];
  81. var year = new Date().getFullYear();
  82. for(var i=0; i<6; i++ ){
  83. years.push( year-- );
  84. }
  85. return years;
  86. },
  87. "event" : {
  88. "change" : function( item, ev ){
  89. // var values = this.getDateSelectValue();
  90. // item.form.getItem( "date").resetItemOptions( values , values )
  91. }.bind(this)
  92. }
  93. },
  94. monthString : {
  95. text : lp.months,
  96. "type" : "select",
  97. "defaultValue" : function(){
  98. var month = (new Date().getMonth() + 1 ).toString();
  99. return month.length == 1 ? "0"+month : month;
  100. },
  101. "selectValue" :["","01","02","03","04","05","06","07","08","09","10","11","12"],
  102. "event" : {
  103. // "change" : function( item, ev ){
  104. // var values = this.getDateSelectValue();
  105. // item.form.getItem( "date").resetItemOptions( values , values )
  106. // }.bind(this)
  107. }
  108. },
  109. status : {
  110. "text" : lp.auditStatus,
  111. "type" : "select",
  112. "value" : "999",
  113. "selectText" : lp.auditStatusSelectText,
  114. "selectValue" :["999","0","1","-1"]
  115. },
  116. appealReason : {
  117. "text" : lp.appealReason,
  118. "type" : "select",
  119. "selectText" : lp.appealReasonSelectText
  120. },
  121. action : { "value" : lp.search, type : "button", className : "filterButton", clazz:"mainColor_bg", event : {
  122. click : function(){
  123. var result = this.form.getResult(true,",",true,true,false);
  124. if( !result )return;
  125. this.loadView( result );
  126. }.bind(this)
  127. }}
  128. }
  129. }, this.app, this.app.css);
  130. this.form.load();
  131. }.bind(this), true);
  132. },
  133. getDateSelectValue : function(){
  134. if( this.form ){
  135. var year = parseInt(this.form.getItem("yearString").getValue());
  136. var month = parseInt(this.form.getItem("monthString").getValue())-1;
  137. }else{
  138. var year = (new Date()).getFullYear() ;
  139. var month = (new Date()).getMonth() ;
  140. }
  141. var date = new Date(year, month, 1);
  142. var days = [];
  143. days.push("");
  144. while (date.getMonth() === month) {
  145. var d = date.getDate().toString();
  146. if( d.length == 1 )d = "0"+d;
  147. days.push( d );
  148. date.setDate(date.getDate() + 1);
  149. }
  150. return days;
  151. },
  152. setContentSize: function(){
  153. var topNodeSize = this.topNode ? this.topNode.getSize() : {"x":0,"y":0};
  154. var nodeSize = this.node.getSize();
  155. var height = nodeSize.y - topNodeSize.y - this.getOffsetY(this.topNode) - this.getOffsetY(this.elementContentNode) - this.getOffsetY(this.node);
  156. this.elementContentNode.setStyle("height", ""+height+"px");
  157. this.pageCount = (height/30).toInt()+5;
  158. if (this.view && this.view.items.length<this.pageCount){
  159. this.view.loadElementList(this.pageCount-this.view.items.length);
  160. }
  161. },
  162. loadView : function( filterData ){
  163. this.elementContentNode.empty();
  164. this.view = new MWF.xApplication.Attendance.MyAppeal.View(this.elementContentNode, this.app,this, this.viewData, this.options.searchKey );
  165. this.view.filterData = filterData;
  166. this.view.load();
  167. this.setContentSize();
  168. },
  169. createDocument: function(){
  170. if(this.view)this.view._createDocument();
  171. }
  172. });
  173. MWF.xApplication.Attendance.MyAppeal.View = new Class({
  174. Extends: MWF.xApplication.Attendance.Explorer.View,
  175. _createItem: function(data){
  176. return new MWF.xApplication.Attendance.MyAppeal.Document(this.table, data, this.explorer, this);
  177. },
  178. _getCurrentPageData: function(callback, count){
  179. if(!count )count=20;
  180. var id = (this.items.length) ? this.items[this.items.length-1].data.id : "(0)";
  181. var filter = this.filterData || {};
  182. /*var month = (new Date().getMonth()+1).toString();
  183. if( month.length == 1 )month = "0"+month;
  184. filter.yearString = new Date().getFullYear().toString();
  185. filter.monthString = month;*/
  186. filter.empName = layout.desktop.session.user.distinguishedName;
  187. this.actions.listAppealFilterNext(id, count, filter, function(json){
  188. var data = json.data;
  189. data.sort( function( a, b ){
  190. return parseInt( b.appealDateString.replace(/-/g,"") ) - parseInt( a.appealDateString.replace(/-/g,"") );
  191. });
  192. json.data = data;
  193. if (callback) callback(json);
  194. });
  195. },
  196. _removeDocument: function(documentData, all){
  197. },
  198. _createDocument: function(){
  199. },
  200. _openDocument: function( documentData ){
  201. if(documentData.appealAuditInfo){
  202. if(documentData.appealAuditInfo.workId){
  203. var workid = documentData.appealAuditInfo.workId;
  204. var options = {"workId":workid, "appId": "process.Work"+workid};
  205. this.app.desktop.openApplication(null, "process.Work", options);
  206. return;
  207. }
  208. }
  209. var appeal = new MWF.xApplication.Attendance.MyAppeal.Appeal(this.explorer, documentData );
  210. appeal.open();
  211. }
  212. });
  213. MWF.xApplication.Attendance.MyAppeal.Document = new Class({
  214. Extends: MWF.xApplication.Attendance.Explorer.Document,
  215. agree : function(){
  216. },
  217. deny : function(){
  218. }
  219. });
  220. MWF.xApplication.Attendance.MyAppeal.Appeal = new Class({
  221. Extends: MWF.xApplication.Attendance.Explorer.PopupForm,
  222. options : {
  223. "width": 700,
  224. "height": 500,
  225. "hasTop" : true,
  226. "hasBottom" : true,
  227. "title" : MWF.xApplication.Attendance.LP.apealApplyForm,
  228. "draggable" : true,
  229. "closeAction" : true,
  230. },
  231. _createTableContent: function(){
  232. var _self = this;
  233. var lp = MWF.xApplication.Attendance.LP;
  234. this.app.restActions.getDetail(this.data.detailId, function(json){
  235. this.data.onDutyTime = json.data.onDutyTime;
  236. this.data.offDutyTime = json.data.offDutyTime;
  237. }.bind(this),null,false)
  238. var d = this.data;
  239. var appealStatus = lp.draft;
  240. if (d.status == 0 ) {
  241. appealStatus = lp.todo;
  242. } else if (d.status == 1) {
  243. appealStatus = lp.approve
  244. } else if (d.status == -1) {
  245. appealStatus = lp.deny
  246. }
  247. this.data.appealStatusShow = appealStatus;
  248. debugger
  249. var html = "<table width='100%' bordr='0' cellpadding='5' cellspacing='0' styles='formTable'>"+
  250. "<tr><td style='width: 85px;' styles='formTableTitle'>"+lp.employeeName+"</td>"+
  251. " <td style='width: 165px;' styles='formTableValue'>"+this.data.empName.split("@")[0]+"</td>" +
  252. " <td style='width: 85px;' styles='formTableTitle' lable='recordDateString'></td>"+
  253. " <td style='width: 165px;' styles='formTableValue' item='recordDateString'></td></tr>" +
  254. "<tr><td styles='formTableTitle' lable='onDutyTime'></td>"+
  255. " <td styles='formTableValue' item='onDutyTime'></td>" +
  256. " <td styles='formTableTitle' lable='offDutyTime'></td>"+
  257. " <td styles='formTableValue' item='offDutyTime'></td></tr>" +
  258. "<tr><td styles='formTableTitle' lable='appealStatusShow'></td>"+
  259. " <td styles='formTableValue' item='appealStatusShow' colspan='3'></td></tr>" +
  260. "<tr><td styles='formTableTitle' lable='appealReason'></td>"+
  261. " <td styles='formTableValue' item='appealReason'></td>" +
  262. " <td styles='formTableTitle' lable='processPerson1Show'></td>"+
  263. " <td styles='formTableValue' item='processPerson1Show'></td></tr>" +
  264. "<tr contain='selfHolidayType'><td styles='formTableTitle' lable='selfHolidayType'></td>"+
  265. " <td styles='formTableValue' item='selfHolidayType' colspan='3'></td></tr>" +
  266. "<tr contain='address'><td styles='formTableTitle' lable='address'></td>"+
  267. " <td styles='formTableValue' item='address' colspan='3'></td></tr>" +
  268. "<tr contain='startTime'><td styles='formTableTitle' lable='startTime'></td>"+
  269. " <td styles='formTableValue' item='startTime' colspan='3'></td></tr>" +
  270. "<tr contain='endTime'><td styles='formTableTitle' lable='endTime'></td>"+
  271. " <td styles='formTableValue' item='endTime' colspan='3'></td></tr>" +
  272. "<tr contain='appealDescription'><td styles='formTableTitle' lable='appealDescription'></td>"+
  273. " <td styles='formTableValue' item='appealDescription' colspan='3'></td></tr>" +
  274. /*"<tr contain='opinion1'><td styles='formTableTitle' lable='opinion1'></td>"+
  275. " <td styles='formTableValue' item='opinion1' colspan='3'></td></tr>" +*/
  276. "</table>";
  277. this.formTableArea.set("html",html);
  278. this.document = new MForm( this.formTableArea, this.data, {
  279. style : "attendance",
  280. isEdited : this.isEdited || this.isNew,
  281. itemTemplate : {
  282. recordDateString : { text:lp.recordDate, type : "innertext"},
  283. onDutyTime : { text:lp.onDutyTime, type : "innertext"},
  284. offDutyTime : { text:lp.offDutyTime, type : "innertext"},
  285. statusShow : { text:lp.attendanceStatus, type : "innertext" },
  286. appealStatusShow : { text:lp.appealStatus, type : "innertext"},
  287. processPerson1Show : {text:lp.auditor, type:"innertext", value : this.data.appealAuditInfo?this.data.appealAuditInfo.currentProcessor.split("@")[0] :""},
  288. appealReason : {
  289. notEmpty : true,
  290. text: lp.appealReason,
  291. type : "select",
  292. selectValue : lp.appealReasonSelectText,
  293. event : { change : function(mdi){
  294. _self.switchFieldByAppealReason(mdi.getValue());
  295. }}
  296. },
  297. address : { text: lp.address },
  298. selfHolidayType : {
  299. text: lp.leaveType,
  300. type : "select",
  301. selectValue : lp.leaveTypeSelectText
  302. },
  303. startTime : { text: lp.startTime, tType : "datetime" },
  304. endTime : { text:lp.endTime, tType : "datetime" },
  305. appealDescription : { text: lp.appealDescriptoin }
  306. //opinion1 : { text :"审批意见" }
  307. }
  308. }, this.app);
  309. this.document.load();
  310. _self.switchFieldByAppealReason(this.data.appealReason);
  311. // this.cancelActionNode = new Element("div", {
  312. // "styles": this.css.createCancelActionNode,
  313. // "text": lp.close
  314. // }).inject(this.formNode);
  315. //
  316. //
  317. // this.cancelActionNode.addEvent("click", function(e){
  318. // this.cancelCreate(e);
  319. // }.bind(this));
  320. // if( this.isNew || this.isEdited){
  321. // this.denyActionNode = new Element("div", {
  322. // "styles": this.css.createDenyActionNode,
  323. // "text": lp.disagree
  324. // }).inject(this.formNode);
  325. // this.createOkActionNode = new Element("div", {
  326. // "styles": this.css.createOkActionNode,
  327. // "text": lp.agree
  328. // }).inject(this.formNode);
  329. //
  330. // this.denyActionNode.addEvent("click", function(e){
  331. // this.deny(e);
  332. // }.bind(this));
  333. // this.createOkActionNode.addEvent("click", function(e){
  334. // this.okCreate(e);
  335. // }.bind(this));
  336. // }
  337. },
  338. switchFieldByAppealReason : function( ar ){
  339. var lp = MWF.xApplication.Attendance.LP;
  340. var tempField = ["selfHolidayType","startTime","endTime","address","appealDescription"];
  341. var showField = [];
  342. if( ar == lp.temporaryLeave ){
  343. showField = ["selfHolidayType","startTime","endTime"];
  344. }else if( ar == lp.out ){
  345. showField = ["address","startTime","endTime"];
  346. }else if( ar == lp.businessTrip ){
  347. showField = ["address","startTime","endTime","appealDescription"];
  348. }else if( ar == lp.other ){
  349. showField = ["appealDescription"];
  350. }
  351. tempField.each( function( f ){
  352. this.formTableArea.getElement("[contain='"+f+"']").setStyle("display", showField.contains(f) ? "" : "none" );
  353. if( this.isNew || this.isEdited )this.document.items[f].options.notEmpty = (showField.contains(f) ? true : false )
  354. }.bind(this))
  355. },
  356. // cancelCreate: function(e){
  357. // this.createMarkNode.destroy();
  358. // this.createAreaNode.destroy();
  359. // delete this;
  360. // },
  361. deny : function(e){
  362. var data = { 'ids' : [this.data.id], 'status':'-1', 'opinion1': this.opinion1.getValue() };
  363. if (data.opinion1 ){
  364. this.process( data );
  365. }else{
  366. this.app.notice( MWF.xApplication.Attendance.LP.inputIdeaNotice, "error");
  367. }
  368. },
  369. okCreate: function(e){
  370. var data = { 'ids' : [this.data.id], 'status':'1', 'opinion1': this.opinion1.getValue() };
  371. this.process( data );
  372. },
  373. process: function( data ){
  374. this.app.restActions.processAppeal( data, function(json){
  375. if( json.type == "ERROR" ){
  376. this.app.notice( json.message , "error");
  377. }else{
  378. if( this.formMaskNode )this.formMaskNode.destroy();
  379. if( this.formAreaNode )this.formAreaNode.destroy();
  380. if (this.explorer && this.explorer.view)this.explorer.view.reload();
  381. this.app.notice( MWF.xApplication.Attendance.LP.processSuccess, "success");
  382. }
  383. // this.app.processConfig();
  384. }.bind(this));
  385. }
  386. });
  387. // MWF.xApplication.Attendance.MyAppeal.Appeal = new Class({
  388. // Extends: MWF.widget.Common,
  389. // initialize: function( explorer, data ){
  390. // this.explorer = explorer;
  391. // this.app = explorer.app;
  392. // this.data = data || {};
  393. // //this.app.restActions.getAppeal(this.data.detailId, function(json){
  394. // // this.data = json.data
  395. // //}.bind(this),null,false)
  396. // //alert(JSON.stringify(this.data))
  397. // this.css = this.explorer.css;
  398. //
  399. // this.load();
  400. // },
  401. // load: function(){
  402. // this.app.restActions.getDetail(this.data.detailId, function(json){
  403. // this.data.onDutyTime = json.data.onDutyTime;
  404. // this.data.offDutyTime = json.data.offDutyTime;
  405. // }.bind(this),null,false)
  406. // },
  407. //
  408. // open: function(e){
  409. // this.isNew = false;
  410. // this.isEdited = false;
  411. // this._open();
  412. // },
  413. // create: function(){
  414. // this.isNew = true;
  415. // this._open();
  416. // },
  417. // edit: function(){
  418. // this.isEdited = true;
  419. // this._open();
  420. // },
  421. // _open : function(){
  422. // this.createMarkNode = new Element("div", {
  423. // "styles": this.css.createMarkNode,
  424. // "events": {
  425. // "mouseover": function(e){e.stopPropagation();},
  426. // "mouseout": function(e){e.stopPropagation();}
  427. // }
  428. // }).inject(this.app.content, "after");
  429. //
  430. // this.createAreaNode = new Element("div", {
  431. // "styles": this.css.createAreaNode
  432. // });
  433. //
  434. // this.createNode();
  435. //
  436. // this.createAreaNode.inject(this.createMarkNode, "after");
  437. // this.createAreaNode.fade("in");
  438. //
  439. // this.setCreateNodeSize();
  440. // this.setCreateNodeSizeFun = this.setCreateNodeSize.bind(this);
  441. // this.addEvent("resize", this.setCreateNodeSizeFun);
  442. // },
  443. // createNode: function(){
  444. // var _self = this;
  445. // var lp = MWF.xApplication.Attendance.LP;
  446. //
  447. // this.createNode = new Element("div", {
  448. // "styles": this.css.createNode
  449. // }).inject(this.createAreaNode);
  450. //
  451. // //
  452. // //this.createIconNode = new Element("div", {
  453. // // "styles": this.isNew ? this.css.createNewNode : this.css.createIconNode
  454. // //}).inject(this.createNode);
  455. //
  456. // this.createContainerNode = new Element("div", {
  457. // "styles": this.css.createContainerNode
  458. // }).inject(this.createNode);
  459. //
  460. //
  461. // this.setScrollBar( this.createContainerNode );
  462. //
  463. //
  464. // this.createFormNode = new Element("div", {
  465. // "styles": this.css.createFormNode
  466. // }).inject(this.createContainerNode);
  467. //
  468. // this.createTableContainer = new Element("div", {
  469. // "styles": this.css.createTableContainer
  470. // }).inject(this.createFormNode);
  471. //
  472. // this.createTableArea = new Element("div", {
  473. // "styles": this.css.createTableArea
  474. // }).inject(this.createTableContainer);
  475. //
  476. //
  477. // var d = this.data;
  478. // var appealStatus = lp.draft;
  479. // if (d.status == 0 ) {
  480. // appealStatus = lp.todo;
  481. // } else if (d.status == 1) {
  482. // appealStatus = lp.approve
  483. // } else if (d.status == -1) {
  484. // appealStatus = lp.deny
  485. // }
  486. // this.data.appealStatusShow = appealStatus;
  487. // debugger
  488. // var html = "<table width='100%' bordr='0' cellpadding='5' cellspacing='0' styles='formTable'>"+
  489. // "<tr><td colspan='4' styles='formTableHead'>"+lp.apealApplyForm+"</td></tr>" +
  490. // "<tr><td styles='formTableTitle'>"+lp.employeeName+"</td>"+
  491. // " <td styles='formTableValue'>"+this.data.empName.split("@")[0]+"</td>" +
  492. // " <td styles='formTableTitle' lable='recordDateString'></td>"+
  493. // " <td styles='formTableValue' item='recordDateString'></td></tr>" +
  494. // "<tr><td styles='formTableTitle' lable='onDutyTime'></td>"+
  495. // " <td styles='formTableValue' item='onDutyTime'></td>" +
  496. // " <td styles='formTableTitle' lable='offDutyTime'></td>"+
  497. // " <td styles='formTableValue' item='offDutyTime'></td></tr>" +
  498. // "<tr><td styles='formTableTitle' lable='appealStatusShow'></td>"+
  499. // " <td styles='formTableValue' item='appealStatusShow' colspan='3'></td></tr>" +
  500. // "<tr><td styles='formTableTitle' lable='appealReason'></td>"+
  501. // " <td styles='formTableValue' item='appealReason'></td>" +
  502. // " <td styles='formTableTitle' lable='processPerson1Show'></td>"+
  503. // " <td styles='formTableValue' item='processPerson1Show'></td></tr>" +
  504. // "<tr contain='selfHolidayType'><td styles='formTableTitle' lable='selfHolidayType'></td>"+
  505. // " <td styles='formTableValue' item='selfHolidayType' colspan='3'></td></tr>" +
  506. // "<tr contain='address'><td styles='formTableTitle' lable='address'></td>"+
  507. // " <td styles='formTableValue' item='address' colspan='3'></td></tr>" +
  508. // "<tr contain='startTime'><td styles='formTableTitle' lable='startTime'></td>"+
  509. // " <td styles='formTableValue' item='startTime' colspan='3'></td></tr>" +
  510. // "<tr contain='endTime'><td styles='formTableTitle' lable='endTime'></td>"+
  511. // " <td styles='formTableValue' item='endTime' colspan='3'></td></tr>" +
  512. // "<tr contain='appealDescription'><td styles='formTableTitle' lable='appealDescription'></td>"+
  513. // " <td styles='formTableValue' item='appealDescription' colspan='3'></td></tr>" +
  514. // /*"<tr contain='opinion1'><td styles='formTableTitle' lable='opinion1'></td>"+
  515. // " <td styles='formTableValue' item='opinion1' colspan='3'></td></tr>" +*/
  516. // "</table>";
  517. // this.createTableArea.set("html",html);
  518. //
  519. // this.document = new MForm( this.createTableArea, this.data, {
  520. // style : "popup",
  521. // isEdited : this.isEdited || this.isNew,
  522. // itemTemplate : {
  523. // recordDateString : { text:lp.recordDate, type : "innertext"},
  524. // onDutyTime : { text:lp.onDutyTime, type : "innertext"},
  525. // offDutyTime : { text:lp.offDutyTime, type : "innertext"},
  526. // statusShow : { text:lp.attendanceStatus, type : "innertext" },
  527. // appealStatusShow : { text:lp.appealStatus, type : "innertext"},
  528. // processPerson1Show : {text:lp.auditor, type:"innertext", value : this.data.appealAuditInfo?this.data.appealAuditInfo.currentProcessor.split("@")[0] :""},
  529. // appealReason : {
  530. // notEmpty : true,
  531. // text: lp.appealReason,
  532. // type : "select",
  533. // selectValue : lp.appealReasonSelectText,
  534. // event : { change : function(mdi){
  535. // _self.switchFieldByAppealReason(mdi.getValue());
  536. // }}
  537. // },
  538. // address : { text: lp.address },
  539. // selfHolidayType : {
  540. // text: lp.leaveType,
  541. // type : "select",
  542. // selectValue : lp.leaveTypeSelectText
  543. // },
  544. // startTime : { text: lp.startTime, tType : "datetime" },
  545. // endTime : { text:lp.endTime, tType : "datetime" },
  546. // appealDescription : { text: lp.appealDescriptoin }
  547. // //opinion1 : { text :"审批意见" }
  548. // }
  549. // }, this.app,this.css);
  550. // this.document.load();
  551. // _self.switchFieldByAppealReason(this.data.appealReason);
  552. //
  553. //
  554. // //createFormNode.set("html", html);
  555. //
  556. // //this.setScrollBar(this.createTableContainer)
  557. //
  558. //
  559. // this.cancelActionNode = new Element("div", {
  560. // "styles": this.css.createCancelActionNode,
  561. // "text": lp.close
  562. // }).inject(this.createFormNode);
  563. //
  564. //
  565. // this.cancelActionNode.addEvent("click", function(e){
  566. // this.cancelCreate(e);
  567. // }.bind(this));
  568. //
  569. // if( this.isNew || this.isEdited){
  570. // this.denyActionNode = new Element("div", {
  571. // "styles": this.css.createDenyActionNode,
  572. // "text": lp.disagree
  573. // }).inject(this.createFormNode);
  574. // this.createOkActionNode = new Element("div", {
  575. // "styles": this.css.createOkActionNode,
  576. // "text": lp.agree
  577. // }).inject(this.createFormNode);
  578. //
  579. // this.denyActionNode.addEvent("click", function(e){
  580. // this.deny(e);
  581. // }.bind(this));
  582. // this.createOkActionNode.addEvent("click", function(e){
  583. // this.okCreate(e);
  584. // }.bind(this));
  585. // }
  586. //
  587. // },
  588. // switchFieldByAppealReason : function( ar ){
  589. // var lp = MWF.xApplication.Attendance.LP;
  590. // var tempField = ["selfHolidayType","startTime","endTime","address","appealDescription"];
  591. // var showField = [];
  592. // if( ar == lp.temporaryLeave ){
  593. // showField = ["selfHolidayType","startTime","endTime"];
  594. // }else if( ar == lp.out ){
  595. // showField = ["address","startTime","endTime"];
  596. // }else if( ar == lp.businessTrip ){
  597. // showField = ["address","startTime","endTime","appealDescription"];
  598. // }else if( ar == lp.other ){
  599. // showField = ["appealDescription"];
  600. // }
  601. // tempField.each( function( f ){
  602. // this.createTableArea.getElement("[contain='"+f+"']").setStyle("display", showField.contains(f) ? "" : "none" );
  603. // if( this.isNew || this.isEdited )this.document.items[f].options.notEmpty = (showField.contains(f) ? true : false )
  604. // }.bind(this))
  605. // },
  606. // setCreateNodeSize: function(){
  607. // var size = this.app.node.getSize();
  608. // var allSize = this.app.content.getSize();
  609. //
  610. // var height = "560";
  611. // var width = "800";
  612. //
  613. // this.createAreaNode.setStyles({
  614. // "width": ""+size.x+"px",
  615. // "height": ""+size.y+"px"
  616. // });
  617. // var hY = height;
  618. // var mY = (size.y-height)/2;
  619. // this.createNode.setStyles({
  620. // "height": ""+hY+"px",
  621. // "margin-top": ""+mY+"px",
  622. // "width" : ""+width+"px"
  623. // });
  624. //
  625. // this.createContainerNode.setStyles({
  626. // "height": ""+hY+"px"
  627. // });
  628. //
  629. // var iconSize = this.createIconNode ? this.createIconNode.getSize() : {x:0,y:0};
  630. // var formMargin = hY-iconSize.y-60;
  631. // this.createFormNode.setStyles({
  632. // "height": ""+formMargin+"px",
  633. // "margin-top": ""+60+"px"
  634. // });
  635. // },
  636. // cancelCreate: function(e){
  637. // this.createMarkNode.destroy();
  638. // this.createAreaNode.destroy();
  639. // delete this;
  640. // },
  641. // deny : function(e){
  642. // var data = { 'ids' : [this.data.id], 'status':'-1', 'opinion1': this.opinion1.getValue() };
  643. // if (data.opinion1 ){
  644. // this.process( data );
  645. // }else{
  646. // this.app.notice( MWF.xApplication.Attendance.LP.inputIdeaNotice, "error");
  647. // }
  648. // },
  649. // okCreate: function(e){
  650. // var data = { 'ids' : [this.data.id], 'status':'1', 'opinion1': this.opinion1.getValue() };
  651. // this.process( data );
  652. // },
  653. // process: function( data ){
  654. // this.app.restActions.processAppeal( data, function(json){
  655. // if( json.type == "ERROR" ){
  656. // this.app.notice( json.message , "error");
  657. // }else{
  658. // this.createMarkNode.destroy();
  659. // this.createAreaNode.destroy();
  660. // if(this.explorer.view)this.explorer.view.reload();
  661. // this.app.notice( MWF.xApplication.Attendance.LP.processSuccess, "success");
  662. // }
  663. // // this.app.processConfig();
  664. // }.bind(this));
  665. // }
  666. // });