WorkGather.js 37 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850
  1. MWF.xApplication.Execution = MWF.xApplication.Execution || {};
  2. MWF.xDesktop.requireApp("Template", "Explorer", null, false);
  3. MWF.xDesktop.requireApp("Template", "MPopupForm", null, false);
  4. MWF.xDesktop.requireApp("Template", "MForm", null, false);
  5. MWF.xDesktop.requireApp("Execution", "WorkForm", null, false);
  6. MWF.xApplication.Execution.WorkGather = new Class({
  7. Extends: MPopupForm,
  8. Implements: [Options, Events],
  9. options: {
  10. //"centerWorkId" : "fc44be47-7271-469f-8f04-deebdb71d3e6",
  11. "style": "default",
  12. "width": "100%",
  13. "height": "100%",
  14. "hasTop": true,
  15. "hasIcon": false,
  16. "hasBottom": true,
  17. "title": "",
  18. "draggable": false,
  19. "closeAction": true,
  20. "isNew": false,
  21. "isEdited": true
  22. },
  23. initialize: function (explorer, actions, data, options) {
  24. this.setOptions(options);
  25. this.explorer = explorer;
  26. this.app = explorer.app||explorer;
  27. this.lp = this.app.lp.workGather;
  28. this.actions = this.app.restActions;
  29. this.path = "../x_component_Execution/$WorkGather/";
  30. this.cssPath = this.path + this.options.style + "/css.wcss";
  31. this._loadCss();
  32. this.data = data || {};
  33. this.actions = actions;
  34. },
  35. load: function () {
  36. //alert(JSON.stringify(this.data))
  37. if (this.options.isNew) {
  38. this.create();
  39. } else if (this.options.isEdited) {
  40. this.edit();
  41. } else {
  42. this.open();
  43. }
  44. },
  45. createTopNode: function () {
  46. if (!this.formTopNode) {
  47. this.formTopNode = new Element("div.formTopNode", {
  48. "styles": this.css.formTopNode
  49. }).inject(this.formNode);
  50. this.formTopIconNode = new Element("div", {
  51. "styles": this.css.formTopIconNode
  52. }).inject(this.formTopNode);
  53. this.formTopTextNode = new Element("div", {
  54. "styles": this.css.formTopTextNode,
  55. "text": this.data.title
  56. }).inject(this.formTopNode);
  57. if (this.options.closeAction) {
  58. this.formTopCloseActionNode = new Element("div.formTopCloseActionNode", {"styles": this.css.formTopCloseActionNode}).inject(this.formTopNode);
  59. this.formTopCloseActionNode.addEvent("click", function () {
  60. this.close()
  61. }.bind(this))
  62. }
  63. this.formTopContentNode = new Element("div", {
  64. "styles": this.css.formTopContentNode
  65. }).inject(this.formTopNode);
  66. this._createTopContent();
  67. }
  68. },
  69. _createTopContent: function () {
  70. },
  71. _createTableContent: function (data) {
  72. this.titleDiv = new Element("div.titleDiv",{
  73. "styles":this.css.titleDiv,
  74. "text":this.data.title
  75. }).inject(this.formTableArea);
  76. this.inforDiv = new Element("div.inforDiv",{"styles":this.css.inforDiv}).inject(this.formTableArea);
  77. //this.gatherDiv = new Element("div.gatherDiv",{"styles":this.css.gatherDiv}).inject(this.formTableArea);
  78. this.gatherJson = null;
  79. this.gatherJsonLen = 0;
  80. this.loadGather();
  81. },
  82. loadGather: function(){
  83. if(this.gatherDiv) this.gatherDiv.destroy();
  84. this.gatherDiv = new Element("div.gatherDiv",{"styles":this.css.gatherDiv}).inject(this.formTableArea);
  85. this.tabContentDiv = new Element("div.tabContentDiv",{
  86. "styles":this.css.tabContentDiv
  87. }).inject(this.gatherDiv);
  88. this.actions.getDepartmentGather(this.data.gatherId,function(json){
  89. if(json.data) {
  90. this.gatherJson = json.data;
  91. this.gatherJsonLen = json.data.length;
  92. }
  93. }.bind(this),null,false);
  94. if(this.gatherJsonLen>0){
  95. this.loadTabContent();
  96. }
  97. },
  98. loadTabContent : function(){
  99. for(i=0;i<this.gatherJson.length;i++){
  100. this.tabContentLi = new Element("li.tabContentLi",{
  101. "styles": this.css.tabContentLi,
  102. "tabIndex" : i,
  103. "text" : this.gatherJson[i].activityName+"("+this.gatherJson[i].count+")",
  104. "tabName" : this.gatherJson[i].activityName
  105. }).inject(this.tabContentDiv);
  106. }
  107. var _this = this;
  108. this.tabContentDiv.getElements("li").addEvents({
  109. "click":function(){
  110. _this.loadGatherContent(this)
  111. }
  112. });
  113. if(this.curTabIndex){
  114. }else{
  115. this.curTabName = "";
  116. this.curTabIndex = 0;
  117. }
  118. this.tabContentDiv.getElements("li")[this.curTabIndex].click();
  119. },
  120. loadGatherContent: function(obj){
  121. this.curTabName = obj.get("tabName");
  122. this.curTabIndex = obj.get("tabIndex");
  123. this.tabContentDiv.getElements("li").setStyles({"background-color":"","color":""});
  124. obj.setStyles({"background-color":"#3d77c1","color":"#ffffff"});
  125. if(this.gatherContentDiv) this.gatherContentDiv.destroy();
  126. this.gatherContentDiv = new Element("div.gatherContentDiv",{
  127. "styles": this.css.gatherContentDiv
  128. }).inject(this.gatherDiv);
  129. var tab = obj.get("tabIndex");
  130. var tabName = obj.get("tabName");
  131. if(obj.get("tabName") == this.lp.gatherName.drafter){
  132. templateUrl = this.path+"listItem_drafter.json"
  133. }else if(obj.get("tabName") == this.lp.gatherName.manager){
  134. templateUrl = this.path+"listItem_manager.json"
  135. }else if(obj.get("tabName") == this.lp.gatherName.leader){
  136. templateUrl = this.path+"listItem_leader.json"
  137. }
  138. this.reportDataArr = [];
  139. this.WorkReportView = new MWF.xApplication.Execution.WorkGather.WorkReportView(this.gatherContentDiv, this.app, this, { templateUrl : templateUrl,tab: tab,tabName:tabName});
  140. this.WorkReportView.load();
  141. },
  142. openWorkReport: function(workReportId,workId){
  143. MWF.xDesktop.requireApp("Execution", "WorkReport", function(){
  144. var data = {
  145. workReportId : workReportId,
  146. workId : workId
  147. };
  148. this.workReport = new MWF.xApplication.Execution.WorkReport(this, this.actions,data,{
  149. "isEdited":false,
  150. "width":"90%",
  151. "height":"90%",
  152. onReloadView : function( data ){
  153. this.actions.getDepartmentGather(this.data.gatherId,function(json){
  154. if(json.data && json.data.length==0){
  155. this.fireEvent("reloadView");
  156. this.close()
  157. }
  158. }.bind(this),null,false);
  159. this.loadGather();
  160. }.bind(this)
  161. } );
  162. this.workReport.load();
  163. }.bind(this));
  164. },
  165. _createBottomContent: function () {
  166. this.submitActionNode = new Element("div.submitActionNode", {
  167. "styles": this.css.formActionNode,
  168. "text": this.lp.bottomAction.submit
  169. }).inject(this.formBottomNode);
  170. var submitInfor = (this.curTabName == this.lp.activityName.drafter || this.curTabName == this.lp.activityName.manager) ? this.lp.submitWarn.warnGatherSubmit:this.lp.submitWarn.warnGatherSubmitAll;
  171. var _self = this;
  172. this.submitActionNode.addEvent("click", function (e) {
  173. this.app.confirm("warn",e,this.lp.submitWarn.warnTitle,submitInfor,300,150,function(){
  174. _self.submitGather();
  175. this.close();
  176. },function(){
  177. this.close();
  178. })
  179. }.bind(this));
  180. this.closeActionNode = new Element("div.formActionNode", {
  181. "styles": this.css.formActionNode,
  182. "text": this.lp.bottomAction.close
  183. }).inject(this.formBottomNode);
  184. this.closeActionNode.addEvent("click", function (e) {
  185. this.close(e);
  186. }.bind(this));
  187. },
  188. submit:function(workReportData,e){
  189. var progressText = this.gatherDiv.getElementById("progress"+workReportData.id);
  190. var progressValue = "";
  191. if(progressText) progressValue = progressText.get("value");
  192. var planText = this.gatherDiv.getElementById("plan"+workReportData.id);
  193. var planValue = "";
  194. if(planText) planValue = planText.get("value");
  195. var adminText = this.gatherDiv.getElementById("admin"+workReportData.id);
  196. var adminValue = "";
  197. if(adminText) adminValue = adminText.get("value");
  198. var opinionValue = "";
  199. var opinionText = this.gatherDiv.getElementById("opinion"+workReportData.id);
  200. if(opinionText) opinionValue = opinionText.get("value");
  201. var isWorkCompletedText = this.gatherDiv.getElementById("completeSelect"+workReportData.id);
  202. var isWorkCompletedValue = "";
  203. if(isWorkCompletedText) isWorkCompletedValue = isWorkCompletedText.get("value");
  204. var progressPercentText = this.gatherDiv.getElementById("completePercentSelect"+workReportData.id);
  205. var progressPercentValue = "";
  206. if(progressPercentText) progressPercentValue = parseInt(progressPercentText.get("value"));
  207. if(progressText && progressValue==""){
  208. this.app.notice(this.lp.viewProgressDescription+this.lp.notEmpty,"error");
  209. return false;
  210. }
  211. if(planText && planValue==""){
  212. this.app.notice(this.lp.viewWorkPlan+this.lp.notEmpty,"error");
  213. return false;
  214. }
  215. var submitData = {
  216. workId : workReportData.workId,
  217. id : workReportData.id,
  218. progressDescription : progressValue,
  219. workPlan : planValue,
  220. adminSuperviseInfo : adminValue,
  221. opinion : opinionValue
  222. };
  223. if(isWorkCompletedText){
  224. submitData.isWorkCompleted = isWorkCompletedValue == "yes"
  225. }
  226. if(progressPercentText){
  227. submitData.progressPercent = progressPercentValue
  228. }
  229. if(isWorkCompletedText && isWorkCompletedText.get("value")=="yes"){
  230. var _self = this;
  231. this.app.confirm("warn",e,_self.lp.submitWarn.warnTitle,_self.lp.submitWarn.warnWorkCompleted,300,150,function(){
  232. _self.app.createShade();
  233. _self.actions.submitWorkReport( submitData, function(json){
  234. _self.app.destroyShade();
  235. if(json.type == "success"){
  236. _self.app.notice(_self.lp.prompt.submitWorkReport,"success");
  237. _self.actions.getDepartmentGather(_self.data.gatherId,function(json){
  238. if(json.data && json.data.length==0){
  239. _self.fireEvent("reloadView");
  240. _self.close()
  241. }else{
  242. if(_self.gatherJson[this.curTabIndex].count == 1){
  243. _self.curTabIndex = 0;
  244. _self.curTabName = "";
  245. }
  246. _self.loadGather();
  247. }
  248. }.bind(_self),null,false)
  249. }
  250. }.bind(_self),function(xhr,text,error){
  251. _self.app.destroyShade();
  252. var errorText = error;
  253. if (xhr) errorMessage = xhr.responseText;
  254. var e = JSON.parse(errorMessage);
  255. if(e.message){
  256. _self.app.notice( e.message,"error");
  257. }else{
  258. _self.app.notice( errorText,"error");
  259. }
  260. }.bind(_self));
  261. this.close();
  262. },function(){
  263. this.close();
  264. })
  265. }else{
  266. this.app.createShade();
  267. this.actions.submitWorkReport( submitData, function(json){
  268. this.app.destroyShade();
  269. if(json.type == "success"){
  270. this.app.notice(this.lp.prompt.submitWorkReport,"success");
  271. this.actions.getDepartmentGather(this.data.gatherId,function(json){
  272. if(json.data && json.data.length==0){
  273. this.fireEvent("reloadView");
  274. this.close()
  275. }else{
  276. if(this.gatherJson[this.curTabIndex].count == 1){
  277. this.curTabIndex = 0;
  278. this.curTabName = "";
  279. }
  280. this.loadGather();
  281. }
  282. }.bind(this),null,false)
  283. }
  284. }.bind(this),function(xhr,text,error){
  285. var errorText = error;
  286. if (xhr) errorMessage = xhr.responseText;
  287. var e = JSON.parse(errorMessage);
  288. if(e.message){
  289. this.app.notice( e.message,"error");
  290. }else{
  291. this.app.notice( errorText,"error");
  292. }
  293. this.app.destroyShade();
  294. }.bind(this));
  295. }
  296. //this.actions.submitWorkReport( submitData, function(json){
  297. // if(json.type == "success"){
  298. // this.app.notice(this.lp.prompt.submitWorkReport,"success");
  299. // this.actions.getDepartmentGather(this.data.gatherId,function(json){
  300. // if(json.data && json.data.length==0){
  301. // this.fireEvent("reloadView");
  302. // this.close()
  303. // }else{
  304. // if(this.gatherJson[this.curTabIndex].count == 1){
  305. // this.curTabIndex = 0;
  306. // this.curTabName = "";
  307. // }
  308. // this.loadGather();
  309. // }
  310. // }.bind(this),null,false)
  311. //
  312. // }
  313. //}.bind(this),function(xhr,text,error){
  314. // var errorText = error;
  315. // if (xhr) errorMessage = xhr.responseText;
  316. // var e = JSON.parse(errorMessage);
  317. // if(e.message){
  318. // this.app.notice( e.message,"error");
  319. // }else{
  320. // this.app.notice( errorText,"error");
  321. // }
  322. //}.bind(this));
  323. },
  324. submitGather:function(){
  325. this.submitStatus = true;
  326. this.submitError = "";
  327. if(this.reportDataArr){
  328. this.app.createShade();
  329. for(var i=0;i<this.reportDataArr.length;i++){
  330. this.currentReportData = this.reportDataArr[i];
  331. if(this.submitStatus){
  332. var progressText = this.gatherDiv.getElementById("progress"+this.currentReportData.id);
  333. var progressValue = "";
  334. if(progressText) progressValue = progressText.get("value");
  335. var planText = this.gatherDiv.getElementById("plan"+this.currentReportData.id);
  336. var planValue = "";
  337. if(planText) planValue = planText.get("value");
  338. var adminText = this.gatherDiv.getElementById("admin"+this.currentReportData.id);
  339. var adminValue = "";
  340. if(adminText) adminValue = adminText.get("value");
  341. var opinionValue = "";
  342. var opinionText = this.gatherDiv.getElementById("opinion"+this.currentReportData.id);
  343. if(opinionText) opinionValue = opinionText.get("value");
  344. var isWorkCompletedText = this.gatherDiv.getElementById("completeSelect"+this.currentReportData.id);
  345. var isWorkCompletedValue = "";
  346. if(isWorkCompletedText) isWorkCompletedValue = isWorkCompletedText.get("value");
  347. var progressPercentText = this.gatherDiv.getElementById("completePercentSelect"+this.currentReportData.id);
  348. var progressPercentValue = "";
  349. if(progressPercentText) progressPercentValue = parseInt(progressPercentText.get("value"));
  350. var submitData = {
  351. workId : this.currentReportData.workId,
  352. id : this.currentReportData.id,
  353. progressDescription : progressValue,
  354. workPlan : planValue,
  355. adminSuperviseInfo : adminValue,
  356. opinion : opinionValue
  357. };
  358. if(isWorkCompletedText){
  359. //submitData.isWorkCompleted = isWorkCompletedValue=="yes"?true:false
  360. submitData.isWorkCompleted = isWorkCompletedValue == "yes"
  361. }
  362. if(progressPercentText){
  363. submitData.progressPercent = progressPercentValue
  364. }
  365. //if(i==0){
  366. // submitData.workId = "fefwfwfwfewfwfewfe";
  367. // submitData.id = "eeeeeeeeee"
  368. //
  369. //}
  370. this.actions.submitWorkReport( submitData, function(json){
  371. }.bind(this), function(xhr){
  372. var json = JSON.parse(xhr.responseText);
  373. this.submitError = "《"+this.currentReportData.title+"》"+json.message;
  374. this.submitStatus = false;
  375. }.bind(this),false);
  376. }
  377. }
  378. }
  379. if(!this.submitStatus){
  380. this.app.notice(this.submitError, "error");
  381. this.loadGather();
  382. }else{
  383. //alert(this.gatherJsonLen)
  384. this.app.notice(this.lp.submitWarn.submitSuccess, "success");
  385. if(this.gatherJsonLen==1 ||this.gatherJsonLen==0 ){
  386. this.fireEvent("reloadView");
  387. this.close();
  388. }else{
  389. this.curTabIndex = 0;
  390. this.curTabName = "";
  391. this.loadGather();
  392. }
  393. }
  394. this.app.destroyShade();
  395. }
  396. });
  397. MWF.xApplication.Execution.WorkGather.WorkReportView = new Class({
  398. Extends: MWF.xApplication.Template.Explorer.ComplexView,
  399. _createDocument: function(data){
  400. data.tabName = this.options.tabName;
  401. return new MWF.xApplication.Execution.WorkGather.WorkReportDocument(this.viewNode, data, this.explorer, this);
  402. },
  403. _getCurrentPageData: function(callback, count){
  404. this.actions.getDepartmentGather(this.explorer.data.gatherId,function(json){ //alert(JSON.stringify(json))
  405. if(json.data){
  406. if(this.options.tab){
  407. var tabIndex = parseInt(this.options.tab);
  408. json = json.data[tabIndex].reportCollect
  409. } else{
  410. json = json.data[0].reportCollect
  411. }
  412. if(callback) callback(json)
  413. }
  414. }.bind(this),null,false)
  415. },
  416. loadElementList: function (count) {
  417. if (!this.isItemsLoaded) {
  418. if (!this.isItemLoadding) {
  419. this.isItemLoadding = true;
  420. this._getCurrentPageData(function (json) {
  421. //if( !json.data )return;
  422. var length = json.count; //|| json.data.length;
  423. //if (!this.isCountShow){
  424. // this.filterAllProcessNode.getFirst("span").set("text", "("+this.count+")");
  425. // this.isCountShow = true;
  426. //}
  427. if (length <= this.items.length) {
  428. this.isItemsLoaded = true;
  429. }
  430. json.reportInfos.each(function (data) {
  431. if (!this.documents[data.id]) {
  432. var item = this._createDocument(data);
  433. this.items.push(item);
  434. this.documents[data.id] = item;
  435. }
  436. }.bind(this));
  437. this.isItemLoadding = false;
  438. if (this.loadItemQueue > 0) {
  439. this.loadItemQueue--;
  440. this.loadElementList();
  441. }
  442. }.bind(this), count);
  443. } else {
  444. this.loadItemQueue++;
  445. }
  446. }
  447. },
  448. _removeDocument: function(documentData, all){
  449. },
  450. _create: function(data){
  451. },
  452. _openDocument: function( documentData ){
  453. //this.workForm = new MWF.xApplication.Execution.WorkForm(this, this.actions, documentData, {
  454. // "isNew": false,
  455. // "isEdited": false
  456. //})
  457. //this.workForm.load();
  458. },
  459. _queryCreateViewNode: function(){
  460. },
  461. _postCreateViewNode: function( viewNode ){
  462. },
  463. _queryCreateViewHead:function(){
  464. },
  465. _postCreateViewHead: function( headNode ){
  466. }
  467. })
  468. MWF.xApplication.Execution.WorkGather.WorkReportDocument = new Class({
  469. Extends: MWF.xApplication.Template.Explorer.ComplexDocument,
  470. _queryCreateDocumentNode:function( itemData ){
  471. },
  472. _postCreateDocumentNode: function( itemNode, itemData ){
  473. //alert(JSON.stringify(itemData))
  474. //alert(itemNode.get("html"))
  475. if(itemData.tabName ==this.view.lp.gatherName.drafter){
  476. cols = 5
  477. }else if(itemData.tabName ==this.view.lp.gatherName.manager){
  478. cols = 6
  479. }else if(itemData.tabName ==this.view.lp.gatherName.leader){
  480. cols = 7
  481. }
  482. if( itemData.reports ){
  483. itemData.reports.each(function(d,ii){
  484. this.view.explorer.reportDataArr.push(d);
  485. var trNode = new Element("tr.trNodeTitle",{"styles":this.view.css.trNodeTitle}).inject(this.view.viewNode);
  486. var tdNode = new Element("td.tdNodeTitle",{
  487. "styles":this.view.css.tdNodeTitle,
  488. //"text": d.title + "(" +d.createTime+ ")",
  489. "html" : d.title + "&nbsp;&nbsp;&nbsp;&nbsp;(" +d.createTime+ ")",
  490. "colspan":cols
  491. }).inject(trNode).
  492. addEvents({
  493. "click":function(){
  494. this.view.explorer.openWorkReport(d.id, d.workId);
  495. }.bind(this)
  496. });
  497. trNode = new Element("tr.trNode",{"styles":this.view.css.trNode}).inject(this.view.viewNode);
  498. tdNode = new Element("td.tdNodeContent",{
  499. "styles":this.view.css.tdNodeContent
  500. }).inject(trNode); //事项分解
  501. divNode = new Element("div.divNode",{
  502. "styles":this.view.css.divNode,
  503. "text": d.workInfo.shortProgressAction?d.workInfo.shortProgressAction:"",
  504. "title": d.workInfo.shortProgressAction?d.workInfo.shortProgressAction:""
  505. }).inject(tdNode); //具体行动
  506. if(itemData.tabName ==this.view.lp.gatherName.drafter){//草稿
  507. tdNode = new Element("td.tdNodeContent",{
  508. "styles":this.view.css.tdNodeContent
  509. }).inject(trNode);
  510. var teextareaNode = new Element("textarea.tetareaNode",{
  511. "styles":this.view.css.textareaNode,
  512. "id":"progress"+ d.id,
  513. "value": d.progressDescription
  514. }).inject(tdNode); //截止当前
  515. tdNode = new Element("td.tdNodeContent",{
  516. "styles":this.view.css.tdNodeContent
  517. }).inject(trNode);
  518. var teextareaNode = new Element("textarea.tetareaNode",{
  519. "styles":this.view.css.textareaNode,
  520. "id":"plan"+ d.id,
  521. "value": d.workPlan
  522. }).inject(tdNode); //下一步
  523. tdNode = new Element("td.tdNodeContent",{
  524. "styles":this.view.css.tdNodeContent
  525. }).inject(trNode);
  526. var tmpDiv = new Element("div.completeSelectDiv",{
  527. styles:this.css.completeSelectDiv
  528. }).inject(tdNode);
  529. var completeSelect = new Element("select.completeSelect",{
  530. styles:this.css.completeSelect,
  531. id:"completeSelect"+ d.id,
  532. position:ii
  533. }).inject(tmpDiv);
  534. var completeSelectOption = new Element("option.completeSelectOption",{"text":this.lp.isCompletedNoOption,"value":"no"}).inject(completeSelect);
  535. completeSelectOption = new Element("option.completeSelectOption",{"text":this.lp.isCompletedYesOption,"value":"yes"}).inject(completeSelect);
  536. var _self = this;
  537. completeSelect.addEvents({
  538. "change":function(){
  539. if(this.get("value")=="yes"){
  540. var po = this.get("position");
  541. _self.view.explorer.gatherContentDiv.getElements(".completePercentSelect[position="+po+"]").set("value","100")
  542. }
  543. }
  544. });
  545. completeSelect.set("value", d.isWorkCompleted?"yes":"no");
  546. tmpDiv = new Element("div.completeSelectDiv",{
  547. styles:this.css.completeSelectDiv
  548. }).inject(tdNode);
  549. var completePercentSelect = new Element("select.completePercentSelect",{
  550. styles:this.css.completeSelect,
  551. id:"completePercentSelect"+ d.id,
  552. position:ii
  553. }).inject(tmpDiv);
  554. var completePercentSelectOption = new Element("option.completePercentSelectOption",{"text":"0%","value":"0"}).inject(completePercentSelect);
  555. completePercentSelectOption = new Element("option.completePercentSelectOption",{"text":"10%","value":"10"}).inject(completePercentSelect);
  556. completePercentSelectOption = new Element("option.completePercentSelectOption",{"text":"20%","value":"20"}).inject(completePercentSelect);
  557. completePercentSelectOption = new Element("option.completePercentSelectOption",{"text":"30%","value":"30"}).inject(completePercentSelect);
  558. completePercentSelectOption = new Element("option.completePercentSelectOption",{"text":"40%","value":"40"}).inject(completePercentSelect);
  559. completePercentSelectOption = new Element("option.completePercentSelectOption",{"text":"50%","value":"50"}).inject(completePercentSelect);
  560. completePercentSelectOption = new Element("option.completePercentSelectOption",{"text":"60%","value":"60"}).inject(completePercentSelect);
  561. completePercentSelectOption = new Element("option.completePercentSelectOption",{"text":"70%","value":"70"}).inject(completePercentSelect);
  562. completePercentSelectOption = new Element("option.completePercentSelectOption",{"text":"80%","value":"80"}).inject(completePercentSelect);
  563. completePercentSelectOption = new Element("option.completePercentSelectOption",{"text":"90%","value":"90"}).inject(completePercentSelect);
  564. completePercentSelectOption = new Element("option.completePercentSelectOption",{"text":"100%","value":"100"}).inject(completePercentSelect);
  565. //是否办结
  566. completePercentSelect.set("value",parseInt(d.progressPercent))
  567. }else if(itemData.tabName ==this.view.lp.gatherName.manager){//管理员
  568. tdNode = new Element("td.tdNodeContent",{
  569. "styles":this.view.css.tdNodeContent
  570. }).inject(trNode);
  571. divNode = new Element("div.divNode",{
  572. "styles":this.view.css.divNode,
  573. "text": d.progressDescription,
  574. "title": d.progressDescription
  575. }).inject(tdNode); //截止当前
  576. tdNode = new Element("td.tdNodeContent",{
  577. "styles":this.view.css.tdNodeContent
  578. }).inject(trNode);
  579. divNode = new Element("div.divNode",{
  580. "styles":this.view.css.divNode,
  581. "text": d.workPlan,
  582. "title": d.workPlan
  583. }).inject(tdNode); //下一步要点
  584. tdNode = new Element("td.tdNodeContent",{
  585. "styles":this.view.css.tdNodeContent
  586. }).inject(trNode);
  587. var tmpDiv = new Element("div.completeSelectDiv",{
  588. styles:this.css.completeSelectDiv
  589. }).inject(tdNode);
  590. var completeSelect = new Element("select.completeSelect",{
  591. styles:this.css.completeSelect,
  592. id:"completeSelect"+ d.id,
  593. position:ii
  594. }).inject(tmpDiv);
  595. var completeSelectOption = new Element("option.completeSelectOption",{"text":this.lp.isCompletedNoOption,"value":"no"}).inject(completeSelect);
  596. completeSelectOption = new Element("option.completeSelectOption",{"text":this.lp.isCompletedYesOption,"value":"yes"}).inject(completeSelect);
  597. var _self = this;
  598. completeSelect.addEvents({
  599. "change":function(){
  600. if(this.get("value")=="yes"){
  601. var po = this.get("position");
  602. _self.view.explorer.gatherContentDiv.getElements(".completePercentSelect[position="+po+"]").set("value","100")
  603. }
  604. }
  605. });
  606. completeSelect.set("value", d.isWorkCompleted?"yes":"no");
  607. tmpDiv = new Element("div.completeSelectDiv",{
  608. styles:this.css.completeSelectDiv
  609. }).inject(tdNode);
  610. var completePercentSelect = new Element("select.completePercentSelect",{
  611. styles:this.css.completeSelect,
  612. id:"completePercentSelect"+ d.id,
  613. position:ii
  614. }).inject(tmpDiv);
  615. var completePercentSelectOption = new Element("option.completePercentSelectOption",{"text":"0%","value":"0"}).inject(completePercentSelect);
  616. completePercentSelectOption = new Element("option.completePercentSelectOption",{"text":"10%","value":"10"}).inject(completePercentSelect);
  617. completePercentSelectOption = new Element("option.completePercentSelectOption",{"text":"20%","value":"20"}).inject(completePercentSelect);
  618. completePercentSelectOption = new Element("option.completePercentSelectOption",{"text":"30%","value":"30"}).inject(completePercentSelect);
  619. completePercentSelectOption = new Element("option.completePercentSelectOption",{"text":"40%","value":"40"}).inject(completePercentSelect);
  620. completePercentSelectOption = new Element("option.completePercentSelectOption",{"text":"50%","value":"50"}).inject(completePercentSelect);
  621. completePercentSelectOption = new Element("option.completePercentSelectOption",{"text":"60%","value":"60"}).inject(completePercentSelect);
  622. completePercentSelectOption = new Element("option.completePercentSelectOption",{"text":"70%","value":"70"}).inject(completePercentSelect);
  623. completePercentSelectOption = new Element("option.completePercentSelectOption",{"text":"80%","value":"80"}).inject(completePercentSelect);
  624. completePercentSelectOption = new Element("option.completePercentSelectOption",{"text":"90%","value":"90"}).inject(completePercentSelect);
  625. completePercentSelectOption = new Element("option.completePercentSelectOption",{"text":"100%","value":"100"}).inject(completePercentSelect);
  626. //是否办结
  627. completePercentSelect.set("value",parseInt(d.progressPercent));
  628. tdNode = new Element("td.tdNodeContent",{
  629. "styles":this.view.css.tdNodeContent
  630. }).inject(trNode);
  631. var teextareaNode = new Element("textarea.tetareaNode",{
  632. "styles":this.view.css.textareaNode,
  633. "id":"admin"+ d.id,
  634. value: d.adminSuperviseInfo
  635. }).inject(tdNode);
  636. //管理员
  637. }else if(itemData.tabName ==this.view.lp.gatherName.leader){ //领导
  638. tdNode = new Element("td.tdNodeContent",{
  639. "styles":this.view.css.tdNodeContent
  640. }).inject(trNode);
  641. divNode = new Element("div.divNode",{
  642. "styles":this.view.css.divNode,
  643. "text": d.progressDescription,
  644. "title": d.progressDescription
  645. }).inject(tdNode); //截止当前
  646. tdNode = new Element("td.tdNodeContent",{
  647. "styles":this.view.css.tdNodeContent
  648. }).inject(trNode);
  649. divNode = new Element("div.divNode",{
  650. "styles":this.view.css.divNode,
  651. "text": d.workPlan,
  652. "title": d.workPlan
  653. }).inject(tdNode); //下一步要点
  654. tdNode = new Element("td.tdNodeContent",{
  655. "styles":this.view.css.tdNodeContent
  656. }).inject(trNode);
  657. divNode = new Element("div.divNode", {
  658. "styles": this.view.css.divNode,
  659. "text": d.isWorkCompleted?"是":"否"
  660. }).inject(tdNode);
  661. var percentComplete = new Element("div.percentComplete",{
  662. "text":"完成率:"+ d.progressPercent+"%"
  663. }).inject(divNode);
  664. //是否办结
  665. tdNode = new Element("td.tdNodeContent",{
  666. "styles":this.view.css.tdNodeContent
  667. }).inject(trNode);
  668. divNode = new Element("div.divNode", {
  669. "styles": this.view.css.divNode,
  670. "text": d.adminSuperviseInfo,
  671. "title": d.adminSuperviseInfo
  672. }).inject(tdNode); //管理员
  673. tdNode = new Element("td.tdNodeContent",{
  674. "styles":this.view.css.tdNodeContent
  675. }).inject(trNode);
  676. var teextareaNode = new Element("textarea.tetareaNode",{
  677. "styles":this.view.css.textareaNode,
  678. "id":"opinion"+ d.id,
  679. "value":this.lp.leaderDefaultOpinion
  680. }).inject(tdNode); //领导
  681. }
  682. var tdNodeAction = new Element("td.tdNodeAction",{
  683. "styles":this.view.css.tdNodeAction
  684. }).inject(trNode);
  685. var actionTxt = new Element("a.actionTxt",{
  686. "styles":this.view.css.actionTxt,
  687. "text":this.view.lp.viewSubmit
  688. }).inject(tdNodeAction)
  689. .addEvents({
  690. "click":function(e){
  691. this.view.explorer.submit(d,e)
  692. }.bind(this)
  693. }); // 操作
  694. ////管理员
  695. //if(d.isWorkAdmin && d.processStatus == this.view.lp.activityName.manager){
  696. //
  697. //}else{
  698. //
  699. //}
  700. ////领导
  701. ////this.workReportData.processStatus == this.lp.activityName.leader && this.workReportData.isReadLeader && this.processIdentity.indexOf(this.app.identity)>-1
  702. //if(d.processStatus == this.view.lp.activityName.leader && d.isReadLeader && d.currentProcessorIdentity.indexOf(this.app.identity)>-1){
  703. // tdNode = new Element("td.tdNodeContent",{
  704. // "styles":this.view.css.tdNodeContent
  705. // }).inject(trNode);
  706. // var teextareaNode = new Element("textarea.tetareaNode",{
  707. // "styles":this.view.css.textareaNode,
  708. // "id":"opinion"+ d.id
  709. // }).inject(tdNode);
  710. //}else{
  711. // tdNode = new Element("td.tdNodeContent",{
  712. // "styles":this.view.css.tdNodeContent,
  713. // "text": ""
  714. // }).inject(trNode);
  715. //}
  716. //
  717. //var tdNodeAction = new Element("td.tdNodeAction",{
  718. // "styles":this.view.css.tdNodeAction,
  719. //}).inject(trNode);
  720. //var actionTxt = new Element("a.actionTxt",{
  721. // "styles":this.view.css.actionTxt,
  722. // "text":this.view.lp.viewSubmit
  723. //}).inject(tdNodeAction)
  724. // .addEvents({
  725. // "click":function(){
  726. // this.view.explorer.submit(d)
  727. // }.bind(this)
  728. // })
  729. }.bind(this));
  730. //this.view.viewNode.getElements("textarea").setStyle("height","100%")
  731. }
  732. }
  733. });