StrategyExplorerWrite.js 73 KB

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