WorkDetail.js 30 KB

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