WorkDetailShow.js 43 KB

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