ScheduleExplorer.js 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533
  1. MWF.xDesktop.requireApp("Template", "Explorer", null, false);
  2. MWF.xDesktop.requireApp("Attendance", "Explorer", null, false);
  3. MWF.xDesktop.requireApp("Selector", "package", null, false);
  4. MWF.xApplication.Attendance.ScheduleExplorer = 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/$ScheduleExplorer/";
  11. this.cssPath = "../x_component_Attendance/$ScheduleExplorer/"+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. loadView : function(){
  19. this.view = new MWF.xApplication.Attendance.ScheduleExplorer.View(this.elementContentNode, this.app,this, this.viewData, this.options.searchKey );
  20. this.view.load();
  21. this.setContentSize();
  22. },
  23. createDocument: function(){
  24. if(this.view)this.view._createDocument();
  25. }
  26. });
  27. MWF.xApplication.Attendance.ScheduleExplorer.View = new Class({
  28. Extends: MWF.xApplication.Attendance.Explorer.View,
  29. _createItem: function(data){
  30. return new MWF.xApplication.Attendance.ScheduleExplorer.Document(this.table, data, this.explorer, this);
  31. },
  32. _getCurrentPageData: function(callback, count){
  33. this.actions.listSchedule(function(json){
  34. json.data=json.data.map(function (v) {
  35. v.signProxy = !v.signProxy?1:v.signProxy;
  36. return v;
  37. });
  38. if (callback) callback(json);
  39. });
  40. },
  41. _removeDocument: function(documentData, all){
  42. this.actions.deleteSchedule(documentData.id, function(json){
  43. this.explorer.view.reload();
  44. this.app.notice(this.app.lp.deleteDocumentOK, "success");
  45. }.bind(this));
  46. },
  47. _createDocument: function(){
  48. var schedule = new MWF.xApplication.Attendance.ScheduleExplorer.Schedule(this.explorer);
  49. schedule.create();
  50. },
  51. copyObject: function(obj){
  52. if(typeof obj != 'object'){
  53. return obj;
  54. }
  55. var newobj = new Object(null);
  56. for ( var attr in obj) {
  57. newobj[attr] = this.copyObject(obj[attr]);
  58. }
  59. return newobj;
  60. },
  61. _openDocument: function( documentData ){
  62. var data =this.copyObject(documentData);
  63. var schedule = new MWF.xApplication.Attendance.ScheduleExplorer.Schedule(this.explorer, data );
  64. schedule.edit();
  65. }
  66. });
  67. MWF.xApplication.Attendance.ScheduleExplorer.Document = new Class({
  68. Extends: MWF.xApplication.Attendance.Explorer.Document
  69. });
  70. MWF.xApplication.Attendance.ScheduleExplorer.Schedule = new Class({
  71. Extends: MWF.xApplication.Attendance.Explorer.PopupForm,
  72. options : {
  73. "width": 600,
  74. "height": 600,
  75. "hasTop" : true,
  76. "hasBottom" : true,
  77. "title" : MWF.xApplication.Attendance.LP.schedule.setSchedule,
  78. "draggable" : true,
  79. "closeAction" : true
  80. },
  81. _createTableContent: function(){
  82. var lp = this.app.lp.schedule;
  83. var signProxy = this.data.signProxy||1;
  84. var html = "<table width='100%' bordr='0' cellpadding='5' cellspacing='0' styles='formTable'>"+
  85. "<tr><td styles='formTabelTitle' lable='unitName'></td>"+
  86. " <td styles='formTableValue' item='unitName'></td></tr>" +
  87. "<tr><td styles='formTabelTitle' lable='signProxy'></td>"+
  88. " <td styles='formTableValue' item='signProxy'></td></tr>" +
  89. "<tr><td styles='formTabelTitle' lable='onDutyTime'></td>"+
  90. " <td styles='formTableValue' item='onDutyTime'></td></tr>" +
  91. "<tr style='"+(!signProxy||signProxy=="0"||signProxy=="1"?"display: none":"")+"'><td styles='formTabelTitle' lable='middayRestStartTime'></td>"+
  92. " <td styles='formTableValue' item='middayRestStartTime'></td></tr>" +
  93. "<tr style='"+(!signProxy||signProxy=="0"||signProxy=="1"?"display: none":"")+"'><td styles='formTabelTitle' lable='middayRestEndTime'></td>"+
  94. " <td styles='formTableValue' item='middayRestEndTime'></td></tr>" +
  95. "<tr><td styles='formTabelTitle' lable='offDutyTime'></td>"+
  96. " <td styles='formTableValue' item='offDutyTime'></td></tr>" +
  97. "<tr><td styles='formTabelTitle' lable='lateStartTime'></td>"+
  98. " <td styles='formTableValue' item='lateStartTime'></td></tr>" +
  99. "<tr style='"+(signProxy!="3"?"display: none":"")+"'><td styles='formTabelTitle' lable='leaveEarlyStartTimeMorning'></td>"+
  100. " <td styles='formTableValue' item='leaveEarlyStartTimeMorning'></td></tr>" +
  101. "<tr style='"+(signProxy!="3"?"display: none":"")+"'><td styles='formTabelTitle' lable='lateStartTimeAfternoon'></td>"+
  102. " <td styles='formTableValue' item='lateStartTimeAfternoon'></td></tr>" +
  103. "<tr><td styles='formTabelTitle' lable='leaveEarlyStartTime'></td>"+
  104. " <td styles='formTableValue' item='leaveEarlyStartTime'></td></tr>" +
  105. "<tr><td styles='formTabelTitle' lable='absenceStartTime'></td>"+
  106. " <td styles='formTableValue' item='absenceStartTime'></td></tr>" +
  107. "</table>";
  108. this.formTableArea.set("html",html);
  109. MWF.xDesktop.requireApp("Template", "MForm", function(){
  110. debugger
  111. var ob = Object;
  112. this.form = new MForm( this.formTableArea, this.data, {
  113. style: "attendance",
  114. onPostLoad: function(){
  115. // if(signProxy!=0&&signProxy!=1){
  116. // if(signProxy==3)
  117. // this.options.height=670;
  118. // else
  119. // this.options.height=570;
  120. // }
  121. }.bind(this),
  122. isEdited : this.isEdited || this.isNew,
  123. itemTemplate : {
  124. unitName : { text: lp.unit, type : "org", orgType : "unit" },
  125. signProxy : { text: lp.signProxy.name, type : "select" ,selectText:ob.values(lp.signProxy.select),selectValue:ob.keys(lp.signProxy.select),defaultValue: signProxy,style:{
  126. // "width": "99%",
  127. // "border": "1px solid rgb(153, 153, 153)",
  128. // "border-radius": "3px",
  129. // "box-shadow": "rgb(204, 204, 204) 0px 0px 6px",
  130. // "min-height": "26px",
  131. // "overflow": "hidden"
  132. },event :{
  133. "change":function(){
  134. var signProxy = this.form.getItem("signProxy").getValue();
  135. if(signProxy!="1"&&signProxy!="0"){
  136. this.formTableArea.getElement("[lable=middayRestStartTime]").getParent().setStyle("display","table-row");
  137. this.formTableArea.getElement("[lable=middayRestEndTime]").getParent().setStyle("display","table-row");
  138. // var tempH = "570px";
  139. if(signProxy=="3"){
  140. this.formTableArea.getElement("[lable=leaveEarlyStartTimeMorning]").getParent().setStyle("display","table-row");
  141. this.formTableArea.getElement("[lable=lateStartTimeAfternoon]").getParent().setStyle("display","table-row");
  142. // tempH = "670px";
  143. this.form.options.itemTemplate.lateStartTimeAfternoon.notEmpty=true;
  144. }else{
  145. this.formTableArea.getElement("[lable=leaveEarlyStartTimeMorning]").getParent().setStyle("display","none");
  146. this.formTableArea.getElement("[lable=lateStartTimeAfternoon]").getParent().setStyle("display","none");
  147. this.form.options.itemTemplate.lateStartTimeAfternoon.notEmpty=false;
  148. }
  149. // this.formNode.setStyle("height",tempH);
  150. this.form.options.itemTemplate.middayRestStartTime.text=lp.signProxy[signProxy].middayRestStartTime;
  151. this.form.options.itemTemplate.middayRestEndTime.text=lp.signProxy[signProxy].middayRestEndTime;
  152. this.form.options.itemTemplate.middayRestStartTime.notEmpty=true;
  153. this.form.options.itemTemplate.middayRestEndTime.notEmpty=true;
  154. }else{
  155. this.formTableArea.getElement("[lable=middayRestStartTime]").getParent().setStyle("display","none");
  156. this.formTableArea.getElement("[lable=middayRestEndTime]").getParent().setStyle("display","none");
  157. this.formTableArea.getElement("[lable=leaveEarlyStartTimeMorning]").getParent().setStyle("display","none");
  158. this.formTableArea.getElement("[lable=lateStartTimeAfternoon]").getParent().setStyle("display","none");
  159. // this.formNode.setStyle("height","500px");
  160. this.form.options.itemTemplate.middayRestStartTime.notEmpty=false;
  161. this.form.options.itemTemplate.middayRestEndTime.notEmpty=false;
  162. this.form.options.itemTemplate.lateStartTimeAfternoon.notEmpty=false;
  163. }
  164. this.form.data[0].signProxy = signProxy;
  165. this.form.load();
  166. }.bind(this)
  167. }},
  168. onDutyTime : { text: lp.workTime, tType : "time",notEmpty:true },
  169. middayRestStartTime:{ text: lp.signProxy["2"].middayRestStartTime, tType : "time",notEmpty:(signProxy!=0&&signProxy!=1)?true:false },
  170. middayRestEndTime:{ text: lp.signProxy["2"].middayRestEndTime, tType : "time",notEmpty:(signProxy!=0&&signProxy!=1)?true:false },
  171. offDutyTime : { text: lp.offTime, tType : "time",notEmpty:true },
  172. lateStartTime : { text: lp.lateStartTime, tType : "time",notEmpty:true},
  173. leaveEarlyStartTimeMorning : { text: lp.leaveEarlyStartTimeMorning, tType : "time"},
  174. lateStartTimeAfternoon : { text: lp.lateStartTimeAfternoon, tType : "time",notEmpty:(signProxy!=0&&signProxy!=1)?true:false},
  175. //leaveEarlyTime : { text:lp.leaveEarlyTime, tType : "time" },
  176. leaveEarlyStartTime : { text:lp.leaveEarlyStartTime, tType : "time" },
  177. absenceStartTime : { text:lp.absenteeismTime, tType : "time" }
  178. }
  179. }, this.app);
  180. this.form.load();
  181. }.bind(this), true);
  182. },
  183. _ok: function( data, callback ){
  184. //checkDate
  185. debugger
  186. var dateList = [];
  187. var signProxy = data.signProxy;
  188. if(signProxy!=1){
  189. dateList= [data.onDutyTime,data.middayRestStartTime,data.middayRestEndTime,data.offDutyTime];
  190. }else{
  191. dateList= [data.onDutyTime,data.offDutyTime];
  192. }
  193. var D = Date.parse;
  194. for(var i=0;i<dateList.length;i++){
  195. if(i!=0&&D(dateList[i])-D(dateList[i-1])<0){
  196. this.app.notice( this.app.lp.schedule.illegal[signProxy][i-1],"error",this.formNode,{x:"center",y:"center"});
  197. return;
  198. }
  199. }
  200. this.app.restActions.saveSchedule(data, function(json){
  201. if( callback )callback(json);
  202. }.bind(this));
  203. }
  204. });
  205. //
  206. //
  207. //MWF.xApplication.Attendance.ScheduleExplorer.Schedule2 = new Class({
  208. // Extends: MWF.widget.Common,
  209. // options: {
  210. // "width": "600",
  211. // "height": "450"
  212. // },
  213. // initialize: function( explorer, data ){
  214. // this.explorer = explorer;
  215. // this.app = explorer.app;
  216. // this.data = data || {};
  217. // this.css = this.explorer.css;
  218. //
  219. // this.load();
  220. // },
  221. // load: function(){
  222. // this.data.workTime = this.data.onDutyTime;
  223. // this.data.offTime = this.data.offDutyTime;
  224. // this.data.unit = this.data.unitName;
  225. // this.data.lateTime = this.data.lateStartTime;
  226. // this.data.leaveEarlyTime =this.data.leaveEarlyStartTime;
  227. // this.data.absenteeismTime =this.data.absenceStartTime;
  228. // },
  229. //
  230. // open: function(e){
  231. // this.isNew = false;
  232. // this.isEdited = false;
  233. // },
  234. // create: function(){
  235. // this.isNew = true;
  236. // this._open();
  237. // },
  238. // edit: function(){
  239. // this.isEdited = true;
  240. // this._open();
  241. // },
  242. // _open : function(){
  243. // this.createMarkNode = new Element("div", {
  244. // "styles": this.css.createMarkNode,
  245. // "events": {
  246. // "mouseover": function(e){e.stopPropagation();},
  247. // "mouseout": function(e){e.stopPropagation();}
  248. // }
  249. // }).inject(this.app.content, "after");
  250. //
  251. // this.createAreaNode = new Element("div", {
  252. // "styles": this.css.createAreaNode
  253. // });
  254. //
  255. // this.createNode();
  256. //
  257. // this.createAreaNode.inject(this.createMarkNode, "after");
  258. // this.createAreaNode.fade("in");
  259. //
  260. // this.unit.focus();
  261. //
  262. // this.setCreateNodeSize();
  263. // this.setCreateNodeSizeFun = this.setCreateNodeSize.bind(this);
  264. // this.addEvent("resize", this.setCreateNodeSizeFun);
  265. // },
  266. // createNode: function(){
  267. // var _self = this;
  268. // this.createNode = new Element("div", {
  269. // "styles": this.css.createNode
  270. // }).inject(this.createAreaNode);
  271. //
  272. //
  273. // this.createIconNode = new Element("div", {
  274. // "styles": this.isNew ? this.css.createNewNode : this.css.createIconNode
  275. // }).inject(this.createNode);
  276. //
  277. //
  278. // this.createFormNode = new Element("div", {
  279. // "styles": this.css.createFormNode
  280. // }).inject(this.createNode);
  281. //
  282. // var lp = this.app.lp.schedule;
  283. //
  284. // var inputStyle = "width: 99%; border:1px solid #999; background-color:#FFF; border-radius: 3px; box-shadow: 0px 0px 6px #CCC;height: 26px;";
  285. // var inputTimeStyle = "width: 99%; border:1px solid #999; background-color:#FFF; border-radius: 3px; box-shadow: 0px 0px 6px #CCC;height: 26px;"+
  286. // "background : url(../x_component_Attendance/$ScheduleExplorer/default/icon/calendar.png) 98% center no-repeat";
  287. // var inputPersonStyle = "width: 99%; border:1px solid #999; background-color:#FFF; border-radius: 3px; box-shadow: 0px 0px 6px #CCC;height: 26px;"+
  288. // "background : url(../x_component_Attendance/$PermissionExplorer/default/icon/selectperson.png) 98% center no-repeat";
  289. //
  290. // var html = "<table width='100%' height='270' border='0' cellPadding='0' cellSpacing='0'>" +
  291. // "<tr>"+
  292. // "<td colspan='2' style='height: 50px; line-height: 50px; text-align: center; min-width: 80px; font-size:18px;font-weight: bold;'>" + lp.setSchedule + "</td>" +
  293. // "</tr>" +
  294. // "<tr>"+
  295. // "<td style='height: 60px; line-height: 60px; text-align: left; min-width: 80px; width:25%' rowspan='2'>" + lp.unit + ":</td>" +
  296. // "<td style='; text-align: right;'>"+
  297. // (!this.isNew && !this.isEdited ? "" :
  298. // ("<input type='text' id='unit' " + "style='" + inputPersonStyle +"'" + " value='" + ( this.data && this.data.unit ? this.data.unit : "") + "'/>")) +
  299. // "</td>"+
  300. // "</tr>" +
  301. // "<tr>"+
  302. // "<td style='; text-align: left;font-size:14px;padding-bottom: 5px'>"+
  303. // (!this.isNew && !this.isEdited ? "" :("<input type='button' id='selTopUnit' " +"style='margin-right:5px'"+ " value='选择公司'/>")) +
  304. // (!this.isNew && !this.isEdited ? "" :("<input type='button' id='selUnit' " + " value='选择部门'/>")) +
  305. // //"注:不选择" + lp.unit + "则为默认排班"+
  306. // "</td>"+
  307. // "</tr>" +
  308. // "<tr>" +
  309. // "<td style='height: 30px; line-height: 30px; text-align: left'>"+lp.workTime+":</td>" +
  310. // "<td style='; text-align: right;'>" +
  311. // (!this.isNew && !this.isEdited ? "" :
  312. // ("<input type='text' id='workTime' " + "style='" + inputTimeStyle +"'" + " value='" + ( this.data && this.data.workTime ? this.data.workTime : "") + "'/>")) +
  313. // "</td>" +
  314. // "</tr>" +
  315. // "<tr>" +
  316. // "<td style='height: 30px; line-height: 30px; text-align: left'>"+lp.offTime+":</td>" +
  317. // "<td style='; text-align: right;'>" +
  318. // (!this.isNew && !this.isEdited ? "" :
  319. // ("<input type='text' id='offTime' " + "style='" + inputTimeStyle +"'" + " value='" + ( this.data && this.data.offTime ? this.data.offTime : "") + "'/>")) +
  320. // "</td>" +
  321. // "</tr>" +
  322. // "<tr>" +
  323. // "<td style='height: 30px; line-height: 30px; text-align: left'>"+lp.lateTime+":</td>" +
  324. // "<td style='; text-align: right;'>" +
  325. // (!this.isNew && !this.isEdited ? "" :
  326. // ("<input type='text' id='lateTime' " + "style='" + inputTimeStyle +"'" + " value='" + ( this.data && this.data.lateTime ? this.data.lateTime : "") + "'/>")) +
  327. // "</td>" +
  328. // "</tr>" +
  329. // "<tr>" +
  330. // "<td style='height: 30px; line-height: 30px; text-align: left'>"+lp.leaveEarlyTime+":</td>" +
  331. // "<td style='; text-align: right;'>" +
  332. // (!this.isNew && !this.isEdited ? "" :
  333. // ("<input type='text' id='leaveEarlyTime' " + "style='" + inputTimeStyle +"'" + " value='" + ( this.data && this.data.leaveEarlyTime ? this.data.leaveEarlyTime : "") + "'/>")) +
  334. // "</td>" +
  335. // "</tr>" +
  336. // "<tr>" +
  337. // "<td style='height: 30px; line-height: 30px; text-align: left'>"+lp.absenteeismTime+":</td>" +
  338. // "<td style='; text-align: right;'>" +
  339. // (!this.isNew && !this.isEdited ? "" :
  340. // ("<input type='text' id='absenteeismTime' " + "style='" + inputTimeStyle +"'" + " value='" + ( this.data && this.data.absenteeismTime ? this.data.absenteeismTime : "") + "'/>")) +
  341. // "</td>" +
  342. // "</tr>" +
  343. // "</table>";
  344. // this.createFormNode.set("html", html);
  345. //
  346. // this.unit = this.createFormNode.getElement("#unit");
  347. // this.workTime = this.createFormNode.getElement("#workTime");
  348. // this.offTime = this.createFormNode.getElement("#offTime");
  349. // this.lateTime = this.createFormNode.getElement("#lateTime");
  350. // this.leaveEarlyTime = this.createFormNode.getElement("#leaveEarlyTime");
  351. // this.absenteeismTime = this.createFormNode.getElement("#absenteeismTime");
  352. //
  353. // this.createFormNode.getElement("#selUnit").addEvent("click",function(){
  354. // _self.selectUnit(this,"d");
  355. // })
  356. // this.createFormNode.getElement("#selTopUnit").addEvent("click",function(){
  357. // _self.selectUnit(this,"c");
  358. // })
  359. //
  360. // this.workTime.addEvent("click",function(){
  361. // _self.selectCalendar(this);
  362. // })
  363. // this.offTime.addEvent("click",function(){
  364. // _self.selectCalendar(this);
  365. // })
  366. // this.lateTime.addEvent("click",function(){
  367. // _self.selectCalendar(this);
  368. // })
  369. // this.leaveEarlyTime.addEvent("click",function(){
  370. // _self.selectCalendar(this);
  371. // })
  372. // this.absenteeismTime.addEvent("click",function(){
  373. // _self.selectCalendar(this);
  374. // })
  375. //
  376. // this.cancelActionNode = new Element("div", {
  377. // "styles": this.css.createCancelActionNode,
  378. // "text": this.app.lp.cancel
  379. // }).inject(this.createFormNode);
  380. // this.createOkActionNode = new Element("div", {
  381. // "styles": this.css.createOkActionNode,
  382. // "text": this.app.lp.ok
  383. // }).inject(this.createFormNode);
  384. //
  385. // this.cancelActionNode.addEvent("click", function(e){
  386. // this.cancelCreate(e);
  387. // }.bind(this));
  388. // this.createOkActionNode.addEvent("click", function(e){
  389. // this.okCreate(e);
  390. // }.bind(this));
  391. // },
  392. //
  393. // setCreateNodeSize: function (width, height, top, left) {
  394. // if (!width)width = this.options && this.options.width ? this.options.width : "50%"
  395. // if (!height)height = this.options && this.options.height ? this.options.height : "50%"
  396. // if (!top) top = this.options && this.options.top ? this.options.top : 0;
  397. // if (!left) left = this.options && this.options.left ? this.options.left : 0;
  398. //
  399. // var allSize = this.app.content.getSize();
  400. // var limitWidth = allSize.x; //window.screen.width
  401. // var limitHeight = allSize.y; //window.screen.height
  402. //
  403. // "string" == typeof width && (1 < width.length && "%" == width.substr(width.length - 1, 1)) && (width = parseInt(limitWidth * parseInt(width, 10) / 100, 10));
  404. // "string" == typeof height && (1 < height.length && "%" == height.substr(height.length - 1, 1)) && (height = parseInt(limitHeight * parseInt(height, 10) / 100, 10));
  405. // 300 > width && (width = 300);
  406. // 220 > height && (height = 220);
  407. // top = top || parseInt((limitHeight - height) / 2, 10);
  408. // left = left || parseInt((limitWidth - width) / 2, 10);
  409. //
  410. // this.createAreaNode.setStyles({
  411. // "width": "" + width + "px",
  412. // "height": "" + height + "px",
  413. // "top": "" + top + "px",
  414. // "left": "" + left + "px"
  415. // });
  416. //
  417. // this.createNode.setStyles({
  418. // "width": "" + width + "px",
  419. // "height": "" + height + "px"
  420. // });
  421. //
  422. // var iconSize = this.createIconNode ? this.createIconNode.getSize() : {x: 0, y: 0};
  423. // var topSize = this.formTopNode ? this.formTopNode.getSize() : {x: 0, y: 0};
  424. // var bottomSize = this.formBottomNode ? this.formBottomNode.getSize() : {x: 0, y: 0};
  425. //
  426. // var contentHeight = height - iconSize.y - topSize.y - bottomSize.y;
  427. // //var formMargin = formHeight -iconSize.y;
  428. // this.createFormNode.setStyles({
  429. // "height": "" + contentHeight + "px"
  430. // });
  431. // },
  432. // cancelCreate: function(e){
  433. // var _self = this;
  434. // var unit = this.unit.get("value");
  435. // if ( this.isNew && unit!="" && unit!="default" ){
  436. // this.app.confirm("warn", e,
  437. // this.app.lp.create_cancel_title,
  438. // this.app.lp.create_cancel, "320px", "100px",
  439. // function(){
  440. // _self.createMarkNode.destroy();
  441. // _self.createAreaNode.destroy();
  442. // this.close();
  443. // },function(){
  444. // this.close();
  445. // }
  446. // );
  447. // }else{
  448. // this.createMarkNode.destroy();
  449. // this.createAreaNode.destroy();
  450. // delete _self;
  451. // }
  452. // },
  453. // okCreate: function(e){
  454. // var data = {
  455. // "id" : (this.data && this.data.id) ? this.data.id : null,
  456. // "unitName": this.unit.get("value"),
  457. // "onDutyTime": this.workTime.get("value"),
  458. // "offDutyTime": this.offTime.get("value"),
  459. // "lateStartTime": this.lateTime.get("value"),
  460. // "leaveEarlyStartTime": this.leaveEarlyTime.get("value"),
  461. // "absenceStartTime": this.absenteeismTime.get("value")
  462. // };
  463. //
  464. // if (data.onDutyTime && data.offDutyTime && data.lateStartTime ){
  465. // this.app.restActions.saveSchedule(data, function(json){
  466. // if( json.type == "ERROR" ){
  467. // this.app.notice( json.message , "error");
  468. // }else{
  469. // this.createMarkNode.destroy();
  470. // this.createAreaNode.destroy();
  471. // if(this.explorer.view)this.explorer.view.reload();
  472. // this.app.notice( this.isNew ? this.app.lp.createSuccess : this.app.lp.updateSuccess , "success");
  473. // }
  474. // // this.app.processConfig();
  475. // }.bind(this));
  476. // }else{
  477. // this.app.notice( "请选择上班打卡时间、下班打卡时间和迟到起算时间", "error");
  478. // }
  479. // },
  480. // selectCalendar : function( calendarNode ){
  481. // MWF.require("MWF.widget.Calendar", function(){
  482. // var calendar = new MWF.widget.Calendar( calendarNode, {
  483. // "style": "xform",
  484. // "timeOnly": true,
  485. // "isTime": true,
  486. // "target": this.app.content
  487. // });
  488. // calendar.show();
  489. // }.bind(this));
  490. // },
  491. // selectUnit: function(el, type ){
  492. // var options = {
  493. // "type": type == "d" ? "unit" : "topUnit",
  494. // "title": type == "d" ? "选择部门" : "选择公司",
  495. // "values": this.data.unit || [],
  496. // "count" : "1",
  497. // "onComplete": function(items){
  498. // this.data.unit = [];
  499. // items.each(function(item){
  500. // this.data.unit.push(item.data.name);
  501. // }.bind(this));
  502. // this.unit.set("value",this.data.unit);
  503. // }.bind(this)
  504. // };
  505. // var selector = new MWF.O2Selector(this.app.content, options);
  506. // }
  507. //});