WorkTask.js 48 KB

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