WorkDetail.js 38 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879
  1. MWF.xApplication.Execution = MWF.xApplication.Execution || {};
  2. MWF.xDesktop.requireApp("Execution", "WorkForm", null, false);
  3. MWF.xDesktop.requireApp("Execution", "Chat", null, false);
  4. MWF.xDesktop.requireApp("Execution","ReportAttachment",null,false);
  5. MWF.xApplication.Execution.WorkDetail = new Class({
  6. Extends: MWF.xApplication.Execution.WorkForm,
  7. Implements: [Options, Events],
  8. options: {
  9. "style": "default",
  10. "width": "100%",
  11. "height": "100%",
  12. "hasTop": true,
  13. "hasIcon": false,
  14. "hasBottom": false,
  15. "title": "",
  16. "draggable": false,
  17. "closeAction": true,
  18. "isNew": false,
  19. "isEdited": true,
  20. "hasScroll" : false
  21. },
  22. initialize: function (explorer, actions, data, options) {
  23. this.setOptions(options);
  24. this.explorer = explorer;
  25. this.app = explorer.app||explorer;
  26. this.lp = this.app.lp;
  27. this.actions = this.app.restActions;
  28. this.path = "../x_component_Execution/$WorkDetail/";
  29. this.cssPath = this.path + this.options.style + "/css.wcss";
  30. this._loadCss();
  31. this.options.title = this.lp.title;
  32. //this.container = this.options.container || this.app.content;
  33. this.data = data || {};
  34. this.workDetailLp = this.app.lp.WorkDetail;
  35. this.actions.getBaseWorkInfo(this.data.id,function(json){
  36. if(json.data){
  37. this.baseWorkData = json.data
  38. }
  39. }.bind(this),
  40. function(xhr,text,error){
  41. this.showErrorMessage(xhr,text,error)
  42. }.bind(this),false
  43. )
  44. },
  45. reload:function(){
  46. this._createTableContent();
  47. this.setFormNodeSize();
  48. },
  49. createTopNode: function () {
  50. if (!this.formTopNode) {
  51. this.formTopNode = new Element("div.formTopNode", {
  52. "styles": this.css.formTopNode
  53. }).inject(this.formNode);
  54. this.formTopIconNode = new Element("div", {
  55. "styles": this.css.formTopIconNode
  56. }).inject(this.formTopNode);
  57. this.formTopTextNode = new Element("div.formTopTextNode", {
  58. "styles": this.css.formTopTextNode,
  59. "text": this.data.title || ""
  60. }).inject(this.formTopNode);
  61. if (this.options.closeAction) {
  62. this.formTopCloseActionNode = new Element("div", {"styles": this.css.formTopCloseActionNode}).inject(this.formTopNode);
  63. this.formTopCloseActionNode.addEvent("click", function () {
  64. this.close();
  65. }.bind(this));
  66. }
  67. this._createTopContent();
  68. }
  69. },
  70. _createTopContent: function () {
  71. },
  72. _createTableContent: function () {
  73. if(this.table) this.table.destroy();
  74. this.table = new Element("table.table", {
  75. "height": "100%",
  76. "border": "0",
  77. "cellpadding": "0",
  78. "cellspacing": "0",
  79. "class": "formTable"
  80. }).inject(this.formTableArea);
  81. this.tr = new Element("tr", {
  82. "valign": "top"
  83. }).inject(this.table);
  84. this.leftArea = new Element("td.leftArea", {
  85. "styles": this.css.leftArea
  86. }).inject(this.tr);
  87. this.detailArea = new Element("td.detailArea", {
  88. "styles": this.css.detailArea
  89. }).inject(this.tr);
  90. this.chatArea = new Element("td.chatArea", {
  91. "styles": this.css.chatArea
  92. }).inject(this.tr);
  93. this.loadLeftContent();
  94. this.loadForm();
  95. this.loadChatNode();
  96. this.setContentSize();
  97. this.setContentSizeFun = this.setContentSize.bind(this);
  98. this.app.addEvent("resize", this.setContentSizeFun);
  99. },
  100. loadLeftContent: function () {
  101. this.reportArea = new Element("div.reportArea", {
  102. "styles": this.css.reportArea
  103. }).inject(this.leftArea);
  104. this.loadReportTop();
  105. this.loadReportContent();
  106. this.questionArea = new Element("div.questionArea", {
  107. "styles": this.css.questionArea
  108. }).inject(this.leftArea);
  109. this.loadQuestionTop();
  110. this.loadQuestionContent();
  111. },
  112. loadReportTop: function () {
  113. this.reportTopNode = new Element("div.reportTopNode", {
  114. "styles": this.css.reportTopNode
  115. }).inject(this.reportArea);
  116. this.reportTopIconNode = new Element("div.reportTopIconNode", {
  117. "styles": this.css.reportTopIconNode
  118. }).inject(this.reportTopNode);
  119. this.reportTopTextNode = new Element("div.reportTopTextNode", {
  120. "styles": this.css.reportTopTextNode,
  121. "text": this.lp.workReportTitle
  122. }).inject(this.reportTopNode);
  123. this.actions.getBaseWorkActions(this.baseWorkData.id,function(json){
  124. if(json.type=="success"){
  125. if(json.data && json.data.operation){
  126. if(json.data.operation.indexOf("REPORT")>-1){
  127. this.startReportDiv = new Element("div.startReport",{
  128. "styles":this.css.startReport,
  129. "text":this.lp.WorkDetail.startReport
  130. }).inject(this.reportTopNode);
  131. this.startReportDiv.addEvents({
  132. "click":function(){
  133. MWF.xDesktop.requireApp("Execution", "WorkReport", function(){
  134. var data = {
  135. workId : this.baseWorkData.id
  136. };
  137. var workReport = new MWF.xApplication.Execution.WorkReport(this, this.actions,data,{
  138. "isNew": false,
  139. "isEdited": false,
  140. "tabLocation":"workDetail",
  141. "from":"drafter",
  142. "onPostClose":function(){
  143. this.reload();
  144. }.bind(this)
  145. //"container":this.formAreaNode
  146. });
  147. //workReport.container = this.formAreaNode;
  148. workReport.load();
  149. //this.load();
  150. }.bind(this));
  151. }.bind(this)
  152. })
  153. }
  154. }
  155. }
  156. }.bind(this))
  157. },
  158. loadReportContent: function () {
  159. _self = this;
  160. this.reportContentNode = new Element("div.reportContentNode", {
  161. "styles": this.css.reportContentNode
  162. }).inject(this.reportArea);
  163. this.getReportData(function(json){
  164. if( json.data ){
  165. json.data.each(function (d) {
  166. var color = "";
  167. if(d.activityName == this.lp.WorkReport.activityName.drafter) color = "#ff0000";
  168. else{
  169. if(d.processLogs){
  170. d.processLogs.each(function(dd){
  171. if(dd.activityName == this.lp.WorkReport.activityName.leader){
  172. color = "#00FF00"
  173. }
  174. }.bind(this))
  175. }
  176. }
  177. if(d.progressDescription=="" && d.workPlan=="") color= "#ff0000";
  178. if(d.createTime){
  179. var createTimes = d.createTime.split(" ")[0].split("-");
  180. var createTime = createTimes[0] + this.lp.year + createTimes[1] + this.lp.month + createTimes[2] + this.lp.day;
  181. }else{
  182. var createTime = "";
  183. }
  184. var reportItemNode = new Element("div", {
  185. "styles": this.css.reportItemNode
  186. }).inject(this.reportContentNode);
  187. new Element("div", {
  188. "styles": this.css.reportItemIconNode
  189. }).inject(reportItemNode);
  190. var reportItemTextNode = new Element("div", {
  191. "styles": this.css.reportItemTextNode,
  192. //"text": createTime + "-" + d.shortTitle
  193. "html" : "<font color='"+color+"'>"+createTime + "-" + d.shortTitle +"</font>"
  194. }).inject(reportItemNode);
  195. reportItemNode.addEvents({
  196. "mouseover" : function(){
  197. if( _self.curReportItemNode != this.node )this.node.setStyles( _self.css.reportItemNode_over );
  198. }.bind({ node : reportItemNode }),
  199. "mouseout" : function(){
  200. if( _self.curReportItemNode != this.node )this.node.setStyles( _self.css.reportItemNode );
  201. }.bind({ node : reportItemNode }),
  202. "click": function( ){
  203. if( this.node != _self.curReportItemNode ){
  204. this.node.setStyles( _self.css.reportItemNode_over );
  205. if(_self.curReportItemNode)_self.curReportItemNode.setStyles( _self.css.reportItemNode );
  206. _self.curReportItemNode = this.node;
  207. _self.createPrevReportInfor( this.data.id );
  208. }
  209. }.bind({ data : d, node : reportItemNode })
  210. })
  211. }.bind(this))
  212. }
  213. }.bind(this));
  214. this.app.setScrollBar(this.reportContentNode)
  215. },
  216. getReportData: function (callback) {
  217. this.actions.getWorkReportList( this.data.id , function(json){
  218. if (callback)callback(json)
  219. })
  220. },
  221. createPrevReportInfor : function(workReportId){
  222. var lp = this.app.lp.WorkReport;
  223. if(this.prevReportInforDiv) this.prevReportInforDiv.destroy();
  224. this.prevReportInforDiv = new Element("div.prevReportInforDiv",{
  225. "styles": this.css.prevReportInforDiv
  226. }).inject(this.formTableContainer);
  227. this.prevReportInforTopDiv = new Element("div.prevReportInforTopDiv",{
  228. "styles":this.css.prevReportInforTopDiv
  229. }).inject(this.prevReportInforDiv);
  230. this.prevReportInforTopCloseDiv = new Element("div.prevReportInforTopCloseDiv",{
  231. "styles": this.css.prevReportInforTopCloseDiv
  232. }).inject(this.prevReportInforTopDiv)
  233. .addEvents({
  234. "click": function(){
  235. this.prevReportInforDiv.destroy();
  236. if(this.curReportItemNode)this.curReportItemNode.setStyles( this.css.reportItemNode );
  237. this.curReportItemNode = null;
  238. }.bind(this)
  239. });
  240. this.prevReportInforListDiv = new Element("div.prevReportInforListDiv",{
  241. "styles":this.css.prevReportInforListDiv
  242. }).inject(this.prevReportInforDiv);
  243. this.prevReportInforListDiv.setStyles({"height":this.reportContentInforHeight+"px"})
  244. //这里显示具体内容
  245. this.app.createShade(this.prevReportInforDiv);
  246. this.actions.getWorkReport(workReportId,function(json){
  247. this.app.destroyShade();
  248. //alert(JSON.stringify(json))
  249. if(json.type == "success"){
  250. var prevContentDiv = new Element("div.prevContentDiv",{
  251. "styles": this.css.prevContentDiv
  252. }).inject(this.prevReportInforListDiv);
  253. var prevContentTitleDiv = new Element("div.prevContentTitleDiv",{
  254. "styles" : this.css.prevContentTitleDiv,
  255. "text" : lp.contentTitle1 + ":"
  256. }).inject(prevContentDiv);
  257. var prevContentValueDiv = new Element("div.prevContentValueDiv",{
  258. "styles": this.css.prevContentValueDiv,
  259. "text" : json.data.progressDescription
  260. }).inject(prevContentDiv);
  261. prevContentDiv = new Element("div.prevContentDiv",{
  262. "styles": this.css.prevContentDiv
  263. }).inject(this.prevReportInforListDiv);
  264. prevContentTitleDiv = new Element("div.prevContentTitleDiv",{
  265. "styles" : this.css.prevContentTitleDiv,
  266. "text" : lp.contentTitle2 + ":"
  267. }).inject(prevContentDiv);
  268. prevContentValueDiv = new Element("div.prevContentValueDiv",{
  269. "styles": this.css.prevContentValueDiv,
  270. "text" : json.data.workPlan
  271. }).inject(prevContentDiv);
  272. //是否办结
  273. prevContentDiv = new Element("div.prevContentDiv",{
  274. "styles": this.css.prevContentDiv
  275. }).inject(this.prevReportInforListDiv);
  276. prevContentTitleDiv = new Element("div.prevContentTitleDiv",{
  277. "styles" : this.css.prevContentTitleDiv,
  278. "text" : this.workDetailLp.isCompleted+":"
  279. }).inject(prevContentDiv);
  280. var tmpstr = json.data.isWorkCompleted?" 是 ":" 否 ";
  281. tmpstr = this.workDetailLp.isCompleted+":" + tmpstr;
  282. tmpstr = tmpstr + " " +this.workDetailLp.completePercent + " " + parseInt(json.data.progressPercent)+"%";
  283. prevContentTitleDiv.set("text",tmpstr);
  284. //管理员督办
  285. if(json.data.needAdminAudit){
  286. prevContentDiv = new Element("div.prevContentDiv",{
  287. "styles": this.css.prevContentDiv
  288. }).inject(this.prevReportInforListDiv);
  289. prevContentTitleDiv = new Element("div.prevContentTitleDiv",{
  290. "styles" : this.css.prevContentTitleDiv,
  291. "text" : lp.adminContentTitle + ":"
  292. }).inject(prevContentDiv);
  293. prevContentValueDiv = new Element("div.prevContentValueDiv",{
  294. "styles": this.css.prevContentValueDiv,
  295. "text" : json.data.adminSuperviseInfo?json.data.adminSuperviseInfo:""
  296. }).inject(prevContentDiv);
  297. }
  298. //领导评价
  299. prevContentDiv = new Element("div.prevContentDiv",{
  300. "styles": this.css.prevContentDiv
  301. }).inject(this.prevReportInforListDiv);
  302. prevContentTitleDiv = new Element("div.prevContentTitleDiv",{
  303. "styles" : this.css.prevContentTitleDiv,
  304. "text" : lp.leaderContentTitle + ":"
  305. }).inject(prevContentDiv);
  306. prevContentValueDiv = new Element("div.prevContentValueDiv",{
  307. "styles": this.css.prevContentValueDiv
  308. }).inject(prevContentDiv);
  309. var reportLeaderOpinionsDiv = new Element("div.reportLeaderOpinionsDiv",{
  310. "styles":this.css.reportLeaderOpinionsDiv
  311. }).inject(prevContentValueDiv);
  312. //alert(JSON.stringify(json.data.processLogs))
  313. var preLogs = json.data.processLogs;
  314. this.preLeaderTitle = [];
  315. this.preLeaderValue = [];
  316. if(preLogs){
  317. preLogs.each(function(data){
  318. if(data.activityName == this.lp.WorkReport.activityName.leader && data.processStatus == this.lp.WorkReport.status.drafter && data.processorIdentity == this.app.identity){
  319. this.leaderOpinionDrafter = data.opinion
  320. }else{
  321. if(data.activityName == this.lp.WorkReport.activityName.leader && data.processStatus == this.lp.WorkReport.status.effect){
  322. this.preLeaderTitle.push(data.processorIdentity.split("@")[0]+"("+data.processTimeStr+")");
  323. this.preLeaderValue.push(data.opinion )
  324. }
  325. }
  326. }.bind(this))
  327. }
  328. for(var i=0;i<this.preLeaderTitle.length;i++){
  329. var reportLeaderContentDiv = new Element("div.reportLeaderContentDiv",{"styles":this.css.reportLeaderContentDiv}).inject(reportLeaderOpinionsDiv);
  330. reportLeaderContentDiv.setStyle("border-bottom","1px dashed #3c76c1");
  331. var reportLeaderTitleDiv = new Element("div.reportLeaderTitleDiv",{
  332. "styles":this.css.reportLeaderTitleDiv,
  333. "text":this.preLeaderTitle[i]+":"
  334. }).inject(reportLeaderContentDiv);
  335. var reportLeaderValueDiv = new Element("div.reportLeaderValueDiv",{
  336. "styles":this.css.reportLeaderValueDiv,
  337. "text":this.preLeaderValue[i]
  338. }).inject(reportLeaderContentDiv);
  339. }
  340. //附件
  341. prevContentDiv = new Element("div.prevContentDiv",{
  342. "styles": this.css.prevContentDiv
  343. }).inject(this.prevReportInforListDiv);
  344. prevContentTitleDiv = new Element("div.prevContentTitleDiv",{
  345. "styles" : this.css.prevContentTitleDiv,
  346. "text" : this.workDetailLp.attachment+":"
  347. }).inject(prevContentDiv);
  348. prevContentValueDiv = new Element("div.prevContentValueDiv",{
  349. "styles": this.css.prevContentValueDiv
  350. }).inject(prevContentDiv);
  351. this.loadReportAttachment(prevContentValueDiv,workReportId);
  352. }
  353. }.bind(this),null,true);
  354. this.app.setScrollBar(this.prevReportInforListDiv);
  355. },
  356. loadReportAttachment: function( area,id ){
  357. this.attachment = new MWF.xApplication.Execution.ReportAttachment( area, this.app, this.actions, this.app.lp, {
  358. //documentId : this.data.workId,
  359. documentId : id,
  360. isNew : this.options.isNew,
  361. isEdited : false,
  362. "size":"min"
  363. });
  364. this.attachment.load();
  365. },
  366. loadQuestionTop: function () {
  367. this.questionTopNode = new Element("div.questionTopNode", {
  368. "styles": this.css.questionTopNode
  369. }).inject(this.questionArea);
  370. this.questionTopIconNode = new Element("div", {
  371. "styles": this.css.questionTopIconNode
  372. }).inject(this.questionTopNode);
  373. this.questionTopTextNode = new Element("div", {
  374. "styles": this.css.questionTopTextNode,
  375. "text": this.lp.workQuestionTitle
  376. }).inject(this.questionTopNode)
  377. },
  378. loadQuestionContent: function () {
  379. this.questionContentNode = new Element("div", {
  380. "styles": this.css.questionContentNode
  381. }).inject(this.questionArea);
  382. this.app.setScrollBar(this.questionContentNode);
  383. this.getQuestionData(function (json) {
  384. json.data.each(function (d) {
  385. var questionItemNode = new Element("div", {
  386. "styles": this.css.questionItemNode
  387. }).inject(this.questionContentNode);
  388. new Element("div", {
  389. "styles": this.css.questionItemIconNode
  390. }).inject(questionItemNode);
  391. var questionItemTextNode = new Element("div", {
  392. "styles": this.css.questionItemTextNode,
  393. "text": d.subject
  394. }).inject(questionItemNode)
  395. }.bind(this))
  396. }.bind(this))
  397. },
  398. getQuestionData: function (callback) {
  399. var json = { data : [] };
  400. if (callback)callback(json)
  401. },
  402. loadChatNode: function () {
  403. this.chatTopNode = new Element("div.chatTopNode", {
  404. "styles": this.css.chatTopNode
  405. }).inject(this.chatArea);
  406. this.chatTopIconNode = new Element("div", {
  407. "styles": this.css.chatTopIconNode
  408. }).inject(this.chatTopNode);
  409. this.chatTopTextNode = new Element("div", {
  410. "styles": this.css.chatTopTextNode,
  411. "text": this.lp.workChatTitle
  412. }).inject(this.chatTopNode);
  413. this.loadChatContent();
  414. },
  415. loadChatContent: function () {
  416. this.chatContentNode = new Element("div", {
  417. "styles": this.css.chatContentNode
  418. }).inject(this.chatArea);
  419. this.chatContentListNode = new Element("div.chatContentListNode", {
  420. "styles": this.css.chatContentListNode
  421. }).inject(this.chatContentNode);
  422. this.chatEditorNode = new Element("div",{
  423. "styles": this.css.chatEditorNode
  424. }).inject(this.chatContentNode);
  425. this.chat = new MWF.xApplication.Execution.Chat(this.chatContentListNode, this.chatEditorNode, this.app, this.actions, this.lp, {
  426. "workId": this.data.id
  427. });
  428. this.chat.load();
  429. //this.getChatData(function (json) {
  430. //
  431. //}.bind(this))
  432. //
  433. //this.loadEditor(this.chatEditorNode)
  434. },
  435. getChatData: function (callback) {
  436. var json = {};
  437. if (callback)callback(json)
  438. },
  439. loadForm: function () {
  440. this.detailTopNode = new Element("div.detailTopNode", {
  441. "styles": this.css.detailTopNode
  442. }).inject(this.detailArea);
  443. this.detailTopIconNode = new Element("div.detailTopIconNode", {
  444. "styles": this.css.detailTopIconNode
  445. }).inject(this.detailTopNode);
  446. this.detailTopTextNode = new Element("div.detailTopTextNode", {
  447. "styles": this.css.detailTopTextNode,
  448. "text": this.lp.workDetailTitle
  449. }).inject(this.detailTopNode);
  450. if(this.data.status && this.data.status == this.workDetailLp.archiveStatus){
  451. var archiveDate = this.data.archiveDate && this.data.archiveDate!="" ? ":"+this.data.archiveDate:"";
  452. this.archiveTextDiv = new Element("div.archiveTextDiv",{
  453. "styles":this.css.archiveTextDiv,
  454. "text":"("+this.workDetailLp.archiveStatus+archiveDate+")"
  455. }).inject(this.detailTopNode);
  456. }
  457. this.detailContentNode = new Element("div.detailContentNode", {
  458. "styles": this.css.detailContentNode
  459. }).inject(this.detailArea);
  460. var html = "<table width='100%' border='0' cellpadding='5' cellspacing='0' styles='formTable'>" +
  461. "<tr>" +
  462. " <td styles='formTableTitle' lable='centerWorkTitle'></td>" +
  463. " <td styles='formTableValue' item='centerWorkTitle' colspan='3'></td>" +
  464. "</tr><tr>" +
  465. " <td styles='formTableTitle' lable='timeLimit'></td>" +
  466. " <td styles='formTableValue' item='timeLimit'></td>" +
  467. " <td styles='formTableTitle' lable='reportCycle'></td>" +
  468. " <td styles='formTableValue'><span item='reportCycle'></span><span item='reportDay'></span></td>" +
  469. "</tr><tr>" +
  470. " <td styles='formTableTitle' lable='dutyDepartment'></td>" +
  471. " <td styles='formTableValue' item='dutyDepartment'></td>" +
  472. " <td styles='formTableTitle' lable='dutyPerson'></td>" +
  473. " <td styles='formTableValue' item='dutyPerson'></td>" +
  474. "</tr><tr>" +
  475. " <td styles='formTableTitle' lable='secondDepartment'></td>" +
  476. " <td styles='formTableValue' item='secondDepartment'></td>" +
  477. " <td styles='formTableTitle' lable='secondPerson'></td>" +
  478. " <td styles='formTableValue' item='secondPerson'></td>" +
  479. "</tr><tr>" +
  480. " <td styles='formTableTitle' lable='readReader'></td>" +
  481. " <td styles='formTableValue' item='readReader' colspan='3'></td>" +
  482. "</tr><tr>" +
  483. //" <td styles='formTableTitle' lable='subject'></td>" +
  484. //" <td styles='formTableValue' item='subject' colspan='3'></td>" +
  485. //"</tr><tr>" +
  486. " <td styles='formTableValue' colspan='4'>" +
  487. " <div styles='formTableTitleDiv' lable='workSplitAndDescription'></div>" +
  488. " <div styles='formTableValueDiv' item='workSplitAndDescription'></div>" +
  489. " </td>" +
  490. "</tr><tr>" +
  491. " <td styles='formTableValue' colspan='4'>" +
  492. " <div styles='formTableTitleDiv' lable='specificActionInitiatives'></div>" +
  493. " <div styles='formTableValueDiv' item='specificActionInitiatives'></div>" +
  494. " </td>" +
  495. "</tr><tr>" +
  496. " <td styles='formTableValue' colspan='4'>" +
  497. " <div styles='formTableTitleDiv' lable='milestoneMark'></div>" +
  498. " <div styles='formTableValueDiv' item='milestoneMark'></div>" +
  499. " </td>" +
  500. "</tr><tr>" +
  501. " <td styles='formTableValue' colspan='4'>" +
  502. " <div styles='formTableValueDiv' item='attachments'></div>"+
  503. " </td>" +
  504. "</tr>"+
  505. "</table>";
  506. this.detailContentNode.set("html", html);
  507. this.form = new MForm(this.detailContentNode, this.data, {
  508. style: "execution",
  509. isEdited: this.isEdited || this.isNew,
  510. itemTemplate: this.getWorkDetailsItemTemplate(this.lp.workForm),
  511. onPostLoad:function(){
  512. }.bind(this)
  513. }, this.app,this.css);
  514. this.form.load();
  515. this.attachmentArea = this.detailArea.getElement("[item='attachments']");
  516. this.loadAttachment(this.attachmentArea);
  517. this.checkArea = new Element("div.checkArea",{
  518. "styles":this.css.checkArea
  519. }).inject(this.detailContentNode);
  520. this.checkTitle = new Element("div.checkTitle",{
  521. "styles":this.css.checkTitle,
  522. "text":this.workDetailLp.checkTitle
  523. }).inject(this.checkArea);
  524. this.checkContent = new Element("div.checkContent",{
  525. "styles":this.css.checkContent
  526. }).inject(this.checkArea);
  527. var tmpStr = this.workDetailLp.checkEmpty;
  528. if(this.baseWorkData.currentAppraiseStatus && this.baseWorkData.currentAppraiseStatus!=""){
  529. if(this.baseWorkData.currentAppraiseStatus==this.workDetailLp.checkCompleted){
  530. tmpStr = this.baseWorkData.currentAppraiseStatus
  531. }else{
  532. tmpStr = this.workDetailLp.checkFlow
  533. }
  534. }
  535. if(tmpStr == this.workDetailLp.checkEmpty){
  536. this.checkContent.set("text",tmpStr)
  537. }else{
  538. this.checkContent.set("text","("+tmpStr+")"+this.baseWorkData.currentAppraiseTitle);
  539. this.checkContent.setStyles({"text-decoration":"underline","cursor":"pointer"});
  540. this.checkContent.addEvents({
  541. "click":function(){
  542. if(this.baseWorkData.currentAppraiseStatus==this.workDetailLp.checkCompleted){
  543. if(this.baseWorkData.currentAppraiseJobId){
  544. this.actions.findProcessCompleteId( this.baseWorkData.currentAppraiseJobId, function( json ){
  545. var workCompletedList = json.data.workCompletedList;
  546. if( workCompletedList.length > 0 ){
  547. var options = {
  548. "workCompletedId": workCompletedList[0].id,
  549. //"appId": workCompletedList[0].id,
  550. "onQueryClose" : function(){
  551. }.bind(this)
  552. };
  553. layout.desktop.openApplication(this.event, "process.Work", options);
  554. }
  555. }.bind(this))
  556. }
  557. }else{
  558. layout.desktop.openApplication(this.event, "process.Work", {
  559. "workId": this.baseWorkData.currentAppraiseWorkId
  560. });
  561. }
  562. }.bind(this)
  563. })
  564. }
  565. this.tmpLp = this.workDetailLp.processInfo;
  566. this.processInfo = new Element("div.processInfo",{
  567. "styles":this.css.processInfoDiv
  568. //}).inject(this.detailContentNode,"top")
  569. }).inject(this.detailContentNode);
  570. this.processInfoTitle = new Element("div.processInfoTitle",{
  571. "styles":this.css.processInfoTitleDiv,
  572. "text":this.tmpLp.title
  573. }).inject(this.processInfo);
  574. //alert(JSON.stringify(this.data.okrWorkAuthorizeRecords))
  575. this.processInfoContent = new Element("div.processInfoContent",{
  576. "styles":this.css.processInfoContent
  577. }).inject(this.processInfo);
  578. var tHead = "<table styles='processTable'>";
  579. var tBody = "<tr>";
  580. tBody+="<td styles='processTH'>"+this.tmpLp.operate+"</td>";
  581. tBody+="<td styles='processTH'>"+this.tmpLp.time+"</td>";
  582. tBody+="<td styles='processTH'>"+this.tmpLp.source.split('@')[0]+"</td>";
  583. tBody+="<td styles='processTH'>"+this.tmpLp.target.split('@')[0]+"</td>";
  584. tBody+="<td styles='processTH'>"+this.tmpLp.opinion+"</td>";
  585. tBody+="</tr>";
  586. if(this.baseWorkData.workDeployAuthorizeRecords){
  587. this.baseWorkData.workDeployAuthorizeRecords.each(function(d){
  588. tBody += "<tr>";
  589. tBody+="<td styles='processTD'>"+d.operationTypeCN+"</td>";
  590. tBody+="<td styles='processTD'>"+ d.operationTime+"</td>";
  591. tBody+="<td styles='processTD'>"+ d.source.split('@')[0]+"</td>";
  592. tBody+="<td styles='processTD'>"+ d.target.split('@')[0]+"</td>";
  593. tBody+="<td styles='processTD'>"+d.opinion+"</td>";
  594. tBody+="</tr>"
  595. }.bind(this))
  596. }
  597. var tBottom = "</table>";
  598. this.processInfoContent.set("html",tHead+tBody+tBottom);
  599. this.formatStyles(this.processInfoContent);
  600. this.app.setScrollBar(this.detailContentNode)
  601. },
  602. formatStyles:function(obj){
  603. obj.getElements("[styles]").each(function(el){
  604. var styles = el.get("styles");
  605. if( styles && this.css[styles] ){
  606. el.setStyles( this.css[styles] )
  607. }
  608. }.bind(this))
  609. },
  610. getWorkDetailsItemTemplate:function(lp){
  611. _self = this;
  612. return {
  613. centerWorkTitle:{
  614. text: lp.centerWorkTitle+":",
  615. value : this.data.centerWorkInfo.title
  616. },
  617. workType: {
  618. text: lp.workType + ":",
  619. type: "select",
  620. selectValue: lp.workTypeValue.split(",")
  621. },
  622. workLevel: {
  623. text: lp.workLevel + ":",
  624. type: "select",
  625. notEmpty:true,
  626. selectValue: lp.workLevelValue.split(",")
  627. },
  628. timeLimit: {text: lp.timeLimit + ":", tType: "date",name:"completeDateLimitStr",notEmpty:true},
  629. reportCycle: {
  630. text: lp.reportCycle + ":",
  631. type: "select",
  632. //selectValue: lp.reportCycleValue.split(","),
  633. selectText: lp.reportCycleText.split(","),
  634. event: {
  635. change: function (item, ev) {
  636. if (item.get("value") == lp.reportCycleText.split(",")[0]) {
  637. this.form.getItem("reportDay").resetItemOptions(lp.weekDayValue.split(","),lp.weekDayText.split(","))
  638. } else if (item.get("value") == lp.reportCycleText.split(",")[1]) {
  639. this.form.getItem("reportDay").resetItemOptions(lp.monthDayValue.split(","),lp.monthDayText.split(","))
  640. }
  641. }.bind(this)
  642. }
  643. },
  644. reportDay: {
  645. type: "select",
  646. name:"reportDayInCycle",
  647. //aa:function(){alert(!this.data.reportCycle)}.bind(this),
  648. selectValue: (!this.data.reportCycle || this.data.reportCycle==lp.reportCycleText.split(",")[0])?lp.weekDayValue.split(","):lp.monthDayValue.split(","),
  649. selectText: (!this.data.reportCycle || this.data.reportCycle==lp.reportCycleText.split(",")[0])?lp.weekDayText.split(","):lp.monthDayText.split(",")
  650. },
  651. dutyDepartment:{text:lp.dutyDepartment+":",name:"responsibilityUnitName",type: "org",orgType:"unit"},
  652. dutyPerson:{text:lp.dutyPerson+":",name:"responsibilityIdentity",type: "org",orgType:"identity"},
  653. secondDepartment:{
  654. text:lp.secondDepartment+":",
  655. name:"cooperateUnitNameList",
  656. value:this.data.cooperateUnitNameList?this.data.cooperateUnitNameList.join(","):"",
  657. type: "org",orgType:"unit"
  658. },
  659. secondPerson: {
  660. text: lp.secondPerson + ":", type: "org",orgType:"identity",
  661. name:"cooperateIdentityList",
  662. value:this.data.cooperateIdentityList?this.data.cooperateIdentityList.join(","):"",
  663. count: 0
  664. },
  665. readReader: {
  666. text: lp.readReader + ":",type: "org",orgType:"identity" ,
  667. name:"readLeaderIdentityList",
  668. value:this.data.readLeaderIdentityList?this.data.readLeaderIdentityList.join(","):"",
  669. count: 0
  670. },
  671. subject: {text: lp.subject + ":",name:"title",notEmpty:true},
  672. workSplitAndDescription: {text: lp.workSplitAndDescription + ":", type: "textarea",name:"workDetail",notEmpty:true},
  673. specificActionInitiatives: {text: lp.specificActionInitiatives + ":", type: "textarea",name:"progressAction"},
  674. cityCompanyDuty: {text: lp.cityCompanyDuty + ":", type: "textarea",name:"dutyDescription"},
  675. milestoneMark: {text: lp.milestoneMark + ":", type: "textarea",name:"landmarkDescription"},
  676. importantMatters: {text: lp.importantMatters + ":", type: "textarea",name:"majorIssuesDescription"}
  677. }
  678. },
  679. loadAttachment: function (area) {
  680. this.attachment = new MWF.xApplication.Execution.Attachment(area, this.app, this.actions, this.app.lp, {
  681. documentId: this.data.id,
  682. isNew: this.options.isNew,
  683. isEdited: this.options.isEdited,
  684. size: "min",
  685. isSizeChange: true
  686. });
  687. this.attachment.load();
  688. },
  689. _ok: function (data, callback) {
  690. //alert(JSON.stringify(data))
  691. //this.app.restActions.saveDocument( this.data.id, data, function(json){
  692. // if( callback )callback(json);
  693. //}.bind(this));
  694. },
  695. setFormNodeSize: function (width, height, top, left) {
  696. if (!width)width = this.options.width ? this.options.width : "50%";
  697. if (!height)height = this.options.height ? this.options.height : "50%";
  698. if (!top) top = this.options.top ? this.options.top : 0;
  699. if (!left) left = this.options.left ? this.options.left : 0;
  700. //var appTitleSize = this.app.window.title.getSize();
  701. var allSize = this.app.content.getSize();
  702. var topTextWidth = allSize.x - this.formTopCloseActionNode.getSize().x - this.formTopIconNode.getSize().x - 40;
  703. this.formTopTextNode.setStyles({
  704. "width": "" + topTextWidth + "px"
  705. });
  706. var limitWidth = allSize.x; //window.screen.width
  707. var limitHeight = allSize.y; //window.screen.height
  708. "string" == typeof width && (1 < width.length && "%" == width.substr(width.length - 1, 1)) && (width = parseInt(limitWidth * parseInt(width, 10) / 100, 10));
  709. "string" == typeof height && (1 < height.length && "%" == height.substr(height.length - 1, 1)) && (height = parseInt(limitHeight * parseInt(height, 10) / 100, 10));
  710. 300 > width && (width = 300);
  711. 220 > height && (height = 220);
  712. top = top || parseInt((limitHeight - height) / 2, 10); //+appTitleSize.y);
  713. left = left || parseInt((limitWidth - width) / 2, 10);
  714. this.formAreaNode.setStyles({
  715. "width": "" + width + "px",
  716. "height": "" + height + "px",
  717. "top": "" + top + "px",
  718. "left": "" + left + "px"
  719. });
  720. this.formNode.setStyles({
  721. "width": "" + width + "px",
  722. "height": "" + height + "px"
  723. });
  724. var iconSize = this.formIconNode ? this.formIconNode.getSize() : {x: 0, y: 0};
  725. var topSize = this.formTopNode ? this.formTopNode.getSize() : {x: 0, y: 0};
  726. var bottomSize = this.formBottomNode ? this.formBottomNode.getSize() : {x: 0, y: 0};
  727. var contentHeight = height - iconSize.y - topSize.y - bottomSize.y;
  728. //var formMargin = formHeight -iconSize.y;
  729. this.formContentNode.setStyles({
  730. "height": "" + contentHeight + "px"
  731. });
  732. this.formTableContainer.setStyles({
  733. "height": "" + contentHeight + "px"
  734. });
  735. this.detailContentNode.setStyles({
  736. "height": "" + (contentHeight - this.detailTopNode.getSize().y) + "px"
  737. });
  738. if(this.chatContentListNode){
  739. this.chatContentListNode.setStyles({
  740. "height": "" + (contentHeight - this.chatTopNode.getSize().y - this.chatEditorNode.getSize().y) + "px"
  741. });
  742. }
  743. var reportContentHeight = ( contentHeight - (this.reportTopNode.getSize().y * 2) ) / 2 ;
  744. this.reportContentNode.setStyles({
  745. "height": "" + reportContentHeight + "px"
  746. });
  747. this.reportContentInforHeight = ( contentHeight - (this.reportTopNode.getSize().y ) );
  748. //alert(reportContentInforHeight)
  749. if(this.prevReportInforListDiv){
  750. this.prevReportInforListDiv.setStyles({
  751. "height": "" + this.reportContentInforHeight + "px"
  752. });
  753. }
  754. this.questionContentNode.setStyles({
  755. "height": "" + reportContentHeight + "px"
  756. });
  757. },
  758. setContentSize: function () {
  759. var allSize = this.app.content.getSize();
  760. var leftAreaWidth = this.leftArea.getStyle("width");
  761. var chatAreaWidth = this.chatArea.getStyle("width");
  762. var width = allSize.x - parseInt(leftAreaWidth) - parseInt(chatAreaWidth); // - 10;
  763. this.detailArea.setStyles({
  764. "width": "" + width + "px"
  765. });
  766. },
  767. showErrorMessage:function(xhr,text,error){
  768. var errorText = error;
  769. if (xhr) errorMessage = xhr.responseText;
  770. if(errorMessage!=""){
  771. var e = JSON.parse(errorMessage);
  772. if(e.message){
  773. this.app.notice( e.message,"error");
  774. }else{
  775. this.app.notice( errorText,"error");
  776. }
  777. }else{
  778. this.app.notice(errorText,"error")
  779. }
  780. }
  781. });