WorkList.js 61 KB

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