WorkList.js 57 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466
  1. MWF.xApplication.Execution = MWF.xApplication.Execution || {};
  2. MWF.xDesktop.requireApp("Template", "Explorer", null, false);
  3. MWF.require("MWF.widget.Identity", null,false);
  4. MWF.xApplication.Execution.WorkList = new Class({
  5. Extends: MWF.widget.Common,
  6. Implements: [Options, Events],
  7. options: {
  8. "style": "default",
  9. "workNavi1" : "",
  10. "workNavi2" : ""
  11. },
  12. initialize: function (node, app, actions, options) {
  13. this.setOptions(options);
  14. this.app = app;
  15. this.lp = app.lp.workList;
  16. this.path = "/x_component_Execution/$WorkList/";
  17. this.loadCss();
  18. this.actions = actions;
  19. this.node = $(node);
  20. },
  21. loadCss: function () {
  22. this.cssPath = "/x_component_Execution/$WorkList/" + this.options.style + "/css.wcss";
  23. this._loadCss();
  24. },
  25. load: function () {
  26. if(!this.appointSwitch){
  27. var switchData = {};
  28. switchData.configCode = "WORK_AUTHORIZE";
  29. this.actions.getProfileByCode(switchData,function(json){
  30. if(json.type == "success"){
  31. if(json.data && json.data.configValue){
  32. this.appointSwitch = json.data.configValue;
  33. }
  34. }
  35. }.bind(this),null,false);
  36. }
  37. this.tabLocation = ""
  38. this.middleContent = this.app.middleContent;
  39. this.middleContent.setStyles({"margin-top":"0px","border":"0px solid #f00"});
  40. this.createNaviContent();
  41. this.createContentDiv();
  42. this.resizeWindow();
  43. this.app.addEvent("resize", function(){
  44. this.resizeWindow();
  45. }.bind(this));
  46. },
  47. resizeWindow: function(){
  48. var size = this.app.middleContent.getSize();
  49. if( this.naviDiv)this.naviDiv.setStyles({"height":(size.y-60)+"px"});
  50. if(this.naviContentDiv)this.naviContentDiv.setStyles({"height":(size.y-180)+"px"});
  51. if(this.contentDiv)this.contentDiv.setStyles({"height":(size.y-60)+"px"});
  52. if(this.rightContentDiv)this.rightContentDiv.setStyles({
  53. "height":(size.y-40-140)+"px",
  54. "width":(size.x-this.naviDiv.getSize().x-6)+"px"
  55. });
  56. },
  57. createNaviContent: function(){
  58. this.naviDiv = new Element("div.naviDiv",{
  59. "styles":this.css.naviDiv
  60. }).inject(this.middleContent);
  61. this.naviTitleDiv = new Element("div.naviTitleDiv",{
  62. "styles":this.css.naviTitleDiv,
  63. "text":this.lp.navi.title
  64. }).inject(this.naviDiv);
  65. this.naviContentDiv = new Element("div.naviContentDiv",{"styles":this.css.naviContentDiv}).inject(this.naviDiv);
  66. this.naviBottomDiv = new Element("div.naviBottomDiv",{"styles":this.css.naviBottomDiv}).inject(this.naviDiv);
  67. var naviContentLi = new Element("li.naviContentLi",{"styles":this.css.naviContentLi}).inject(this.naviContentDiv)
  68. .addEvents({
  69. "click":function(){
  70. this.app.openWorkReport()
  71. }.bind(this)
  72. })
  73. var naviContentImg = new Element("img.naviContentImg",{
  74. "styles":this.css.naviContentImg,
  75. "src":this.path+"default/icon/Prototype-100.png"
  76. }).inject(naviContentLi);
  77. var naviContentSpan = new Element("span.naviContentSpan",{
  78. "styles":this.css.naviContentSpan,
  79. "text":this.lp.navi.items.workReport
  80. }).inject(naviContentLi)
  81. },
  82. createContentDiv: function(){
  83. this.contentDiv = new Element("div.contentDiv",{"styles":this.css.contentDiv}).inject(this.middleContent);
  84. this.createCategoryItemDiv();
  85. this.clickWorkListNavi( this.options.workNavi1 || "base", this.options.workNavi2 || "" );
  86. },
  87. createCategoryItemDiv: function(){
  88. this.rightCategoryDiv = new Element("div.rightCategoryDiv",{"styles":this.css.rightCategoryDiv}).inject(this.contentDiv);
  89. var isCreate = false;
  90. this.actions.createCenterWorkAuthorization(function(json){
  91. if(json.data && json.data.value){
  92. isCreate = json.data.value;
  93. }
  94. }.bind(this),null,false)
  95. if(isCreate){
  96. this.rightCategoryNewDiv = new Element("div.rightCategoryNewDiv",{
  97. "styles":this.css.rightCategoryNewDiv,
  98. "text":this.lp.createWork
  99. }).inject(this.rightCategoryDiv)
  100. .addEvents({
  101. "click":function(){
  102. MWF.xDesktop.requireApp("Execution", "WorkDeploy", function(){
  103. this.explorer = new MWF.xApplication.Execution.WorkDeploy(this, this.actions,{},{
  104. "isEdited":true,
  105. "isNew":true,
  106. "onReloadView" : function( data ){
  107. this.createRightContentDiv(this.workNavi1,this.workNavi2)
  108. }.bind(this)
  109. });
  110. this.explorer.load();
  111. }.bind(this))
  112. }.bind(this)
  113. });
  114. }
  115. this.rightCategoryItemDiv = new Element("div.rightCategoryItemDiv",{"styles":this.css.rightCategoryItemDiv}).inject(this.rightCategoryDiv);
  116. this.centerWorkLi = new Element("li.centerWorkLi",{
  117. "styles":this.css.rightCategoryItemCurrentLi,
  118. "text": this.lp.workItems.centerWork.title
  119. }).inject(this.rightCategoryItemDiv)
  120. .addEvents({
  121. "click":function(){
  122. //alert("中心工作点击");
  123. this.clickWorkListNavi("center")
  124. }.bind(this)
  125. })
  126. this.baseWorkLi = new Element("li.baseWorkLi",{
  127. "styles":this.css.rightCategoryItemLi,
  128. "text": this.lp.workItems.baseWork.title
  129. }).inject(this.rightCategoryItemDiv)
  130. .addEvents({
  131. "click":function(){
  132. //alert("具体工作点击");
  133. this.clickWorkListNavi("base");
  134. }.bind(this)
  135. })
  136. this.rightSearchDiv = new Element("div.rightSearchDiv",{"styles":this.css.rightSearchDiv}).inject(this.contentDiv);
  137. },
  138. clickWorkListNavi : function( workNavi1, workNavi2 ){
  139. this.workNavi1 = workNavi1 || "base";
  140. if(this.rightSearchDiv)this.rightSearchDiv.empty();
  141. if(this.rightContentDiv)this.rightContentDiv.destroy();
  142. if( workNavi1 == "base" ){
  143. if(this.centerWorkLi)this.centerWorkLi.setStyles({"border-bottom":""});
  144. if(this.baseWorkLi)this.baseWorkLi.setStyles({"border-bottom":"2px solid #124c93"});
  145. this.createBaseWorkSearchDiv();
  146. this.createRightContentDiv( "base" , workNavi2 || "" );
  147. }else{
  148. if(this.centerWorkLi)this.centerWorkLi.setStyles({"border-bottom":"2px solid #124c93"});
  149. if(this.baseWorkLi)this.baseWorkLi.setStyles({"border-bottom":""});
  150. this.createCenterWorkSearchDiv();
  151. this.createRightContentDiv("center", workNavi2 || "" );
  152. }
  153. },
  154. createCenterWorkSearchDiv: function(){
  155. this.rightDrafterTabLi = new Element("li.rightDrafterTabLi", {
  156. "styles": this.css.rightDrafterTabLi,
  157. "text" : MWF.xApplication.Execution.LP.workTask.centerWorkDrafter
  158. }).inject(this.rightSearchDiv)
  159. .addEvents({
  160. "click":function(){
  161. this.clickCenterWorkTaskNavi("drafter")
  162. }.bind(this)
  163. })
  164. this.rightDeployTabLi = new Element("li.rightDeployTabLi", {
  165. "styles": this.css.rightDeployTabLi,
  166. "text" :MWF.xApplication.Execution.LP.workTask.centerWorkDeploy
  167. }).inject(this.rightSearchDiv)
  168. .addEvents({
  169. "click":function(){
  170. this.clickCenterWorkTaskNavi("deploy")
  171. }.bind(this)
  172. })
  173. this.rightArchiveTabLi = new Element("li.rightArchiveTabLi", {
  174. "styles": this.css.rightArchiveTabLi,
  175. "text" :MWF.xApplication.Execution.LP.workTask.centerWorkArchive
  176. }).inject(this.rightSearchDiv)
  177. .addEvents({
  178. "click":function(){
  179. this.clickCenterWorkTaskNavi("archive")
  180. }.bind(this)
  181. })
  182. rightSearchBarSpan = new Element("span.rightSearchBarSpan",{
  183. "styles":this.css.rightSearchBarSpan
  184. }).inject(this.rightSearchDiv);
  185. this.rightSearchBarInput = new Element("input.rightSearchBarInput",{
  186. "styles":this.css.rightSearchBarInput,
  187. "type":"text"
  188. }).inject(rightSearchBarSpan)
  189. .addEvents({
  190. "keyup": function(e){
  191. if(e.code == 13){
  192. this.searchAction();
  193. }
  194. }.bind(this)
  195. })
  196. this.rightSearchBarSearch = new Element("div.rightSearchBarSearch",{
  197. "styles":this.css.rightSearchBarSearch,
  198. "text" : MWF.xApplication.Execution.LP.workTask.search
  199. }).inject(rightSearchBarSpan)
  200. .addEvents({
  201. "click":function(){
  202. this.searchAction();
  203. }.bind(this)
  204. })
  205. },
  206. clickCenterWorkTaskNavi : function( str ){
  207. if(this.rightSearchBarInput) this.rightSearchBarInput.set("value","")
  208. this.workNavi1 = "center"
  209. this.workNavi2 = str || "deploy";
  210. if( str == "drafter" ){
  211. this.rightContentDiv.empty();
  212. if(this.rightDrafterTabLi)this.rightDrafterTabLi.setStyles({"border-bottom":"2px solid #124c93"});
  213. if(this.rightDeployTabLi)this.rightDeployTabLi.setStyles({"border-bottom":""});
  214. if(this.rightArchiveTabLi)this.rightArchiveTabLi.setStyles({"border-bottom":""});
  215. this.loadCenterWorkList("drafter");
  216. }else if(str=="archive"){
  217. this.rightContentDiv.empty();
  218. if(this.rightArchiveTabLi)this.rightArchiveTabLi.setStyles({"border-bottom":"2px solid #124c93"});
  219. if(this.rightDeployTabLi)this.rightDeployTabLi.setStyles({"border-bottom":""});
  220. if(this.rightDrafterTabLi)this.rightDrafterTabLi.setStyles({"border-bottom":""});
  221. this.loadCenterWorkList("archive");
  222. }else{
  223. this.rightContentDiv.empty();
  224. if(this.rightDrafterTabLi)this.rightDrafterTabLi.setStyles({"border-bottom":""});
  225. if(this.rightArchiveTabLi)this.rightArchiveTabLi.setStyles({"border-bottom":""});
  226. if(this.rightDeployTabLi)this.rightDeployTabLi.setStyles({"border-bottom":"2px solid #124c93"});
  227. this.loadCenterWorkList("deploy");
  228. }
  229. },
  230. createBaseWorkSearchDiv:function(){
  231. //全部工作
  232. this.baseAllTabLi = new Element("li.baseAllTabLi", {
  233. "styles": this.css.baseTabLi,
  234. "text" : this.lp.baseWorkCategory.all
  235. }).inject(this.rightSearchDiv)
  236. .addEvents({
  237. "click":function(){
  238. this.clickBaseWorkTaskNavi("myAll")
  239. }.bind(this)
  240. })
  241. //草稿
  242. this.baseDrafterTabLi = new Element("li.baseDrafterTabLi", {
  243. "styles": this.css.baseTabLi,
  244. "text" : this.lp.baseWorkCategory.myDrafter
  245. }).inject(this.rightSearchDiv)
  246. .addEvents({
  247. "click":function(){
  248. this.clickBaseWorkTaskNavi("myDrafter")
  249. }.bind(this)
  250. })
  251. //我部署的
  252. this.baseDeployTabLi = new Element("li.baseDeployTabLi", {
  253. "styles": this.css.baseTabLi,
  254. "text" : this.lp.baseWorkCategory.myDeploy
  255. }).inject(this.rightSearchDiv)
  256. .addEvents({
  257. "click":function(){
  258. this.clickBaseWorkTaskNavi("myDeploy");
  259. }.bind(this)
  260. })
  261. //我负责的
  262. this.baseDoTabLi = new Element("li.baseDoTabLi", {
  263. "styles": this.css.baseTabLi,
  264. "text" : this.lp.baseWorkCategory.myDo
  265. }).inject(this.rightSearchDiv)
  266. .addEvents({
  267. "click":function(){
  268. this.clickBaseWorkTaskNavi("myDo");
  269. }.bind(this)
  270. })
  271. //我协助的
  272. this.baseAssistTabLi = new Element("li.baseAssistTabLi", {
  273. "styles": this.css.baseTabLi,
  274. "text" : this.lp.baseWorkCategory.myAssist
  275. }).inject(this.rightSearchDiv)
  276. .addEvents({
  277. "click":function(){
  278. this.clickBaseWorkTaskNavi("myAssist");
  279. }.bind(this)
  280. })
  281. //我阅知的
  282. this.baseReadTabLi = new Element("li.baseReadTabLi", {
  283. "styles": this.css.baseTabLi,
  284. "text" : this.lp.baseWorkCategory.myRead
  285. }).inject(this.rightSearchDiv)
  286. .addEvents({
  287. "click":function(){
  288. this.clickBaseWorkTaskNavi("myRead");
  289. }.bind(this)
  290. })
  291. if(this.appointSwitch && this.appointSwitch.toUpperCase() == "OPEN"){
  292. //我委派的
  293. this.baseAppointTabLi = new Element("li.baseAppointTabLi", {
  294. "styles": this.css.baseTabLi,
  295. "text" : this.lp.baseWorkCategory.myAppoint
  296. }).inject(this.rightSearchDiv)
  297. .addEvents({
  298. "click":function(){
  299. this.clickBaseWorkTaskNavi("myAppoint");
  300. }.bind(this)
  301. })
  302. }
  303. //已归档
  304. this.baseArchiveTabLi = new Element("li.baseArchiveTabLi", {
  305. "styles": this.css.baseTabLi,
  306. "text" : this.lp.baseWorkCategory.myArchive
  307. }).inject(this.rightSearchDiv)
  308. .addEvents({
  309. "click":function(){
  310. this.clickBaseWorkTaskNavi("myArchive");
  311. }.bind(this)
  312. })
  313. rightSearchBarSpan = new Element("span.rightSearchBarSpan",{
  314. "styles":this.css.rightSearchBarSpan
  315. }).inject(this.rightSearchDiv);
  316. this.rightSearchBarInput = new Element("input.input",{
  317. "styles":this.css.rightSearchBarInput,
  318. "type":"text"
  319. }).inject(rightSearchBarSpan)
  320. .addEvents({
  321. "keyup": function(e){
  322. if(e.code == 13){
  323. this.searchAction();
  324. }
  325. }.bind(this)
  326. })
  327. this.rightSearchBarSearch = new Element("div.rightSearchBarSearch",{
  328. "styles":this.css.rightSearchBarSearch,
  329. "text" : this.lp.searchButton.search
  330. }).inject(rightSearchBarSpan)
  331. .addEvents({
  332. "click":function(){
  333. this.searchAction();
  334. }.bind(this)
  335. })
  336. },
  337. clickBaseWorkTaskNavi : function( str ){
  338. if(this.rightSearchBarInput) this.rightSearchBarInput.set("value","")
  339. this.workNavi1 = "base"
  340. this.workNavi2 = str || "myDo";
  341. if( str == "myDrafter" ) {
  342. this.changeBaseWork(this.baseDrafterTabLi)
  343. this.loadBaseWorkList("myDrafter");
  344. }else if(str =="myDeploy"){
  345. this.changeBaseWork(this.baseDeployTabLi);
  346. this.loadBaseWorkList("myDeploy");
  347. }else if( str == "myDo" ){
  348. this.changeBaseWork(this.baseDoTabLi);
  349. this.loadBaseWorkList("myDo");
  350. }else if( str == "myAssist" ){
  351. this.changeBaseWork(this.baseAssistTabLi)
  352. this.loadBaseWorkList("myAssist");
  353. }else if( str == "myRead" ){
  354. this.changeBaseWork(this.baseReadTabLi)
  355. this.loadBaseWorkList("myRead");
  356. }else if( str == "myAppoint") {
  357. this.changeBaseWork(this.baseAppointTabLi)
  358. this.loadBaseWorkList("myAppoint");
  359. }else if( str == "myArchive"){
  360. this.changeBaseWork(this.baseArchiveTabLi)
  361. this.loadBaseWorkList("myArchive");
  362. }else if(str == "myAll"){
  363. this.changeBaseWork(this.baseAllTabLi)
  364. this.loadBaseWorkList("myAll");
  365. }else{
  366. this.changeBaseWork(this.baseDoTabLi)
  367. this.loadBaseWorkList("myDo");
  368. }
  369. },
  370. reloadRightContentDiv : function(){
  371. if(this.rightContentDiv)this.rightContentDiv.destroy();
  372. this.rightContentDiv = new Element("div.rightContentDiv",{
  373. "styles":this.css.rightContentDiv
  374. }).inject(this.contentDiv);
  375. this.rightContentDiv.setStyles({
  376. "width":(this.app.middleContent.getSize().x-this.naviDiv.getSize().x-6)+"px"
  377. });
  378. },
  379. createRightContentDiv: function(workNavi1 , workNavi2 ){
  380. //alert(this.app.middleContent.getSize()-40-140+"px")
  381. if(this.rightContentDiv)this.rightContentDiv.destroy();
  382. this.rightContentDiv = new Element("div.rightContentDiv",{
  383. "styles":this.css.rightContentDiv
  384. }).inject(this.contentDiv);
  385. if(workNavi1=="base"){
  386. this.clickBaseWorkTaskNavi( workNavi2 );
  387. }else{
  388. this.clickCenterWorkTaskNavi( workNavi2 );
  389. }
  390. },
  391. createTableContent:function(json,colsJson){
  392. },
  393. loadCenterWorkList: function (str,filter) {
  394. if( this.baseView )delete this.baseView;
  395. //if(this.rightContentDiv) this.rightContentDiv.empty();
  396. this.reloadRightContentDiv();
  397. this.rightContentDiv.setStyles({"height":this.app.middleContent.getSize().y-40-140+"px"});
  398. //if(this.scrollBar && this.scrollBar.scrollVAreaNode){
  399. // this.scrollBar.scrollVAreaNode.destroy()
  400. //}
  401. //MWF.require("MWF.widget.ScrollBar", function () {
  402. // this.scrollBar = new MWF.widget.ScrollBar(this.rightContentDiv, {
  403. // "indent": false,
  404. // "style": "default",
  405. // "where": "before",
  406. // "distance": 100,
  407. // "friction": 4,
  408. // "axis": {"x": false, "y": true},
  409. // "onScroll": function (y) {
  410. // var scrollSize = this.rightContentDiv.getScrollSize();
  411. // var clientSize = this.rightContentDiv.getSize();
  412. // var scrollHeight = scrollSize.y - clientSize.y;
  413. // var view = this.baseView || this.centerView;
  414. // if (y + 200 > scrollHeight && view && view.loadElementList) {
  415. // if (! view.isItemsLoaded) view.loadElementList()
  416. // }
  417. // }.bind(this)
  418. // });
  419. //}.bind(this),false);
  420. templateUrl = this.path+"centerWorkAll.json";
  421. this.centerView = new MWF.xApplication.Execution.WorkList.CenterWorkView(this.rightContentDiv, this.app, {explorer:this,lp : this.app.lp.centerWorkView, css : this.css, actions : this.actions }, { templateUrl : templateUrl,category:str,filterData:filter } )
  422. this.centerView.load();
  423. this.app.setScrollBar(this.rightContentDiv,this.centerView);
  424. },
  425. loadBaseWorkList: function (str,filter) {
  426. this.workNavi2 = str || "deploy"
  427. if( this.centerView )delete this.centerView;
  428. this.reloadRightContentDiv();
  429. this.rightContentDiv.setStyles({"height":this.app.middleContent.getSize().y-40-140+"px"});
  430. templateUrl= this.path+"baseWorkAll.json";
  431. if(this.scrollBar && this.scrollBar.scrollVAreaNode){
  432. this.scrollBar.scrollVAreaNode.destroy()
  433. }
  434. //this.app.setScrollBar(this.rightContentDiv,this.baseView);
  435. //MWF.require("MWF.widget.ScrollBar", function () {
  436. // if(this.scrollBar) delete this.scrollBar
  437. // this.scrollBar = new MWF.widget.ScrollBar(this.rightContentDiv, {
  438. // "indent": false,
  439. // "style": "xApp_TaskList",
  440. // "where": "before",
  441. // "distance": 100,
  442. // "friction": 4,
  443. // "axis": {"x": false, "y": true},
  444. // "onScroll": function (y) {
  445. // var scrollSize = this.rightContentDiv.getScrollSize();
  446. // var clientSize = this.rightContentDiv.getSize();
  447. // var scrollHeight = scrollSize.y - clientSize.y;
  448. // var view = this.baseView || this.centerView;
  449. // if (y+200 > scrollHeight && view && view.loadElementList) {
  450. // if (! view.isItemsLoaded) view.loadElementList();
  451. // }
  452. // }.bind(this)
  453. // });
  454. //
  455. //}.bind(this),false);
  456. this.baseView = new MWF.xApplication.Execution.WorkList.BaseWorkView(this.rightContentDiv, this.app, {lp : this.app.lp.baseWorkView, css : this.css, actions : this.actions }, { templateUrl : templateUrl,category:str,filterData:filter} )
  457. //this.baseView.options.templateUrl =
  458. this.baseView.load();
  459. this.app.setScrollBar(this.rightContentDiv,this.baseView);
  460. },
  461. //切换具体工作tab页
  462. changeBaseWork: function(obj){
  463. var liObj = this.rightSearchDiv.getElements("li");
  464. liObj.setStyle("border-bottom","");
  465. obj.setStyle("border-bottom","2px solid #124c93");
  466. },
  467. searchAction : function(){
  468. var filterData = {}
  469. filterData.workTitle = this.rightSearchBarInput.get("value");
  470. if(this.workNavi1 == "base"){
  471. this.loadBaseWorkList(this.workNavi2,filterData)
  472. }else if(this.workNavi1 == "center"){
  473. this.loadCenterWorkList(this.workNavi2,filterData)
  474. }
  475. },
  476. showErrorMessage:function(xhr,text,error){
  477. var errorText = error;
  478. if (xhr) errorMessage = xhr.responseText;
  479. if(errorMessage!=""){
  480. var e = JSON.parse(errorMessage);
  481. if(e.message){
  482. this.app.notice( e.message,"error");
  483. }else{
  484. this.app.notice( errorText,"error");
  485. }
  486. }else{
  487. this.app.notice(errorText,"error")
  488. }
  489. }
  490. })
  491. MWF.xApplication.Execution.WorkList.WorkForm = new Class({
  492. Extends: MWF.xApplication.Template.Explorer.PopupForm,
  493. createTopNode: function(){
  494. if (!this.formTopNode) {
  495. this.formTopNode = new Element("div.formTopNode", {
  496. "styles": this.css.formTopNode
  497. }).inject(this.formNode);
  498. this.formTopImg = new Element("img.formTopImg",{
  499. "styles":this.css.formTopImg,
  500. "src":"/x_component_Execution/$Main/default/icon/Document-104.png"
  501. }).inject(this.formTopNode);
  502. this.formTopSpan = new Element("span.formTopSpan",{
  503. "styles": this.css.formTopSpan,
  504. "text":this.options.title
  505. }).inject(this.formTopNode);
  506. if( this.options.closeAction ){
  507. this.formTopCloseActionNode = new Element("div.formTopCloseActionNode", {"styles": this.css.formTopCloseActionNode}).inject(this.formTopNode);
  508. this.formTopCloseActionNode.addEvent("click", function () {
  509. this.close()
  510. }.bind(this))
  511. }
  512. }
  513. },
  514. _createBottomContent: function(){
  515. var html = "<span style='color:#f59353'>"+MWF.xApplication.Execution.LP.workTask.popUp.createNewTask.title+"</span>:"+MWF.xApplication.Execution.LP.workTask.popUp.createNewTask.explain
  516. html += "<br><span style='color:#f59353'>"+MWF.xApplication.Execution.LP.workTask.popUp.createAddTask.title+"</span>:"+MWF.xApplication.Execution.LP.workTask.popUp.createAddTask.explain
  517. this.createExplainDiv = new Element("div.createExplainDiv",{
  518. "styles":this.css.createExplainDiv,
  519. "html":html
  520. }).inject(this.formBottomNode);
  521. }
  522. })
  523. MWF.xApplication.Execution.WorkList.CenterWorkView = new Class({
  524. Extends: MWF.xApplication.Template.Explorer.ComplexView,
  525. _createDocument: function(data){
  526. return new MWF.xApplication.Execution.WorkList.CenterWorkDocument(this.viewNode, data, this.explorer, this);
  527. },
  528. _getCurrentPageData: function(callback, count){
  529. var category = this.options.category;
  530. if (!count)count = 15;
  531. var id = (this.items.length) ? this.items[this.items.length - 1].data.id : "(0)";
  532. if(id=="(0)")this.app.createShade();
  533. //alert("this.items.length="+this.items.length)
  534. //alert("id="+id)
  535. var filter = this.options.filterData || {};
  536. filter.maxCharacterNumber = "-1"
  537. if(category=="deploy"){
  538. this.tabLocation = "centerDeploy"
  539. this.actions.getCenterWorkDeployListNext(id, count, filter, function (json) {
  540. if (callback)callback(json);
  541. this.app.destroyShade();
  542. }.bind(this))
  543. }else if(category=="drafter"){
  544. this.tabLocation = "centerDrafter"
  545. this.actions.getCenterWorkDrafterListNext(id, count, filter, function (json) {
  546. if (callback)callback(json);
  547. this.app.destroyShade();
  548. }.bind(this))
  549. }else if(category=="archive"){
  550. this.tabLocation = "centerArchive"
  551. this.actions.getCenterWorkArchiveListNext(id,count,filter,function(json){
  552. if(callback)callback(json);
  553. this.app.destroyShade();
  554. }.bind(this))
  555. }else{
  556. this.tabLocation = "centerDeploy"
  557. this.actions.getCenterWorkDeployListNext(id, count, filter, function (json) {
  558. if (callback)callback(json);
  559. this.app.destroyShade();
  560. }.bind(this),null,false)
  561. }
  562. //this.app.workList.tabLocation = this.tabLocation;
  563. },
  564. _removeDocument: function(documentData, all){
  565. this.actions.deleteCenterWork(documentData.id, function(json){
  566. if(this.tabLocation == "centerDrafter"){
  567. this.app.workList.loadCenterWorkList("drafter")
  568. }else if(this.tabLocation == "centerDeploy"){
  569. this.app.workList.loadCenterWorkList("deploy")
  570. }
  571. this.app.notice(this.app.lp.deleteDocumentOK, "success");
  572. }.bind(this));
  573. },
  574. _create: function(){
  575. },
  576. _openDocument: function( documentData ){
  577. MWF.xDesktop.requireApp("Execution", "WorkDeploy", function(){
  578. this.workDeploy = new MWF.xApplication.Execution.WorkDeploy(this, this.actions,{"id":documentData.id},{
  579. "isEdited":false,
  580. "centerWorkId":documentData.id,
  581. "onReloadView":function(json){
  582. if(json && json.action && json.action == "reload"){
  583. this.explorer.explorer.createRightContentDiv(this.explorer.explorer.workNavi1,this.explorer.explorer.workNavi2)
  584. }
  585. }.bind(this)
  586. } );
  587. this.workDeploy.load();
  588. }.bind(this))
  589. },
  590. _queryCreateViewNode: function(){
  591. },
  592. _postCreateViewNode: function( viewNode ){
  593. },
  594. _queryCreateViewHead:function(){
  595. },
  596. _postCreateViewHead: function( headNode ){
  597. }
  598. })
  599. MWF.xApplication.Execution.WorkList.CenterWorkDocument = new Class({
  600. Extends: MWF.xApplication.Template.Explorer.ComplexDocument,
  601. viewActionReturn:function(d) {
  602. var ret = false
  603. if(d.operation && d.operation.length==1){
  604. ret = true;
  605. }
  606. //if (d.operation && d.operation.indexOf("VIEW")>-1)ret = true;
  607. return ret;
  608. },
  609. editActionReturn:function(d) {
  610. var ret = false
  611. if (d.operation && d.operation.indexOf("EDIT")>-1)ret = true;
  612. return ret;
  613. },
  614. deleteActionReturn:function(d) {
  615. var ret = false
  616. if (d.operation && d.operation.indexOf("DELETE")>-1)ret = true;
  617. return ret;
  618. },
  619. action_view:function(){
  620. MWF.xDesktop.requireApp("Execution", "WorkDeploy", function(){
  621. this.workDeploy = new MWF.xApplication.Execution.WorkDeploy(this.view, this.view.app.restActions,{"id":this.data.id},{
  622. "isEdited":false,
  623. "centerWorkId":this.data.id,
  624. "onReloadView":function(json){
  625. if(json && json.action && json.action == "reload"){
  626. this.explorer.explorer.clickCenterWorkTaskNavi("drafter")
  627. }
  628. }.bind(this)
  629. });
  630. this.workDeploy.load();
  631. }.bind(this))
  632. },
  633. action_edit:function(){
  634. MWF.xDesktop.requireApp("Execution", "WorkDeploy", function(){
  635. this.workDeploy = new MWF.xApplication.Execution.WorkDeploy(this.view, this.view.app.restActions,{"id":this.data.id},{
  636. "isEdited":true,"centerWorkId":this.data.id
  637. } );
  638. this.workDeploy.load();
  639. }.bind(this))
  640. },
  641. action_delete:function(){
  642. var _self = this;
  643. _self.view.app.confirm("warn",e,_self.view.app.lp.workList.submitWarn.warnTitle,_self.view.app.lp.workList.submitWarn.warnContent.delete,300,120,function(){
  644. _self.actions.deleteCenterWork(_self.data.id, function(json){
  645. if(json.type && json.type=="success"){
  646. this.app.notice(_self.view.app.lp.workList.prompt.deleteCenterWork, "success");
  647. _self.app.workList.loadCenterWorkList(this.app.workList.workNavi2)
  648. }
  649. }.bind(_self),function(xhr,text,error){
  650. _self.explorer.explorer.showErrorMessage(xhr,text,error)
  651. }.bind(_self));
  652. this.close()
  653. },function(){
  654. this.close();
  655. })
  656. },
  657. _postCreateDocumentNode: function( itemNode, itemData ){
  658. if(itemNode.getElements("span[icon='showIcon']")){
  659. var iconObj = itemNode.getElements("span[icon='showIcon']")
  660. var icons = itemData.workProcessIdentity;
  661. var path = this.app.workList.path+"default/icon/";
  662. var styles = "margin-left:5px";
  663. for(i=0;i<icons.length;i++){
  664. if(icons[i]=="AUTHORIZE"){
  665. iconObj.set("html",iconObj.get("html")+"<img src='"+path+"authorize.png' style='"+styles+"' >")
  666. }else if(icons[i]=="TACKBACK"){
  667. iconObj.set("html",iconObj.get("html")+"<img src='"+path+"authorize.png' style='"+styles+"' >")
  668. }else if(icons[i]=="AUTHORIZECANCEL"){
  669. iconObj.set("html",iconObj.get("html")+"<img src='"+path+"authorize.png' style='"+styles+"' >")
  670. }else if(icons[i]=="RESPONSIBILITY"){
  671. iconObj.set("html",iconObj.get("html")+"<img src='"+path+"responsibility.png' style='"+styles+"' >")
  672. }else if(icons[i]=="COOPERATE"){
  673. iconObj.set("html",iconObj.get("html")+"<img src='"+path+"cooperate.png' style='"+styles+"' >")
  674. }else if(icons[i]=="READ"){
  675. iconObj.set("html",iconObj.get("html")+"<img src='"+path+"read.png' style='"+styles+"' >")
  676. }else if(icons[i]=="DEPLOY"){
  677. iconObj.set("html",iconObj.get("html")+"<img src='"+path+"deploy.png' style='"+styles+"' >")
  678. }else if(icons[i]=="VIEW"){
  679. iconObj.set("html",iconObj.get("html")+"<img src='"+path+"view.png' style='"+styles+"' >")
  680. }
  681. }
  682. }
  683. }
  684. })
  685. MWF.xApplication.Execution.WorkList.BaseWorkView = new Class({
  686. Extends: MWF.xApplication.Template.Explorer.ComplexView,
  687. _createDocument: function(data){
  688. return new MWF.xApplication.Execution.WorkList.BaseWorkDocument(this.viewNode, data, this.explorer, this);
  689. },
  690. _getCurrentPageData: function(callback, count){
  691. var category = this.category = this.options.category;
  692. if (!count)count = 20;
  693. var id = (this.items.length) ? this.items[this.items.length - 1].data.id : "(0)";
  694. if(id=="(0)")this.app.createShade()
  695. var filter = this.options.filterData || {};
  696. filter.maxCharacterNumber = "-1"
  697. if(category=="myDrafter"){ //我的草稿
  698. this.tabLocation = "baseDrafter"
  699. this.actions.getBaseWorkListMyDrafterNext(id, count, filter, function (json) {
  700. if (callback)callback(json);
  701. this.app.destroyShade();
  702. }.bind(this))
  703. }else if(category=="myDeploy"){ //我部署的
  704. this.tabLocation = "baseDeploy"
  705. this.actions.getBaseWorkListMyDeployNext(id, count, filter, function (json) {
  706. if (callback)callback(json);
  707. this.app.destroyShade();
  708. }.bind(this))
  709. }else if(category=="myDo"){ //我负责的
  710. this.tabLocation = "baseDo"
  711. this.actions.getBaseWorkListMyDoNext(id, count, filter, function (json) {
  712. if (callback)callback(json);
  713. this.app.destroyShade();
  714. }.bind(this))
  715. }else if(category=="myAssist"){ //我协助的
  716. this.tabLocation = "baseAssist"
  717. this.actions.getBaseWorkListMyAssistNext(id, count, filter, function (json) {
  718. if (callback)callback(json);
  719. this.app.destroyShade();
  720. }.bind(this))
  721. }else if(category=="myRead"){ //我阅知的
  722. this.tabLocation = "baseRead"
  723. this.actions.getBaseWorkListMyReadNext(id, count, filter, function (json) {
  724. if (callback)callback(json);
  725. this.app.destroyShade();
  726. }.bind(this))
  727. }else if(category=="myAppoint"){ //我委托的
  728. this.tabLocation = "baseAppoint"
  729. this.actions.getBaseWorkListMyAppointNext(id, count,filter,function(json){
  730. if (callback)callback(json)
  731. this.app.destroyShade();
  732. }.bind(this))
  733. }else if(category=="myArchive"){
  734. this.tabLocation = "baseArchive"
  735. this.actions.getBaseWorkListMyArchiveNext(id, count,filter,function(json){
  736. if (callback)callback(json)
  737. this.app.destroyShade();
  738. }.bind(this))
  739. }else if(category=="myAll"){
  740. this.tabLocation = "baseAll";
  741. this.actions.getBaseWorkListAllNext(id, count,filter,function(json){
  742. if (callback)callback(json)
  743. this.app.destroyShade();
  744. }.bind(this))
  745. }
  746. this.app.workList.tabLocation = this.tabLocation;
  747. },
  748. _removeDocument: function(documentData, all){
  749. this.actions.deleteBaseWork(documentData.id, function(json){
  750. if(json.type && json.type=="success"){
  751. if(this.tabLocation == "baseDrafter"){
  752. this.app.workList.loadBaseWorkList("myDrafter")
  753. }else if(this.tabLocation == "baseDeploy"){
  754. this.app.workList.loadBaseWorkList("myDeploy")
  755. }
  756. this.app.notice(this.app.lp.deleteDocumentOK, "success");
  757. }
  758. }.bind(this),function(xhr,text,error){
  759. var errorText = error;
  760. if (xhr) errorMessage = xhr.responseText;
  761. var e = JSON.parse(errorMessage);
  762. if(e.message){
  763. this.app.notice( e.message,"error");
  764. }else{
  765. this.app.notice( errorText,"error");
  766. }
  767. }.bind(this));
  768. },
  769. _create: function(){
  770. },
  771. _openDocument: function( documentData ){
  772. if( documentData.workProcessStatus == this.lp.workProcessStatus.drafter ){
  773. MWF.xDesktop.requireApp("Execution", "WorkForm", function(){
  774. var workform = new MWF.xApplication.Execution.WorkForm(this, this.app.restActions,documentData,{
  775. "isNew": false,
  776. "isEdited": false,
  777. "tabLocation":this.category
  778. });
  779. workform.load();
  780. }.bind(this));
  781. }else{
  782. MWF.xDesktop.requireApp("Execution", "WorkDetail", function(){
  783. var workform = new MWF.xApplication.Execution.WorkDetail(this, this.app.restActions,documentData,{
  784. "isNew": false,
  785. "isEdited": false,
  786. "tabLocation":this.category
  787. });
  788. workform.load();
  789. }.bind(this));
  790. }
  791. },
  792. _queryCreateViewNode: function(){
  793. },
  794. _postCreateViewNode: function( viewNode ){
  795. },
  796. _queryCreateViewHead:function(){
  797. },
  798. _postCreateViewHead: function( headNode ){
  799. }
  800. })
  801. MWF.xApplication.Execution.WorkList.BaseWorkDocument = new Class({
  802. Extends: MWF.xApplication.Template.Explorer.ComplexDocument,
  803. viewActionReturn:function(d) {
  804. var ret = false
  805. if(d.operation && d.operation.length==1){
  806. ret = true;
  807. }
  808. //if (d.operation && d.operation.indexOf("VIEW")>-1)ret = true;
  809. return ret;
  810. },
  811. editActionReturn:function(d) {
  812. var ret = false
  813. if (d.operation && d.operation.indexOf("EDIT")>-1)ret = true;
  814. return ret;
  815. },
  816. splitActionReturn:function(d) {
  817. var ret = false
  818. if (d.operation && d.operation.indexOf("SPLIT")>-1)ret = true;
  819. return ret;
  820. },
  821. authorizeActionReturn:function(d) {
  822. var ret = false
  823. if (d.operation && d.operation.indexOf("AUTHORIZE")>-1)ret = true;
  824. return ret;
  825. },
  826. tackBackActionReturn:function(d) {
  827. var ret = false
  828. if (d.operation && d.operation.indexOf("TACKBACK")>-1)ret = true;
  829. return ret;
  830. },
  831. reportActionReturn:function(d) {
  832. var ret = false
  833. if (d.operation && d.operation.indexOf("REPORT")>-1)ret = true;
  834. return ret;
  835. },
  836. deleteActionReturn:function(d) {
  837. var ret = false
  838. if (d.operation && d.operation.indexOf("DELETE")>-1)ret = true;
  839. return ret;
  840. },
  841. archiveActionReturn:function(d){
  842. var ret = false;
  843. if (d.operation && d.operation.indexOf("ARCHIVE")>-1)ret = true;
  844. return ret;
  845. },
  846. progressActionReturn:function(d){
  847. var ret = false;
  848. if (d.operation && d.operation.indexOf("PROGRESS")>-1)ret = true;
  849. return ret;
  850. },
  851. action_view:function(){
  852. if( this.data.workProcessStatus == this.lp.workProcessStatus.drafter ){
  853. MWF.xDesktop.requireApp("Execution", "WorkForm", function(){
  854. var workform = new MWF.xApplication.Execution.WorkForm(this, this.app.restActions,this.data,{
  855. "isNew": false,
  856. "isEdited": false,
  857. "tabLocation":this.category
  858. });
  859. workform.load();
  860. }.bind(this));
  861. }else{
  862. MWF.xDesktop.requireApp("Execution", "WorkDetail", function(){
  863. var workform = new MWF.xApplication.Execution.WorkDetail(this, this.app.restActions,this.data,{
  864. "isNew": false,
  865. "isEdited": false,
  866. "tabLocation":this.category
  867. });
  868. workform.load();
  869. }.bind(this));
  870. }
  871. },
  872. action_edit:function(){
  873. MWF.xDesktop.requireApp("Execution", "WorkForm", function(){
  874. var workform = new MWF.xApplication.Execution.WorkForm(this, this.app.restActions,this.data,{
  875. "isNew": false,
  876. "isEdited": true,
  877. "tabLocation":this.view.category,
  878. "actionStatus":"save"
  879. });
  880. workform.load();
  881. }.bind(this));
  882. },
  883. action_split:function(){
  884. MWF.xDesktop.requireApp("Execution", "WorkForm", function(){
  885. var workform = new MWF.xApplication.Execution.WorkForm(this, this.app.restActions,{},{
  886. "isNew": true,
  887. "isEdited": false,
  888. "parentWorkId":this.data.id,
  889. "actionStatus":"deploy"
  890. });
  891. workform.load();
  892. }.bind(this));
  893. },
  894. action_authorize:function(){
  895. data = {
  896. workId : this.data.id
  897. };
  898. var appointForm = new MWF.xApplication.Execution.WorkList.Appoint(this.view.app,this.view.app.restActions,data,this.view.css,{
  899. "ieEdited": true,
  900. "onReloadView" : function( data ){
  901. //this.view.app.workList.createRightContentDiv("base","myAppoint");
  902. this.view.app.workList.clickBaseWorkTaskNavi("myAppoint")
  903. }.bind(this)
  904. });
  905. appointForm.load();
  906. },
  907. action_tackBack:function(e){
  908. var _self = this;
  909. _self.view.app.confirm("warn",e,_self.view.app.lp.workList.submitWarn.warnTitle,_self.view.app.lp.workList.submitWarn.warnContent.tackBack,300,120,function(){
  910. data = {
  911. workId : _self.data.id
  912. };
  913. _self.actions.unAppointBaseWork(data,function(json){
  914. this.app.notice(_self.view.app.lp.workList.prompt.tackbackBaseWork,"success");
  915. }.bind(_self),function(xhr,text,error){
  916. var errorText = error;
  917. if (xhr) errorMessage = xhr.responseText;
  918. var e = JSON.parse(errorMessage);
  919. if(e.message){
  920. this.app.notice( e.message,"error");
  921. }else{
  922. this.app.notice( errorText,"error");
  923. }
  924. }.bind(_self),false)
  925. _self.view.app.workList.clickBaseWorkTaskNavi("myAppoint");
  926. this.close()
  927. },function(){
  928. this.close();
  929. })
  930. },
  931. action_report:function(){
  932. MWF.xDesktop.requireApp("Execution", "WorkReport", function(){
  933. var data = {
  934. workId : this.data.id
  935. }
  936. var workReport = new MWF.xApplication.Execution.WorkReport(this, this.app.restActions,data,{
  937. "isNew": false,
  938. "isEdited": false,
  939. "tabLocation":this.view.category,
  940. "from":"drafter"
  941. });
  942. workReport.load();
  943. }.bind(this));
  944. },
  945. action_delete:function(e){
  946. var _self = this;
  947. _self.view.app.confirm("warn",e,_self.view.app.lp.workList.submitWarn.warnTitle,_self.view.app.lp.workList.submitWarn.warnContent.delete,300,120,function(){
  948. _self.actions.deleteBaseWork(_self.data.id, function(json){
  949. if(json.type && json.type=="success"){
  950. this.app.notice(_self.view.app.lp.workList.prompt.deleteBaseWork, "success");
  951. _self.app.workList.clickBaseWorkTaskNavi(_self.app.workList.workNavi2)
  952. }
  953. }.bind(_self),function(xhr,text,error){
  954. _self.app.WorkList.showErrorMessage(xhr,text,error)
  955. }.bind(_self));
  956. this.close()
  957. },function(){
  958. this.close();
  959. })
  960. },
  961. action_archive:function(e){
  962. var _self = this;
  963. _self.view.app.confirm("warn",e,_self.view.app.lp.workList.submitWarn.warnTitle,_self.view.app.lp.workList.submitWarn.warnContent.archive,300,120,function(){
  964. _self.actions.archiveBaseWork(_self.data.id, function(json){
  965. if(json.type && json.type=="success"){
  966. this.app.notice(_self.view.app.lp.workList.prompt.deleteBaseWork, "success");
  967. _self.app.workList.clickBaseWorkTaskNavi(_self.app.workList.workNavi2)
  968. }
  969. }.bind(_self),function(xhr,text,error){
  970. _self.app.WorkList.showErrorMessage(xhr,text,error)
  971. }.bind(_self));
  972. this.close()
  973. },function(){
  974. this.close();
  975. })
  976. },
  977. action_progress:function(e){
  978. data = {
  979. title : this.data.title,
  980. workId : this.data.id,
  981. isCompleted : this.data.isCompleted,
  982. overallProgress : this.data.overallProgress
  983. };
  984. var progressForm = new MWF.xApplication.Execution.WorkList.Progress(this.view.app,this.view.app.restActions,data,this.view.css,{
  985. "ieEdited": true,
  986. "onReloadView" : function( data ){
  987. //this.view.app.workList.createRightContentDiv("base","myAppoint");
  988. this.view.app.workList.clickBaseWorkTaskNavi(this.app.workList.workNavi2 || "")
  989. }.bind(this)
  990. });
  991. progressForm.load();
  992. },
  993. _queryCreateDocumentNode:function( itemData ){
  994. },
  995. _postCreateDocumentNode: function( itemNode, itemData ){
  996. if(itemNode.getElements("div[name='appointDiv']")){
  997. if(itemData.okrWorkAuthorizeRecord){
  998. itemNode.getElements("div[name='appointDiv']").setStyle("display","")
  999. }
  1000. }
  1001. if(itemNode.getElements("div[item='workDetail']")){
  1002. itemNode.getElements("div[item='workDetail']").set("title",itemData.workDetail)
  1003. }
  1004. if(itemNode.getElements("div[item='progressAction']")){
  1005. itemNode.getElements("div[item='progressAction']").set("title",itemData.progressAction)
  1006. }
  1007. if(itemNode.getElements("span[icon='showIcon']")){
  1008. var iconObj = itemNode.getElements("span[icon='showIcon']")
  1009. var icons = itemData.workProcessIdentity;
  1010. var path = this.app.workList.path+"default/icon/";
  1011. var styles = "margin-left:5px";
  1012. for(i=0;i<icons.length;i++){
  1013. if(icons[i]=="AUTHORIZE"){
  1014. iconObj.set("html",iconObj.get("html")+"<img src='"+path+"authorize.png' style='"+styles+"' >")
  1015. }else if(icons[i]=="TACKBACK"){
  1016. iconObj.set("html",iconObj.get("html")+"<img src='"+path+"authorize.png' style='"+styles+"' >")
  1017. }else if(icons[i]=="AUTHORIZECANCEL"){
  1018. iconObj.set("html",iconObj.get("html")+"<img src='"+path+"authorize.png' style='"+styles+"' >")
  1019. }else if(icons[i]=="RESPONSIBILITY"){
  1020. iconObj.set("html",iconObj.get("html")+"<img src='"+path+"responsibility.png' style='"+styles+"' >")
  1021. }else if(icons[i]=="COOPERATE"){
  1022. iconObj.set("html",iconObj.get("html")+"<img src='"+path+"cooperate.png' style='"+styles+"' >")
  1023. }else if(icons[i]=="READ"){
  1024. iconObj.set("html",iconObj.get("html")+"<img src='"+path+"read.png' style='"+styles+"' >")
  1025. }else if(icons[i]=="DEPLOY"){
  1026. iconObj.set("html",iconObj.get("html")+"<img src='"+path+"deploy.png' style='"+styles+"' >")
  1027. }else if(icons[i]=="VIEW"){
  1028. iconObj.set("html",iconObj.get("html")+"<img src='"+path+"view.png' style='"+styles+"' >")
  1029. }
  1030. }
  1031. }
  1032. }
  1033. })
  1034. MWF.xApplication.Execution.WorkList.Appoint = new Class({
  1035. Extends: MWF.xApplication.Template.Explorer.PopupForm,
  1036. Implements: [Options, Events],
  1037. options: {
  1038. "style": "default",
  1039. "width": "500",
  1040. "height": "300",
  1041. "hasTop": true,
  1042. "hasIcon": false,
  1043. "hasBottom": true,
  1044. "title": "",
  1045. "draggable": false,
  1046. "closeAction": true,
  1047. "closeText" : "",
  1048. "needLogout" : false,
  1049. "isNew": true
  1050. },
  1051. initialize: function (app, actions, data, css, options) {
  1052. this.setOptions(options);
  1053. this.app = app;
  1054. this.actions = this.app.restActions;
  1055. this.css = css;
  1056. //this.options.title = this.app.lp.idenitySelectTitle;
  1057. //
  1058. //this.identities = identities;
  1059. this.data = data || {};
  1060. this.actions = actions;
  1061. },
  1062. load: function () {
  1063. this.create();
  1064. },
  1065. createTopNode: function () {
  1066. if (!this.formTopNode) {
  1067. this.formTopNode = new Element("div.formTopNode", {
  1068. "styles": this.css.formTopNode
  1069. }).inject(this.formNode);
  1070. this.formTopIconNode = new Element("div.formTopIconNode", {
  1071. "styles": this.css.formTopIconNode
  1072. }).inject(this.formTopNode)
  1073. this.formTopTextNode = new Element("div.formTopTextNode", {
  1074. "styles": this.css.formTopTextNode,
  1075. "text": this.app.lp.workTask.appoint.appointTitle
  1076. }).inject(this.formTopNode)
  1077. if (this.options.closeAction) {
  1078. this.formTopCloseActionNode = new Element("div.formTopCloseActionNode", {"styles": this.css.formTopCloseActionNode}).inject(this.formTopNode);
  1079. this.formTopCloseActionNode.addEvent("click", function () {
  1080. this.close()
  1081. }.bind(this))
  1082. }
  1083. this.formTopContentNode = new Element("div.formTopContentNode", {
  1084. "styles": this.css.formTopContentNode
  1085. }).inject(this.formTopNode)
  1086. //this._createTopContent();
  1087. }
  1088. },
  1089. _createTableContent: function () {
  1090. var table = new Element("table",{"width":"100%",border:"0",cellpadding:"5",cellspacing:"0"}).inject(this.formTableArea);
  1091. table.setStyles({"margin-top":"40px"})
  1092. var tr = new Element("tr").inject(table);
  1093. var td = new Element("td",{
  1094. text : this.app.lp.workTask.appoint.appointFor,
  1095. valign:"middle",
  1096. width:"20%"
  1097. }).inject(tr);
  1098. td = new Element("td",{width:"80%"}).inject(tr);
  1099. this.appointPerson = new Element("input",{
  1100. "readonly": true
  1101. }).inject(td);
  1102. this.appointPerson.setStyles({"width":"90%","height":"20px"})
  1103. this.appointPerson.addEvents({
  1104. "click":function(){
  1105. this.selectPerson(this.appointPerson,"identity",1)
  1106. }.bind(this)
  1107. })
  1108. tr = new Element("tr").inject(table);
  1109. td = new Element("td",{
  1110. "text" : this.app.lp.workTask.appoint.appointOpinion,
  1111. valign:"middle"
  1112. }).inject(tr);
  1113. td = new Element("td").inject(tr);
  1114. this.appointOpinion = new Element("textarea").inject(td)
  1115. this.appointOpinion.setStyles({"width":"90%","height":"50px"})
  1116. },
  1117. _createBottomContent: function () {
  1118. this.cancelActionNode = new Element("div.formCancelActionNode", {
  1119. "styles": this.css.formCancelActionNode,
  1120. "text": this.app.lp.workTask.appoint.appointCancel
  1121. }).inject(this.formBottomNode);
  1122. this.cancelActionNode.addEvent("click", function (e) {
  1123. this.close();
  1124. }.bind(this));
  1125. this.okActionNode = new Element("div.formOkActionNode", {
  1126. "styles": this.css.formOkActionNode,
  1127. "text": this.app.lp.workTask.appoint.appointOK
  1128. }).inject(this.formBottomNode);
  1129. this.okActionNode.addEvent("click", function (e) {
  1130. this.ok(e);
  1131. }.bind(this));
  1132. },
  1133. ok:function(){
  1134. if(this.appointPerson.get("value")==""){
  1135. this.app.notice(this.app.lp.workTask.appoint.personEmpty,"error")
  1136. return false;
  1137. }
  1138. if(this.appointOpinion.get("value")==""){
  1139. this.app.notice(this.app.lp.workTask.appoint.opinionEmpty,"error")
  1140. return false;
  1141. }
  1142. var submitData = {
  1143. workId : this.data.workId,
  1144. undertakerIdentity : this.appointPerson.get("value"),
  1145. authorizeOpinion : this.appointOpinion.get("value")
  1146. }
  1147. this.actions.appointBaseWork(submitData,function(json){
  1148. this.close();
  1149. this.fireEvent("reloadView");
  1150. }.bind(this),function(xhr,text,error){
  1151. var errorText = error;
  1152. if (xhr) errorMessage = xhr.responseText;
  1153. var e = JSON.parse(errorMessage);
  1154. if(e.message){
  1155. this.app.notice( e.message,"error");
  1156. }else{
  1157. this.app.notice( errorText,"error");
  1158. }
  1159. }.bind(this),false)
  1160. },
  1161. selectPerson: function( item, type,count ) {
  1162. MWF.xDesktop.requireApp("Organization", "Selector.package", null, false);
  1163. this.fireEvent("querySelect", this);
  1164. var value = item.get("value").split(this.valSeparator);
  1165. var options = {
  1166. "type": type,
  1167. "title": this.app.lp.workTask.appoint.appointTitle,
  1168. "count": count,
  1169. "names": value || [],
  1170. "onComplete": function (items) {
  1171. var arr = [];
  1172. items.each(function (item) {
  1173. arr.push(item.data.name);
  1174. }.bind(this));
  1175. item.set("value", arr.join(","));
  1176. }.bind(this)
  1177. };
  1178. var selector = new MWF.OrgSelector(this.app.content, options);
  1179. }
  1180. });
  1181. MWF.xApplication.Execution.WorkList.Progress = new Class({
  1182. Extends: MWF.xApplication.Template.Explorer.PopupForm,
  1183. Implements: [Options, Events],
  1184. options: {
  1185. "style": "default",
  1186. "width": "400",
  1187. "height": "200",
  1188. "hasTop": true,
  1189. "hasIcon": false,
  1190. "hasBottom": true,
  1191. "title": "",
  1192. "draggable": true,
  1193. "closeAction": true,
  1194. "closeText" : "",
  1195. "needLogout" : false,
  1196. "isNew": true
  1197. },
  1198. initialize: function (app, actions, data, css, options) {
  1199. this.setOptions(options);
  1200. this.app = app;
  1201. this.actions = this.app.restActions;
  1202. this.css = css;
  1203. //this.options.title = this.app.lp.idenitySelectTitle;
  1204. //
  1205. //this.identities = identities;
  1206. this.data = data || {};
  1207. this.actions = actions;
  1208. },
  1209. load: function () {
  1210. this.create();
  1211. },
  1212. createTopNode: function () {
  1213. if (!this.formTopNode) {
  1214. this.formTopNode = new Element("div.formTopNode", {
  1215. "styles": this.css.formTopNode
  1216. }).inject(this.formNode);
  1217. this.formTopIconNode = new Element("div.formTopIconNode", {
  1218. "styles": this.css.formTopIconNode
  1219. }).inject(this.formTopNode)
  1220. this.formTopTextNode = new Element("div.formTopTextNode", {
  1221. "styles": this.css.formTopTextNode,
  1222. "text": this.app.lp.workList.progress.progressTitle
  1223. }).inject(this.formTopNode)
  1224. if (this.options.closeAction) {
  1225. this.formTopCloseActionNode = new Element("div.formTopCloseActionNode", {"styles": this.css.formTopCloseActionNode}).inject(this.formTopNode);
  1226. this.formTopCloseActionNode.addEvent("click", function () {
  1227. this.close()
  1228. }.bind(this))
  1229. }
  1230. this.formTopContentNode = new Element("div.formTopContentNode", {
  1231. "styles": this.css.formTopContentNode
  1232. }).inject(this.formTopNode)
  1233. //this._createTopContent();
  1234. }
  1235. },
  1236. _createTableContent: function () {
  1237. this.formTableArea.setStyles({"margin-top":"40px"})
  1238. var table = new Element("table",{"width":"100%",border:"0",cellpadding:"5",cellspacing:"0"}).inject(this.formTableArea);
  1239. table.setStyles({"margin-top":"10px"});
  1240. tr = new Element("tr").inject(table);
  1241. tr = new Element("tr").inject(table);
  1242. td = new Element("td",{
  1243. "text" : this.app.lp.workList.progress.completedPercent,
  1244. align:"center",
  1245. "width":"40%"
  1246. }).inject(tr);
  1247. td = new Element("td").inject(tr);
  1248. this.completePercentSelect = new Element("select.completePercentSelect").inject(td)
  1249. var completePercentSelectOption = new Element("option.completePercentSelectOption",{"text":"0%","value":"0"}).inject(this.completePercentSelect)
  1250. completePercentSelectOption = new Element("option.completePercentSelectOption",{"text":"10%","value":"10"}).inject(this.completePercentSelect)
  1251. completePercentSelectOption = new Element("option.completePercentSelectOption",{"text":"20%","value":"20"}).inject(this.completePercentSelect)
  1252. completePercentSelectOption = new Element("option.completePercentSelectOption",{"text":"30%","value":"30"}).inject(this.completePercentSelect)
  1253. completePercentSelectOption = new Element("option.completePercentSelectOption",{"text":"40%","value":"40"}).inject(this.completePercentSelect)
  1254. completePercentSelectOption = new Element("option.completePercentSelectOption",{"text":"50%","value":"50"}).inject(this.completePercentSelect)
  1255. completePercentSelectOption = new Element("option.completePercentSelectOption",{"text":"60%","value":"60"}).inject(this.completePercentSelect)
  1256. completePercentSelectOption = new Element("option.completePercentSelectOption",{"text":"70%","value":"70"}).inject(this.completePercentSelect)
  1257. completePercentSelectOption = new Element("option.completePercentSelectOption",{"text":"80%","value":"80"}).inject(this.completePercentSelect)
  1258. completePercentSelectOption = new Element("option.completePercentSelectOption",{"text":"90%","value":"90"}).inject(this.completePercentSelect)
  1259. completePercentSelectOption = new Element("option.completePercentSelectOption",{"text":"100%","value":"100"}).inject(this.completePercentSelect)
  1260. this.completePercentSelect.set("value",parseInt(this.data.overallProgress))
  1261. },
  1262. _createBottomContent: function () {
  1263. this.cancelActionNode = new Element("div.formCancelActionNode", {
  1264. "styles": this.css.formCancelActionNode,
  1265. "text": this.app.lp.workTask.appoint.appointCancel
  1266. }).inject(this.formBottomNode);
  1267. this.cancelActionNode.addEvent("click", function (e) {
  1268. this.close();
  1269. }.bind(this));
  1270. this.okActionNode = new Element("div.formOkActionNode", {
  1271. "styles": this.css.formOkActionNode,
  1272. "text": this.app.lp.workTask.appoint.appointOK
  1273. }).inject(this.formBottomNode);
  1274. this.okActionNode.addEvent("click", function (e) {
  1275. this.ok(e);
  1276. }.bind(this));
  1277. },
  1278. ok:function(){
  1279. var percent = this.completePercentSelect.get("value");
  1280. this.actions.progressBaseWork(this.data.workId,parseInt(percent),
  1281. function(json){
  1282. this.close();
  1283. this.fireEvent("reloadView");
  1284. }.bind(this),
  1285. function(xhr,text,error){
  1286. this.app.showErrorMessage(xhr,text,error)
  1287. }.bind(this)
  1288. )
  1289. }
  1290. });