MyAppeal.js 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629
  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.loadToolbar();
  20. this.loadFilter();
  21. this.loadContentNode();
  22. var month = (new Date().getMonth()+1).toString();
  23. if( month.length == 1 )month = "0"+month;
  24. var filterData = {
  25. "status" : "999",
  26. "yearString" : new Date().getFullYear().toString(),
  27. "monthString" : month
  28. };
  29. this.loadView( filterData );
  30. this.setNodeScroll();
  31. },
  32. loadFilter: function(){
  33. this.fileterNode = new Element("div.fileterNode", {
  34. "styles" : this.css.fileterNode
  35. }).inject(this.node);
  36. var html = "<table width='100%' bordr='0' cellpadding='5' cellspacing='0' style='width: 580px;font-size: 14px;color:#666'>"+
  37. "<tr>" +
  38. " <td styles='filterTableTitle' lable='yearString'></td>"+
  39. " <td styles='filterTableValue' item='yearString'></td>" +
  40. " <td styles='filterTableTitle' lable='monthString'></td>"+
  41. " <td styles='filterTableValue' item='monthString'></td>" +
  42. " <td styles='filterTableTitle' lable='status'></td>"+
  43. " <td styles='filterTableValue' item='status'></td>" +
  44. " <td styles='filterTableTitle' lable='appealReason'></td>"+
  45. " <td styles='filterTableValue' item='appealReason'></td>" +
  46. " <td styles='filterTableValue' item='action'></td>" +
  47. "</tr>" +
  48. "</table>";
  49. this.fileterNode.set("html",html);
  50. MWF.xDesktop.requireApp("Template", "MForm", function(){
  51. this.form = new MForm( this.fileterNode, {}, {
  52. isEdited : true,
  53. itemTemplate : {
  54. yearString : {
  55. text : "年度",
  56. "type" : "select",
  57. "selectValue" : function(){
  58. var years = [];
  59. var year = new Date().getFullYear();
  60. for(var i=0; i<6; i++ ){
  61. years.push( year-- );
  62. }
  63. return years;
  64. },
  65. "event" : {
  66. "change" : function( item, ev ){
  67. var values = this.getDateSelectValue();
  68. item.form.getItem( "date").resetItemOptions( values , values )
  69. }.bind(this)
  70. }
  71. },
  72. monthString : {
  73. text : "月份",
  74. "type" : "select",
  75. "defaultValue" : function(){
  76. var month = (new Date().getMonth() + 1 ).toString();
  77. return month.length == 1 ? "0"+month : month;
  78. },
  79. "selectValue" :["","01","02","03","04","05","06","07","08","09","10","11","12"],
  80. "event" : {
  81. "change" : function( item, ev ){
  82. var values = this.getDateSelectValue();
  83. item.form.getItem( "date").resetItemOptions( values , values )
  84. }.bind(this)
  85. }
  86. },
  87. status : {
  88. "text" : "申述状态",
  89. "type" : "select",
  90. "value" : "999",
  91. "selectText" :["所有状态","待处理","审批通过","审批未通过"],
  92. "selectValue" :["999","0","1","-1"]
  93. },
  94. appealReason : {
  95. "text" : "申述原因",
  96. "type" : "select",
  97. "selectText" :["","临时请假","出差","因公外出","其他"]
  98. },
  99. action : { "value" : "查询", type : "button", className : "filterButton", event : {
  100. click : function(){
  101. var result = this.form.getResult(true,",",true,true,false);
  102. if( !result )return;
  103. this.loadView( result );
  104. }.bind(this)
  105. }}
  106. }
  107. }, this.app, this.css);
  108. this.form.load();
  109. }.bind(this), true);
  110. },
  111. //loadFilter : function(){
  112. // this.fileterNode = new Element("div.fileterNode", {
  113. // "styles" : this.css.fileterNode
  114. // }).inject(this.node)
  115. //
  116. // var table = new Element("table", {
  117. // "width" : "100%", "border" : "0", "cellpadding" : "5", "cellspacing" : "0", "styles" : this.css.filterTable, "class" : "filterTable"
  118. // }).inject( this.fileterNode );
  119. //
  120. // var tr = new Element("tr").inject(table);
  121. //
  122. // var td = new Element("td", { "styles" : this.css.filterTableTitle, "text" : (new Date).format(this.app.lp.dateFormatMonth) }).inject(tr);
  123. //
  124. // this.createStatusSelectTd(tr);
  125. // this.createAppealReasonTd(tr);
  126. // //this.createUnitTd(tr);
  127. // //this.createPersonTd( tr );
  128. // //this.createYearSelectTd( tr );
  129. // //this.createMonthSelectTd( tr );
  130. // this.createActionTd( tr );
  131. //},
  132. //createStatusSelectTd : function( tr ){
  133. // var _self = this;
  134. // var td = new Element("td", { "styles" : this.css.filterTableTitle, "text" : "审批状态" }).inject(tr);
  135. // var td = new Element("td", { "styles" : this.css.filterTableValue }).inject(tr);
  136. // this.status = new MDomItem( td, {
  137. // "name" : "status",
  138. // "type" : "select",
  139. // "value" : "999",
  140. // "selectText" :["所有状态","待处理","审批通过","审批未通过"],
  141. // "selectValue" :["999","0","1","-1"]
  142. // }, true, this.app );
  143. // this.status.load();
  144. //},
  145. //createAppealReasonTd : function( tr ){
  146. // var _self = this;
  147. // var td = new Element("td", { "styles" : this.css.filterTableTitle, "text" : "申诉原因" }).inject(tr);
  148. // var td = new Element("td", { "styles" : this.css.filterTableValue }).inject(tr);
  149. // this.appealReason = new MDomItem( td, {
  150. // "name" : "appealReason",
  151. // "type" : "select",
  152. // "selectText" :["","临时请假","出差","因公外出","其他"]
  153. // }, true, this.app );
  154. // this.appealReason.load();
  155. //},
  156. //createUnitTd : function(tr){
  157. // var _self = this;
  158. // var td = new Element("td", { "styles" : this.css.filterTableTitle, "text" : "部门" }).inject(tr);
  159. // var td = new Element("td", { "styles" : this.css.filterTableValue }).inject(tr);
  160. // this.unitName = new MDomItem( td, {
  161. // "name" : "unitName",
  162. // "style" : {"width":"60px"},
  163. // "defaultValue" : this.app.manageUnits.length > 0 ? this.app.manageUnits[0] : "",
  164. // "event" : {
  165. // "click" : function(mdi){ _self.selecePerson( mdi, "unit" ); }
  166. // }
  167. // }, true, this.app );
  168. // this.unitName.load();
  169. //},
  170. //createPersonTd : function(tr){
  171. // var _self = this;
  172. // var td = new Element("td", { "styles" : this.css.filterTableTitle, "text" : "人员" }).inject(tr);
  173. // var td = new Element("td", { "styles" : this.css.filterTableValue }).inject(tr);
  174. // this.empName = new MDomItem( td, {
  175. // "name" : "empName",
  176. // "style" : {"width":"60px"},
  177. // "event" : {
  178. // "click" : function(mdi){ _self.selecePerson( mdi, "person" ); }
  179. // }
  180. // }, true, this.app );
  181. // this.empName.load();
  182. //},
  183. //createYearSelectTd : function( tr ){
  184. // var _self = this;
  185. // var td = new Element("td", { "styles" : this.css.filterTableTitle, "text" : "年度" }).inject(tr);
  186. // var td = new Element("td", { "styles" : this.css.filterTableValue }).inject(tr);
  187. // this.yearString = new MDomItem( td, {
  188. // "name" : "yearString",
  189. // "type" : "select",
  190. // "selectValue" : function(){
  191. // var years = [];
  192. // var year = new Date().getFullYear();
  193. // for(var i=0; i<6; i++ ){
  194. // years.push( year-- );
  195. // }
  196. // return years;
  197. // }
  198. // }, true, this.app );
  199. // this.yearString.load();
  200. //},
  201. //createMonthSelectTd : function( tr ){
  202. // var _self = this;
  203. // var td = new Element("td", { "styles" : this.css.filterTableTitle, "text" : "月份" }).inject(tr);
  204. // var td = new Element("td", { "styles" : this.css.filterTableValue }).inject(tr);
  205. // this.monthString = new MDomItem( td, {
  206. // "name" : "monthString",
  207. // "type" : "select",
  208. // "selectValue" :["","01","02","03","04","05","06","07","08","09","10","11","12"]
  209. // }, true, this.app );
  210. // this.monthString.load();
  211. //},
  212. //createActionTd : function( tr ){
  213. // var td = new Element("td", { "styles" : this.css.filterTableValue }).inject(tr);
  214. // var input = new Element("button",{
  215. // "text" : "查询",
  216. // "styles" : this.css.filterButton
  217. // }).inject(td);
  218. // input.addEvent("click", function(){
  219. // var filterData = {
  220. // status : this.status.getValue(),
  221. // appealReason : this.appealReason.getValue(),
  222. // //unitName : this.unitName.getValue(),
  223. // //empName : this.empName.getValue(),
  224. // //yearString : this.yearString.getValue(),
  225. // //monthString : this.monthString.getValue()
  226. // }
  227. // this.loadView( filterData );
  228. // }.bind(this))
  229. //},
  230. //selecePerson: function( el, type ){
  231. // var text = "选择人员"
  232. // if( type=="topUnit") {
  233. // text = "选择公司"
  234. // }else if( type=="unit"){
  235. // text = "选择部门"
  236. // }
  237. // var options = {
  238. // "type": type, //topUnit unit person,
  239. // "title": text,
  240. // "count" : "1",
  241. // "values": [ el.get("value") ] || [],
  242. // "onComplete": function(items){
  243. // var arr = [];
  244. // items.each(function(item){
  245. // arr.push(item.data.name);
  246. // }.bind(this));
  247. // el.set("value",arr.join(","));
  248. // }.bind(this)
  249. // };
  250. // var selector = new MWF.O2Selector(this.app.content, options);
  251. //},
  252. setContentSize: function(){
  253. var toolbarSize = this.toolbarNode ? this.toolbarNode.getSize() : {"x":0,"y":0};
  254. var titlebarSize = this.app.titleBar ? this.app.titleBar.getSize() : {"x":0,"y":0};
  255. var filterSize = this.fileterNode ? this.fileterNode.getSize() : {"x":0,"y":0};
  256. var nodeSize = this.node.getSize();
  257. var pt = this.elementContentNode.getStyle("padding-top").toFloat();
  258. var pb = this.elementContentNode.getStyle("padding-bottom").toFloat();
  259. //var filterSize = this.filterNode.getSize();
  260. var filterConditionSize = this.filterConditionNode ? this.filterConditionNode.getSize() : {"x":0,"y":0};
  261. var height = nodeSize.y-toolbarSize.y-pt-pb-filterConditionSize.y-titlebarSize.y-filterSize.y;
  262. this.elementContentNode.setStyle("height", ""+height+"px");
  263. this.pageCount = (height/30).toInt()+5;
  264. if (this.view && this.view.items.length<this.pageCount){
  265. this.view.loadElementList(this.pageCount-this.view.items.length);
  266. }
  267. },
  268. loadView : function( filterData ){
  269. this.elementContentNode.empty();
  270. this.view = new MWF.xApplication.Attendance.MyAppeal.View(this.elementContentNode, this.app,this, this.viewData, this.options.searchKey );
  271. this.view.filterData = filterData;
  272. this.view.load();
  273. this.setContentSize();
  274. },
  275. createDocument: function(){
  276. if(this.view)this.view._createDocument();
  277. }
  278. });
  279. MWF.xApplication.Attendance.MyAppeal.View = new Class({
  280. Extends: MWF.xApplication.Attendance.Explorer.View,
  281. _createItem: function(data){
  282. return new MWF.xApplication.Attendance.MyAppeal.Document(this.table, data, this.explorer, this);
  283. },
  284. _getCurrentPageData: function(callback, count){
  285. if(!count )count=20;
  286. var id = (this.items.length) ? this.items[this.items.length-1].data.id : "(0)";
  287. var filter = this.filterData || {};
  288. /*var month = (new Date().getMonth()+1).toString();
  289. if( month.length == 1 )month = "0"+month;
  290. filter.yearString = new Date().getFullYear().toString();
  291. filter.monthString = month;*/
  292. filter.empName = layout.desktop.session.user.distinguishedName;
  293. this.actions.listAppealFilterNext(id, count, filter, function(json){
  294. var data = json.data;
  295. data.sort( function( a, b ){
  296. return parseInt( b.appealDateString.replace(/-/g,"") ) - parseInt( a.appealDateString.replace(/-/g,"") );
  297. });
  298. json.data = data;
  299. if (callback) callback(json);
  300. });
  301. },
  302. _removeDocument: function(documentData, all){
  303. },
  304. _createDocument: function(){
  305. },
  306. _openDocument: function( documentData ){
  307. if(documentData.appealAuditInfo){
  308. if(documentData.appealAuditInfo.workId){
  309. var workid = documentData.appealAuditInfo.workId;
  310. var options = {"workId":workid, "appId": "process.Work"+workid};
  311. this.app.desktop.openApplication(null, "process.Work", options);
  312. return;
  313. }
  314. }
  315. var appeal = new MWF.xApplication.Attendance.MyAppeal.Appeal(this.explorer, documentData );
  316. appeal.open();
  317. }
  318. });
  319. MWF.xApplication.Attendance.MyAppeal.Document = new Class({
  320. Extends: MWF.xApplication.Attendance.Explorer.Document,
  321. agree : function(){
  322. },
  323. deny : function(){
  324. }
  325. });
  326. MWF.xApplication.Attendance.MyAppeal.Appeal = new Class({
  327. Extends: MWF.widget.Common,
  328. initialize: function( explorer, data ){
  329. this.explorer = explorer;
  330. this.app = explorer.app;
  331. this.data = data || {};
  332. //this.app.restActions.getAppeal(this.data.detailId, function(json){
  333. // this.data = json.data
  334. //}.bind(this),null,false)
  335. //alert(JSON.stringify(this.data))
  336. this.css = this.explorer.css;
  337. this.load();
  338. },
  339. load: function(){
  340. this.app.restActions.getDetail(this.data.detailId, function(json){
  341. this.data.onDutyTime = json.data.onDutyTime;
  342. this.data.offDutyTime = json.data.offDutyTime;
  343. }.bind(this),null,false)
  344. },
  345. open: function(e){
  346. this.isNew = false;
  347. this.isEdited = false;
  348. this._open();
  349. },
  350. create: function(){
  351. this.isNew = true;
  352. this._open();
  353. },
  354. edit: function(){
  355. this.isEdited = true;
  356. this._open();
  357. },
  358. _open : function(){
  359. this.createMarkNode = new Element("div", {
  360. "styles": this.css.createMarkNode,
  361. "events": {
  362. "mouseover": function(e){e.stopPropagation();},
  363. "mouseout": function(e){e.stopPropagation();}
  364. }
  365. }).inject(this.app.content, "after");
  366. this.createAreaNode = new Element("div", {
  367. "styles": this.css.createAreaNode
  368. });
  369. this.createNode();
  370. this.createAreaNode.inject(this.createMarkNode, "after");
  371. this.createAreaNode.fade("in");
  372. this.setCreateNodeSize();
  373. this.setCreateNodeSizeFun = this.setCreateNodeSize.bind(this);
  374. this.addEvent("resize", this.setCreateNodeSizeFun);
  375. },
  376. createNode: function(){
  377. var _self = this;
  378. this.createNode = new Element("div", {
  379. "styles": this.css.createNode
  380. }).inject(this.createAreaNode);
  381. //
  382. //this.createIconNode = new Element("div", {
  383. // "styles": this.isNew ? this.css.createNewNode : this.css.createIconNode
  384. //}).inject(this.createNode);
  385. this.createContainerNode = new Element("div", {
  386. "styles": this.css.createContainerNode
  387. }).inject(this.createNode);
  388. this.setScrollBar( this.createContainerNode );
  389. this.createFormNode = new Element("div", {
  390. "styles": this.css.createFormNode
  391. }).inject(this.createContainerNode);
  392. this.createTableContainer = new Element("div", {
  393. "styles": this.css.createTableContainer
  394. }).inject(this.createFormNode);
  395. this.createTableArea = new Element("div", {
  396. "styles": this.css.createTableArea
  397. }).inject(this.createTableContainer);
  398. var d = this.data;
  399. var appealStatus = "发起";
  400. if (d.status == 0 ) {
  401. appealStatus = "待处理"
  402. } else if (d.status == 1) {
  403. appealStatus = "审批通过"
  404. } else if (d.status == -1) {
  405. appealStatus = "申诉不通过"
  406. }
  407. this.data.appealStatusShow = appealStatus;
  408. debugger
  409. var html = "<table width='100%' bordr='0' cellpadding='5' cellspacing='0' styles='formTable'>"+
  410. "<tr><td colspan='4' styles='formTableHead'>申诉申请单</td></tr>" +
  411. "<tr><td styles='formTableTitle'>员工姓名</td>"+
  412. " <td styles='formTableValue'>"+this.data.empName.split("@")[0]+"</td>" +
  413. " <td styles='formTableTitle' lable='recordDateString'></td>"+
  414. " <td styles='formTableValue' item='recordDateString'></td></tr>" +
  415. "<tr><td styles='formTableTitle' lable='onDutyTime'></td>"+
  416. " <td styles='formTableValue' item='onDutyTime'></td>" +
  417. " <td styles='formTableTitle' lable='offDutyTime'></td>"+
  418. " <td styles='formTableValue' item='offDutyTime'></td></tr>" +
  419. "<tr><td styles='formTableTitle' lable='appealStatusShow'></td>"+
  420. " <td styles='formTableValue' item='appealStatusShow' colspan='3'></td></tr>" +
  421. "<tr><td styles='formTableTitle' lable='appealReason'></td>"+
  422. " <td styles='formTableValue' item='appealReason'></td>" +
  423. " <td styles='formTableTitle' lable='processPerson1Show'></td>"+
  424. " <td styles='formTableValue' item='processPerson1Show'></td></tr>" +
  425. "<tr contain='selfHolidayType'><td styles='formTableTitle' lable='selfHolidayType'></td>"+
  426. " <td styles='formTableValue' item='selfHolidayType' colspan='3'></td></tr>" +
  427. "<tr contain='address'><td styles='formTableTitle' lable='address'></td>"+
  428. " <td styles='formTableValue' item='address' colspan='3'></td></tr>" +
  429. "<tr contain='startTime'><td styles='formTableTitle' lable='startTime'></td>"+
  430. " <td styles='formTableValue' item='startTime' colspan='3'></td></tr>" +
  431. "<tr contain='endTime'><td styles='formTableTitle' lable='endTime'></td>"+
  432. " <td styles='formTableValue' item='endTime' colspan='3'></td></tr>" +
  433. "<tr contain='appealDescription'><td styles='formTableTitle' lable='appealDescription'></td>"+
  434. " <td styles='formTableValue' item='appealDescription' colspan='3'></td></tr>" +
  435. /*"<tr contain='opinion1'><td styles='formTableTitle' lable='opinion1'></td>"+
  436. " <td styles='formTableValue' item='opinion1' colspan='3'></td></tr>" +*/
  437. "</table>";
  438. this.createTableArea.set("html",html);
  439. this.document = new MForm( this.createTableArea, this.data, {
  440. style : "popup",
  441. isEdited : this.isEdited || this.isNew,
  442. itemTemplate : {
  443. recordDateString : { text:"考勤日期", type : "innertext"},
  444. onDutyTime : { text:"上班打卡时间", type : "innertext"},
  445. offDutyTime : { text:"下班打卡时间", type : "innertext"},
  446. statusShow : { text:"考勤状态", type : "innertext" },
  447. appealStatusShow : { text:"审批状态",type : "innertext"},
  448. processPerson1Show : {text:"审核人",type:"innertext", value : this.data.appealAuditInfo?this.data.appealAuditInfo.currentProcessor.split("@")[0] :""},
  449. appealReason : {
  450. notEmpty : true,
  451. text:"申述原因",
  452. type : "select",
  453. selectValue : ["","临时请假","出差","因公外出","其他"],
  454. event : { change : function(mdi){
  455. _self.switchFieldByAppealReason(mdi.getValue());
  456. }}
  457. },
  458. address : { text:"地点" },
  459. selfHolidayType : {
  460. text:"请假类型",
  461. type : "select",
  462. selectValue : ["","带薪年休假","带薪病假","带薪福利假","扣薪事假","其他"]
  463. },
  464. startTime : { text:"开始日期", tType : "datetime" },
  465. endTime : { text:"结束日期", tType : "datetime" },
  466. appealDescription : { text:"事由" }
  467. //opinion1 : { text :"审批意见" }
  468. }
  469. }, this.app,this.css);
  470. this.document.load();
  471. _self.switchFieldByAppealReason(this.data.appealReason);
  472. //createFormNode.set("html", html);
  473. //this.setScrollBar(this.createTableContainer)
  474. this.cancelActionNode = new Element("div", {
  475. "styles": this.css.createCancelActionNode,
  476. "text": "关闭"
  477. }).inject(this.createFormNode);
  478. this.cancelActionNode.addEvent("click", function(e){
  479. this.cancelCreate(e);
  480. }.bind(this));
  481. if( this.isNew || this.isEdited){
  482. this.denyActionNode = new Element("div", {
  483. "styles": this.css.createDenyActionNode,
  484. "text": "不同意"
  485. }).inject(this.createFormNode);
  486. this.createOkActionNode = new Element("div", {
  487. "styles": this.css.createOkActionNode,
  488. "text": "同意"
  489. }).inject(this.createFormNode);
  490. this.denyActionNode.addEvent("click", function(e){
  491. this.deny(e);
  492. }.bind(this));
  493. this.createOkActionNode.addEvent("click", function(e){
  494. this.okCreate(e);
  495. }.bind(this));
  496. }
  497. },
  498. switchFieldByAppealReason : function( ar ){
  499. var tempField = ["selfHolidayType","startTime","endTime","address","appealDescription"];
  500. var showField = [];
  501. if( ar == "临时请假" ){
  502. showField = ["selfHolidayType","startTime","endTime"];
  503. }else if( ar == "出差" ){
  504. showField = ["address","startTime","endTime"];
  505. }else if( ar == "因公外出" ){
  506. showField = ["address","startTime","endTime","appealDescription"];
  507. }else if( ar == "其他" ){
  508. showField = ["appealDescription"];
  509. }
  510. tempField.each( function( f ){
  511. this.createTableArea.getElement("[contain='"+f+"']").setStyle("display", showField.contains(f) ? "" : "none" );
  512. if( this.isNew || this.isEdited )this.document.items[f].options.notEmpty = (showField.contains(f) ? true : false )
  513. }.bind(this))
  514. },
  515. setCreateNodeSize: function(){
  516. var size = this.app.node.getSize();
  517. var allSize = this.app.content.getSize();
  518. var height = "560";
  519. var width = "800";
  520. this.createAreaNode.setStyles({
  521. "width": ""+size.x+"px",
  522. "height": ""+size.y+"px"
  523. });
  524. var hY = height;
  525. var mY = (size.y-height)/2;
  526. this.createNode.setStyles({
  527. "height": ""+hY+"px",
  528. "margin-top": ""+mY+"px",
  529. "width" : ""+width+"px"
  530. });
  531. this.createContainerNode.setStyles({
  532. "height": ""+hY+"px"
  533. });
  534. var iconSize = this.createIconNode ? this.createIconNode.getSize() : {x:0,y:0};
  535. var formMargin = hY-iconSize.y-60;
  536. this.createFormNode.setStyles({
  537. "height": ""+formMargin+"px",
  538. "margin-top": ""+60+"px"
  539. });
  540. },
  541. cancelCreate: function(e){
  542. this.createMarkNode.destroy();
  543. this.createAreaNode.destroy();
  544. delete this;
  545. },
  546. deny : function(e){
  547. var data = { 'ids' : [this.data.id], 'status':'-1', 'opinion1': this.opinion1.getValue() };
  548. if (data.opinion1 ){
  549. this.process( data );
  550. }else{
  551. this.app.notice( "请填写意见", "error");
  552. }
  553. },
  554. okCreate: function(e){
  555. var data = { 'ids' : [this.data.id], 'status':'1', 'opinion1': this.opinion1.getValue() };
  556. this.process( data );
  557. },
  558. process: function( data ){
  559. this.app.restActions.processAppeal( data, function(json){
  560. if( json.type == "ERROR" ){
  561. this.app.notice( json.message , "error");
  562. }else{
  563. this.createMarkNode.destroy();
  564. this.createAreaNode.destroy();
  565. if(this.explorer.view)this.explorer.view.reload();
  566. this.app.notice( "处理成功" , "success");
  567. }
  568. // this.app.processConfig();
  569. }.bind(this));
  570. }
  571. });