StrategyExplorerWrite.js 73 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635
  1. MWF.xApplication.Report.StrategyExplorer.Write = new Class({
  2. Implements: [Options, Events],
  3. options: {
  4. "style": "default",
  5. "isEdited" : false,
  6. "status" : "write"
  7. },
  8. initialize: function (container, explorer, data, options) {
  9. this.setOptions( options );
  10. this.container = container;
  11. this.explorer = explorer;
  12. this.app = this.explorer.app;
  13. this.lp = this.app.lp;
  14. this.css = this.explorer.css;
  15. this.actions = this.app.restActions;
  16. this.data = data;
  17. this.path = "/x_component_Report/$StrategyExplorer/";
  18. },
  19. load: function () {
  20. //this.node = new Element("div", {
  21. // styles : this.css.deplymentNode
  22. //}).inject( this.container );
  23. this.month = parseInt(this.data.month);
  24. this.thisMonth_inputContent_all = [];
  25. this.nextMonth_inputTitle_all = [];
  26. this.nextMonth_inputContent_all = [];
  27. this.nextMonth_inputTitle = [];
  28. this.thisMonthKeyworkList = [];
  29. this.thisMonthKeyworkNode = new Element("div", {
  30. //styles : this.css.monthNode
  31. }).inject( this.explorer.summaryContainer );
  32. //new Element( "div", {
  33. // text : "本月【"+ this.month + "月】",
  34. // styles : this.css.monthTitleNode
  35. //}).inject( this.thisMonthKeyworkNode );
  36. this.data.thisMonth_workList.each( function( data, index ){
  37. var keywork = new MWF.xApplication.Report.StrategyExplorer.Write.ThisKeyWorkItem( this.thisMonthKeyworkNode, this, data, {
  38. reportId : this.data.id,
  39. "isEdited" : this.options.isEdited,
  40. "status" : this.options.status,
  41. "orderNumber" : index + 1
  42. });
  43. keywork.load();
  44. this.thisMonthKeyworkList.push( keywork );
  45. }.bind(this));
  46. this.nexMonthKeyworkList = [];
  47. this.nextMonthKeyWorkNode = new Element("div", {
  48. //styles : this.css.monthNode
  49. }).inject( this.explorer.planContainer );
  50. //new Element( "div", {
  51. // text : "下月【"+ ( parseInt( this.month ) + 1 )+ "月】",
  52. // styles : this.css.monthTitleNode
  53. //}).inject( this.nextMonthKeyWorkNode );
  54. this.data.nextMonth_workList.each( function( data, index ){
  55. var keywork = new MWF.xApplication.Report.StrategyExplorer.Write.NextKeyWorkItem( this.nextMonthKeyWorkNode, this, data, {
  56. reportId : this.data.id,
  57. "isEdited" : this.options.isEdited,
  58. "status" : this.options.status,
  59. "orderNumber" : index + 1,
  60. "defaultTitle" : (this.data.thisMonth_workList && this.data.thisMonth_workList.length > index) ? this.data.thisMonth_workList[index].workTitle : ""
  61. });
  62. keywork.load();
  63. this.nexMonthKeyworkList.push( keywork );
  64. }.bind(this));
  65. if( this.options.isEdited && this.options.status=="write"){
  66. //new Element("button", {
  67. // value : "标题沿用上月重点工作",
  68. // text : "标题沿用上月重点工作",
  69. // styles : this.css.normalButton,
  70. // events : {
  71. // click : function(){
  72. // this.nextMonth_inputTitle.each( function( input, index ){
  73. // if( this.data.thisMonth_workList && this.data.thisMonth_workList.length > index ){
  74. // if( input.get("value") ){
  75. // input.set("value", input.get("value") + " " +this.data.thisMonth_workList[index].workTitle );
  76. // }else{
  77. // input.set("value", this.data.thisMonth_workList[index].workTitle );
  78. // }
  79. // }
  80. // }.bind(this))
  81. // }.bind(this)
  82. // }
  83. //}).inject(this.nextMonthKeyWorkNode);
  84. var _self = this;
  85. this.nextMonth_inputTitle.each( function( input, index ){
  86. var button = new Element("button", {
  87. value : "沿用标题",
  88. text : "沿用标题",
  89. title : "标题沿用上月重点工作",
  90. styles : this.css.normalButton,
  91. events : {
  92. click : function(){
  93. var index = this.index;
  94. var input = this.input;
  95. if( _self.data.thisMonth_workList && _self.data.thisMonth_workList.length > index ){
  96. if( input.get("value") ){
  97. input.set("value", input.get("value") + " " +_self.data.thisMonth_workList[index].workTitle );
  98. }else{
  99. input.set("value", _self.data.thisMonth_workList[index].workTitle );
  100. }
  101. }
  102. }.bind({ input : input, index : index })
  103. }
  104. }).inject(input, "before");
  105. if( _self.data.thisMonth_workList && _self.data.thisMonth_workList.length > index ){
  106. new Element("div", {
  107. "styles" : { "margin-bottom" : "5px" },
  108. html : this.app.common.replaceWithBr( _self.data.thisMonth_workList[index].workTitle )
  109. }).inject(button, "before");
  110. }
  111. }.bind(this))
  112. }
  113. this.extWorkNode = new Element("div", {
  114. styles : {
  115. width : "96%",
  116. margin : "0px auto"
  117. }
  118. }).inject( this.explorer.threeworkContainer );
  119. var extwork = this.extWork = new MWF.xApplication.Report.StrategyExplorer.Write.ExtWork(this.extWorkNode, this, this.data, {
  120. reportId: this.data.id,
  121. "isEdited" : this.options.isEdited,
  122. "status" : this.options.status
  123. });
  124. extwork.load();
  125. //this.extFuwuKeyworkList = [];
  126. //this.extFuWuNode = new Element("div", {
  127. // styles : this.css.monthNode
  128. //}).inject( this.explorer.threeworkContainer ); //客户服务
  129. //new Element( "div", {
  130. // text : "【"+ this.month+ "月】服务客户",
  131. // styles : this.css.monthTitleNode
  132. //}).inject( this.extFuWuNode );
  133. //this.data.extFuwuCategories.each( function( data, index ) {
  134. // var keywork = new MWF.xApplication.Report.StrategyExplorer.Write.ExtKeyWorkItem(this.extFuWuNode, this, data, {
  135. // reportId: this.data.id,
  136. // category : "Fuwu",
  137. // index : index+1,
  138. // "isEdited" : this.options.isEdited,
  139. // "status" : this.options.status
  140. // });
  141. // keywork.load();
  142. // this.extFuwuKeyworkList.push( keywork );
  143. //}.bind(this));
  144. //
  145. //this.extGuanaiKeyworkList = [];
  146. //this.extGuanAiNode = new Element("div", {
  147. // styles : this.css.monthNode
  148. //}).inject( this.node ); //客户服务
  149. //new Element( "div", {
  150. // text : "【"+ this.month+ "月】关爱员工",
  151. // styles : this.css.monthTitleNode
  152. //}).inject( this.extGuanAiNode );
  153. //this.data.extGuanaiCategories.each( function( data , index ) {
  154. // var keywork = new MWF.xApplication.Report.StrategyExplorer.Write.ExtKeyWorkItem(this.extGuanAiNode, this, data, {
  155. // reportId: this.data.id,
  156. // category : "Guanai",
  157. // index : index+1,
  158. // "isEdited" : this.options.isEdited,
  159. // "status" : this.options.status
  160. // });
  161. // keywork.load();
  162. // this.extGuanaiKeyworkList.push( keywork );
  163. //}.bind(this));
  164. //
  165. //this.extYijianKeyworkList = [];
  166. //this.extYiJianNode = new Element("div", {
  167. // styles : this.css.monthNode
  168. //}).inject( this.node ); //客户服务
  169. //new Element( "div", {
  170. // text : "【"+ this.month+ "月】意见建议",
  171. // styles : this.css.monthTitleNode
  172. //}).inject( this.extYiJianNode );
  173. //this.data.extYijianCategories.each( function( data , index ) {
  174. // var keywork = new MWF.xApplication.Report.StrategyExplorer.Write.ExtKeyWorkItem(this.extYiJianNode, this, data, {
  175. // reportId: this.data.id,
  176. // category : "Yijian",
  177. // index : index+1,
  178. // "isEdited" : this.options.isEdited,
  179. // "status" : this.options.status
  180. // });
  181. // keywork.load();
  182. // this.extYijianKeyworkList.push( keywork );
  183. //}.bind(this))
  184. },
  185. getExtKeywork : function( category, id ){
  186. var keyworkList = this[ "ext"+category+ "KeyworkList"];
  187. for( var i = 0; i<keyworkList.length; i++ ){
  188. if( keyworkList[i].data.id == id ){
  189. return keyworkList[ i ]
  190. }
  191. }
  192. return null;
  193. },
  194. getThisMonthKeywork : function(id){
  195. for( var i = 0; i<this.thisMonthKeyworkList.length; i++ ){
  196. if( this.thisMonthKeyworkList[i].data.id == id ){
  197. return this.thisMonthKeyworkList[ i ]
  198. }
  199. }
  200. return null;
  201. },
  202. getNextMonthKeywork : function(id){
  203. for( var i = 0; i<this.nexMonthKeyworkList.length; i++ ){
  204. if( this.nexMonthKeyworkList[i].data.id == id ){
  205. return this.nexMonthKeyworkList[ i ]
  206. }
  207. }
  208. return null;
  209. },
  210. listPlan : function( workInfoId, refresh, callback ){
  211. if( !refresh && this.planDataObject ) {
  212. if(callback)callback( this.planDataObject[workInfoId] || [] ) ;
  213. }else{
  214. this.actions.listPlan( this.data.id || this.options.id, function( json ){
  215. this.planDataObject = {};
  216. json.data.each( function( d ){
  217. if( !this.planDataObject[d.workInfoId] ) {
  218. this.planDataObject[d.workInfoId] = [];
  219. }
  220. this.planDataObject[d.workInfoId].push( d );
  221. }.bind(this));
  222. if(callback)callback( this.planDataObject[workInfoId] || [] ) ;
  223. }.bind(this))
  224. }
  225. },
  226. listWork : function( workInfoId, refresh, callback ){
  227. if( !refresh && this.workDataObject ) {
  228. if(callback)callback( this.workDataObject[workInfoId] || [] ) ;
  229. }else{
  230. this.actions.listWork( this.data.id || this.options.id, function( json ){
  231. this.workDataObject = {};
  232. json.data.each( function( d ){
  233. if( !this.workDataObject[d.workInfoId] ) {
  234. this.workDataObject[d.workInfoId] = [];
  235. }
  236. this.workDataObject[d.workInfoId].push( d );
  237. }.bind(this));
  238. if(callback)callback( this.workDataObject[workInfoId] || [] ) ;
  239. }.bind(this))
  240. }
  241. },
  242. listPlanNext : function( workInfoId, refresh, callback ){
  243. if( !refresh && this.planNextDataObject ) {
  244. if(callback)callback( this.planNextDataObject[workInfoId] || [] ) ;
  245. }else{
  246. this.actions.listPlanNext( this.data.id || this.options.id, function( json ){
  247. this.planNextDataObject = {};
  248. json.data.each( function( d ){
  249. if( !this.planNextDataObject[d.workInfoId] ) {
  250. this.planNextDataObject[d.workInfoId] = [];
  251. }
  252. this.planNextDataObject[d.workInfoId].push( d );
  253. }.bind(this));
  254. if(callback)callback( this.planNextDataObject[workInfoId] || [] ) ;
  255. }.bind(this))
  256. }
  257. },
  258. //listExt : function( workInfoId, refresh, callback, category ){
  259. // this.extData = this.extData || {};
  260. // if( !refresh && this.extData[category] ) {
  261. // if(callback)callback( this.extData[category][workInfoId] || [] ) ;
  262. // }else{
  263. // this.actions["list"+ category +"WithReportId"]( this.data.id || this.options.id, function( json ){
  264. // this.extData[category] = {};
  265. // json.data.each( function( d ){
  266. // if( !this.extData[category][d.category] ) {
  267. // this.extData[category][d.category] = [];
  268. // }
  269. // this.extData[category][d.category].push( d );
  270. // }.bind(this));
  271. // if(callback)callback( this.extData[category][workInfoId] || [] ) ;
  272. // }.bind(this))
  273. // }
  274. //},
  275. submit: function(){
  276. var flag = false;
  277. var result = this.getResult( true );
  278. if( result ){
  279. this.actions.saveWorkPerson( result, function(){
  280. //this.app.notice("保存并上传成功");
  281. flag = true;
  282. }.bind(this), null, false )
  283. }
  284. if( !flag && this.errorNodeList && this.errorNodeList.length > 0 ){
  285. var errorNode = this.errorNodeList[0];
  286. if( this.app.scrollNode ){
  287. this.app.scrollNode.scrollTo( 0, errorNode.getCoordinates().top - this.app.scrollNode.getCoordinates().top + this.app.scrollNode.scrollTop.toFloat() - 120 );
  288. }
  289. }
  290. return flag;
  291. },
  292. save: function(){
  293. var flag = false;
  294. var result = this.getResult( false );
  295. if( result ){
  296. this.actions.saveWorkPerson( result, function(){
  297. //this.app.notice("保存并上传成功");
  298. flag = true;
  299. }.bind(this), null, false )
  300. }
  301. return flag;
  302. },
  303. verifyProcess : function( status ){
  304. if( this.errorNodeList && this.errorNodeList.length ){
  305. while( this.errorNodeList.length > 0 ){
  306. this.errorNodeList.pop().destroy();
  307. }
  308. }
  309. if( status == "confirm" ){
  310. var flag1 = true;
  311. this.thisMonth_inputContent_all.each( function( input ){
  312. if( input.get("value") == "" ){
  313. flag1 = false;
  314. this.createErrorNode( input, "请填写工作总结" )
  315. }
  316. }.bind(this));
  317. var flag2 = true;
  318. this.nextMonth_inputTitle_all.each( function( input ){
  319. if( input.get("value") == "" ){
  320. flag2 = false;
  321. this.createErrorNode( input, "请填写标题" )
  322. }
  323. }.bind(this));
  324. var flag3 = true;
  325. this.nextMonth_inputContent_all.each( function( input ){
  326. if( input.get("value") == "" ){
  327. flag3 = false;
  328. this.createErrorNode( input, "请填写工作计划" )
  329. }
  330. }.bind(this));
  331. var flag7 = true;
  332. //this.nexMonthKeyworkList.each( function( keywork ){
  333. // var measuresList = keywork.getMeasuresList();
  334. // if( !measuresList || measuresList.length == 0 ){
  335. // flag7 = false;
  336. // this.createErrorNode( keywork.measureContentNode, "请选择举措" );
  337. // }
  338. //}.bind(this));
  339. var flag4,flag5, flag6;
  340. this.extWork.gridContainer.getElements( "textarea").each( function( textarea ){
  341. var name = textarea.get("name").split("_")[0];
  342. if( textarea.get("value").trim() != "" ){
  343. if( name == "fuwu" )flag4 = true;
  344. if( name == "guanai" )flag5 = true;
  345. if( name == "yijian" )flag6 = true;
  346. }
  347. }.bind(this));
  348. var errorTextArr = [];
  349. if( !flag4 )errorTextArr.push("至少需要填写一项服务客户内容");
  350. if( !flag5 )errorTextArr.push("至少需要填写一项关爱员工内容");
  351. if( !flag6 )errorTextArr.push("至少需要填写一项意见建议内容");
  352. if( errorTextArr.length > 0 ){
  353. this.createErrorNode( this.extWork.gridContainer, errorTextArr.join(",")+ "。")
  354. }
  355. errorTextArr = [];
  356. if( !flag1 )errorTextArr.push("本月工作总结不能为空");
  357. if( !flag2 )errorTextArr.push("下月部门重点工作不能为空");
  358. if( !flag3 )errorTextArr.push("下月工作计划工作不能为空");
  359. if( !flag7 )errorTextArr.push("下月举措不能为空");
  360. if( !flag4 )errorTextArr.push("至少需要填写一项服务客户内容");
  361. if( !flag5 )errorTextArr.push("至少需要填写一项关爱员工内容");
  362. if( !flag6 )errorTextArr.push("至少需要填写一项意见建议内容");
  363. if( errorTextArr.length > 0 ){
  364. this.app.notice( errorTextArr.join(",<br/>") + "。", "error" );
  365. }
  366. return flag1 && flag2 && flag3 && flag4 && flag5 && flag6;
  367. }
  368. return true;
  369. },
  370. getResult : function( verify ){
  371. if( this.errorNodeList ){
  372. this.errorNodeList.each( function(node){
  373. node.destroy();
  374. }.bind(this));
  375. this.errorNodeList = []
  376. }
  377. var flag = true;
  378. if( this.options.isEdited && this.options.status == "confirm" ){
  379. var workList = [];
  380. this.nexMonthKeyworkList.each( function( keywork ){
  381. var title = keywork.getWorkTitle();
  382. if( !title || title.length == 0 ){
  383. if( verify ){
  384. this.createErrorNode( keywork.workTitleInput, "请填写工作标题", { "float" : "left" } );
  385. flag = false;
  386. }
  387. }
  388. var measuresList = keywork.getMeasuresList();
  389. if( !measuresList || measuresList.length == 0 ){
  390. if( verify ){
  391. this.createErrorNode( keywork.measureContentNode, "请选择举措" );
  392. flag = false;
  393. }
  394. }
  395. workList.push({
  396. id : keywork.data.id,
  397. orderNumber : keywork.getOrderNumber(),
  398. workTitle : title,
  399. measuresList : measuresList
  400. }) ;
  401. }.bind(this));
  402. if( !flag )return false;
  403. return {
  404. id : this.data.id,
  405. workList : workList
  406. }
  407. }
  408. },
  409. createErrorNode : function(node, text, styles){
  410. if( !this.errorNodeList )this.errorNodeList = [];
  411. var div = new Element("div", {
  412. text : text,
  413. styles : this.css.warningMessageNode
  414. }).inject( node, "after" );
  415. if(styles)div.setStyles(styles);
  416. this.errorNodeList.push( div );
  417. }
  418. });
  419. MWF.xApplication.Report.StrategyExplorer.Write.ThisKeyWorkItem = new Class({
  420. Implements: [Options, Events],
  421. options: {
  422. "style": "default",
  423. "reportId" : "",
  424. "isEdited" : true,
  425. "orderNumber" : 1,
  426. "status" : ""
  427. },
  428. initialize: function(container, explorer, data, options ) {
  429. this.setOptions(options);
  430. this.container = container;
  431. this.explorer = explorer;
  432. this.app = this.explorer.app;
  433. this.lp = this.app.lp;
  434. this.css = this.explorer.css;
  435. this.actions = this.app.restActions;
  436. this.data = data;
  437. },
  438. load: function(){
  439. var status = this.options.status;
  440. var table = new Element( "table", {
  441. "width":"96%",
  442. "border":"0",
  443. "cellpadding":"5",
  444. "cellspacing":"0",
  445. "styles" : this.css.formTable
  446. }).inject( this.container );
  447. var tr = new Element("tr").inject( table );
  448. new Element("td", { "rowspan" : 3, "text" : this.data.orderNumber || this.options.orderNumber, "width" : "30", "styles": this.css.formTableTitle }).inject( tr );
  449. new Element("td", { "text" : "部门重点工作", "width" : "140", "styles": this.css.formTableTitle }).inject( tr );
  450. var contentTd = new Element("td", { "styles": this.css.formTableValue }).inject( tr );
  451. new Element("div", {
  452. "html" : this.app.common.replaceWithBr( this.data.workTitle ),
  453. styles : { "width" : "870px", "float" : "left" }
  454. }).inject( contentTd );
  455. var showMeasureNode = new Element("input",{
  456. "type" : "button",
  457. "styles" : this.css.showMeasureNode,
  458. "value" : "查看举措"
  459. }).inject( contentTd );
  460. var tooltip = new MWF.xApplication.Report.ShowMeasureTooltip( this.app.content, showMeasureNode, this.app, this.explorer.data, {
  461. style : "report",
  462. position : { x : "auto", y : "auto" },
  463. event : "click"
  464. });
  465. tooltip.measuresList = this.data.measuresList;
  466. tr = new Element("tr").inject( table );
  467. new Element("td", { "text" : "工作计划", "styles": this.css.formTableTitle }).inject( tr );
  468. contentTd = new Element("td", {
  469. "styles": this.css.formTableValue,
  470. html : this.app.common.replaceWithBr( this.data.workPlanSummary )
  471. }).inject( tr );
  472. //this.loadPlanView( contentTd );
  473. tr = new Element("tr").inject( table );
  474. new Element("td", { "text" : "工作总结", "styles": this.css.formTableTitle }).inject( tr );
  475. contentTd = new Element("td", { "styles": this.css.formTableValue }).inject( tr );
  476. //this.loadWorkAction( contentTd );
  477. if( status == "confirm" || status == "write" ){
  478. this.loadWorkView( contentTd );
  479. }
  480. if( status == "confirm" || status == "audit" ){
  481. if( this.options.isEdited ){
  482. this.contentInput_all = new Element("textarea", {
  483. placeholder : status == "confirm" ? "请汇总工作总结" : "",
  484. styles : this.css.textarea,
  485. value : this.data.workProgSummary
  486. }).inject( contentTd );
  487. this.explorer.thisMonth_inputContent_all.push( this.contentInput_all );
  488. this.contentInput_all.addEvent("blur", function(){
  489. if( this.data.workProgSummary != this.contentInput_all.get("value") ){
  490. this.data.workProgSummary = this.contentInput_all.get("value");
  491. if(this.app.onChangeValue)this.app.onChangeValue();
  492. }
  493. this.app.restActions.saveWorkProgSummary( {
  494. id : this.data.id,
  495. workProgSummary : this.contentInput_all.get("value")
  496. }, function(){
  497. this.app.notice( "工作总结保存并上传成功", "success", this.contentInput_all.getParent() )
  498. }.bind(this))
  499. }.bind(this))
  500. }else{
  501. if( status == "confirm" ){
  502. var div = new Element("div").inject( contentTd );
  503. var html = "<table width='100%' bordr='0' cellpadding='3' cellspacing='0' style='margin-top: 5px; '>" +
  504. "<tr><td width='70' align='center'>汇总:</td>" +
  505. " <td>"+this.app.common.replaceWithBr( this.data.workProgSummary )+"</td>"+
  506. "</table>";
  507. div.set("html", html);
  508. }else{
  509. var div = new Element("div").inject( contentTd );
  510. div.set("html", this.app.common.replaceWithBr( this.data.workProgSummary ));
  511. }
  512. }
  513. }
  514. },
  515. addContentToAll : function( data ){
  516. var oldValue = this.contentInput_all.get("value");
  517. if( !oldValue ){
  518. this.contentInput_all.set("value", data.progressContent); //JSON.stringify( data ))
  519. }else{
  520. this.contentInput_all.set("value", oldValue + " " + data.progressContent); //JSON.stringify( data ))
  521. }
  522. if(this.app.onChangeValue)this.app.onChangeValue();
  523. this.data.workProgSummary = this.contentInput_all.get("value");
  524. this.app.restActions.saveWorkProgSummary( {
  525. id : this.data.id,
  526. workProgSummary : this.contentInput_all.get("value")
  527. }, function(){
  528. this.app.notice( "工作总结保存并上传成功", "success", this.contentInput_all.getParent() )
  529. }.bind(this))
  530. },
  531. loadPlanView : function( container ){
  532. this.planViewNode = new Element("div").inject( container );
  533. this.planView = new MWF.xApplication.Report.StrategyExplorer.PlanView(this.planViewNode, this.app, this, {
  534. "style": "default",
  535. "documentSortable" : false, //this.options.status == "confirm" && this.options.isEdited,
  536. "reportId" : this.options.reportId,
  537. "isEdited" : this.options.isEdited,
  538. "templateUrl": this.explorer.path+"listItemPlan.json",
  539. "onDocumentSortComplete" : function( element, serial ){
  540. var arr = [];
  541. this.planView.node.getElements("[item='id']").each( function( el, index ){
  542. var id = el.get("text");
  543. this.planView.documents[id].data.orderNumber = index+1;
  544. arr.push( {
  545. id : id,
  546. orderNumber : index+1
  547. })
  548. }.bind(this));
  549. this.actions.updatePlanOrder( { orderList : arr } )
  550. }.bind(this)
  551. });
  552. this.planView.report = this.explorer.explorer;
  553. this.planView.data = this.data.planList;
  554. this.planView.load();
  555. },
  556. loadWorkView : function( container ){
  557. //this.workViewNode = new Element("div").inject( this.workNode);
  558. this.workView = new MWF.xApplication.Report.StrategyExplorer.WorkView( container || this.workViewNode, this.app, this, {
  559. "style": "default",
  560. "documentSortable" : false, //this.options.status == "confirm" && this.options.isEdited,
  561. "reportId" : this.options.reportId,
  562. "isEdited" : this.options.isEdited,
  563. "templateUrl": this.explorer.path+"listItemWork.json",
  564. "onDocumentSortComplete" : function( element, serial ){
  565. var arr = [];
  566. this.workView.node.getElements("[item='id']").each( function( el, index ){
  567. var id = el.get("text");
  568. this.workView.documents[id].data.orderNumber = index+1;
  569. arr.push( {
  570. id : id,
  571. orderNumber : index+1
  572. })
  573. }.bind(this));
  574. this.actions.updateWorkOrder( { orderList : arr } )
  575. }.bind(this)
  576. });
  577. this.workView.report = this.explorer.explorer;
  578. this.workView.data = this.data.progList;
  579. this.workView.load();
  580. }
  581. });
  582. MWF.xApplication.Report.StrategyExplorer.Write.NextKeyWorkItem = new Class({
  583. Implements: [Options, Events],
  584. options: {
  585. "style": "default",
  586. "reportId" : "",
  587. "isEdited" : false,
  588. "orderNumber" : 1,
  589. "status" : "",
  590. "defaultTitle" : ""
  591. },
  592. initialize: function(container, explorer, data, options ) {
  593. this.setOptions(options);
  594. this.container = container;
  595. this.explorer = explorer;
  596. this.app = this.explorer.app;
  597. this.lp = this.app.lp;
  598. this.css = this.explorer.css;
  599. this.actions = this.app.restActions;
  600. this.data = data;
  601. },
  602. load: function(){
  603. var status = this.options.status;
  604. var table = new Element( "table", {
  605. "width":"96%",
  606. "border":"0",
  607. "cellpadding":"5",
  608. "cellspacing":"0",
  609. "styles" : this.css.formTable
  610. }).inject( this.container );
  611. var tr = new Element("tr").inject( table );
  612. new Element("td", { "rowspan" : status == "write" ? 3 : 4, "text" : this.data.orderNumber || this.options.orderNumber, "width" : "30", "styles": this.css.formTableTitle }).inject( tr );
  613. new Element("td", {
  614. "text" : status == "write" ? "标题" : "部门重点工作",
  615. "width" : "140",
  616. "styles": this.css.formTableTitle
  617. }).inject( tr );
  618. var contentTd = new Element("td", { "styles": this.css.formTableValue }).inject( tr );
  619. if( status == "confirm" || status == "write" ) {
  620. this.loadPlanTitleViewNext(contentTd);
  621. }
  622. if( status == "confirm" || status == "audit" ){
  623. if( this.options.isEdited ){
  624. this.titleInput_all = new Element("textarea", {
  625. placeholder : status == "confirm" ? "请汇总部门重点工作" : "",
  626. styles : this.css.textarea,
  627. value : this.data.workTitle || this.options.defaultTitle
  628. }).inject( contentTd );
  629. this.explorer.nextMonth_inputTitle_all.push( this.titleInput_all );
  630. this.titleInput_all.addEvent("blur", function(){
  631. var data = Object.clone(this.data);
  632. delete data.planNextList;
  633. delete data.planList;
  634. //data.measuresList = this.selectedMeasuresList ;
  635. if( this.data.workTitle != this.titleInput_all.get("value") ){
  636. this.data.workTitle = this.titleInput_all.get("value");
  637. if(this.app.onChangeValue)this.app.onChangeValue();
  638. }
  639. data.workPlanSummary = this.contentInput_all.get("value");
  640. data.workTitle = this.titleInput_all.get("value");
  641. //data.orderNumber = this.data.orderNumber || this.options.orderNumber;
  642. this.app.restActions.saveWorkInfor( data , function(){
  643. this.app.notice( "部门重点工作保存并上传成功", "success", this.titleInput_all.getParent() )
  644. }.bind(this));
  645. }.bind(this))
  646. }else{
  647. if( status == "confirm" ){
  648. var div = new Element("div").inject( contentTd );
  649. var html = "<table width='100%' bordr='0' cellpadding='3' cellspacing='0' style='margin-top: 5px; '>" +
  650. "<tr><td width='70' align='center'>汇总:</td>" +
  651. " <td>"+this.app.common.replaceWithBr( this.data.workTitle )+"</td>"+
  652. "</table>";
  653. div.set("html", html);
  654. }else{
  655. var div = new Element("div").inject( contentTd );
  656. div.set("html", this.app.common.replaceWithBr( this.data.workTitle ));
  657. }
  658. }
  659. }
  660. //if( this.options.isEdited ){
  661. // this.workTitleInput = new Element("input", {
  662. // "value" : this.data.workTitle,
  663. // "styles" : this.css.keyWorkTitleInput
  664. // }).inject( contentTd )
  665. //}else{
  666. // new Element("div", {
  667. // "text" : this.data.workTitle
  668. // }).inject( contentTd )
  669. //}
  670. if( status == "confirm" || status == "audit" ){
  671. var tr = new Element("tr").inject( table );
  672. new Element("td", {
  673. "text" : "举措",
  674. "width" : "140",
  675. "styles": this.css.formTableTitle
  676. }).inject( tr );
  677. var contentTd = new Element("td", { "styles": this.css.formTableValue }).inject( tr );
  678. var table_m = new Element("table", { width: "100%", border : 0, cellspacing : 0, cellpadding : 0, styles : this.css.listViewTable }).inject( contentTd );
  679. var tr_m = new Element("tr", { styles : this.css.listViewTableTr }).inject( table_m );
  680. var td_m = new Element("td", { styles : this.css.listViewTableTd }).inject( tr_m );
  681. this.measureContentNode = new Element("div").inject( td_m );
  682. this.loadMeasureList( this.data.measuresList || []);
  683. td_m = new Element("td", { styles : this.css.listViewTableTd, width : "80" }).inject( tr_m );
  684. if( this.options.isEdited ){
  685. var button = new Element("button", {
  686. text : "选择举措",
  687. styles : this.css.selectMeasureAction
  688. //events : {
  689. // "click" : function(){
  690. //
  691. // //var form = new MWF.xApplication.Report.SelectMeasureForm(this, this.explorer.data, {
  692. // // onPostOk: function( list, value ){
  693. // // this.measureContentNode.empty();
  694. // // var idList = [];
  695. // // list.each( function( it ){
  696. // // idList.push( it.id );
  697. // // });
  698. // // this.loadMeasureList( idList );
  699. // // this.measuresList = idList;
  700. // // }.bind(this)
  701. // //}, { app : this.app });
  702. // //form.edit();
  703. // }.bind(this)
  704. //}
  705. }).inject( td_m );
  706. var tooltip = new MWF.xApplication.Report.SelectMeasureTooltips( this.app.content, button, this.app, this.explorer.data, {
  707. style : "report",
  708. hasArrow : false,
  709. position : { x : "auto", y : "auto" },
  710. event : "click",
  711. onSelect : function( list, value ){
  712. this.measureContentNode.empty();
  713. var idList = [];
  714. list.each( function( it ){
  715. idList.push( it.id );
  716. });
  717. this.loadMeasureList( idList );
  718. if(this.app.onChangeValue)this.app.onChangeValue();
  719. this.measuresList = this.data.measuresList = idList;
  720. var data = Object.clone(this.data);
  721. delete data.planNextList;
  722. delete data.planList;
  723. //data.measuresList = this.selectedMeasuresList ;
  724. data.workPlanSummary = this.contentInput_all.get("value");
  725. data.workTitle = this.titleInput_all.get("value");
  726. this.app.restActions.saveWorkInfor( data , function(){
  727. this.app.notice( "举措保存并上传成功", "success" )
  728. }.bind(this));
  729. }.bind(this)
  730. });
  731. tooltip.measuresList = this.data.measuresList;
  732. }
  733. }
  734. tr = new Element("tr").inject( table );
  735. new Element("td", { "text" : "工作计划", "styles": this.css.formTableTitle }).inject( tr );
  736. contentTd = new Element("td", { "styles": this.css.formTableValue }).inject( tr );
  737. //this.loadPlanNextAction( contentTd, true ,true );
  738. if( status == "confirm" || status == "write" ){
  739. this.loadPlanViewNext( contentTd );
  740. }
  741. if( status == "confirm" || status == "audit" ){
  742. if( this.options.isEdited ) {
  743. this.contentInput_all = new Element("textarea", {
  744. placeholder: status == "confirm" ? "请汇总计划" : "",
  745. styles: this.css.textarea,
  746. value: this.data.workPlanSummary
  747. }).inject(contentTd);
  748. this.explorer.nextMonth_inputContent_all.push( this.contentInput_all );
  749. this.contentInput_all.addEvent("blur", function () {
  750. if( this.data.workPlanSummary != this.contentInput_all.get("value") ){
  751. this.data.workPlanSummary = this.contentInput_all.get("value");
  752. if(this.app.onChangeValue)this.app.onChangeValue();
  753. }
  754. this.app.restActions.saveWorkPlanSummary({
  755. id: this.data.id,
  756. workPlanSummary: this.contentInput_all.get("value")
  757. }, function(){
  758. this.app.notice( "工作计划保存并上传成功", "success", this.contentInput_all.getParent() )
  759. }.bind(this))
  760. }.bind(this))
  761. }else{
  762. if( status == "confirm" ){
  763. var div = new Element("div").inject( contentTd );
  764. var html = "<table width='100%' bordr='0' cellpadding='3' cellspacing='0' style='margin-top: 5px; '>" +
  765. "<tr><td width='70' align='center'>汇总:</td>" +
  766. " <td>"+this.app.common.replaceWithBr( this.data.workPlanSummary )+"</td>"+
  767. "</table>";
  768. div.set("html", html);
  769. }else{
  770. var div = new Element("div").inject( contentTd );
  771. div.set("html", this.app.common.replaceWithBr( this.data.workPlanSummary ));
  772. }
  773. }
  774. }
  775. },
  776. addTitleToAll : function( data ){
  777. var oldValue = this.titleInput_all.get("value");
  778. if( !oldValue ){
  779. this.titleInput_all.set("value", data.title); //JSON.stringify( data ))
  780. }else{
  781. this.titleInput_all.set("value", oldValue + " " + data.title); //JSON.stringify( data ))
  782. }
  783. var data = Object.clone(this.data);
  784. delete data.planNextList;
  785. delete data.planList;
  786. this.data.workTitle = this.titleInput_all.get("value");
  787. if(this.app.onChangeValue)this.app.onChangeValue();
  788. //data.measuresList = this.selectedMeasuresList ;
  789. data.workPlanSummary = this.contentInput_all.get("value");
  790. data.workTitle = this.titleInput_all.get("value");
  791. this.app.restActions.saveWorkInfor( data, function(){
  792. this.app.notice( "部门重点工作保存并上传成功", "success", this.titleInput_all.getParent() )
  793. }.bind(this));
  794. },
  795. addContentToAll : function( data ){
  796. var oldValue = this.contentInput_all.get("value");
  797. if( !oldValue ){
  798. this.contentInput_all.set("value", data.planContent); //JSON.stringify( data ))
  799. }else{
  800. this.contentInput_all.set("value", oldValue + " " + data.planContent); //JSON.stringify( data ))
  801. }
  802. this.data.workPlanSummary = this.contentInput_all.get("value");
  803. if(this.app.onChangeValue)this.app.onChangeValue();
  804. this.app.restActions.saveWorkPlanSummary({
  805. id: this.data.id,
  806. workPlanSummary: this.contentInput_all.get("value")
  807. }, function(){
  808. this.app.notice( "工作计划保存并上传成功", "success", this.contentInput_all.getParent() )
  809. }.bind(this))
  810. },
  811. getOrderNumber : function(){
  812. return this.data.orderNumber || this.options.orderNumber;
  813. },
  814. getWorkTitle : function(){
  815. return this.workTitleInput.get("value");
  816. },
  817. getMeasuresList : function(){
  818. return this.measuresList || this.data.measuresList;
  819. },
  820. loadMeasureList: function( list ){
  821. this.selectableMeasureObject = {};
  822. this.explorer.data.selectableMeasures.each( function( m ){
  823. this.selectableMeasureObject[ m.id ]=m;
  824. }.bind(this));
  825. var table_m = new Element("table", { width: "100%", border : 0, cellspacing : 0, cellpadding : 3, styles : this.css.listViewTable }).inject( this.measureContentNode );
  826. list.each( function( id,i ){
  827. if( id ){
  828. var data = this.selectableMeasureObject[ id ];
  829. var tr_m = new Element("tr", { styles : this.css.listViewTableTr }).inject( table_m );
  830. var td_m = new Element("td", { styles : this.css.listViewTableTd , width : "40"}).inject( tr_m );
  831. var iconNode = new Element("div", {
  832. styles : this.css.descriptionNode,
  833. text : "详情"
  834. }).inject( td_m );
  835. this.loadMeasureTooltip( iconNode, id );
  836. //var td_m = new Element("td", { styles : this.css.listViewTableTd, width : "10", text : i + ":" }).inject( tr_m );
  837. var td_m = new Element("td", { styles : this.css.listViewTableTd, text : data.measuresinfotitle }).inject( tr_m );
  838. //var tetNode = new Element("div.itemMeasureTextNode", {
  839. // styles : this.css.itemMeasureTextNode,
  840. // text : (i+1) + ":" +data.measuresinfotitle
  841. //}).inject( measureNoe );
  842. }
  843. }.bind(this));
  844. },
  845. loadMeasureTooltip: function( node, measureId ){
  846. var tooltip = new MWF.xApplication.Report.MeasureTooltip( this.app.content, node, this.app, this.selectableMeasureObject[ measureId ], {
  847. style : "report",
  848. position : { x : "auto", y : "auto" },
  849. measureId : measureId,
  850. displayDelay : 300
  851. })
  852. },
  853. loadPlanTitleViewNext : function( container ){
  854. var _self = this;
  855. this.planViewTitleNextNode = new Element("div",{
  856. "data-id" : this.data.id
  857. }).inject( container );
  858. this.planTitleViewNext = new MWF.xApplication.Report.StrategyExplorer.PlanTitleViewNext(this.planViewTitleNextNode, this.app, this, {
  859. "style": "default",
  860. "reportId" : this.options.reportId,
  861. "isEdited" : this.options.isEdited,
  862. "templateUrl": this.explorer.path+"listItemPlanTitleNext.json"
  863. });
  864. this.planTitleViewNext.report = this.explorer.explorer;
  865. //this.planViewNext.data = this.data.planNextList;
  866. this.planTitleViewNext.load();
  867. },
  868. loadPlanViewNext : function( container ){
  869. var _self = this;
  870. this.planViewNextNode = new Element("div",{
  871. "data-id" : this.data.id
  872. }).inject( container );
  873. this.planViewNext = new MWF.xApplication.Report.StrategyExplorer.PlanViewNext(this.planViewNextNode, this.app, this, {
  874. "style": "default",
  875. "reportId" : this.options.reportId,
  876. "isEdited" : this.options.isEdited,
  877. "templateUrl": this.explorer.path+"listItemPlanNext.json"
  878. });
  879. this.planViewNext.report = this.explorer.explorer;
  880. //this.planViewNext.data = this.data.planNextList;
  881. this.planViewNext.load();
  882. },
  883. savePersonPlan: function( ev, noticeText ){
  884. var data = this.currentPersonData;
  885. var title = this.titleInput.get("value").trim();
  886. var content = this.contentInput.get("value").trim();
  887. if( title || content ){
  888. if( !data ){ //如果没有保存过
  889. data = {};
  890. var reportData = this.explorer.explorer.data;
  891. var keyworkData = this.data;
  892. data.reportId = reportData.id;
  893. data.workInfoId = keyworkData.id;
  894. data.keyWorkId = keyworkData.keyWorkId;
  895. data.workTitle = keyworkData.workTitle;
  896. data.flag = reportData.flag;
  897. data.year = reportData.year;
  898. data.month = reportData.month;
  899. data.week = reportData.week;
  900. data.date = reportData.date;
  901. data.targetPerson = ( layout.desktop.session.user || layout.user ).distinguishedName;
  902. data.orderNumber = this.options.orderNumber || 1;
  903. }
  904. data.title = title;
  905. data.workDescribe = content;
  906. data.planContent = content;
  907. this.app.restActions.savePlanNext( data, function(json){
  908. var id = json.data.id;
  909. this.app.restActions.getPlanNext( id, function(js){
  910. this.currentPersonData = js.data;
  911. }.bind(this))
  912. this.app.notice( noticeText, "success", ev.target.getParent() )
  913. }.bind(this));
  914. }else if( !title && !content && data ){ //清空内容了,需要删除
  915. this.app.restActions.deletePlanNext( data.id, function(){
  916. this.currentPersonData = null;
  917. this.app.notice( noticeText, "success", ev.target.getParent() )
  918. }.bind(this))
  919. }
  920. }
  921. });
  922. MWF.xApplication.Report.StrategyExplorer.Write.ExtWork = new Class({
  923. Implements: [Options, Events],
  924. options: {
  925. "style": "default",
  926. "reportId": "",
  927. "isEdited": true,
  928. "status": ""
  929. },
  930. initialize: function (container, explorer, data, options) {
  931. this.setOptions(options);
  932. this.container = container;
  933. this.explorer = explorer;
  934. this.app = this.explorer.app;
  935. this.lp = this.app.lp;
  936. this.css = this.explorer.css;
  937. this.actions = this.app.restActions;
  938. this.data = data;
  939. },
  940. load: function () {
  941. this.userName = ( layout.desktop.session.user || layout.user ).distinguishedName;
  942. this.summaryContainer_last = new Element("div").inject(this.container);
  943. this.personContainer = new Element("div").inject(this.container);
  944. this.summaryContainer = new Element("div").inject(this.container);
  945. this.listSummary_last();
  946. if( this.options.status == "confirm" || this.options.status == "write" ){
  947. this.listPersonData();
  948. }
  949. if( this.options.status == "confirm" || this.options.status == "audit" ){
  950. this.listSummaryData();
  951. }
  952. },
  953. listSummary_last : function(){
  954. if( this.data.WoReport_I_Ext_Contents_sumamry_lastMonth ){
  955. var table = this.table = new Element( "table", {
  956. "width":"100%",
  957. "border":"0",
  958. "cellpadding":"5",
  959. "cellspacing":"0",
  960. "styles" : this.css.formTable
  961. }).inject( this.summaryContainer_last );
  962. var tr = new Element("tr").inject( table );
  963. new Element("td", { colspan : 4, "styles": this.css.formTableTitle, text : "上月汇总" }).inject( tr );
  964. tr = new Element("tr").inject( table );
  965. new Element("td", { "width" : "30", "styles": this.css.formTableTitle, text : "序号" }).inject( tr );
  966. new Element("td", { "width" : "140", "styles": this.css.formTableTitle, text : "服务客户" }).inject( tr );
  967. new Element("td", { "width" : "140", "styles": this.css.formTableTitle, text : "关爱员工" }).inject( tr );
  968. new Element("td", { "width" : "140", "styles": this.css.formTableTitle, text : "意见建议" }).inject( tr );
  969. this.data.WoReport_I_Ext_Contents_sumamry_lastMonth.each( function( d, i ){
  970. tr = new Element("tr").inject( table );
  971. var td = new Element("td", { "width" : "30", "align" : "center", "styles": this.css.formTableValue, text : i+1 }).inject( tr );
  972. td.setStyle("text-align","center");
  973. new Element("td", {
  974. "text" : d.fuwu,
  975. "width" : "140",
  976. "styles": this.css.formTableValue
  977. }).inject( tr );
  978. new Element("td", {
  979. "text" : d.guanai,
  980. "width" : "140",
  981. "styles": this.css.formTableValue
  982. }).inject( tr );
  983. new Element("td", {
  984. "text" : d.yijian,
  985. "width" : "140",
  986. "styles": this.css.formTableValue
  987. }).inject( tr );
  988. }.bind(this) )
  989. }
  990. },
  991. listSummaryData : function(){
  992. var summaryData = this.data.WoReport_I_Ext_Contents_sumamry;
  993. if( !summaryData || !summaryData.length ){
  994. for( var i = 1; i<=5; i++ ){
  995. var d = {
  996. "infoLevel": "汇总",
  997. "orderNumber" : i
  998. };
  999. this.app.restActions.saveExtWork( this.data.id, d, function( json ){
  1000. }.bind(this), null, false)
  1001. }
  1002. this.actions.listExtWorkWithReportId(this.data.id, { "infoLevel": "汇总" }, function( json ){
  1003. this.loadSummaryGrid( json.data );
  1004. }.bind(this));
  1005. }else{
  1006. this.loadSummaryGrid( this.data.WoReport_I_Ext_Contents_sumamry );
  1007. }
  1008. },
  1009. listPersonData : function(){
  1010. var currentPersonData = [];
  1011. var otherPersonData = [];
  1012. //this.actions.listExtWorkWithReportId(this.options.reportId, { "infoLevel": "员工" }, function( json ){
  1013. var array = this.data.WoReport_I_Ext_Contents || [];
  1014. array.sort( function( a, b ){
  1015. var flag = a.targetPerson.localeCompare(b.targetPerson);
  1016. if( flag == 0 ){ //相等
  1017. return a.orderNumber - b.orderNumber;
  1018. }else{
  1019. return flag;
  1020. }
  1021. });
  1022. array.each( function(d){
  1023. if(d.targetPerson == this.userName && this.options.status == "write" ){
  1024. currentPersonData.push( d );
  1025. }else{
  1026. if( d.fuwu || d.guanai || d.yijian ){
  1027. otherPersonData.push( d );
  1028. }
  1029. }
  1030. }.bind(this));
  1031. this.loadPersonTable( otherPersonData );
  1032. if( this.options.status == "write" ){
  1033. this.loadPersonGrid( currentPersonData );
  1034. }
  1035. //}.bind(this));
  1036. },
  1037. loadSummaryGrid : function( data ){
  1038. this.gridContainer = new Element("div").inject( this.summaryContainer );
  1039. MWF.xDesktop.requireApp("Template", "MGrid", function () {
  1040. var extwork_grid = new MGrid( this.gridContainer, data, {
  1041. style: "report",
  1042. isEdited: this.options.isEdited ,
  1043. hasOperation: false,
  1044. hasSequence: true,
  1045. tableAttributes: {width: "100%", border: "0", cellpadding: "5", cellspacing: "0"},
  1046. itemTemplate: {
  1047. fuwu : {
  1048. attr : { placeholder: "请汇总服务客户"},
  1049. text: "服务客户",
  1050. type : "textarea",
  1051. event : { "blur" : function( item, ev ){ this.saveExtWork_summary( item, ev, "服务客户" ) }.bind(this) }
  1052. },
  1053. guanai: {
  1054. attr : { placeholder: "请汇总关爱员工"},
  1055. text: "关爱员工",
  1056. type : "textarea",
  1057. event : { "blur" : function(item, ev){ this.saveExtWork_summary( item , ev, "关爱员工") }.bind(this) }
  1058. },
  1059. yijian: {
  1060. attr : { placeholder: "请汇总意见建议"},
  1061. text: "意见建议",
  1062. type : "textarea",
  1063. event : { "blur" : function(item, ev){ this.saveExtWork_summary(item, ev, "意见建议") }.bind(this) }
  1064. }
  1065. },
  1066. onPostCreateTable: function ( grid ){
  1067. var table = grid.table;
  1068. var tr = new Element("tr").inject(table);
  1069. new Element("td", { "colspan" : 4, "styles": this.css.formTableTitle, text : "本月汇总" }).inject( tr );
  1070. },
  1071. onQueryCreateTr: function () {
  1072. },
  1073. onQueryRemoveTr: function(e, el, trObj){
  1074. }.bind(this)
  1075. }, this.app);
  1076. //vote_grid.setThTemplate("<tr><th label='fuwu' style=''></th><th button_add></th></tr>");
  1077. //vote_grid.setTrTemplate("<tr><td><div item='optionTextContent' style='padding-top:10px'></div><div item='optionPictureId' style='padding-top: 5px;'></div></td><td button_remove style='vertical-align: top;padding-top:15px;'></td></tr>");
  1078. extwork_grid.load();
  1079. var addTrCount = data.length ? 5 - data.length : 5;
  1080. extwork_grid.addTrs( addTrCount - 1 );
  1081. }.bind(this), true);
  1082. },
  1083. loadPersonTable: function( data ){
  1084. var table = this.table = new Element( "table", {
  1085. "width":"100%",
  1086. "border":"0",
  1087. "cellpadding":"5",
  1088. "cellspacing":"0",
  1089. "styles" : this.css.formTable
  1090. }).inject( this.personContainer );
  1091. var text = this.options.status == "write" ? "本月同事填写" : "本月员工填写";
  1092. var tr = new Element("tr").inject(table);
  1093. new Element("td", { "colspan" : (this.options.isEdited ? 5 : 4), "styles": this.css.formTableTitle, text : text }).inject( tr );
  1094. var tr = new Element("tr").inject( table );
  1095. new Element("td", { "width" : "20", "styles": this.css.formTableTitle, text : "姓名" }).inject( tr );
  1096. new Element("td", { "width" : "100", "styles": this.css.formTableTitle, text : "服务客户" }).inject( tr );
  1097. new Element("td", { "width" : "100", "styles": this.css.formTableTitle, text : "关爱员工" }).inject( tr );
  1098. new Element("td", { "width" : "100", "styles": this.css.formTableTitle, text : "意见建议" }).inject( tr );
  1099. data.each( function(d){
  1100. var tr = new Element("tr").inject( table );
  1101. new Element("td", { "styles": this.css.formTableValue, text : d.targetPerson.split("@")[0] }).inject( tr );
  1102. new Element("td", { "styles": this.css.formTableValue, text : d.fuwu }).inject( tr );
  1103. new Element("td", { "styles": this.css.formTableValue, text : d.guanai }).inject( tr );
  1104. new Element("td", { "styles": this.css.formTableValue, text : d.yijian }).inject( tr );
  1105. }.bind(this))
  1106. },
  1107. loadPersonGrid : function( data ){
  1108. this.gridContainer = new Element("div").inject( this.personContainer );
  1109. MWF.xDesktop.requireApp("Template", "MGrid", function () {
  1110. var extwork_grid = new MGrid( this.gridContainer, data, {
  1111. style: "report",
  1112. isEdited: this.options.isEdited ,
  1113. hasOperation: true,
  1114. hasSequence: true,
  1115. minTrCount: 1,
  1116. maxTrCount : 5,
  1117. tableAttributes: {width: "100%", border: "0", cellpadding: "5", cellspacing: "0"},
  1118. lp : {
  1119. "add" : "添加", "remove" : "删除"
  1120. },
  1121. itemTemplate: {
  1122. fuwu : {
  1123. text: "服务客户",
  1124. type : "textarea",
  1125. event : { "blur" : function( item, ev ){ this.saveExtWork_person( item, ev, "服务客户" ) }.bind(this) }
  1126. },
  1127. guanai: {
  1128. text: "关爱员工",
  1129. type : "textarea",
  1130. event : { "blur" : function(item, ev){ this.saveExtWork_person( item , ev, "关爱员工") }.bind(this) }
  1131. },
  1132. yijian: {
  1133. text: "意见建议",
  1134. type : "textarea",
  1135. event : { "blur" : function(item, ev){ this.saveExtWork_person(item, ev, "意见建议") }.bind(this) }
  1136. }
  1137. },
  1138. onNewData: function ( grid, callback ) {
  1139. var list = grid.trList;
  1140. if( list.length > 0 ){
  1141. var last = list[ list.length - 1 ];
  1142. var orderNumber = last.sourceData.orderNumber + 1;
  1143. }else{
  1144. var orderNumber = 1;
  1145. }
  1146. if( callback )callback( this.addEmptyExtWork_person( orderNumber ) ) ;
  1147. }.bind(this),
  1148. onPostCreateTable: function ( grid ){
  1149. var table = grid.table;
  1150. var tr = new Element("tr").inject(table);
  1151. new Element("td", { "colspan" : (this.options.isEdited ? 5 : 4), "styles": this.css.formTableTitle, text : "本月本人填写" }).inject( tr );
  1152. },
  1153. onQueryRemoveTr: function(e, el, trObj){
  1154. if( trObj.sourceData && trObj.sourceData.id ){
  1155. this.app.restActions.deleteExtWork( this.options.reportId, trObj.sourceData.id, function(){
  1156. }.bind(this), null, false)
  1157. }
  1158. }.bind(this)
  1159. }, this.app);
  1160. //vote_grid.setThTemplate("<tr><th label='fuwu' style=''></th><th button_add></th></tr>");
  1161. //vote_grid.setTrTemplate("<tr><td><div item='optionTextContent' style='padding-top:10px'></div><div item='optionPictureId' style='padding-top: 5px;'></div></td><td button_remove style='vertical-align: top;padding-top:15px;'></td></tr>");
  1162. extwork_grid.load();
  1163. //if (!d) {
  1164. //extwork_grid.addTrs(3);
  1165. //}
  1166. }.bind(this), true);
  1167. },
  1168. saveExtWork_summary: function( item, ev, noticeText ){
  1169. var result = item.parent.getResult(true, "<br>", false, false, true );
  1170. result.infoLevel = "汇总";
  1171. if(!result.orderNumber){
  1172. result.orderNumber = item.options.index;
  1173. }
  1174. if(this.app.onChangeValue)this.app.onChangeValue();
  1175. this.app.restActions.saveExtWork( this.data.id, result, function( json ){
  1176. if( !result.id ){
  1177. this.app.restActions.getExtWork( json.data.id, function( js ) {
  1178. item.parent.sourceData = js.data;
  1179. }.bind(this), null, false);
  1180. }
  1181. this.app.notice( noticeText+"保存并上传成功", "success", ev.target.getParent("tr") );
  1182. }.bind(this), null, false)
  1183. },
  1184. saveExtWork_person : function( item, ev, noticeText ){
  1185. var result = item.parent.getResult(true, "<br>", false, false, true );
  1186. result.infoLevel = "员工";
  1187. if( !result.orderNumber )result.orderNumber = 1;
  1188. this.app.restActions.saveExtWork( this.data.id, result, function( json ){
  1189. if( !result.id ){
  1190. this.app.restActions.getExtWork( json.data.id, function( js ) {
  1191. item.parent.sourceData = js.data;
  1192. }.bind(this), null, false);
  1193. }
  1194. this.app.notice( noticeText+"保存并上传成功", "success", ev.target.getParent("tr") );
  1195. }.bind(this), null, false)
  1196. },
  1197. addEmptyExtWork_person: function( orderNumber ){
  1198. var result = {};
  1199. result.infoLevel = "员工";
  1200. result.orderNumber = orderNumber;
  1201. var d;
  1202. this.app.restActions.saveExtWork( this.data.id, result, function( json ){
  1203. this.app.restActions.getExtWork( json.data.id, function( js ) {
  1204. d = js.data;
  1205. }.bind(this), null, false);
  1206. }.bind(this), null, false);
  1207. return d;
  1208. }
  1209. //saveExtWork: function( item, infoLevel ){
  1210. // var result = item.parent.getResult(true, "<br>", false, false, true );
  1211. // if( result.fuwu || result.guanai || result.yijian ){
  1212. // result.infoLevel = infoLevel;
  1213. // this.app.restActions.saveExtWork( this.data.id, result, function( json ){
  1214. // if( !result.id ){
  1215. //
  1216. // this.app.restActions.getExtWork( json.data.id, function( js ) {
  1217. // //if( !item.parent.sourceData )item.parent.sourceData = {};
  1218. // //item.parent.sourceData.id = json.data.id;
  1219. // item.parent.sourceData = js.data;
  1220. // }.bind(this));
  1221. // }
  1222. // }.bind(this), null, false)
  1223. // }else if( result.id ){
  1224. // if( infoLevel == "员工" ){
  1225. // this.app.restActions.deleteExtWork( result.id, this.options.reportId, function(){
  1226. // item.parent.sourceData = {};
  1227. // }.bind(this), null, false)
  1228. // }
  1229. // }
  1230. //}
  1231. });
  1232. MWF.xApplication.Report.StrategyExplorer.WorkView = new Class({
  1233. Extends: MWF.xApplication.Template.Explorer.ComplexView,
  1234. _createDocument: function (data, index) {
  1235. return new MWF.xApplication.Report.StrategyExplorer.WorkDocument( this.viewBodyNode || this.viewNode, data, this.departmentexplorer, this, null, index);
  1236. },
  1237. _getCurrentPageData: function(callback, count, pageNum){
  1238. //this.actions.listWork( this.options.reportId, function( json ){
  1239. // if( callback )callback( json );
  1240. //})
  1241. this.userName = ( layout.desktop.session.user || layout.user ).distinguishedName;
  1242. if( !this.loaded ){
  1243. this.loaded = true;
  1244. var arr = this.explorer.data.progList || [];
  1245. //this.setAction( arr );
  1246. if( callback )callback( { data : arr } )
  1247. }else{
  1248. this.explorer.explorer.listWork( this.explorer.data.id, this.loaded, function( arr ){
  1249. this.loaded = true;
  1250. arr.sort( function( a , b){
  1251. return a.orderNumber - b.orderNumber
  1252. });
  1253. //this.setAction( arr );
  1254. if( callback )callback( { data : arr } )
  1255. }.bind(this));
  1256. }
  1257. },
  1258. //setAction : function( arr ){
  1259. // var addFlag = true;
  1260. // for( var i=0; i<arr.length; i++ ){
  1261. // if( arr[i].targetPerson == this.userName ){
  1262. // addFlag = false;
  1263. // }
  1264. // }
  1265. // if(this.explorer.workAddAction)this.explorer.workAddAction.setStyle( "display", addFlag ? "" : "none" );
  1266. //},
  1267. _removeDocument: function (documentData, all) {
  1268. this.app.common.deleteWork( documentData, e, function(){
  1269. this.reload();
  1270. }.bind(this))
  1271. },
  1272. _openDocument: function (documentData) {
  1273. this.app.common.openWork( documentData, this.report.data, this.explorer.data, this, this.report.isEdited );
  1274. },
  1275. _postCreateViewBody : function( bodyNode ){
  1276. if( this.getStatus() == "write" && this.options.isEdited ){
  1277. this.contentInput = new Element("textarea", {
  1278. placeholder : "请填写您的工作总结",
  1279. styles : this.css.textarea
  1280. }).inject( this.container );
  1281. if( this.currentPersonData ){
  1282. this.contentInput.set("text", this.currentPersonData.progressContent );
  1283. this.contentInput.set("value", this.currentPersonData.progressContent );
  1284. }
  1285. this.contentInput.addEvent("blur", function(ev){
  1286. this.saveWork( ev, "工作总结保存并上传成功" );
  1287. }.bind(this))
  1288. }
  1289. },
  1290. saveWork: function(ev, noticeText){
  1291. var data = this.currentPersonData;
  1292. var content = this.contentInput.get("value").trim();
  1293. if( content ){
  1294. if( !data ){ //如果没有保存过
  1295. data = {};
  1296. var reportData = this.report.data;
  1297. var keyworkData = this.explorer.data;
  1298. data.reportId = reportData.id;
  1299. data.workInfoId = keyworkData.id;
  1300. data.keyWorkId = keyworkData.keyWorkId;
  1301. data.title = keyworkData.workTitle;
  1302. data.workTitle = keyworkData.workTitle;
  1303. data.flag = reportData.flag;
  1304. data.year = reportData.year;
  1305. data.month = reportData.month;
  1306. data.week = reportData.week;
  1307. data.date = reportData.date;
  1308. data.targetPerson = ( layout.desktop.session.user || layout.user ).distinguishedName;
  1309. data.orderNumber = this.options.orderNumber || 1;
  1310. }
  1311. data.workDescribe = content;
  1312. data.progressContent = content;
  1313. this.app.restActions.saveWork( data, function(json){
  1314. var id = json.data.id;
  1315. this.app.restActions.getWork( id, function(js){
  1316. this.currentPersonData = js.data;
  1317. }.bind(this));
  1318. this.app.notice( noticeText, "success", ev.target.getParent() )
  1319. }.bind(this));
  1320. }else if( !content && data ){ //清空内容了,需要删除
  1321. this.app.restActions.deleteWork( data.id, function(){
  1322. this.currentPersonData = null;
  1323. this.app.notice( noticeText, "success", ev.target.getParent() )
  1324. }.bind(this))
  1325. }
  1326. },
  1327. getStatus : function(){
  1328. if( !this.status ){
  1329. this.status = this.explorer.options.status;
  1330. }
  1331. return this.status
  1332. }
  1333. });
  1334. MWF.xApplication.Report.StrategyExplorer.WorkDocument = new Class({
  1335. Extends: MWF.xApplication.Template.Explorer.ComplexDocument,
  1336. open: function( ){
  1337. //this.view._openDocument( this.data )
  1338. },
  1339. edit: function(node, ev){
  1340. //this.app.common.editWork( this.data, this.view.report.data, this.explorer.data, this.view );
  1341. //ev.stopPropagation();
  1342. },
  1343. delete : function(node, ev){
  1344. this.app.common.deleteWork( this.data, ev, function(){
  1345. this.view.reload();
  1346. }.bind(this));
  1347. ev.stopPropagation();
  1348. },
  1349. _postCreateDocumentNode : function(node, data){
  1350. if( this.view.getStatus() == "write" && this.view.options.isEdited ){
  1351. if( data.targetPerson == this.view.userName ){
  1352. node.setStyle("display","none");
  1353. this.view.currentPersonData = data;
  1354. }
  1355. }
  1356. }
  1357. });
  1358. MWF.xApplication.Report.StrategyExplorer.PlanView = new Class({
  1359. Extends: MWF.xApplication.Template.Explorer.ComplexView,
  1360. _createDocument: function (data, index) {
  1361. return new MWF.xApplication.Report.StrategyExplorer.PlanDocument( this.viewBodyNode || this.viewNode, data, this.explorer, this, null, index);
  1362. },
  1363. _getCurrentPageData: function(callback, count, pageNum){
  1364. //this.actions.listPlan( this.options.reportId, function( json ){
  1365. // if( callback )callback( json );
  1366. //})
  1367. this.userName = ( layout.desktop.session.user || layout.user ).distinguishedName;
  1368. if( !this.loaded ){
  1369. this.loaded = true;
  1370. if( callback )callback( { data : this.explorer.data.planList } )
  1371. }else{
  1372. this.explorer.explorer.listPlan( this.explorer.data.id, this.loaded, function( arr ){
  1373. this.loaded = true;
  1374. arr.sort( function( a , b){
  1375. return a.orderNumber - b.orderNumber
  1376. });
  1377. if( callback )callback( { data : arr } )
  1378. }.bind(this));
  1379. }
  1380. //if( callback )callback( { data : this.data || [] } )
  1381. },
  1382. _openDocument: function (documentData) {
  1383. this.app.common.openPlan( documentData, this.report.data, this.explorer.data, this, false, this.report.isEdited );
  1384. }
  1385. });
  1386. MWF.xApplication.Report.StrategyExplorer.PlanDocument = new Class({
  1387. Extends: MWF.xApplication.Template.Explorer.ComplexDocument,
  1388. open: function( ){
  1389. this.view._openDocument( this.data )
  1390. },
  1391. edit: function( node , ev ){
  1392. this.app.common.editPlan( this.data, this.view.report.data, this.explorer.data, this.view, false );
  1393. ev.stopPropagation();
  1394. },
  1395. delete : function(node, ev){
  1396. this.app.common.deletePlan( this.data, ev, function (){
  1397. this.view.reload();
  1398. }.bind(this));
  1399. ev.stopPropagation();
  1400. }
  1401. });
  1402. MWF.xApplication.Report.StrategyExplorer.PlanViewNext = new Class({
  1403. Extends: MWF.xApplication.Template.Explorer.ComplexView,
  1404. _createDocument: function (data, index) {
  1405. return new MWF.xApplication.Report.StrategyExplorer.PlanDocumentNext(this.viewBodyNode || this.viewNode, data, this.explorer, this, null, index);
  1406. },
  1407. _getCurrentPageData: function(callback, count, pageNum){
  1408. this.userName = ( layout.desktop.session.user || layout.user ).distinguishedName;
  1409. var addFlag = true;
  1410. if( !this.loaded ){
  1411. this.loaded = true;
  1412. var arr = this.explorer.data.planNextList || [];
  1413. //this.setAction( arr );
  1414. if( callback )callback( { data : arr } )
  1415. }else{
  1416. this.explorer.explorer.listPlanNext( this.explorer.data.id, this.loaded, function( arr ){
  1417. this.loaded = true;
  1418. arr.sort( function( a , b){
  1419. return a.orderNumber - b.orderNumber
  1420. });
  1421. //this.setAction( arr );
  1422. if( callback )callback( { data : arr } )
  1423. }.bind(this));
  1424. }
  1425. },
  1426. _openDocument: function (documentData) {
  1427. this.app.common.openPlan( documentData, this.report.data, this.explorer.data,this, true, this.report.isEdited );
  1428. },
  1429. _postCreateViewBody : function( bodyNode ){
  1430. if( this.getStatus() == "write" && this.options.isEdited ){
  1431. this.explorer.contentInput = new Element("textarea", {
  1432. placeholder : "请填写计划",
  1433. styles : this.css.textarea
  1434. }).inject( this.container );
  1435. if( this.explorer.currentPersonData ){
  1436. this.explorer.contentInput.set("text", this.explorer.currentPersonData.planContent);
  1437. this.explorer.contentInput.set("value", this.explorer.currentPersonData.planContent)
  1438. }
  1439. this.explorer.contentInput.addEvent("blur", function(ev){
  1440. this.explorer.savePersonPlan( ev, "计划保存并上传成功" );
  1441. }.bind(this))
  1442. }
  1443. },
  1444. getStatus : function(){
  1445. if( !this.status ){
  1446. this.status = this.explorer.options.status;
  1447. }
  1448. return this.status
  1449. }
  1450. });
  1451. MWF.xApplication.Report.StrategyExplorer.PlanDocumentNext = new Class({
  1452. Extends: MWF.xApplication.Template.Explorer.ComplexDocument,
  1453. open: function( ){
  1454. this.view._openDocument( this.data )
  1455. },
  1456. edit: function( node , ev ){
  1457. this.app.common.editPlan( this.data, this.view.report.data, this.explorer.data, this.view, true );
  1458. ev.stopPropagation();
  1459. },
  1460. delete : function(node, ev){
  1461. this.app.common.deletePlanNext( this.data, ev, function () {
  1462. this.view.reload();
  1463. }.bind(this));
  1464. ev.stopPropagation();
  1465. },
  1466. _postCreateDocumentNode : function(node, data){
  1467. if( this.view.getStatus() == "write" && this.view.options.isEdited ){
  1468. if( data.targetPerson == this.view.userName ){
  1469. node.setStyle("display","none");
  1470. this.explorer.currentPersonData = data;
  1471. }
  1472. }
  1473. }
  1474. });
  1475. MWF.xApplication.Report.StrategyExplorer.PlanTitleViewNext = new Class({
  1476. Extends: MWF.xApplication.Template.Explorer.ComplexView,
  1477. _createDocument: function (data, index) {
  1478. return new MWF.xApplication.Report.StrategyExplorer.PlanTitleDocumentNext(this.viewBodyNode || this.viewNode, data, this.explorer, this, null, index);
  1479. },
  1480. _getCurrentPageData: function(callback, count, pageNum){
  1481. this.userName = ( layout.desktop.session.user || layout.user ).distinguishedName;
  1482. var addFlag = true;
  1483. if( !this.loaded ){
  1484. this.loaded = true;
  1485. var arr = this.explorer.data.planNextList || [];
  1486. //this.setAction( arr );
  1487. if( callback )callback( { data : arr } )
  1488. }else{
  1489. this.explorer.explorer.listPlanNext( this.explorer.data.id, this.loaded, function( arr ){
  1490. this.loaded = true;
  1491. arr.sort( function( a , b){
  1492. return a.orderNumber - b.orderNumber
  1493. });
  1494. //this.setAction( arr );
  1495. if( callback )callback( { data : arr } )
  1496. }.bind(this));
  1497. }
  1498. },
  1499. _postCreateViewBody : function( bodyNode ){
  1500. if( this.getStatus() == "write" && this.options.isEdited ) {
  1501. this.explorer.titleInput = new Element("textarea", {
  1502. placeholder: "请填写标题",
  1503. styles: this.css.textarea
  1504. }).inject(this.container);
  1505. this.explorer.explorer.nextMonth_inputTitle.push( this.explorer.titleInput );
  1506. if (this.explorer.currentPersonData) {
  1507. this.explorer.titleInput.set("text",this.explorer.currentPersonData.title);
  1508. this.explorer.titleInput.set("value",this.explorer.currentPersonData.title);
  1509. }
  1510. this.explorer.titleInput.addEvent("blur", function ( ev ) {
  1511. this.explorer.savePersonPlan( ev, "标题保存并上传成功" );
  1512. }.bind(this))
  1513. }
  1514. },
  1515. getStatus : function(){
  1516. if( !this.status ){
  1517. this.status = this.explorer.options.status;
  1518. }
  1519. return this.status
  1520. }
  1521. });
  1522. MWF.xApplication.Report.StrategyExplorer.PlanTitleDocumentNext = new Class({
  1523. Extends: MWF.xApplication.Template.Explorer.ComplexDocument,
  1524. open: function( ){
  1525. this.view._openDocument( this.data )
  1526. },
  1527. edit: function( node , ev ){
  1528. this.app.common.editPlan( this.data, this.view.report.data, this.explorer.data, this.view, true );
  1529. ev.stopPropagation();
  1530. },
  1531. delete : function(node, ev){
  1532. this.app.common.deletePlanNext( this.data, ev, function () {
  1533. this.view.reload();
  1534. }.bind(this));
  1535. ev.stopPropagation();
  1536. },
  1537. _postCreateDocumentNode : function(node, data){
  1538. if( this.view.getStatus() == "write" && this.view.options.isEdited ){
  1539. if(data.targetPerson == this.view.userName ){
  1540. node.setStyle("display","none");
  1541. this.explorer.currentPersonData = data;
  1542. }
  1543. }
  1544. }
  1545. });