WorkMinder.js 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646
  1. MWF.xApplication.Execution = MWF.xApplication.Execution || {};
  2. MWF.xDesktop.requireApp("Template", "MPopupForm", null, false);
  3. MWF.xDesktop.requireApp("Template", "MForm", null, false);
  4. MWF.xDesktop.requireApp("Execution", "Minder", null, false);
  5. MWF.xDesktop.requireApp("Execution", "WorkDeploy", null,false);
  6. MWF.xApplication.Execution.WorkMinder = new Class({
  7. Extends: MPopupForm,
  8. Implements: [Options, Events],
  9. options: {
  10. "style": "default",
  11. "template" : "default",
  12. "theme": "fresh-blue-compat", //"fresh-blue"
  13. "width": "100%",
  14. "height": "100%",
  15. "hasTop": true,
  16. "hasTopIcon" : true,
  17. "hasTopContent" : true,
  18. "hasIcon": false,
  19. "hasBottom": false,
  20. "hasScroll" : false,
  21. "title": "脑图展现",
  22. "draggable": false,
  23. "closeAction": true
  24. },
  25. initialize: function (explorer, data, options) {
  26. this.setOptions(options);
  27. this.app = explorer.app;
  28. this.lp = this.app.lp;
  29. this.actions = this.app.restActions;
  30. this.explorer = explorer;
  31. this.path = "../x_component_Execution/$WorkMinder/";
  32. this.cssPath = this.path+this.options.style+"/css.wcss";
  33. this._loadCss();
  34. this.options.title = this.lp.minderTitle + "-" + ( data.title || "") ;
  35. this.data = data;
  36. },
  37. load: function (callback) {
  38. this.open();
  39. },
  40. _open: function () {
  41. this.formMaskNode = new Element("div.formMaskNode", {
  42. "styles": this.css.formMaskNode,
  43. "events": {
  44. "mouseover": function (e) {
  45. e.stopPropagation();
  46. },
  47. "mouseout": function (e) {
  48. e.stopPropagation();
  49. }
  50. }
  51. }).inject(this.app.content);
  52. this.formAreaNode = new Element("div.formAreaNode", {
  53. "styles": this.css.formAreaNode
  54. });
  55. this.formAreaNode.inject(this.formMaskNode, "after");
  56. this.formAreaNode.fade("in");
  57. this.createFormNode();
  58. //this.setFormNodeSize();
  59. this.refreshFun = this.refresh.bind(this);
  60. this.app.addEvent("resize", this.refreshFun);
  61. if (this.options.draggable && this.formTopNode) {
  62. var size = this.app.content.getSize();
  63. var nodeSize = this.formAreaNode.getSize();
  64. this.formAreaNode.makeDraggable({
  65. "handle": this.formTopNode,
  66. "limit": {
  67. "x": [0, size.x - nodeSize.x],
  68. "y": [0, size.y - nodeSize.y]
  69. }
  70. });
  71. }
  72. },
  73. destroy : function(){
  74. if(this.minder)this.minder.destroy() ;
  75. this.formMaskNode.destroy();
  76. this.formAreaNode.destroy();
  77. delete this;
  78. },
  79. refresh: function(){
  80. this.setFormNodeSize();
  81. if(this.minder)this.minder.refresh();
  82. },
  83. reload: function(){
  84. if(this.minder)this.minder.destroy() ;
  85. this.formTableArea.empty();
  86. this._createTableContent();
  87. },
  88. _createTableContent: function () {
  89. this.setFormNodeSize();
  90. this.formTableArea.setStyles({"width": "100%", "height": "100%","background-color":"#fbfbfb"})
  91. this.listNestWork( function(json){
  92. this.createMinder( json );
  93. }.bind(this))
  94. },
  95. createMinder: function( json ) {
  96. this.minder = new MWF.xApplication.Execution.Minder(this.formTableArea, this.app, json, {
  97. "hasNavi" : false,
  98. "onPostLoad" : function(){
  99. this.minder.km.execCommand('ExpandToLevel', 1); //折叠到第一层
  100. this.minder.loadNavi( this.formTableContainer );
  101. }.bind(this),
  102. "onPostLoadNode" : function( minderNode ){
  103. this.setMinderNode( minderNode );
  104. }.bind(this)
  105. });
  106. this.minder.load();
  107. },
  108. listNestWork: function( callback ){
  109. //var data = {
  110. // "root": {
  111. // "data": {"id": "9f92035021ac", "text": "软装修"},
  112. // "children": [{
  113. // "data": {"id": "b45yogtullsg", "created": 1463069010918, "text": "包阳台"},
  114. // "children": [{
  115. // "data": {"id": "3jl3i3j43", "created": 1463069010923, "text": "凤铝"}
  116. // }, {
  117. // "data": {"id": "3jl3i3j44", "created": 1463069010923, "text": "断桥"}
  118. // }]
  119. // },
  120. // {
  121. // "data": {"id": "b45yohdlynco", "created": 1463069012113, "text": "衣柜"}, "children": [
  122. // {"data": {"id": "b45yohdlynco", "created": 1463069012113, "text": "主卧"}},
  123. // {"data": {"id": "b45yohdlynco", "created": 1463069012113, "text": "次卧"}}
  124. // ]
  125. // },
  126. // {"data": {"id": "b45yohdlynco", "created": 1463069012113, "text": "床"}, "children": []},
  127. // {"data": {"id": "b45yohdlynco", "created": 1463069012113, "text": "餐桌"}, "children": []},
  128. // {"data": {"id": "b45yohdlynco", "created": 1463069012113, "text": "灯具"}, "children": []},
  129. // {"data": {"id": "b45yohdlynco", "created": 1463069012113, "text": "窗帘"}, "children": []}
  130. // ]
  131. // }
  132. //};
  133. //if(callback)callback( data );
  134. //this.actions.getUserNestBaseWork(this.data.id, function(json){
  135. // var d = this.transportData( json );
  136. // if(callback)callback( d );
  137. //}.bind(this))
  138. this.actions.getUserMind(this.data.id, function(json){
  139. var d = this.transportData( json );
  140. if(callback)callback( d );
  141. }.bind(this))
  142. },
  143. transportData : function( json ){
  144. var newData = [];
  145. this.getNestData( json.data.works , newData );
  146. var d = {
  147. root : {
  148. data : this.data,
  149. children : newData
  150. }
  151. };
  152. d.root.data.text = d.root.data.title.length > 30 ? d.root.data.title.substr(0, 30) + "..." : d.root.data.title;
  153. d.root.data.note = " ";
  154. d.root.data.isCenterWork = true;
  155. return d;
  156. },
  157. getNestData: function( oldData, newData ){
  158. oldData.each( function(d){
  159. var newd = {};
  160. if(d.subWorks ){
  161. newd.children = [];
  162. this.getNestData( d.subWorks , newd.children );
  163. }
  164. newd.data = d;
  165. if( d.subWorks )delete newd.data.subWorks;
  166. newd.data.text = d.title.length > 20 ? d.title.substr(0, 20) + "..." : d.title;
  167. //if( newd.data.workProcessStatus == this.lp.WorkDeploy.statusDraft ){
  168. // newd.data.readOnly = true;
  169. //}else{
  170. newd.data.note= d.watch? " ":null;
  171. //newd.data.note = " "
  172. /*
  173. * 取值为 0 移除进度信息;
  174. * 取值为 1 表示未开始;
  175. * 取值为 2 表示完成 1/8;
  176. * 取值为 3 表示完成 2/8;
  177. * 取值为 4 表示完成 3/8;
  178. * 其余类推,取值为 9 表示全部完成
  179. */
  180. //newd.data.progress = 8;
  181. newd.data.resource = this.getActions( newd.data, newd.children );
  182. //}
  183. newData.push( newd );
  184. }.bind(this))
  185. },
  186. setMinderNode : function( minderNode ){
  187. var _self = this;
  188. //alert("title="+minderNode.getData().title)
  189. //alert("watch="+minderNode.getData().watch)
  190. if( !minderNode.getData().watch ){
  191. //km.select([minderNode],true);
  192. //km.execCommand('Background', "#dcdcdc");
  193. //km.execCommand('ForeColor', "#fff");
  194. }else{
  195. var icon = minderNode.getRenderer('NoteIconRenderer').getRenderShape();
  196. if( icon ){
  197. icon.addEventListener("mouseover", function ( ev ) {
  198. _self.workInforTimer = setTimeout(function() {
  199. var c = this.getRenderBox('screen');
  200. _self.showWorkInfor( this.getData(), c );
  201. }.bind(this), 300);
  202. }.bind(minderNode));
  203. icon.addEventListener("mouseout", function ( ev ) {
  204. clearTimeout(_self.workInforTimer);
  205. _self.destroyWorkInfor();
  206. }.bind(minderNode));
  207. icon.addEventListener("click", function ( ev ) {
  208. _self.openWork( this, this.getData() );
  209. ev.stopPropagation();
  210. }.bind(minderNode));
  211. }
  212. var actions = minderNode.getRenderer('ResourceRenderer');
  213. if( actions && actions.overlays && actions.overlays.length > 0){
  214. actions.overlays.forEach(function( atn ){
  215. atn.addEventListener("click", function ( ev ) {
  216. var e = {
  217. event : {
  218. x : ev.originEvent.x,
  219. y : ev.originEvent.y
  220. }
  221. };
  222. _self.activeAction( atn.lastResourceName, this.getData(), e );
  223. ev.stopPropagation();
  224. }.bind(minderNode));
  225. })
  226. }
  227. var cNode = minderNode.getRenderContainer().node;
  228. cNode.addEventListener("dblclick", function ( ev ) {
  229. _self.openWork( this, this.getData() );
  230. }.bind(minderNode));
  231. }
  232. },
  233. getActions: function( data, children ){
  234. var actions = [];
  235. //return actions;
  236. if( data.workProcessStatus == this.lp.WorkDeploy.statusDraft ){
  237. if( this.app.identity == data.deployerIdentity ){
  238. actions.push("删除");
  239. }
  240. }else{
  241. if( (!children || children.length == 0) && this.app.identity == data.deployerIdentity) {
  242. actions.push("删除");
  243. }
  244. if( data.responsibilityIdentity == this.app.identity ){
  245. actions.push("汇报");
  246. actions.push("拆分");
  247. }
  248. }
  249. //return ["删除", "拆分"];
  250. return []
  251. },
  252. activeAction : function( actionText, data, ev){
  253. if( actionText == "删除" ){
  254. this.removeWork(data, ev);
  255. }else if(actionText == "汇报"){
  256. this.reportWork( data );
  257. }else if(actionText == "拆分"){
  258. this.splitWork( data );
  259. }
  260. },
  261. openWork : function(node, data){
  262. if( data.isCenterWork ){
  263. this.openCenterWork(node, data)
  264. }else{
  265. this.openBaseWork(node, data);
  266. }
  267. },
  268. openCenterWork: function(node, data){
  269. var isEditedBool = ( data.processStatus == this.lp.WorkDeploy.statusDraft && this.app.identity == data.deployerIdentity )? true : false;
  270. this.workDeploy = new MWF.xApplication.Execution.WorkMinder.WorkDeploy(this, this.actions,{"id":data.id},{
  271. "isEdited":isEditedBool,
  272. "centerWorkId":data.id,
  273. "onQueryClose" : function(){
  274. if( this.workDeploy.contentChanged ){
  275. this.reload();
  276. }
  277. }.bind(this)
  278. } );
  279. this.workDeploy.load();
  280. },
  281. openBaseWork : function( node, data ){
  282. if( data.workProcessStatus == this.lp.WorkDeploy.statusDraft ){
  283. MWF.xDesktop.requireApp("Execution", "WorkForm", null, false);
  284. var workform = new MWF.xApplication.Execution.WorkForm(this.explorer, this.app.restActions, data,{
  285. "isNew": false,
  286. "isEdited": this.app.identity == data.deployerIdentity,
  287. "onPostSave" : function(){
  288. this.reload();
  289. }.bind(this)
  290. });
  291. workform.load();
  292. }else{
  293. MWF.xDesktop.requireApp("Execution", "WorkDetail", function(){
  294. var workform = new MWF.xApplication.Execution.WorkDetail(this, this.app.restActions,data,{
  295. "isNew": false,
  296. "isEdited": false
  297. });
  298. workform.load();
  299. }.bind(this));
  300. }
  301. },
  302. removeWork:function( data , ev ){
  303. var lp = this.app.lp;
  304. var text = lp.deleteDocument2.replace(/{title}/g, data.title);
  305. var _self = this;
  306. this.readyRemove = true;
  307. this.app.confirm("warn", ev, lp.deleteDocumentTitle, text, 350, 120, function () {
  308. _self._removeDocument( data );
  309. this.close();
  310. }, function () {
  311. _self.readyRemove = false;
  312. this.close();
  313. });
  314. },
  315. _removeDocument: function( data ){
  316. if( data.isCenterWork ){
  317. this.actions.deleteCenterWork(data.id, function(json){
  318. this.app.notice(this.app.lp.deleteDocumentOK, "success");
  319. this.reload();
  320. }.bind(this));
  321. }else{
  322. this.actions.deleteBaseWork(data.id, function(json){
  323. if(json.type && json.type == "success"){
  324. this.app.notice(this.app.lp.deleteDocumentOK, "success");
  325. this.reload();
  326. }else{
  327. this.app.notice(json.data.message, "error")
  328. }
  329. }.bind(this));
  330. }
  331. },
  332. reportWork: function( data ){
  333. MWF.xDesktop.requireApp("Execution", "WorkReport", function(){
  334. var d = {
  335. title : data.title,
  336. workId : data.id,
  337. centerId : data.centerId,
  338. //centerTitle: this.data.centerTitle,
  339. parentWorkId : data.parentWorkId,
  340. //parentWorkTitle : this.data.title,
  341. workType : data.workType,
  342. workLevel : data.workLevel,
  343. completeDateLimitStr : data.completeDateLimitStr,
  344. completeDateLimit : data.completeDateLimit,
  345. reportCycle: data.reportCycle,
  346. responsibilityOrganizationName: data.responsibilityOrganizationName,
  347. responsibilityEmployeeName: data.responsibilityEmployeeName,
  348. responsibilityIdentity: data.responsibilityIdentity,
  349. cooperateOrganizationName: data.cooperateOrganizationName,
  350. cooperateEmployeeName: data.cooperateEmployeeName,
  351. cooperateIdentity: data.cooperateIdentity,
  352. readLeaderName: data.readLeaderName,
  353. readLeaderIdentity: data.readLeaderIdentity,
  354. reportDayInCycle: data.reportDayInCycle
  355. };
  356. var workReport = new MWF.xApplication.Execution.WorkReport(this, this.app.restActions, d, {
  357. "isNew": false,
  358. "isEdited": false,
  359. "from" : "drafter"
  360. });
  361. workReport.load();
  362. }.bind(this));
  363. },
  364. splitWork: function( data ){
  365. MWF.xDesktop.requireApp("Execution", "WorkForm", function(){
  366. var d = {
  367. title : data.title,
  368. centerId : data.centerId,
  369. //centerTitle: data.centerTitle,
  370. parentWorkId : data.id,
  371. //parentWorkTitle : data.title,
  372. workType : data.workType,
  373. workLevel : data.workLevel,
  374. completeDateLimitStr : data.completeDateLimitStr,
  375. completeDateLimit : data.completeDateLimit,
  376. reportCycle: data.reportCycle,
  377. reportDayInCycle: data.reportDayInCycle
  378. };
  379. var workform = new MWF.xApplication.Execution.WorkForm(this, this.app.restActions,d,{
  380. "isNew": false,
  381. "isEdited": true,
  382. "tabLocation": "myDo",
  383. "onPostSave" : function(){ this.reload(); }.bind(this),
  384. "onPostDeploy" : function(){ this.reload();}.bind(this)
  385. });
  386. workform.load();
  387. }.bind(this));
  388. },
  389. destroyWorkInfor:function(){
  390. if( this.inforNode ){
  391. this.inforNode.destroy();
  392. this.inforNode = null;
  393. }
  394. if( this.tooltip ){
  395. this.tooltip.destroy();
  396. this.tooltip = null;
  397. }
  398. },
  399. showWorkInfor: function( data, c ){
  400. this.destroyWorkInfor();
  401. this.createInforNode( data, c);
  402. },
  403. setInforNodeCoondinates: function( inforNode, targetCoondinates ){
  404. var containerScroll = this.formTableContainer.getScroll();
  405. var containerSize = this.formTableContainer.getSize();
  406. var nodeSize = inforNode.getSize();
  407. var left;
  408. var arrowX, arrowY;
  409. if( targetCoondinates.left + 10 + nodeSize.x - containerScroll.x > containerSize.x ){
  410. left = targetCoondinates.left + 50 - nodeSize.x;
  411. arrowX = "right";
  412. }else{
  413. left = targetCoondinates.left + 10;
  414. arrowX = "left";
  415. }
  416. var top;
  417. if( targetCoondinates.top + 57 + nodeSize.y - containerScroll.y > containerSize.y ){
  418. top = targetCoondinates.top - nodeSize.y - 10;
  419. arrowY = "bottom";
  420. }else{
  421. top = targetCoondinates.top + targetCoondinates.height + 10;
  422. arrowY = "top";
  423. }
  424. inforNode.setStyles({
  425. "left" : left,
  426. "top" : top
  427. });
  428. this.inforBoxArrow = new Element("div", {"styles":this.css.inforBoxArrow}).inject(this.inforNode);
  429. if( arrowY == "top" ){
  430. this.inforBoxArrow.setStyles({
  431. "top" : "-8px",
  432. "background-position" : "0px -18px"
  433. })
  434. }else{
  435. this.inforBoxArrow.setStyles({
  436. "bottom" : "-8px",
  437. "background-position" : "0px -28px"
  438. })
  439. }
  440. if( arrowX == "left" ){
  441. this.inforBoxArrow.setStyle( "left" , "52px")
  442. }else{
  443. this.inforBoxArrow.setStyle( "right" , "10px")
  444. }
  445. },
  446. createInforNode: function( data, c, callback){
  447. this.inforNode = new Element("div", {
  448. styles : {
  449. "font-size" : "12px",
  450. "position" : "absolute",
  451. "z-index" : "11",
  452. "background-color" : "#fff",
  453. "border" : "1px solid #aaa",
  454. "padding" : "10px",
  455. "border-radius" : "3px",
  456. "box-shadow": "0px 0px 5px #aaa"
  457. }
  458. }).inject( this.formTableArea );
  459. this.inforNode.set("html", data.isCenterWork ? this.getCenterWorkInforHtml( data ) : this.getSubWorkInforHtml( data ) );
  460. this.setInforNodeCoondinates( this.inforNode, c );
  461. if( callback )callback();
  462. },
  463. getSubWorkInforHtml : function(data){
  464. var titleStyle = "font-weight:bold;";
  465. var valueStyle = "";
  466. var lp = this.lp.workForm;
  467. return "<table width='300' bordr='0' cellpadding='3' cellspacing='0' styles='formTable'>" +
  468. "<tr>" +
  469. " <td style='"+titleStyle+"' colspan='2'>"+data.title+"</td>" +
  470. "</tr><tr>" +
  471. " <td style='"+titleStyle+"' width='60px'>"+"状态"+":</td>" +
  472. " <td style='"+valueStyle+"' width='140px'>"+data.workProcessStatus+"</td>" +
  473. "</tr><tr>" +
  474. " <td style='"+titleStyle+"' width='60px'>"+lp.workType+":</td>" +
  475. " <td style='"+valueStyle+"' width='140px'>"+data.workType+"</td>" +
  476. //"</tr><tr>" +
  477. //" <td style='"+titleStyle+"'>"+lp.workLevel+":</td>" +
  478. //" <td style='"+valueStyle+"'>"+data.workLevel+"</td>" +
  479. "</tr><tr>" +
  480. " <td style='"+titleStyle+"'>"+lp.timeLimit+":</td>" +
  481. " <td style='"+valueStyle+"'>"+data.completeDateLimitStr+"</td>" +
  482. "</tr><tr>" +
  483. " <td style='"+titleStyle+"'>"+lp.dutyDepartment+":</td>" +
  484. " <td style='"+valueStyle+"'>"+data.responsibilityOrganizationName+"</td>" +
  485. "</tr><tr>" +
  486. " <td style='"+titleStyle+"'>"+lp.dutyPerson+":</td>" +
  487. " <td style='"+valueStyle+"'>"+data.responsibilityEmployeeName+"</td>" +
  488. "</tr><tr>" +
  489. " <td style='"+titleStyle+"'>"+lp.secondDepartment+":</td>" +
  490. " <td style='"+valueStyle+"'>"+data.cooperateOrganizationName+"</td>" +
  491. "</tr><tr>" +
  492. " <td style='"+titleStyle+"'>"+lp.secondPerson+":</td>" +
  493. " <td style='"+valueStyle+"'>"+data.cooperateEmployeeName+"</td>" +
  494. "</tr>" +
  495. "</table>"
  496. },
  497. getCenterWorkInforHtml: function(data){
  498. var titleStyle = "font-weight:bold;";
  499. var valueStyle = "";
  500. var lp = this.lp;
  501. var description = data.description.length > 50 ? data.description.substring(0,50) + "..." : data.description;
  502. return "<table width='300' bordr='0' cellpadding='3' cellspacing='0' styles='formTable'>" +
  503. "<tr>" +
  504. " <td style='"+titleStyle+"' colspan='2'>"+data.title+"</td>" +
  505. "</tr><tr>" +
  506. " <td style='"+titleStyle+"' width='60px'>"+"状态"+":</td>" +
  507. " <td style='"+valueStyle+"' width='140px'>"+data.processStatus+"</td>" +
  508. "</tr><tr>" +
  509. " <td style='"+titleStyle+"'>"+lp.workForm.workType+":</td>" +
  510. " <td style='"+valueStyle+"'>"+data.defaultWorkType+"</td>" +
  511. //"</tr><tr>" +
  512. //" <td style='"+titleStyle+"'>"+lp.workForm.workLevel+":</td>" +
  513. //" <td style='"+valueStyle+"'>"+data.defaultWorkLevel+"</td>" +
  514. "</tr><tr>" +
  515. " <td style='"+titleStyle+"'>"+lp.workForm.timeLimit+":</td>" +
  516. " <td style='"+valueStyle+"'>"+data.defaultCompleteDateLimitStr+"</td>" +
  517. "</tr><tr>" +
  518. " <td style='"+titleStyle+"'>"+lp.baseWorkView.deployerName+":</td>" +
  519. " <td style='"+valueStyle+"'>"+data.deployerIdentity+"</td>" +
  520. "</tr><tr>" +
  521. " <td style='"+titleStyle+"'>"+lp.WorkDeploy.draftDate+":</td>" +
  522. " <td style='"+valueStyle+"'>"+data.createTime+"</td>" +
  523. "</tr><tr>" +
  524. " <td style='"+titleStyle+"'>"+lp.description+":</td>" +
  525. " <td style='"+valueStyle+"'>"+ description+"</td>" +
  526. "</tr>" +
  527. "</table>";
  528. },
  529. setFormNodeSize: function (width, height, top, left) {
  530. if (!width)width = this.options.width ? this.options.width : "50%";
  531. if (!height)height = this.options.height ? this.options.height : "50%";
  532. if (!top) top = this.options.top ? this.options.top : 0;
  533. if (!left) left = this.options.left ? this.options.left : 0;
  534. //var appTitleSize = this.app.window.title.getSize();
  535. var allSize = this.app.content.getSize();
  536. var limitWidth = allSize.x; //window.screen.width
  537. var limitHeight = allSize.y; //window.screen.height
  538. "string" == typeof width && (1 < width.length && "%" == width.substr(width.length - 1, 1)) && (width = parseInt(limitWidth * parseInt(width, 10) / 100, 10));
  539. "string" == typeof height && (1 < height.length && "%" == height.substr(height.length - 1, 1)) && (height = parseInt(limitHeight * parseInt(height, 10) / 100, 10));
  540. 300 > width && (width = 300);
  541. 220 > height && (height = 220);
  542. top = top || parseInt((limitHeight - height) / 2, 10); //+appTitleSize.y);
  543. left = left || parseInt((limitWidth - width) / 2, 10);
  544. this.formAreaNode.setStyles({
  545. "width": "" + width + "px",
  546. "height": "" + height + "px",
  547. "top": "" + top + "px",
  548. "left": "" + left + "px"
  549. });
  550. this.formNode.setStyles({
  551. "width": "" + width + "px",
  552. "height": "" + height + "px"
  553. });
  554. var iconSize = this.formIconNode ? this.formIconNode.getSize() : {x: 0, y: 0};
  555. var topSize = this.formTopNode ? this.formTopNode.getSize() : {x: 0, y: 0};
  556. var bottomSize = this.formBottomNode ? this.formBottomNode.getSize() : {x: 0, y: 0};
  557. var contentHeight = height - iconSize.y - topSize.y - bottomSize.y;
  558. //var formMargin = formHeight -iconSize.y;
  559. this.formContentNode.setStyles({
  560. "height": "" + contentHeight + "px"
  561. });
  562. this.formTableContainer.setStyles({
  563. "width": "" + (width) + "px",
  564. "height": "" + contentHeight + "px"
  565. });
  566. }
  567. });
  568. MWF.xApplication.Execution.WorkMinder.WorkDeploy = new Class({
  569. Extends: MWF.xApplication.Execution.WorkDeploy,
  570. deploy: function(){
  571. var ids = [];
  572. this.actions.getUserDeployBaseWork( this.centerWorkId, function(json){
  573. if(this.centerWorkInforData){
  574. if(this.centerWorkInforData.processStatus == this.lp.statusDraft){ //中心工作草稿环节,
  575. json.data.each(function(d){
  576. if(d.workProcessStatus == this.lp.statusDraft){
  577. ids.push(d.id)
  578. }
  579. }.bind(this))
  580. }else{ //其他环节,其他环节也有可能拟稿人追加
  581. json.data.each(function( d ){
  582. //if( d.subWrapOutOkrWorkBaseInfos ){
  583. // d.subWrapOutOkrWorkBaseInfos.each(function( infor ){
  584. if( d.subWorks ){
  585. d.subWorks.each(function( infor ){
  586. if( infor.workProcessStatus == this.lp.statusDraft ){
  587. ids.push( infor.id )
  588. }
  589. }.bind(this))
  590. }
  591. if(d.workProcessStatus == this.lp.statusDraft){
  592. ids.push(d.id)
  593. }
  594. }.bind(this))
  595. }
  596. }
  597. if( ids.length > 0 ){
  598. var data = { "workIds":ids };
  599. this.actions.deployBaseWork( data, function( j ){
  600. if(j.type && j.type == "success"){
  601. this.app.notice(this.lp.deployeSuccess, "ok");
  602. //this.reloadContent();
  603. this.close();
  604. this.explorer.reload();
  605. }else{
  606. this.app.notice(j.data.message, "error")
  607. }
  608. }.bind(this));
  609. }else{
  610. this.app.notice(this.lp.noWordNeedDeployed, "ok");
  611. }
  612. }.bind(this));
  613. }
  614. });