WorkGather.js 37 KB

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