WorkMinder.js 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644
  1. MWF.xApplication.Execution = MWF.xApplication.Execution || {};
  2. MWF.xDesktop.requireApp("Template", "Explorer", 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: MWF.xApplication.Template.Explorer.PopupForm,
  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.formMarkNode = new Element("div.formMarkNode", {
  42. "styles": this.css.formMarkNode,
  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.formMarkNode, "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.formMarkNode.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 actions; //["删除", "拆分","汇报"];
  250. },
  251. activeAction : function( actionText, data, ev){
  252. if( actionText == "删除" ){
  253. this.removeWork(data, ev);
  254. }else if(actionText == "汇报"){
  255. this.reportWork( data );
  256. }else if(actionText == "拆分"){
  257. this.splitWork( data );
  258. }
  259. },
  260. openWork : function(node, data){
  261. if( data.isCenterWork ){
  262. this.openCenterWork(node, data)
  263. }else{
  264. this.openBaseWork(node, data);
  265. }
  266. },
  267. openCenterWork: function(node, data){
  268. var isEditedBool = ( data.processStatus == this.lp.WorkDeploy.statusDraft && this.app.identity == data.deployerIdentity )? true : false;
  269. this.workDeploy = new MWF.xApplication.Execution.WorkMinder.WorkDeploy(this, this.actions,{"id":data.id},{
  270. "isEdited":isEditedBool,
  271. "centerWorkId":data.id,
  272. "onQueryClose" : function(){
  273. if( this.workDeploy.contentChanged ){
  274. this.reload();
  275. }
  276. }.bind(this)
  277. } );
  278. this.workDeploy.load();
  279. },
  280. openBaseWork : function( node, data ){
  281. if( data.workProcessStatus == this.lp.WorkDeploy.statusDraft ){
  282. MWF.xDesktop.requireApp("Execution", "WorkForm", null, false);
  283. var workform = new MWF.xApplication.Execution.WorkForm(this.explorer, this.app.restActions, data,{
  284. "isNew": false,
  285. "isEdited": this.app.identity == data.deployerIdentity,
  286. "onPostSave" : function(){
  287. this.reload();
  288. }.bind(this)
  289. });
  290. workform.load();
  291. }else{
  292. MWF.xDesktop.requireApp("Execution", "WorkDetail", function(){
  293. var workform = new MWF.xApplication.Execution.WorkDetail(this, this.app.restActions,data,{
  294. "isNew": false,
  295. "isEdited": false
  296. });
  297. workform.load();
  298. }.bind(this));
  299. }
  300. },
  301. removeWork:function( data , ev ){
  302. var lp = this.app.lp;
  303. var text = lp.deleteDocument2.replace(/{title}/g, data.title);
  304. var _self = this;
  305. this.readyRemove = true;
  306. this.app.confirm("warn", ev, lp.deleteDocumentTitle, text, 350, 120, function () {
  307. _self._removeDocument( data );
  308. this.close();
  309. }, function () {
  310. _self.readyRemove = false;
  311. this.close();
  312. });
  313. },
  314. _removeDocument: function( data ){
  315. if( data.isCenterWork ){
  316. this.actions.deleteCenterWork(data.id, function(json){
  317. this.app.notice(this.app.lp.deleteDocumentOK, "success");
  318. this.reload();
  319. }.bind(this));
  320. }else{
  321. this.actions.deleteBaseWork(data.id, function(json){
  322. if(json.type && json.type == "success"){
  323. this.app.notice(this.app.lp.deleteDocumentOK, "success");
  324. this.reload();
  325. }else{
  326. this.app.notice(json.data.message, "error")
  327. }
  328. }.bind(this));
  329. }
  330. },
  331. reportWork: function( data ){
  332. MWF.xDesktop.requireApp("Execution", "WorkReport", function(){
  333. var d = {
  334. title : data.title,
  335. workId : data.id,
  336. centerId : data.centerId,
  337. //centerTitle: this.data.centerTitle,
  338. parentWorkId : data.parentWorkId,
  339. //parentWorkTitle : this.data.title,
  340. workType : data.workType,
  341. workLevel : data.workLevel,
  342. completeDateLimitStr : data.completeDateLimitStr,
  343. completeDateLimit : data.completeDateLimit,
  344. reportCycle: data.reportCycle,
  345. responsibilityOrganizationName: data.responsibilityOrganizationName,
  346. responsibilityEmployeeName: data.responsibilityEmployeeName,
  347. responsibilityIdentity: data.responsibilityIdentity,
  348. cooperateOrganizationName: data.cooperateOrganizationName,
  349. cooperateEmployeeName: data.cooperateEmployeeName,
  350. cooperateIdentity: data.cooperateIdentity,
  351. readLeaderName: data.readLeaderName,
  352. readLeaderIdentity: data.readLeaderIdentity,
  353. reportDayInCycle: data.reportDayInCycle
  354. }
  355. var workReport = new MWF.xApplication.Execution.WorkReport(this, this.app.restActions, d, {
  356. "isNew": false,
  357. "isEdited": false,
  358. "from" : "drafter"
  359. });
  360. workReport.load();
  361. }.bind(this));
  362. },
  363. splitWork: function( data ){
  364. MWF.xDesktop.requireApp("Execution", "WorkForm", function(){
  365. var d = {
  366. title : data.title,
  367. centerId : data.centerId,
  368. //centerTitle: data.centerTitle,
  369. parentWorkId : data.id,
  370. //parentWorkTitle : data.title,
  371. workType : data.workType,
  372. workLevel : data.workLevel,
  373. completeDateLimitStr : data.completeDateLimitStr,
  374. completeDateLimit : data.completeDateLimit,
  375. reportCycle: data.reportCycle,
  376. reportDayInCycle: data.reportDayInCycle
  377. };
  378. var workform = new MWF.xApplication.Execution.WorkForm(this, this.app.restActions,d,{
  379. "isNew": false,
  380. "isEdited": true,
  381. "tabLocation": "myDo",
  382. "onPostSave" : function(){ this.reload(); }.bind(this),
  383. "onPostDeploy" : function(){ this.reload();}.bind(this)
  384. });
  385. workform.load();
  386. }.bind(this));
  387. },
  388. destroyWorkInfor:function(){
  389. if( this.inforNode ){
  390. this.inforNode.destroy();
  391. this.inforNode = null;
  392. }
  393. if( this.tooltip ){
  394. this.tooltip.destroy();
  395. this.tooltip = null;
  396. }
  397. },
  398. showWorkInfor: function( data, c ){
  399. this.destroyWorkInfor();
  400. this.createInforNode( data, c);
  401. },
  402. setInforNodeCoondinates: function( inforNode, targetCoondinates ){
  403. var containerScroll = this.formTableContainer.getScroll();
  404. var containerSize = this.formTableContainer.getSize();
  405. var nodeSize = inforNode.getSize();
  406. var left;
  407. var arrowX, arrowY;
  408. if( targetCoondinates.left + 10 + nodeSize.x - containerScroll.x > containerSize.x ){
  409. left = targetCoondinates.left + 50 - nodeSize.x;
  410. arrowX = "right";
  411. }else{
  412. left = targetCoondinates.left + 10;
  413. arrowX = "left";
  414. }
  415. var top;
  416. if( targetCoondinates.top + 57 + nodeSize.y - containerScroll.y > containerSize.y ){
  417. top = targetCoondinates.top - nodeSize.y - 10;
  418. arrowY = "bottom";
  419. }else{
  420. top = targetCoondinates.top + targetCoondinates.height + 10;
  421. arrowY = "top";
  422. };
  423. inforNode.setStyles({
  424. "left" : left,
  425. "top" : top
  426. });
  427. this.inforBoxArrow = new Element("div", {"styles":this.css.inforBoxArrow}).inject(this.inforNode);
  428. if( arrowY == "top" ){
  429. this.inforBoxArrow.setStyles({
  430. "top" : "-8px",
  431. "background-position" : "0px -18px"
  432. })
  433. }else{
  434. this.inforBoxArrow.setStyles({
  435. "bottom" : "-8px",
  436. "background-position" : "0px -28px"
  437. })
  438. }
  439. if( arrowX == "left" ){
  440. this.inforBoxArrow.setStyle( "left" , "52px")
  441. }else{
  442. this.inforBoxArrow.setStyle( "right" , "10px")
  443. }
  444. },
  445. createInforNode: function( data, c, callback){
  446. this.inforNode = new Element("div", {
  447. styles : {
  448. "font-size" : "12px",
  449. "position" : "absolute",
  450. "z-index" : "11",
  451. "background-color" : "#fff",
  452. "border" : "1px solid #aaa",
  453. "padding" : "10px",
  454. "border-radius" : "3px",
  455. "box-shadow": "0px 0px 5px #aaa"
  456. }
  457. }).inject( this.formTableArea );
  458. this.inforNode.set("html", data.isCenterWork ? this.getCenterWorkInforHtml( data ) : this.getSubWorkInforHtml( data ) );
  459. this.setInforNodeCoondinates( this.inforNode, c );
  460. if( callback )callback();
  461. },
  462. getSubWorkInforHtml : function(data){
  463. var titleStyle = "font-weight:bold;"
  464. var valueStyle = ""
  465. var lp = this.lp.workForm;
  466. return "<table width='300' bordr='0' cellpadding='3' cellspacing='0' styles='formTable'>" +
  467. "<tr>" +
  468. " <td style='"+titleStyle+"' colspan='2'>"+data.title+"</td>" +
  469. "</tr><tr>" +
  470. " <td style='"+titleStyle+"' width='60px'>"+"状态"+":</td>" +
  471. " <td style='"+valueStyle+"' width='140px'>"+data.workProcessStatus+"</td>" +
  472. "</tr><tr>" +
  473. " <td style='"+titleStyle+"' width='60px'>"+lp.workType+":</td>" +
  474. " <td style='"+valueStyle+"' width='140px'>"+data.workType+"</td>" +
  475. //"</tr><tr>" +
  476. //" <td style='"+titleStyle+"'>"+lp.workLevel+":</td>" +
  477. //" <td style='"+valueStyle+"'>"+data.workLevel+"</td>" +
  478. "</tr><tr>" +
  479. " <td style='"+titleStyle+"'>"+lp.timeLimit+":</td>" +
  480. " <td style='"+valueStyle+"'>"+data.completeDateLimitStr+"</td>" +
  481. "</tr><tr>" +
  482. " <td style='"+titleStyle+"'>"+lp.dutyDepartment+":</td>" +
  483. " <td style='"+valueStyle+"'>"+data.responsibilityOrganizationName+"</td>" +
  484. "</tr><tr>" +
  485. " <td style='"+titleStyle+"'>"+lp.dutyPerson+":</td>" +
  486. " <td style='"+valueStyle+"'>"+data.responsibilityEmployeeName+"</td>" +
  487. "</tr><tr>" +
  488. " <td style='"+titleStyle+"'>"+lp.secondDepartment+":</td>" +
  489. " <td style='"+valueStyle+"'>"+data.cooperateOrganizationName+"</td>" +
  490. "</tr><tr>" +
  491. " <td style='"+titleStyle+"'>"+lp.secondPerson+":</td>" +
  492. " <td style='"+valueStyle+"'>"+data.cooperateEmployeeName+"</td>" +
  493. "</tr>" +
  494. "</table>"
  495. },
  496. getCenterWorkInforHtml: function(data){
  497. var titleStyle = "font-weight:bold;"
  498. var valueStyle = ""
  499. var lp = this.lp;
  500. var description = data.description.length > 50 ? data.description.substring(0,50) + "..." : data.description;
  501. return "<table width='300' bordr='0' cellpadding='3' cellspacing='0' styles='formTable'>" +
  502. "<tr>" +
  503. " <td style='"+titleStyle+"' colspan='2'>"+data.title+"</td>" +
  504. "</tr><tr>" +
  505. " <td style='"+titleStyle+"' width='60px'>"+"状态"+":</td>" +
  506. " <td style='"+valueStyle+"' width='140px'>"+data.processStatus+"</td>" +
  507. "</tr><tr>" +
  508. " <td style='"+titleStyle+"'>"+lp.workForm.workType+":</td>" +
  509. " <td style='"+valueStyle+"'>"+data.defaultWorkType+"</td>" +
  510. //"</tr><tr>" +
  511. //" <td style='"+titleStyle+"'>"+lp.workForm.workLevel+":</td>" +
  512. //" <td style='"+valueStyle+"'>"+data.defaultWorkLevel+"</td>" +
  513. "</tr><tr>" +
  514. " <td style='"+titleStyle+"'>"+lp.workForm.timeLimit+":</td>" +
  515. " <td style='"+valueStyle+"'>"+data.defaultCompleteDateLimitStr+"</td>" +
  516. "</tr><tr>" +
  517. " <td style='"+titleStyle+"'>"+lp.baseWorkView.deployerName+":</td>" +
  518. " <td style='"+valueStyle+"'>"+data.deployerIdentity+"</td>" +
  519. "</tr><tr>" +
  520. " <td style='"+titleStyle+"'>"+lp.WorkDeploy.draftDate+":</td>" +
  521. " <td style='"+valueStyle+"'>"+data.createTime+"</td>" +
  522. "</tr><tr>" +
  523. " <td style='"+titleStyle+"'>"+lp.description+":</td>" +
  524. " <td style='"+valueStyle+"'>"+ description+"</td>" +
  525. "</tr>" +
  526. "</table>";
  527. },
  528. setFormNodeSize: function (width, height, top, left) {
  529. if (!width)width = this.options.width ? this.options.width : "50%"
  530. if (!height)height = this.options.height ? this.options.height : "50%"
  531. if (!top) top = this.options.top ? this.options.top : 0;
  532. if (!left) left = this.options.left ? this.options.left : 0;
  533. //var appTitleSize = this.app.window.title.getSize();
  534. var allSize = this.app.content.getSize();
  535. var limitWidth = allSize.x; //window.screen.width
  536. var limitHeight = allSize.y; //window.screen.height
  537. "string" == typeof width && (1 < width.length && "%" == width.substr(width.length - 1, 1)) && (width = parseInt(limitWidth * parseInt(width, 10) / 100, 10));
  538. "string" == typeof height && (1 < height.length && "%" == height.substr(height.length - 1, 1)) && (height = parseInt(limitHeight * parseInt(height, 10) / 100, 10));
  539. 300 > width && (width = 300);
  540. 220 > height && (height = 220);
  541. top = top || parseInt((limitHeight - height) / 2, 10) //+appTitleSize.y);
  542. left = left || parseInt((limitWidth - width) / 2, 10);
  543. this.formAreaNode.setStyles({
  544. "width": "" + width + "px",
  545. "height": "" + height + "px",
  546. "top": "" + top + "px",
  547. "left": "" + left + "px"
  548. });
  549. this.formNode.setStyles({
  550. "width": "" + width + "px",
  551. "height": "" + height + "px"
  552. });
  553. var iconSize = this.formIconNode ? this.formIconNode.getSize() : {x: 0, y: 0};
  554. var topSize = this.formTopNode ? this.formTopNode.getSize() : {x: 0, y: 0};
  555. var bottomSize = this.formBottomNode ? this.formBottomNode.getSize() : {x: 0, y: 0};
  556. var contentHeight = height - iconSize.y - topSize.y - bottomSize.y;
  557. //var formMargin = formHeight -iconSize.y;
  558. this.formContentNode.setStyles({
  559. "height": "" + contentHeight + "px"
  560. });
  561. this.formTableContainer.setStyles({
  562. "width": "" + (width) + "px",
  563. "height": "" + contentHeight + "px"
  564. });
  565. }
  566. })
  567. MWF.xApplication.Execution.WorkMinder.WorkDeploy = new Class({
  568. Extends: MWF.xApplication.Execution.WorkDeploy,
  569. deploy: function(){
  570. var ids = [];
  571. this.actions.getUserDeployBaseWork( this.centerWorkId, function(json){
  572. if(this.centerWorkInforData){
  573. if(this.centerWorkInforData.processStatus == this.lp.statusDraft){ //中心工作草稿环节,
  574. json.data.each(function(d){
  575. if(d.workProcessStatus == this.lp.statusDraft){
  576. ids.push(d.id)
  577. }
  578. }.bind(this))
  579. }else{ //其他环节,其他环节也有可能拟稿人追加
  580. json.data.each(function( d ){
  581. //if( d.subWrapOutOkrWorkBaseInfos ){
  582. // d.subWrapOutOkrWorkBaseInfos.each(function( infor ){
  583. if( d.subWorks ){
  584. d.subWorks.each(function( infor ){
  585. if( infor.workProcessStatus == this.lp.statusDraft ){
  586. ids.push( infor.id )
  587. }
  588. }.bind(this))
  589. }
  590. if(d.workProcessStatus == this.lp.statusDraft){
  591. ids.push(d.id)
  592. }
  593. }.bind(this))
  594. }
  595. }
  596. if( ids.length > 0 ){
  597. var data = { "workIds":ids };
  598. this.actions.deployBaseWork( data, function( j ){
  599. if(j.type && j.type == "success"){
  600. this.app.notice(this.lp.deployeSuccess, "ok");
  601. //this.reloadContent();
  602. this.close();
  603. this.explorer.reload();
  604. }else{
  605. this.app.notice(j.data.message, "error")
  606. }
  607. }.bind(this));
  608. }else{
  609. this.app.notice(this.lp.noWordNeedDeployed, "ok");
  610. }
  611. }.bind(this));
  612. }
  613. })