WorkTask.js 48 KB

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