AppealExplorer.js 25 KB

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