Task.js 104 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137
  1. // this.taskData 任务对象
  2. MWF.xApplication.TeamWork = MWF.xApplication.TeamWork || {};
  3. MWF.xApplication.TeamWork.Task = new Class({
  4. Extends: MPopupForm,
  5. Implements: [Options, Events],
  6. options: {
  7. "style": "default",
  8. "width": 1200,
  9. "height": "90%",
  10. "top": null,
  11. "left": null,
  12. "bottom" : null,
  13. "right" : null,
  14. "minWidth" : 300,
  15. "minHeight" : 220,
  16. "isLimitSize": true,
  17. "ifFade": false,
  18. "hasTop": false,
  19. "hasTopIcon" : false,
  20. "hasTopContent" : false,
  21. "hasIcon": false,
  22. "hasBottom": false,
  23. "hasMask" : true,
  24. "closeByClickMask" : false,
  25. "hasScroll" : false,
  26. "scrollType" : "",
  27. "title": "",
  28. "draggable": false,
  29. "resizeable" : false,
  30. "maxAction" : false,
  31. "closeAction": false,
  32. "relativeToApp" : true,
  33. "sizeRelateTo" : "app", //desktop
  34. "resultSeparator" : ","
  35. },
  36. initialize: function (explorer, data, options, para) {
  37. this.setOptions(options);
  38. if(this.options.type && this.options.type=="window"){
  39. // this.options.width = "100%";
  40. // this.options.height = "100%";
  41. this.explorer = explorer;
  42. this.app = explorer;
  43. this.container = this.app.content;
  44. this.openType = "window"
  45. }else{
  46. this.explorer = explorer;
  47. this.app = this.explorer.app;
  48. this.container = this.app.content;
  49. this.openType = "dialog"
  50. }
  51. this.projectObj = this.explorer;
  52. if(para){
  53. if(para.projectObj) this.projectObj = para.projectObj
  54. }
  55. // this.explorer = explorer;
  56. //
  57. // this.app = this.explorer.app;
  58. // this.container = this.app.content;
  59. this.rootActions = this.app.rootActions;
  60. this.actions = this.rootActions.TaskAction;
  61. this.data = data || {};
  62. this.css = {};
  63. this.cssPath = "../x_component_TeamWork/$Task/"+this.options.style+"/css.wcss";
  64. this.load();
  65. this.lp = this.app.lp.task;
  66. // this.lp = MWF.xApplication.TeamWork.LP.task;
  67. },
  68. close: function (data) {
  69. //愤愤愤愤
  70. this.fireEvent("queryClose");
  71. this._close();
  72. //if( this.form ){
  73. // this.form.destroy();
  74. //}
  75. if(this.setFormNodeSizeFun && this.app && this.app.removeEvent ){
  76. this.app.removeEvent("resize",this.setFormNodeSizeFun);
  77. }
  78. if( this.formMaskNode )this.formMaskNode.destroy();
  79. if( this.formAreaNode )this.formAreaNode.destroy();
  80. this.fireEvent("postClose",[data]);
  81. delete this;
  82. },
  83. openTask:function(data){
  84. //this.data.taskId = data.id;
  85. //alert("id="+this.data.taskId)
  86. // this.formAreaNode.setStyles({"opacity":"1"});
  87. // var fx = new Fx.Tween(this.formAreaNode,{duration:400});
  88. // fx.start(["opacity"] ,"1", "0");
  89. var ef = new Fx.Morph(this.formAreaNode, {
  90. duration: 200,
  91. transition: Fx.Transitions.Sine.easeOut,
  92. onStart:function(){},
  93. onComplete:function(){
  94. this._createTableContent();
  95. }.bind(this)
  96. });
  97. ef.start({
  98. 'opacity': [1, 0]
  99. });
  100. //this.formAreaNode.setStyles({"opacity":0});
  101. //this._createTableContent();
  102. },
  103. _createTableContent: function () {
  104. //data { taskId:xxx }
  105. var _self = this;
  106. this.getTaskData(function(){
  107. this.control = {};
  108. this.control.isEdit = this.taskData.control.edit;
  109. this.control.isDelete = this.taskData.control.delete;
  110. this.control.isFounder = this.taskData.control.founder;
  111. this.control.isCreate = true;
  112. //this.control.comment = this.projectData.comment; 目前没启用
  113. this.control.comment = true;
  114. if(this.openType == "window"){
  115. this.app.setTitle(this.taskData.name);
  116. }
  117. this.formTableArea.empty();
  118. this.topLayout = new Element("div.topLayout",{styles:this.css.topLayout}).inject(this.formTableArea);
  119. //this.topImage = new Element("div.topImage",{styles:this.css.topImage}).inject(this.topLayout);
  120. this.topContent = new Element("div.topContent",{styles:this.css.topContent,text:this.taskData.name}).inject(this.topLayout);
  121. if(this.isNew){
  122. this.topContent.set("text",this.lp.newTask)
  123. }
  124. this.topContent.addEvents({
  125. click:function(e){
  126. //layout.openApplication(e,"TeamWork.Task",null,{"taskId":this.data.taskId})
  127. }.bind(this)
  128. })
  129. this.topIconContainer = new Element("div.topIconContainer",{styles:this.css.topIconContainer}).inject(this.topLayout);
  130. //更多
  131. //权限
  132. if(!this.projectData.deleted && !this.projectData.completed){
  133. this.topIconMore = new Element("div.topIconMore",{styles:this.css.topIconMore,title:this.lp.more}).inject(this.topIconContainer);
  134. this.topIconMore.addEvents({
  135. click:function(){
  136. var tm = new MWF.xApplication.TeamWork.Task.TaskMore(this.container, this.topIconMore, this.app, {data:this.taskData}, {
  137. css:this.css, lp:this.lp, axis : "y",
  138. position : { //node 固定的位置
  139. x : "auto",
  140. y : "middle"
  141. },
  142. nodeStyles : {
  143. "min-width":"200px",
  144. "padding":"2px",
  145. "border-radius":"5px",
  146. "box-shadow":"0px 0px 4px 0px #999999",
  147. "z-index" : "201"
  148. },
  149. onPostLoad:function(){
  150. tm.node.setStyles({"opacity":"0","top":(tm.node.getStyle("top").toInt()+4)+"px"});
  151. var fx = new Fx.Tween(tm.node,{duration:400});
  152. fx.start(["opacity"] ,"0", "1");
  153. },
  154. onClose:function(rd){
  155. if(!rd) return;
  156. if(rd.act == "remove"){
  157. this.close(rd);
  158. if(this.data.projectObj){ //reload project
  159. this.data.projectObj.createTaskGroup();
  160. //this.data.projectObj.reloadTaskCountInfor()
  161. }
  162. }
  163. }.bind(this)
  164. },null,this);
  165. tm.load();
  166. }.bind(this),
  167. mouseover:function(){
  168. this.setStyles({"background-image":"url(../x_component_TeamWork/$Task/default/icon/icon_more_click.png)"});
  169. },
  170. mouseout:function(){
  171. this.setStyles(_self.css.topIconMore)
  172. }
  173. });
  174. }
  175. //关闭
  176. this.topIconClose = new Element("div.topIconClose",{styles:this.css.topIconClose,title:this.lp.close}).inject(this.topIconContainer);
  177. this.topIconClose.addEvents({
  178. click:function(){
  179. this.close();
  180. if(this.openType=="window"){
  181. this.app.close();
  182. }
  183. }.bind(this),
  184. mouseover:function(){
  185. this.setStyles({"background-image":"url(../x_component_TeamWork/$Task/default/icon/icon_off_click.png)"});
  186. },
  187. mouseout:function(){
  188. this.setStyles(_self.css.topIconClose)
  189. }
  190. });
  191. this.contentLayout = new Element("div.contentLayout",{styles:this.css.contentLayout}).inject(this.formTableArea);
  192. this.createContentLayout();
  193. this.createDetailLayout();
  194. this.formAreaNode.setStyles({"opacity":1})
  195. }.bind(this));
  196. },
  197. createContentLayout:function(){
  198. var _self = this;
  199. this.taskInforContainer = new Element("div.taskInforContainer",{styles:this.css.taskInforContainer}).inject(this.contentLayout);
  200. this.taskActionBar = new Element("div.taskActionBar",{styles:this.css.taskActionBar}).inject(this.taskInforContainer);
  201. if(this.taskData.parent!="0"){
  202. this.taskActionParentContent = new Element("div.taskActionParentContent").inject(this.taskActionBar);
  203. this.taskActionParentIcon = new Element("div.taskActionParentIcon",{styles:this.css.taskActionParentIcon}).inject(this.taskActionParentContent);
  204. this.taskActionParentText = new Element("div.taskActionParentText",{styles:this.css.taskActionParentText,text:this.lp.taskBelongText+":"}).inject(this.taskActionParentContent);
  205. this.taskActionParentValue = new Element("div.taskActionParentValue",{styles:this.css.taskActionParentValue}).inject(this.taskActionParentContent);
  206. this.actions.get(this.taskData.parent,function(json){
  207. this.taskActionParentValue.set("text",json.data.name);
  208. this.taskActionParentValue.addEvents({
  209. click:function(){
  210. this.data.taskId = json.data.id;
  211. this.openTask()
  212. }.bind(this)
  213. });
  214. }.bind(this))
  215. }
  216. // this.taskActionSave = new Element("div.taskActionSave",{styles:this.css.taskActionSave,text:this.lp.save}).inject(this.taskActionBar);
  217. // this.taskActionSave.addEvents({
  218. // click:function(){
  219. // this.saveTaskData();
  220. // }.bind(this),
  221. // mouseover:function(){
  222. // this.setStyles({
  223. // "color":"#ffffff",
  224. // "background-color":"#4A90E2",
  225. // "border":"1px solid #4A90E2"
  226. // })
  227. // },
  228. // mouseout:function(){
  229. // this.setStyles(_self.css.taskActionSave)
  230. // }
  231. // });
  232. this.taskInforLayout = new Element("div.taskInforLayout",{styles:this.css.taskInforLayout}).inject(this.taskInforContainer);
  233. this.taskInforContent = new Element("div.taskInforContent",{styles:this.css.taskInforContent}).inject(this.taskInforLayout);
  234. this.app.setScrollBar(this.taskInforContent);
  235. //名称
  236. this.taskNameContainer = Element("div.taskNameContainer",{styles:this.css.taskNameContainer}).inject(this.taskInforContent);
  237. //状态
  238. this.taskStatusContainer = Element("div.taskStatusContainer",{styles:this.css.taskStatusContainer}).inject(this.taskInforContent);
  239. this.taskStatusIcon = Element("div.taskStatusIcon",{styles:this.css.taskStatusIcon}).inject(this.taskStatusContainer);
  240. this.taskStatusText = Element("div.taskStatusText",{styles:this.css.taskStatusText,text:this.lp.taskStatus}).inject(this.taskStatusContainer);
  241. this.taskStatusValue = Element("div.taskStatusValue",{styles:this.css.taskStatusValue}).inject(this.taskStatusContainer);
  242. //责任人
  243. this.taskDutyContainer = Element("div.taskDutyContainer",{styles:this.css.taskDutyContainer}).inject(this.taskInforContent);
  244. this.taskDutyIcon = Element("div.taskDutyIcon",{styles:this.css.taskDutyIcon}).inject(this.taskDutyContainer);
  245. this.taskDutyText = Element("div.taskDutyText",{styles:this.css.taskDutyText,text:this.lp.taskDuty}).inject(this.taskDutyContainer);
  246. this.taskDutyValue = Element("div.taskDutyValue",{styles:this.css.taskDutyValue}).inject(this.taskDutyContainer);
  247. //时间
  248. this.taskTimeContainer = Element("div.taskTimeContainer",{styles:this.css.taskTimeContainer}).inject(this.taskInforContent);
  249. this.taskTimeIcon = Element("div.taskTimeIcon",{styles:this.css.taskTimeIcon}).inject(this.taskTimeContainer);
  250. this.taskTimeText = Element("div.taskTimeText",{styles:this.css.taskTimeText,text:this.lp.taskTime}).inject(this.taskTimeContainer);
  251. this.taskTimeValue = Element("div.taskTimeValue",{styles:this.css.taskTimeValue}).inject(this.taskTimeContainer);
  252. //备注
  253. this.taskRemarkContainer = Element("div.taskRemarkContainer",{styles:this.css.taskRemarkContainer}).inject(this.taskInforContent);
  254. this.taskRemarkIcon = Element("div.taskRemarkIcon",{styles:this.css.taskRemarkIcon}).inject(this.taskRemarkContainer);
  255. this.taskRemarkText = Element("div.taskRemarkText",{styles:this.css.taskRemarkText,text:this.lp.taskRemark}).inject(this.taskRemarkContainer);
  256. this.taskRemarkValue = Element("div.taskRemarkValue",{styles:this.css.taskRemarkValue}).inject(this.taskRemarkContainer);
  257. //优先级
  258. this.taskPriorityContainer = Element("div.taskPriorityContainer",{styles:this.css.taskPriorityContainer}).inject(this.taskInforContent);
  259. this.taskPriorityIcon = Element("div.taskPriorityIcon",{styles:this.css.taskPriorityIcon}).inject(this.taskPriorityContainer);
  260. this.taskPriorityText = Element("div.taskPriorityText",{styles:this.css.taskPriorityText,text:this.lp.taskPriority}).inject(this.taskPriorityContainer);
  261. this.taskPriorityValue = Element("div.taskPriorityValue",{styles:this.css.taskPriorityValue}).inject(this.taskPriorityContainer);
  262. //扩展字段
  263. if(this.taskData.extFieldConfigs && this.taskData.extFieldConfigs.length>0){
  264. this.taskExtFieldContainer = new Element("div.taskExtFieldContainer",{styles:this.css.taskExtFieldContainer}).inject(this.taskInforContent);
  265. this.loadTaskExtField();
  266. }
  267. //标签
  268. this.taskTagContainer = Element("div.taskTagContainer",{styles:this.css.taskTagContainer}).inject(this.taskInforContent);
  269. this.taskTagIcon = Element("div.taskTagIcon",{styles:this.css.taskTagIcon}).inject(this.taskTagContainer);
  270. this.taskTagText = Element("div.taskTagText",{styles:this.css.taskTagText,text:this.lp.taskTag}).inject(this.taskTagContainer);
  271. this.taskTagValue = Element("div.taskTagValue",{styles:this.css.taskTagValue}).inject(this.taskTagContainer);
  272. //附件 -- 换成其他样式
  273. // this.taskAttachmentContainer = Element("div.taskAttachmentContainer",{styles:this.css.taskAttachmentContainer}).inject(this.taskInforContent);
  274. // this.taskAttachmentIcon = Element("div.taskAttachmentIcon",{styles:this.css.taskAttachmentIcon}).inject(this.taskAttachmentContainer);
  275. // this.taskAttachmentText = Element("div.taskAttachmentText",{styles:this.css.taskAttachmentText,text:this.lp.taskAttachment}).inject(this.taskAttachmentContainer);
  276. // this.taskAttachmentValue = Element("div.taskAtchatBarEmojitachmentValue",{styles:this.css.taskAttachmentValue}).inject(this.taskAttachmentContainer);
  277. //附件
  278. this.taskAttachmentListContainer = new Element("div.taskAttachmentListContainer",{styles:this.css.taskAttachmentListContainer}).inject(this.taskInforContent);
  279. this.loadTaskAttachmentListContainer();
  280. this.setTaskData();
  281. //this.setAuth();
  282. //子任务
  283. this.subTaskContainer = new Element("div.subTaskContainer",{styles:this.css.subTaskContainer}).inject(this.taskInforContent);
  284. this.loadSubTaskContainer();
  285. //占位
  286. new Element("div",{styles:{"width":"100%","height":"100px"}}).inject(this.taskInforContent)
  287. },
  288. loadTaskExtField:function(){
  289. this.taskData.extFieldConfigs.each(function(data){
  290. this.loadTaskExtFieldItem(data);
  291. }.bind(this))
  292. },
  293. loadTaskExtFieldItem:function(data){
  294. var taskExtFieldItem = new Element("div.taskExtFieldItem",{styles:this.css.taskExtFieldItem}).inject(this.taskExtFieldContainer);
  295. var taskExtFieldIcon = new Element("div.taskExtFieldIcon",{styles:this.css.taskExtFieldIcon}).inject(taskExtFieldItem);
  296. var taskExtFieldText = new Element("div.taskExtFieldText",{styles:this.css.taskExtFieldText}).inject(taskExtFieldItem);
  297. new Element("p",{styles:{
  298. "justify-content": "center",
  299. "align-items":"center"
  300. },text:data.displayName}).inject(taskExtFieldText);
  301. if(data.displayType.toUpperCase() == "TEXT"){
  302. }
  303. },
  304. createDetailLayout:function(){
  305. this.taskDetailLayout = new Element("div.taskDetailLayout",{styles:this.css.taskDetailLayout}).inject(this.contentLayout);
  306. this.taskParticipateContainer = new Element("div.taskParticipateContainer",{styles:this.css.taskParticipateContainer}).inject(this.taskDetailLayout);
  307. this.createParticipateContainer();
  308. this.taskDynamicContainer = new Element("div.taskDynamicContainer",{styles:this.css.taskDynamicContainer}).inject(this.taskDetailLayout);
  309. this.createDynamicContainer();
  310. this.taskChatContainer = new Element("div.taskChatContainer",{styles:this.css.taskChatContainer}).inject(this.taskDetailLayout);
  311. this.createChatContainer();
  312. },
  313. createParticipateContainer:function(){
  314. this.taskParticipateContainer.empty();
  315. this.participateTitle = new Element("div.participateTitle",{styles:this.css.participateTitle}).inject(this.taskParticipateContainer);
  316. this.participateTitleText = new Element("div.participateTitleText",{styles:this.css.participateTitleText}).inject(this.participateTitle);
  317. if(this.control.isEdit){
  318. this.participateTitleIcon = new Element("div.participateTitleIcon",{styles:this.css.participateTitleIcon,title:this.lp.taskReaderAdd}).inject(this.participateTitle);
  319. this.participateTitleIcon.addEvents({
  320. click:function(){
  321. this.selectPerson(this.participateTitleIcon,null,["identity","unit"],1,
  322. function(json){
  323. if(json.length>0){
  324. if(this.taskData.participantList.indexOf(json) == -1){
  325. this.taskData.participantList = this.taskData.participantList.concat(json);
  326. }
  327. //this.actions.updateParticipantList(this.taskData.id,{participantList:this.taskData.participantList},function(json){
  328. this.actions.updateParticipant(this.taskData.id,{participantList:this.taskData.participantList},function(json){
  329. if(json.data.dynamics){
  330. json.data.dynamics.each(function(dd){
  331. this.loadDynamicItem(dd,"bottom")
  332. }.bind(this))
  333. }
  334. this.dynamicContent.scrollTo(0,this.dynamicContent.getScrollSize().y);
  335. this.createParticipateContainer();
  336. }.bind(this))
  337. }
  338. }.bind(this)
  339. );
  340. }.bind(this)
  341. });
  342. }
  343. this.participateValue = new Element("div.participateValue",{styles:this.css.participateValue}).inject(this.taskParticipateContainer);
  344. this.setScrollBar(this.participateValue);
  345. if(this.taskData.participantList){
  346. count = this.taskData.participantList.length;
  347. this.participateTitleText.set("text",this.lp.taskReader + " . " + count);
  348. this.taskData.participantList.each(function(d){
  349. var flag = true;
  350. if(this.taskData.executor){
  351. if(d === this.taskData.executor) flag = false
  352. }
  353. this.loadparticipantPerson(this.participateValue,d,flag);
  354. }.bind(this));
  355. }
  356. },
  357. createDynamicContainer:function(){
  358. var _self = this;
  359. this.taskDynamicContainer.empty();
  360. this.dynamicBar = new Element("div.dynamicBar",{styles:this.css.dynamicBar}).inject(this.taskDynamicContainer);
  361. this.dynamicBar.addEvents({
  362. mouseover:function(){
  363. this.dynamicText.setStyle("color","#4a90e2");
  364. this.dynamicIcon.setStyle("background-image","url(../x_component_TeamWork/$Task/default/icon/icon_dw_click.png)")
  365. }.bind(this),
  366. mouseout:function(){
  367. this.dynamicText.setStyle("color","#666666");
  368. this.dynamicIcon.setStyle("background-image","url(../x_component_TeamWork/$Task/default/icon/icon_dw.png)")
  369. }.bind(this),
  370. click:function(){
  371. var pc = new MWF.xApplication.TeamWork.Task.DynamicType(this.container, this.dynamicBar, this.app, {data:this.taskData}, {
  372. css:this.css, lp:this.lp, axis : "y",
  373. position : { //node 固定的位置
  374. x : "right",
  375. y : "middle"
  376. },
  377. nodeStyles : {
  378. "min-width":"150px",
  379. "padding":"2px",
  380. "border-radius":"5px",
  381. "box-shadow":"0px 0px 4px 0px #999999",
  382. "z-index" : "201"
  383. },
  384. onPostLoad:function(){
  385. pc.node.setStyles({"opacity":"0","top":(pc.node.getStyle("top").toInt()-6)+"px","left":(pc.node.getStyle("left").toInt()+10)+"px"});
  386. var fx = new Fx.Tween(pc.node,{duration:400});
  387. fx.start(["opacity"] ,"0", "1");
  388. },
  389. onClose:function(rd){
  390. if(!rd) return;
  391. if(rd.value == "all"){
  392. filter = {};
  393. this.dynamicText.set("text",this.lp.dynamicAll)
  394. }else if(rd.value == "chat"){
  395. filter = {objectType:"CHAT"};
  396. this.dynamicText.set("text",this.lp.dynamicChat)
  397. }else if(rd.value == "attachment"){
  398. this.dynamicText.set("text",this.lp.dynamicAttachment)
  399. filter = {objectType:"ATTACHMENT"};
  400. }
  401. this.dynamicContent.empty();
  402. this.dyncurCount = 0;
  403. this.createDynamicContent(null,filter,function(){
  404. this.dynamicContent.scrollTo(0,this.dynamicContent.getScrollSize().y);
  405. this.getDynamicStatus = false;
  406. }.bind(this))
  407. }.bind(this)
  408. });
  409. pc.load();
  410. }.bind(this),
  411. });
  412. this.dynamicText = new Element("div.dynamicText",{styles:this.css.dynamicText,text:this.lp.dynamicAll}).inject(this.dynamicBar);
  413. this.dynamicIcon = new Element("div.dynamicIcon",{styles:this.css.dynamicIcon}).inject(this.dynamicBar);
  414. this.dynamicContent = new Element("div.dynamicContent",{styles:this.css.dynamicContent}).inject(this.taskDynamicContainer);
  415. var filter = {};
  416. var _y = this.dynamicContent.getScrollSize().y;
  417. this.dynamicContent.addEvents({
  418. scroll:function(){
  419. if(this.getScrollTop()==0){
  420. //alert("top")
  421. //加载下一页
  422. if(_self.getDynamicStatus) return;
  423. if(_self.dyncurCount>=_self.dyntotal) return;
  424. _self.createDynamicContent(_self.curDynamicId,filter,function(){
  425. _self.dynamicContent.scrollTo(0,_y);
  426. _self.getDynamicStatus = false;
  427. });
  428. }
  429. }
  430. });
  431. this.createDynamicContent(null,filter,function(){
  432. this.dynamicContent.scrollTo(0,this.dynamicContent.getScrollSize().y);
  433. this.getDynamicStatus = false;
  434. }.bind(this));
  435. },
  436. createDynamicContent:function(id,data,callback){
  437. this.getDynamicStatus = true;
  438. var _self = this, id = id || "(0)", count = 15, taskId = this.taskData.id;
  439. this.curDynamicId = id;
  440. //this.dyntotal = 0;
  441. this.dyncurCount = this.dyncurCount || 0;
  442. this.tmpdynamicLoading = new Element("div").inject(this.dynamicContent,"top");
  443. this.app.setLoading(this.tmpdynamicLoading);
  444. this.rootActions.DynamicAction.listNextWithTask(id,count,taskId,data||{},function(json){
  445. //this.actions.taskDynamicListNext(id,count,taskId,data||{},function(json){
  446. if(this.tmpdynamicLoading)this.tmpdynamicLoading.destroy();
  447. //this.getDynamicStatus = false;
  448. if(json.type == "success"){
  449. this.dyntotal = json.count;
  450. json.data.each(function(d,i){
  451. this.curDynamicId = d.id;
  452. this.loadDynamicItem(d);
  453. }.bind(this));
  454. if(callback)callback(json)
  455. }
  456. }.bind(this))
  457. },
  458. loadDynamicItem:function(data,where){
  459. this.dyncurCount = this.dyncurCount + 1;
  460. var dynamicItem = new Element("div.dynamicItem",{styles:this.css.dynamicItem}).inject(this.dynamicContent,where||"top");
  461. var dynamicItemIcon = new Element("div.dynamicItemIcon",{styles:this.css.dynamicItemIcon}).inject(dynamicItem);
  462. var optType = data.optType.toUpperCase();
  463. var objectType = data.objectType.toUpperCase();
  464. if(objectType == "CHAT"){
  465. //if(optType.toUpperCase() == "PUBLISH"){
  466. dynamicItemIcon.setStyle("background-image","url(../x_component_TeamWork/$Task/default/icon/dy_chat.png)")
  467. //}
  468. }else if(objectType == "ATTACHMENT"){
  469. if(optType == "DELETE"){ //UPLOAD、DOWNLOAD、DELETE
  470. dynamicItemIcon.setStyle("background-image","url(../x_component_TeamWork/$Task/default/icon/dy_remove.png)")
  471. }else{
  472. dynamicItemIcon.setStyle("background-image","url(../x_component_TeamWork/$Task/default/icon/dy_attachment.png)")
  473. }
  474. }else if(objectType == "TASK"){
  475. //UPDATE_NAME、UPDATE_EXECUTOR、UPDATE_STATUS、UPDATE_TIME、UPDATE_PROGRESS、ADD_TAGS、REMOVE_TAGS、
  476. //ADD_MANAGER、REMOVE_MANAGER、ADD_PARTICIPANTS、REMOVE_PARTICIPANTS、CREATE、DELETE
  477. if(optType=="SPLIT"){
  478. dynamicItemIcon.setStyle("background-image","url(../x_component_TeamWork/$Task/default/icon/dy_subtask.png)")
  479. }else if(optType=="DELETE_SUBTASK"){
  480. dynamicItemIcon.setStyle("background-image","url(../x_component_TeamWork/$Task/default/icon/dy_remove.png)")
  481. }else if(optType=="UPDATE_EXECUTOR"){
  482. dynamicItemIcon.setStyle("background-image","url(../x_component_TeamWork/$Task/default/icon/dy_duty.png)")
  483. }else if(optType=="UPDATE_NAME"){
  484. dynamicItemIcon.setStyle("background-image","url(../x_component_TeamWork/$Task/default/icon/dy_title.png)")
  485. }else if(optType=="UPDATE_WORKSTATUS"){
  486. dynamicItemIcon.setStyle("background-image","url(../x_component_TeamWork/$Task/default/icon/dy_status.png)")
  487. }else if(optType=="UPDATE_WORKDATE"){
  488. dynamicItemIcon.setStyle("background-image","url(../x_component_TeamWork/$Task/default/icon/dy_time.png)")
  489. }else if(optType=="UPDATE_DESCRIPTION"){
  490. dynamicItemIcon.setStyle("background-image","url(../x_component_TeamWork/$Task/default/icon/dy_remark.png)")
  491. }else if(optType=="ADD_PARTICIPANTS" || optType == "REMOVE_PARTICIPANTS"){
  492. dynamicItemIcon.setStyle("background-image","url(../x_component_TeamWork/$Task/default/icon/dy_participant.png)")
  493. }else if(optType=="CREATE"){
  494. dynamicItemIcon.setStyle("background-image","url(../x_component_TeamWork/$Task/default/icon/icon_jia.png)")
  495. }else{
  496. dynamicItemIcon.setStyle("background-image","url(../x_component_TeamWork/$Task/default/icon/icon_edit.png)")
  497. }
  498. }else if(objectType=="TASK_TAG"){
  499. if(optType=="REMOVE"){
  500. dynamicItemIcon.setStyle("background-image","url(../x_component_TeamWork/$Task/default/icon/dy_remove.png)")
  501. }else{
  502. dynamicItemIcon.setStyle("background-image","url(../x_component_TeamWork/$Task/default/icon/dy_tag.png)")
  503. }
  504. }
  505. var dynamicItemText = new Element("div.dynamicItemText",{styles:this.css.dynamicItemText}).inject(dynamicItem);
  506. if(objectType == "CHAT"){
  507. new Element("div.dynamicItemUser",{styles:this.css.dynamicItemUser,text:data.operator.split("@")[0]}).inject(dynamicItemText);
  508. var chattext = data.description.split("\n").join("<br/>");
  509. //转换表情
  510. for(var item in this.app.lp.emoji){
  511. var val = this.app.lp.emoji[item]; //alert(val)
  512. chattext = chattext.split("["+val+"]").join('<img style="margin:0px 2px; width:30px;height:30px;" src="../x_component_TeamWork/$Emoji/default/icon/'+item+'.png" />');
  513. }
  514. new Element("div.dynamicItemUserChat",{styles:{"margin-top":"5px"},html:chattext}).inject(dynamicItemText);
  515. }else{
  516. dynamicItemText.set("text",data.description);
  517. }
  518. var dynamicItemTime = new Element("div.dynamicItemTime",{styles:this.css.dynamicItemTime}).inject(dynamicItem);
  519. dynamicItemTime.set("text",this.compareWithNow(data.createTime).text);
  520. //最后加一层清除浮动
  521. new Element("div.dynamicItemTime",{styles:{"clear":"both"}}).inject(dynamicItem);
  522. },
  523. createChatContainer:function(){
  524. this.taskChatContainer.empty();
  525. var node = this.taskChatContainer;
  526. this.chatContent = new Element("div.chatContent",{styles:this.css.chatContent}).inject(node);
  527. this.chatTextarea = new Element("textarea.chatTextarea",{styles:this.css.chatTextarea,placeholder:this.lp.chatPlaceholder}).inject(this.chatContent);
  528. if(this.control.comment){
  529. this.chatTextarea.addEvents({
  530. keypress:function(e){
  531. var keycode = (e.event.keyCode ? e.event.keyCode : e.event.which);
  532. if (e.event.ctrlKey && (keycode == 13 || keycode == 10)) {
  533. this.chatBarSend.click();
  534. }
  535. }.bind(this)
  536. });
  537. }else{
  538. this.chatTextarea.erase("placeholder");
  539. }
  540. this.chatBarContent = new Element("div.chatBarContent",{styles:this.css.chatBarContent}).inject(node);
  541. this.chatBarTool = new Element("div.chatBarTool",{styles:this.css.chatBarTool}).inject(this.chatBarContent);
  542. this.chatBarEmoji = new Element("div.chatBarEmoji",{styles:this.css.chatBarEmoji,title:this.lp.chatInsertEmoji}).inject(this.chatBarTool);
  543. this.chatBarEmoji.addEvents({
  544. mouseover:function(){this.setStyle("background-image","url(../x_component_TeamWork/$Task/default/icon/icon_emoji_click.png)")},
  545. mouseout:function(){this.setStyle("background-image","url(../x_component_TeamWork/$Task/default/icon/icon_emoji.png)")},
  546. click:function(){
  547. MWF.xDesktop.requireApp("TeamWork", "Emoji", function(){
  548. var pc = new MWF.xApplication.TeamWork.Emoji(this,this.container, this.chatBarEmoji, this.app, {}, {
  549. css:this.css, lp:this.lp, axis : "y",
  550. position : { //node 固定的位置
  551. x : "right",
  552. y : "middle"
  553. },
  554. nodeStyles : {
  555. "min-width":"200px",
  556. "max-width":"350px",
  557. "height":"150px",
  558. "padding":"2px",
  559. "border-radius":"5px",
  560. "box-shadow":"0px 0px 4px 0px #999999",
  561. "z-index" : "201"
  562. },
  563. onPostLoad:function(){
  564. pc.node.setStyles({"opacity":"0","top":(pc.node.getStyle("top").toInt())+"px"});
  565. var fx = new Fx.Tween(pc.node,{duration:400});
  566. fx.start(["opacity"] ,"0", "1");
  567. },
  568. onClose:function(rd){
  569. if(!rd) return;
  570. if(rd.value && rd.value !=""){
  571. this.chatTextarea.set("value",this.chatTextarea.get("value")+"["+rd.value+"]");
  572. this.chatTextarea.focus();
  573. }
  574. }.bind(this)
  575. });
  576. pc.load();
  577. }.bind(this))
  578. }.bind(this)
  579. });
  580. this.chatBarSend = new Element("div.chatBarSend",{styles:this.css.chatBarSend,text:this.lp.chatSend}).inject(this.chatBarContent);
  581. if(this.control.comment) {
  582. this.chatBarSend.addEvents({
  583. click:function(){
  584. if(this.chatTextarea.get("value").trim()=="") return;
  585. var data = {
  586. taskId : this.taskData.id,
  587. content : this.chatTextarea.get("value").trim()
  588. };
  589. //this.actions.chatCreate(data,function(json){
  590. this.rootActions.ChatAction.create(data,function(json){
  591. if(json.data.id){
  592. this.rootActions.ChatAction.get(json.data.id,function(json){
  593. var person = json.data.sender;
  594. var content = json.data.content;
  595. var dynamicItem = new Element("div.dynamicItem",{styles:this.css.dynamicItem}).inject(this.dynamicContent);
  596. var dynamicItemIcon = new Element("div.dynamicItemIcon",{styles:this.css.dynamicItemIcon}).inject(dynamicItem);
  597. dynamicItemIcon.setStyle("background-image","url(../x_component_TeamWork/$Task/default/icon/icon_chat.png)")
  598. var dynamicItemText = new Element("div.dynamicItemText",{styles:this.css.dynamicItemText}).inject(dynamicItem);
  599. new Element("div.dynamicItemUser",{styles:this.css.dynamicItemUser,text:person.split("@")[0]}).inject(dynamicItemText);
  600. var chattext = content.split("\n").join("<br/>");
  601. for(var item in this.app.lp.emoji){
  602. var val = this.app.lp.emoji[item];
  603. chattext = chattext.split("["+val+"]").join('<img style="margin:0 2px; width:30px;height:30px;" src="../x_component_TeamWork/$Emoji/default/icon/'+item+'.png" />');
  604. }
  605. new Element("div.dynamicItemUserChat",{styles:{"margin-top":"5px"},html:chattext}).inject(dynamicItemText);
  606. var dynamicItemTime = new Element("div.dynamicItemTime",{styles:this.css.dynamicItemTime}).inject(dynamicItem);
  607. dynamicItemTime.set("text","刚刚");
  608. new Element("div.dynamicItemTime",{styles:{"clear":"both"}}).inject(dynamicItem);
  609. this.dynamicContent.scrollTo(0,this.dynamicContent.getScrollSize().y);
  610. }.bind(this))
  611. }
  612. this.createChatContainer()
  613. }.bind(this))
  614. }.bind(this)
  615. })
  616. }else{
  617. this.chatBarSend.setStyles({"cursor":"not-allowed"});
  618. }
  619. },
  620. addDynamicItem:function(){
  621. },
  622. getTaskData:function(callback){
  623. if(this.data.taskId){
  624. //this.actions.taskGet(this.data.taskId,function(json){
  625. this.actions.get(this.data.taskId,function(json){
  626. if(json.data) {
  627. this.taskData = json.data;
  628. this.getProject(this.taskData.project,function(){
  629. if(callback)callback()
  630. }.bind(this))
  631. }
  632. }.bind(this))
  633. }
  634. },
  635. setTaskData:function(){
  636. var _self = this;
  637. //名称
  638. if(this.taskNameContainer){
  639. this.loadNameValue();
  640. }
  641. //状态
  642. if(this.taskStatusValue){
  643. this.loadStatusValue()
  644. }
  645. //负责人
  646. if(this.taskDutyValue){
  647. this.loadDutyValue()
  648. }
  649. //时间
  650. if(this.taskTimeContainer){
  651. this.loadTimeValue()
  652. }
  653. //备注
  654. if(this.taskRemarkContainer){
  655. this.loadRemarkValue()
  656. }
  657. //优先级
  658. if(this.taskPriorityValue){
  659. this.loadPriorityValue()
  660. }
  661. //标签
  662. if(this.taskTagValue){
  663. this.loadTagValue()
  664. }
  665. //附件
  666. if(this.taskAttachmentValue){
  667. this.loadAttachment(this.taskAttachmentValue)
  668. }
  669. },
  670. saveTaskData:function(callback) {
  671. if(this.editor){
  672. this.taskData.description = encodeURI(this.editor.getData());
  673. }
  674. this.actions.save(this.taskData,function(json){
  675. if(this.editor) delete this.editor;
  676. //alert(JSON.stringify(json));
  677. this.reload();
  678. //刷新project区域内的task,可能有更新,删除等 干脆直接载入区域
  679. var data = {
  680. "act":"save",
  681. "taskId":json.data.id
  682. };
  683. this.reloadOutContent(data);
  684. }.bind(this))
  685. },
  686. reloadOutContent:function(json){
  687. if(json.act == "save"){
  688. //保存操作,刷新task即可
  689. var taskNode = this.explorer.container.getElementById(json.taskId);
  690. if(!taskNode) return;
  691. this.actions.get(json.taskId,function(d){
  692. this.explorer.loadTaskNode(taskNode,d.data)
  693. }.bind(this));
  694. }
  695. },
  696. updateSingleProperty:function(data,callback){
  697. //this.actions.updateSingleProperty(data.taskId,data,function(json){
  698. this.actions.updateSingleProperty(data.taskId,data,function(json){
  699. if(json.data.dynamics){
  700. json.data.dynamics.each(function(dd){
  701. this.loadDynamicItem(dd,"bottom");
  702. }.bind(this))
  703. }
  704. this.dynamicContent.scrollTo(0,this.dynamicContent.getScrollSize().y);
  705. if(callback)callback(json.data)
  706. }.bind(this))
  707. },
  708. loadNameValue:function(){ //名称
  709. var _self = this;
  710. this.taskNameContainer.set("text",this.taskData.name);
  711. if(this.control.isEdit){ //权限修改
  712. var node = this.taskNameContainer;
  713. var nameEdit = false;
  714. var overStatus = null;
  715. node.addEvents({
  716. mouseenter:function(){
  717. overStatus = window.setTimeout(function(){
  718. var opt={ axis: "y", position : { x : "auto", y : "top"} };
  719. //_self.app.showTips(node,{_html:"<div style='margin:2px 5px;'>"+_self.lp.editTip+"</div>"},opt);
  720. node.set("title",_self.lp.editTip);
  721. },300);
  722. if(this.getElement("input")) return;
  723. var name = this.get("text");
  724. node.empty();
  725. var input = new Element("input.taskNameInput",{type:"text",value:name,styles:_self.css.taskNameInput}).inject(node);
  726. input.addEvents({
  727. click:function(ev){
  728. nameEdit = true;
  729. if(_self.app.st&&_self.app.st.node)_self.app.st.node.destroy();
  730. delete _self.app.st;
  731. ev.stopPropagation()
  732. },
  733. blur:function(){
  734. var v = this.get("value").trim();
  735. if(v=="" || v == _self.taskData.name){
  736. _self.taskNameContainer.empty();
  737. _self.taskNameContainer.set("text",_self.taskData.name);
  738. _self.taskNameContainer.setStyles({"background-color":""});
  739. _self.taskData.name = v;
  740. }else{
  741. if(v != _self.taskData.name){
  742. var sd = {
  743. taskId:_self.taskData.id,
  744. property:"name",
  745. mainValue:v,
  746. secondaryValue:""
  747. }
  748. _self.updateSingleProperty(sd,function(json){
  749. _self.taskNameContainer.empty();
  750. _self.taskNameContainer.set("text",v);
  751. _self.taskNameContainer.setStyles({"background-color":""});
  752. _self.taskData.name = v;
  753. nameEdit = false;
  754. })
  755. }
  756. }
  757. }
  758. });
  759. },
  760. mouseleave:function(){
  761. window.clearTimeout(overStatus);
  762. if(!nameEdit){
  763. if(this.getElement("input")){
  764. var n = this.getElement("input").get("value");
  765. this.empty();
  766. this.set("text",n);
  767. }
  768. this.setStyles({"background-color":""})
  769. }
  770. }
  771. });
  772. }
  773. },
  774. loadStatusValue:function(){ //状态
  775. var _self = this;
  776. if(this.taskStatusValue) this.taskStatusValue.empty();
  777. this.taskStatusValueContainer = new Element("div.taskStatusValueContainer",{styles:this.css.taskStatusValueContainer}).inject(this.taskStatusValue);
  778. this.taskStatusValueIcon = new Element("div.taskStatusValueIcon",{styles:this.css.taskStatusValueIcon}).inject(this.taskStatusValueContainer);
  779. this.taskStatusValueText = new Element("div.taskStatusValueText",{styles:this.css.taskStatusValueText}).inject(this.taskStatusValueContainer);
  780. if(this.taskData.workStatus == "draft"){
  781. this.taskStatusValueContainer.setStyles({"color":"#666666"});
  782. this.taskStatusValueIcon.setStyles({"background-image":"url(../x_component_TeamWork/$Task/default/icon/icon_draft.png)"});
  783. this.taskStatusValueText.set("text",this.lp.status.draft);
  784. }else if(this.taskData.workStatus == "flow"){
  785. this.taskStatusValueContainer.setStyles({"color":"#666666"});
  786. this.taskStatusValueIcon.setStyles({"background-image":"url(../x_component_TeamWork/$Task/default/icon/icon_flow.png)"});
  787. this.taskStatusValueText.set("text",this.lp.status.flow);
  788. }else if(this.taskData.workStatus == "processing") {
  789. this.taskStatusValueContainer.setStyles({"color": "#666666"});
  790. this.taskStatusValueIcon.setStyles({"background-image": "url(../x_component_TeamWork/$Task/default/icon/icon_flow.png)"});
  791. this.taskStatusValueText.set("text",this.lp.status.processing);
  792. }else if(this.taskData.workStatus == "completed"){
  793. this.taskStatusValueContainer.setStyles({"color":"#69b439"});
  794. this.taskStatusValueIcon.setStyles({"background-image":"url(../x_component_TeamWork/$Task/default/icon/icon_complete.png)"});
  795. this.taskStatusValueText.set("text",this.lp.status.completed);
  796. }
  797. if(this.control.isEdit){ //权限
  798. this.taskStatusValueContainer.addEvents({
  799. click:function(){
  800. var sc = new MWF.xApplication.TeamWork.Task.StatusCheck(this.container, this.taskStatusValueContainer, this.app, {data:this.taskData}, {
  801. css:this.css, lp:this.lp, axis : "y",
  802. position : { //node 固定的位置
  803. x : "right",
  804. y : "middle"
  805. },
  806. nodeStyles : {
  807. "min-width":"200px",
  808. "padding":"2px",
  809. "border-radius":"5px",
  810. "box-shadow":"0px 0px 4px 0px #999999",
  811. "z-index" : "201"
  812. },
  813. onPostLoad:function(){
  814. sc.node.setStyles({"opacity":"0","top":(sc.node.getStyle("top").toInt()+4)+"px"});
  815. var fx = new Fx.Tween(sc.node,{duration:400});
  816. fx.start(["opacity"] ,"0", "1");
  817. },
  818. onClose:function(rd){
  819. if(!rd) return;
  820. if(rd.status){
  821. if(rd.status != this.taskData.workStatus){
  822. var sd = {
  823. taskId:_self.taskData.id,
  824. property:"workStatus",
  825. mainValue:rd.status,
  826. secondaryValue:""
  827. };
  828. _self.updateSingleProperty(sd,function(){
  829. this.taskData.workStatus = rd.status;
  830. this.loadStatusValue();
  831. }.bind(this))
  832. }
  833. }
  834. }.bind(this)
  835. });
  836. sc.load();
  837. }.bind(this),
  838. mouseover:function(){
  839. this.setStyles({"background-color":"#efefef"});
  840. this.getElement(".taskStatusValueIcon").setStyles({ "background-image":"url(../x_component_TeamWork/$Task/default/icon/icon_down.png)"})
  841. },
  842. mouseout:function(){
  843. this.setStyles(_self.css.taskStatusValueContainer);
  844. var bgurl = "url(../x_component_TeamWork/$Task/default/icon/icon_draft.png)";
  845. if(_self.taskData.workStatus == "processing")bgurl = "url(../x_component_TeamWork/$Task/default/icon/icon_flow.png)";
  846. else if(_self.taskData.workStatus == "completed")bgurl = "url(../x_component_TeamWork/$Task/default/icon/icon_complete.png)";
  847. this.getElement(".taskStatusValueIcon").setStyles({"background-image":bgurl})
  848. }
  849. });
  850. }
  851. },
  852. loadDutyValue:function(){
  853. var _self = this;
  854. if(this.taskDutyValue) this.taskDutyValue.empty();
  855. this.taskDutyValueContainer = new Element("div.taskDutyValueContainer",{styles:this.css.taskDutyValueContainer}).inject(this.taskDutyValue);
  856. if(this.control.isEdit){//权限
  857. if(this.taskData.executor==""){
  858. this.taskDutyAddIcon = new Element("div.taskDutyAddIcon",{styles:this.css.taskDutyAddIcon}).inject(this.taskDutyValueContainer);
  859. this.taskDutyAddText = new Element("div.taskDutyAddText",{styles:this.css.taskDutyAddText,text:this.lp.addDuty}).inject(this.taskDutyValueContainer);
  860. this.taskDutyAddText.addEvents({
  861. mouseover:function(){this.setStyles({"color":"#4a90e2"})},
  862. mouseout:function(){this.setStyles({"color":"#666666"})},
  863. click:function(){
  864. this.selectPerson(this.taskDutyAddText,"identity",null,1,
  865. function(json){
  866. if(json.length>0){
  867. this.taskData.executor = json[0];
  868. this.loadDutyValue()
  869. }
  870. }.bind(this));
  871. }.bind(this)
  872. })
  873. }else{
  874. this.loadTaskPerson(this.taskDutyValueContainer,this.taskData.executor,this.taskData.control.founder);
  875. }
  876. }else{
  877. if(this.taskData.executor!=""){
  878. this.loadTaskPerson(this.taskDutyValueContainer,this.taskData.executor);
  879. }
  880. }
  881. },
  882. loadTimeValue:function(){
  883. var _self = this;
  884. this.taskStartTime = new Element("div.taskStartTime",{styles:this.css.taskStartTime}).inject(this.taskTimeContainer);
  885. this.taskTimeLine = new Element("div.taskTimeLine",{styles:this.css.taskTimeLine,text:"-"}).inject(this.taskTimeContainer);
  886. this.taskEndTime = new Element("div.taskEndTime",{styles:this.css.taskEndTime}).inject(this.taskTimeContainer);
  887. if(this.taskData.startTime && this.taskData.startTime!=""){
  888. this.taskStartTime.set("text",this.taskData.startTime);
  889. this.taskStartTime.setStyles({"color":"#333333"});
  890. }else{
  891. this.taskStartTime.set("text",this.lp.taskTimeStart);
  892. }
  893. if(this.taskData.endTime && this.taskData.endTime!=""){
  894. this.taskEndTime.set("text",this.taskData.endTime);
  895. this.taskEndTime.setStyles({"color":"#333333"});
  896. }else{
  897. this.taskEndTime.set("text",this.lp.taskTimeEnd);
  898. }
  899. if(this.control.isEdit){ //权限
  900. this.taskStartTime.setStyles({"background-color":"#f5f5f5","cursor":"pointer"});
  901. this.taskEndTime.setStyles({"background-color":"#f5f5f5","cursor":"pointer"});
  902. this.taskStartTime.addEvents({
  903. click:function(){
  904. var opt = {
  905. type:"datetime"
  906. };
  907. this.app.selectCalendar(this.taskStartTime,this.container,opt,function(json){
  908. var sd = {
  909. taskId:_self.taskData.id,
  910. property:"startTime",
  911. secondaryValue:""
  912. };
  913. if(json.action == "ok"){
  914. this.taskStartTime.set("text",json.dateString+":00");
  915. sd.mainValue = json.dateString+":00"
  916. }else if(json.action == "clear"){
  917. this.taskStartTime.set("text",this.lp.taskTimeStart);
  918. sd.mainValue = ""
  919. }
  920. this.updateSingleProperty(sd)
  921. }.bind(this))
  922. }.bind(this)
  923. });
  924. this.taskEndTime.addEvents({
  925. click:function(){
  926. var opt = {
  927. type:"datetime"
  928. };
  929. this.app.selectCalendar(this.taskEndTime,this.container,opt,function(json){
  930. var sd = {
  931. taskId:_self.taskData.id,
  932. property:"endTime",
  933. secondaryValue:""
  934. };
  935. if(json.action == "ok"){
  936. this.taskEndTime.set("text",json.dateString+":00");
  937. sd.mainValue = json.dateString + ":00"
  938. }else if(json.action == "clear"){
  939. this.taskEndTime.set("text",this.lp.taskTimeEnd);
  940. sd.mainValue = ""
  941. }
  942. this.updateSingleProperty(sd)
  943. }.bind(this))
  944. }.bind(this)
  945. })
  946. }
  947. },
  948. loadRemarkValue:function(){
  949. var _self = this;
  950. var value = this.taskData.description || "";
  951. value = decodeURI(value);
  952. this.taskRemarkValue.set("html",value);
  953. if(this.taskRemarkValue.getFirst("p")){
  954. this.taskRemarkValue.getFirst("p").setStyles({"margin-top":"0px"})
  955. }
  956. if(this.editor) delete this.editor;
  957. if(this.control.isEdit){ //权限
  958. if(value == ""){
  959. this.taskRemarkValue.set("text",this.lp.editTip);
  960. }
  961. this.taskRemarkValue.removeEvents(["click"])
  962. this.taskRemarkValue.addEvents({
  963. click:function(e){
  964. this.taskRemarkValue.setStyles({"background-color":"","color":""});
  965. this.taskRemarkValue.removeEvents(["mouseenter"]);
  966. if(!this.editor)this.taskRemarkValue.empty();
  967. this.loadRemarkEditor(this.taskRemarkValue,value,"taskRemark");
  968. e.stopPropagation();
  969. }.bind(this),
  970. mouseenter:function(){
  971. this.taskRemarkValue.setStyles({"background-color":"#f5f5f5","color":"#999999"})
  972. }.bind(this),
  973. mouseleave:function(){
  974. this.taskRemarkValue.setStyles({"background-color":"","color":""})
  975. }.bind(this)
  976. });
  977. }
  978. },
  979. loadPriorityValue:function(){
  980. if(this.taskPriorityValue)this.taskPriorityValue.empty();
  981. var node = new Element("div.taskPriorityValueText",{styles:this.css.taskPriorityValueText}).inject(this.taskPriorityValue);
  982. var dColor = "#999999";
  983. if(this.taskData.priority){
  984. var arr = this.taskData.priority.split("||");
  985. var name = arr[0]?arr[0]:this.lp.priority.normal;
  986. var color = arr[1]?arr[1]:dColor;
  987. node.set("text",name);
  988. // if(this.taskData.priority == this.lp.priority.urgency) curColor = "#ffaf38";
  989. // else if(this.taskData.priority == this.lp.priority.emergency) curColor = "#ff4f3e";
  990. node.setStyles({"color":color,"border":"1px solid "+color+""});
  991. }else{
  992. node.set("text",this.lp.priority.normal)
  993. }
  994. if(this.control.isEdit){
  995. node.addEvents({
  996. click:function(){
  997. var pc = new MWF.xApplication.TeamWork.Task.PriorityCheck(this.container, node, this.app, {data:this.taskData}, {
  998. css:this.css, lp:this.lp, axis : "y",
  999. position : { //node 固定的位置
  1000. x : "right",
  1001. y : "middle"
  1002. },
  1003. nodeStyles : {
  1004. "min-width":"200px",
  1005. "padding":"2px",
  1006. "border-radius":"5px",
  1007. "box-shadow":"0px 0px 4px 0px #999999",
  1008. "z-index" : "201"
  1009. },
  1010. onPostLoad:function(){
  1011. pc.node.setStyles({"opacity":"0","top":(pc.node.getStyle("top").toInt()+4)+"px"});
  1012. var fx = new Fx.Tween(pc.node,{duration:400});
  1013. fx.start(["opacity"] ,"0", "1");
  1014. },
  1015. onClose:function(rd){
  1016. if(!rd) return;
  1017. if(rd.value){
  1018. if(rd.value != this.taskData.priority){
  1019. var sd = {
  1020. taskId:this.taskData.id,
  1021. property:"priority",
  1022. mainValue:rd.value,
  1023. secondaryValue:""
  1024. };
  1025. this.updateSingleProperty(sd,function(){
  1026. this.taskData.priority = rd.value;
  1027. this.loadPriorityValue();
  1028. }.bind(this))
  1029. }
  1030. }
  1031. this.loadPriorityValue();
  1032. }.bind(this)
  1033. });
  1034. pc.load();
  1035. }.bind(this),
  1036. mouseover:function(){
  1037. this.setStyles({"border":"1px solid #4A90E2","color":"#4A90E2"})
  1038. },
  1039. mouseout:function(){
  1040. this.setStyles({"border":"1px solid "+color+"","color":color})
  1041. }
  1042. })
  1043. }
  1044. },
  1045. loadTagValue:function(){
  1046. if(this.taskTagValue)this.taskTagValue.empty();
  1047. this.taskTagLayout = new Element("div.taskTagLayout",{styles:this.css.taskTagLayout}).inject(this.taskTagValue);
  1048. this.taskTagAddContainer = new Element("div.taskTagAddContainer",{styles:this.css.taskTagAddContainer}).inject(this.taskTagValue);
  1049. this.taskTagAddText = new Element("div.taskTagAddText",{styles:this.css.taskTagAddText,text:this.lp.taskTagAddText}).inject(this.taskTagAddContainer);
  1050. this.taskTagAddText.addEvents({
  1051. mouseover:function(){this.setStyles({"color":"#4A90E2"})},
  1052. mouseout:function(){this.setStyles({"color":"#666666"})},
  1053. click:function(){
  1054. this.loadTaskTag(this.taskTagAddText)
  1055. }.bind(this)
  1056. });
  1057. this.taskTagAdd = new Element("div.taskTagAdd",{styles:this.css.taskTagAdd}).inject(this.taskTagAddContainer);
  1058. this.taskTagAdd.addEvents({
  1059. mouseover:function(){this.setStyles({"background-image":"url(../x_component_TeamWork/$Task/default/icon/icon_subtask_add.png)"})},
  1060. mouseout:function(){this.setStyles({"background-image":"url(../x_component_TeamWork/$Task/default/icon/icon_jia.png)"})},
  1061. click:function(){
  1062. this.loadTaskTag(this.taskTagAdd)
  1063. }.bind(this)
  1064. });
  1065. if(!this.taskData.tags || this.taskData.tags.length==0){
  1066. this.taskTagAdd.hide();
  1067. }else{
  1068. this.taskTagAddText.hide();
  1069. this.taskData.tags.each(function(json){
  1070. this.loadTagItem(json)
  1071. }.bind(this))
  1072. }
  1073. },
  1074. loadTagItem:function(data){
  1075. var _self = this;
  1076. var tagItemContainer = new Element("div.tagItemContainer",{styles:this.css.tagItemContainer,id:data.id}).inject(this.taskTagLayout);
  1077. tagItemContainer.setStyles({"background-color":data.tagColor});
  1078. tagItemContainer.addEvents({
  1079. mouseenter:function(){
  1080. var tagItemClose = new Element("div.tagItemClose",{styles:_self.css.tagItemClose}).inject(tagItemContainer);
  1081. tagItemContainer.setStyles({"width":(tagItemContainer.getWidth().toInt()+2)+"px"});
  1082. tagItemText.setStyles({"margin-right":"5px"});
  1083. tagItemText.set("title",data.tag);
  1084. tagItemClose.addEvents({
  1085. click:function(){
  1086. _self.rootActions.TaskTagAction.removeTagRele(_self.taskData.id,data.id,function(json){
  1087. if(json.data.dynamics){
  1088. json.data.dynamics.each(function(dd){
  1089. _self.loadDynamicItem(dd,"bottom")
  1090. })
  1091. }
  1092. _self.dynamicContent.scrollTo(0,_self.dynamicContent.getScrollSize().y);
  1093. tagItemContainer.destroy();
  1094. _self.taskData.tags.each(function(ddd){
  1095. if(ddd.id == data.id){
  1096. _self.taskData.tags.erase(ddd)
  1097. }
  1098. })
  1099. })
  1100. }
  1101. })
  1102. },
  1103. mouseleave:function(){
  1104. //tagItemContainer.setStyles({"width":(tagItemContainer.getWidth().toInt()-this.getElement(".tagItemClose").getWidth()-2)+"px"});
  1105. tagItemContainer.setStyles({"width":""});
  1106. tagItemText.setStyles({"margin-right":"10px"});
  1107. this.getElement(".tagItemClose").destroy();
  1108. }
  1109. });
  1110. var tagItemText = new Element("div.tagItemText",{styles:this.css.tagItemText}).inject(tagItemContainer);
  1111. tagItemText.set("text",data.tag);
  1112. },
  1113. loadTaskTag:function(node){
  1114. MWF.xDesktop.requireApp("TeamWork", "TaskTag", function(){
  1115. //alert(JSON.stringify(this.taskData.tags))
  1116. var data = {
  1117. projectId:this.taskData.project,
  1118. taskId:this.taskData.id,
  1119. taskTags:this.taskData.tags||[]
  1120. };
  1121. var pc = new MWF.xApplication.TeamWork.TaskTag(this.container, node, this.app, data, {
  1122. axis : "y",
  1123. position : { //node 固定的位置
  1124. x : "right",
  1125. y : "middle"
  1126. },
  1127. nodeStyles : {
  1128. "min-width":"200px",
  1129. "width":"210px",
  1130. //"height":"80px",
  1131. "padding":"2px",
  1132. "border-radius":"2px",
  1133. "box-shadow":"0px 0px 4px 0px #999999",
  1134. "z-index" : "201"
  1135. },
  1136. onPostLoad:function(){
  1137. pc.node.setStyles({"opacity":"0","top":(pc.node.getStyle("top").toInt())+"px"});
  1138. var fx = new Fx.Tween(pc.node,{duration:400});
  1139. fx.start(["opacity"] ,"0", "1");
  1140. },
  1141. onClose:function(rd){
  1142. if(!rd) return;
  1143. // if(rd.value && rd.value !=""){
  1144. // this.chatTextarea.set("value",this.chatTextarea.get("value")+"["+rd.value+"]")
  1145. // }
  1146. }.bind(this)
  1147. },null,this);
  1148. pc.load();
  1149. }.bind(this))
  1150. },
  1151. loadRemarkEditor:function(parent,value,name){
  1152. if(this.editor)return;
  1153. COMMON.AjaxModule.load("ckeditor", function(){
  1154. //CKEDITOR.disableAutoInline = true;
  1155. var item = new Element("div",{
  1156. "name" : name,
  1157. "id" : name
  1158. });
  1159. //item.set( attr );
  1160. if(parent)item.inject(parent);
  1161. //if( value )item.set("html", value);
  1162. var editorConfig = {
  1163. "autoGrow_maxHeight": 400,
  1164. //"autoGrow_minHeight": 300,
  1165. "resize_enabled": true,
  1166. //"resize_maxHeight": "3000",
  1167. //"resize_minHeight": "200",
  1168. "autoParagraph": true,
  1169. "autoUpdateElement": true,
  1170. "enterMode": 1,
  1171. "height": 100,
  1172. "width": 580,
  1173. "readOnly": false,
  1174. "startupFocus" : true,
  1175. toolbar : [
  1176. //{ name: 'document', items : [ 'Preview' ] },
  1177. //{ name: 'clipboard', items : [ 'Cut','Copy','Paste','PasteText','PasteFromWord','-','Undo','Redo' ] },
  1178. { name: 'basicstyles', items : [ 'Bold','Underline','Strike','-','RemoveFormat' ] },
  1179. //{ name: 'paragraph', items : [ 'JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock' ] },
  1180. { name: 'styles', items : [ 'Font','FontSize' ] },
  1181. { name: 'colors', items : [ 'TextColor' ] },
  1182. { name: 'links', items : [ 'Link','Unlink' ] },
  1183. //{ name: 'insert', items : [ 'Image' ] },
  1184. { name: 'tools', items : [ 'Maximize','-' ] }
  1185. ]
  1186. };
  1187. if( this.options.RTFConfig ){
  1188. editorConfig = Object.merge( editorConfig, this.options.RTFConfig )
  1189. }
  1190. if( editorConfig.skin )editorConfig.skin = "moono-lisa";
  1191. this.editor = CKEDITOR.replace(item, editorConfig);
  1192. //this.items.push( this.editor );
  1193. this.editor.setData(value);
  1194. this.editor.on('instanceReady', function (e) {
  1195. this.editor.focus();
  1196. var range = this.editor.createRange();
  1197. range.moveToElementEditEnd(this.editor.editable());
  1198. this.editor.getSelection().selectRanges([range]);
  1199. this.taskRemarkActionContainer = new Element("div.taskRemarkActionContainer",{styles:this.css.taskRemarkActionContainer}).inject(parent);
  1200. this.taskRemarkActionOk = new Element("div.taskRemarkActionOk",{styles:this.css.taskRemarkActionOk,text:this.lp.save}).inject(this.taskRemarkActionContainer);
  1201. this.taskRemarkActionOk.addEvents({
  1202. mouseover:function(){this.setStyles({"opacity":"0.9"})},
  1203. mouseout:function(){this.setStyles({"opacity":"1"})},
  1204. click:function(e){
  1205. var sd = {
  1206. taskId:this.taskData.id,
  1207. property:"description",
  1208. dataType:"RichText",
  1209. mainValue:encodeURI(this.editor.getData()),
  1210. secondaryValue:this.editor.document.getBody().getText()
  1211. }
  1212. this.updateSingleProperty(sd,function(json){
  1213. this.taskData.description = encodeURI(this.editor.getData());
  1214. this.loadRemarkValue()
  1215. delete this.editor;
  1216. }.bind(this))
  1217. e.stopPropagation();
  1218. //this.taskData.description = encodeURI(this.editor.getData());
  1219. }.bind(this)
  1220. });
  1221. this.taskRemarkActionCancel = new Element("div.taskRemarkActionCancel",{styles:this.css.taskRemarkActionCancel,text:this.lp.cancel}).inject(this.taskRemarkActionContainer);
  1222. this.taskRemarkActionCancel.addEvents({
  1223. mouseover:function(){this.setStyles({"color":"#4A90E2"})},
  1224. mouseout:function(){this.setStyles({"color":"#999999"})},
  1225. click:function(e){
  1226. this.loadRemarkValue();
  1227. e.stopPropagation()
  1228. }.bind(this)
  1229. })
  1230. }.bind(this))
  1231. }.bind(this));
  1232. },
  1233. loadAttachment: function( area ){
  1234. MWF.xDesktop.requireApp("TeamWork", "TaskAttachment", function(){
  1235. this.attachment = new MWF.xApplication.TeamWork.TaskAttachment( area, this.app, this.actions, this.app.lp, {
  1236. size:"max",
  1237. documentId : this.taskData.id,
  1238. //isNew : this.options.isNew,
  1239. //isEdited : this.options.isEdited,
  1240. onQueryUploadAttachment : function(){
  1241. this.attachment.isQueryUploadSuccess = true;
  1242. if( !this.taskData.id || this.taskData.id=="" ){
  1243. }
  1244. }.bind(this)
  1245. });
  1246. this.attachment.load();
  1247. }.bind(this));
  1248. },
  1249. loadTaskAttachmentListContainer:function(){
  1250. MWF.xDesktop.requireApp("TeamWork", "TaskAttachmentList", function(){
  1251. var data = {
  1252. id:this.taskData.id
  1253. };
  1254. var opt = {};
  1255. this.attachment = new MWF.xApplication.TeamWork.TaskAttachmentList( this,this.taskAttachmentListContainer, data, opt);
  1256. this.attachment.load();
  1257. }.bind(this));
  1258. },
  1259. loadSubTaskContainer:function(){
  1260. this.subTaskContainer.empty();
  1261. this.subTaskTitleContent = new Element("div.subTaskTitleContent",{styles:this.css.subTaskTitleContent}).inject(this.subTaskContainer);
  1262. this.subTaskTitleIcon = new Element("div.subTaskTitleIcon",{styles:this.css.subTaskTitleIcon}).inject(this.subTaskTitleContent);
  1263. this.subTaskTitleText = new Element("div.subTaskTitleText",{styles:this.css.subTaskTitleText,text:this.lp.taskSubName+""}).inject(this.subTaskTitleContent);
  1264. this.subTaskValueContent = new Element("div.subTaskValueContent",{styles:this.css.subTaskValueContent}).inject(this.subTaskContainer);
  1265. this.subTaskAddContainer = new Element("div.subTaskAddContainer",{styles:this.css.subTaskAddContainer}).inject(this.subTaskValueContent);
  1266. //子任务列表
  1267. this.subTaskListContent = new Element("div.subTaskListContent",{styles:this.css.subTaskListContent}).inject(this.subTaskAddContainer);
  1268. this.loadSubTask();
  1269. //添加子任务
  1270. if(this.control.isEdit){ //权限
  1271. this.subTaskNewContent = new Element("div.subTaskNewContent",{styles:this.css.subTaskNewContent}).inject(this.subTaskAddContainer);
  1272. this.subTaskNewIcon = new Element("div.subTaskNewIcon",{styles:this.css.subTaskNewIcon}).inject(this.subTaskNewContent);
  1273. this.subTaskNewText = new Element("div.subTaskNewText",{styles:this.css.subTaskNewText,text:this.lp.taskSubText}).inject(this.subTaskNewContent);
  1274. this.subTaskNewContent.addEvents({
  1275. click:function(){
  1276. this.subTaskNewContent.hide();
  1277. if(this.subTaskNewContainer)this.subTaskNewContainer.destroy();
  1278. this.subTaskNewContainer = new Element("div.subTaskNewContainer",{styles:this.css.subTaskNewContainer}).inject(this.subTaskAddContainer);
  1279. this.subTaskNewValue = new Element("div.subTaskNewValue",{styles:this.css.subTaskNewValue}).inject(this.subTaskNewContainer);
  1280. this.subTaskNewInput = new Element("input.subTaskNewInput",{styles:this.css.subTaskNewInput,placeholder:this.lp.taskSubNamePlaceholder}).inject(this.subTaskNewValue);
  1281. this.subTaskNewPerson = new Element("div.subTaskNewPerson",{styles:this.css.subTaskNewPerson}).inject(this.subTaskNewValue);
  1282. this.subTaskNewPerson.addEvent("click",function(){
  1283. this.selectPerson(this.subTaskNewPerson,"identity",null,1,
  1284. function(json){
  1285. if(json.length>0){
  1286. this.taskSubNewPerson = json[0];
  1287. this.loadSubTaskPerson(this.subTaskNewPerson,json[0],true)
  1288. }
  1289. }.bind(this)
  1290. );
  1291. }.bind(this));
  1292. this.subTaskNewAction = new Element("div.subTaskNewAction",{styles:this.css.subTaskNewAction}).inject(this.subTaskNewContainer);
  1293. this.subTaskNewCancel = new Element("div.subTaskNewCancel",{styles:this.css.subTaskNewCancel,text:this.lp.cancel}).inject(this.subTaskNewAction);
  1294. this.subTaskNewCancel.addEvents({
  1295. click:function(){
  1296. this.subTaskNewContent.show();
  1297. this.subTaskNewContainer.destroy()
  1298. }.bind(this),
  1299. mouseover:function(){
  1300. this.setStyles({"color":"#4A90E2"})
  1301. },
  1302. mouseout:function(){
  1303. this.setStyles({"color":"#666666"})
  1304. }
  1305. });
  1306. this.subTaskNewOK = new Element("div.subTaskNewOK",{styles:this.css.subTaskNewOK,text:this.lp.save}).inject(this.subTaskNewAction);
  1307. this.subTaskNewOK.addEvents({
  1308. click:function(){
  1309. if(this.subTaskNewInput.get("value").trim()=="") return;
  1310. var data = {
  1311. name:this.subTaskNewInput.get("value").trim(),
  1312. project:this.taskData.project,
  1313. parent:this.taskData.id,
  1314. taskGroupId:this.taskData.taskGroupId,
  1315. executor:this.taskSubNewPerson || ""
  1316. };
  1317. this.actions.save(data,function(json){
  1318. this.taskSubNewPerson = "";
  1319. if(json.data.id){
  1320. //this.actions.taskGet(json.data.id,function(d){
  1321. this.actions.get(json.data.id,function(d){
  1322. this.loadSubTaskItem(this.subTaskListContent,d.data);
  1323. }.bind(this))
  1324. }
  1325. this.subTaskNewContent.show();
  1326. this.subTaskNewContainer.destroy();
  1327. if(json.data.dynamics){
  1328. json.data.dynamics.each(function(dd){
  1329. this.loadDynamicItem(dd,"bottom")
  1330. }.bind(this));
  1331. }
  1332. this.dynamicContent.scrollTo(0,this.dynamicContent.getScrollSize().y);
  1333. }.bind(this))
  1334. }.bind(this)
  1335. })
  1336. }.bind(this)
  1337. });
  1338. }
  1339. },
  1340. loadSubTask:function(){
  1341. var node = this.subTaskListContent;
  1342. node.empty();
  1343. this.actions.listSubTaskWithTaskId(this.taskData.id,function(json){
  1344. json.data.each(function(data){
  1345. this.loadSubTaskItem(node,data);
  1346. }.bind(this))
  1347. }.bind(this))
  1348. },
  1349. loadSubTaskItem:function(node,data){
  1350. var subTaskItemContainer = new Element("div.subTaskItemContainer",{styles:this.css.subTaskItemContainer,id:data.id}).inject(node);
  1351. var subTaskItemText = new Element("div.subTaskItemText",{styles:this.css.subTaskItemText,text:data.name,title:this.lp.taskSubDes}).inject(subTaskItemContainer);
  1352. subTaskItemText.addEvents({
  1353. mouseover:function(){
  1354. this.setStyles({"background-color":"#f5f5f5"})
  1355. },
  1356. mouseout:function(){
  1357. this.setStyles({"background-color":""})
  1358. },
  1359. click:function(){
  1360. var id = subTaskItemContainer.get("id");
  1361. if(id && id!=""){
  1362. this.data.taskId = id;
  1363. this.openTask()
  1364. }
  1365. }.bind(this)
  1366. });
  1367. var subTaskItemPerson = new Element("div.subTaskItemPerson",{styles:this.css.subTaskItemPerson}).inject(subTaskItemContainer);
  1368. // subTaskItemPerson.addEvent("click",function(){
  1369. // this.selectPerson(subTaskItemPerson,"identity",null,1,
  1370. // function(json){
  1371. // if(json.length>0){
  1372. // this.loadSubTaskPerson(subTaskItemPerson,json[0],true)
  1373. // }
  1374. // }.bind(this)
  1375. // );
  1376. // }.bind(this));
  1377. if(data.executor && data.executor!=""){
  1378. this.loadSubTaskPerson(subTaskItemPerson,data.executor)
  1379. }
  1380. },
  1381. loadSubTaskPerson:function(node,identity,flag){
  1382. if(flag==null) flag=false;
  1383. node.empty();
  1384. var taskSubNewPerson = identity;
  1385. var _self = this
  1386. var name = identity.split("@")[0];
  1387. var container = new Element("div",{styles:{"height":"30px","padding":"0px 8px 0px 2px","border-radius":"4px","float":"left","position":"relative"}}).inject(node);
  1388. container.set("title",name);
  1389. var circleStyles={
  1390. "width":"24px","height":"24px","border-radius":"20px","float":"left",
  1391. "background-color":"#4A90E2","color":"#ffffff","line-height":"22px",
  1392. "text-align":"center","margin-top":"3px","font-size":"12px"
  1393. };
  1394. var closeStyles={
  1395. "width":"16px","height":"16px","position":"absolute","right":"-5px","top":"-2px",
  1396. "background":"url(../x_component_TeamWork/$Task/default/icon/icon_off.png) no-repeat center"
  1397. };
  1398. var circleDiv = new Element("div",{styles:circleStyles,text:name.substr(0,1)}).inject(container);
  1399. if(flag){ //权限
  1400. container.addEvents({
  1401. mouseenter:function(){
  1402. var closeIcon = new Element("div.closeIcon",{styles:closeStyles}).inject(this);
  1403. closeIcon.addEvents({
  1404. click:function(e){
  1405. node.empty();
  1406. node.setStyles(_self.css.subTaskNewPerson);
  1407. container.destroy();
  1408. e.stopPropagation();
  1409. }
  1410. });
  1411. this.setStyles({"background-color":"#efefef","cursor":"pointer"});
  1412. },
  1413. mouseleave:function(){
  1414. if(this.getElement(".closeIcon"))this.getElement(".closeIcon").destroy();
  1415. this.setStyles({"background-color":""})
  1416. },
  1417. click:function(e){
  1418. this.selectPerson(this.subTaskNewPerson,"identity",null,1,
  1419. function(json){
  1420. if(json.length>0){
  1421. taskSubNewPerson = json[0];
  1422. this.loadSubTaskPerson(this.subTaskNewPerson,json[0],true)
  1423. }
  1424. }.bind(this)
  1425. );
  1426. e.stopPropagation();
  1427. }.bind(this)
  1428. })
  1429. }
  1430. },
  1431. loadTaskPerson:function(node,identity,flag){
  1432. var _self = this
  1433. var name = identity.split("@")[0];
  1434. var container = new Element("div",{styles:{"height":"30px","padding":"0 0px","border-radius":"4px","float":"left","position":"relative"}}).inject(node);
  1435. var circleStyles={
  1436. "width":"24px","height":"24px","border-radius":"20px","float":"left",
  1437. "background-color":"#4A90E2","color":"#ffffff","line-height":"22px",
  1438. "text-align":"center","margin-top":"3px","font-size":"12px"
  1439. };
  1440. var nameStyles={
  1441. "height":"24px","float":"left","margin-left":"2px","margin-right":"10px",
  1442. "color":"#333333","line-height":"22px","margin-top":"3px"
  1443. };
  1444. var closeStyles={
  1445. "width":"16px","height":"16px","position":"absolute","right":"0px",
  1446. "background":"url(../x_component_TeamWork/$Task/default/icon/icon_off.png) no-repeat center"
  1447. };
  1448. var circleDiv = new Element("div",{styles:circleStyles,text:name.substr(0,1)}).inject(container);
  1449. var nameDiv = new Element("div",{styles:nameStyles,text:name}).inject(container);
  1450. if(flag){ //权限
  1451. container.addEvents({
  1452. mouseenter:function(){
  1453. // var closeIcon = new Element("div.closeIcon",{styles:closeStyles}).inject(this);
  1454. // closeIcon.addEvents({
  1455. // click:function(e){
  1456. // // _self.taskData.executor = "";
  1457. // // _self.loadDutyValue();
  1458. //
  1459. // var sd = {
  1460. // taskId:_self.taskData.id,
  1461. // property:"executor",
  1462. // mainValue:"",
  1463. // secondaryValue:""
  1464. // };
  1465. // _self.updateSingleProperty(sd,function(){
  1466. // _self.taskData.executor = "";
  1467. // _self.loadDutyValue()
  1468. // })
  1469. //
  1470. // e.stopPropagation();
  1471. // }
  1472. // });
  1473. this.setStyles({"background-color":"#efefef","cursor":"pointer"});
  1474. },
  1475. mouseleave:function(){
  1476. if(this.getElement(".closeIcon"))this.getElement(".closeIcon").destroy();
  1477. this.setStyles({"background-color":""})
  1478. },
  1479. click:function(e){
  1480. _self.selectPerson(_self.taskDutyAddText,"identity",null,1,
  1481. function(json){
  1482. if(json.length>0){
  1483. if(_self.taskData.executor!=json[0]){
  1484. var sd = {
  1485. taskId:_self.taskData.id,
  1486. property:"executor",
  1487. mainValue:json[0],
  1488. secondaryValue:""
  1489. };
  1490. _self.updateSingleProperty(sd,function(){
  1491. _self.taskData.executor = json[0];
  1492. _self.loadDutyValue()
  1493. })
  1494. }
  1495. }
  1496. }
  1497. );
  1498. }
  1499. })
  1500. }
  1501. },
  1502. loadparticipantPerson:function(node,identity,flag){
  1503. var _self = this;
  1504. var name = identity.split("@")[0];
  1505. var container = new Element("div",{styles:{"height":"30px","padding":"0 0px","border-radius":"4px","float":"left","position":"relative"}}).inject(node);
  1506. var circleStyles={
  1507. "width":"24px","height":"24px","border-radius":"20px","float":"left",
  1508. "background-color":"#4A90E2","color":"#ffffff","line-height":"22px",
  1509. "text-align":"center","margin-top":"3px","font-size":"12px"
  1510. };
  1511. var nameStyles={
  1512. "height":"24px","float":"left","margin-left":"2px","margin-right":"16px",
  1513. "color":"#333333","line-height":"22px","margin-top":"3px"
  1514. };
  1515. var closeStyles={
  1516. "width":"16px","height":"16px","position":"absolute","right":"0px",
  1517. "background":"url(../x_component_TeamWork/$Task/default/icon/icon_off.png) no-repeat center"
  1518. };
  1519. var circleDiv = new Element("div",{styles:circleStyles,text:name.substr(0,1)}).inject(container);
  1520. var nameDiv = new Element("div",{styles:nameStyles,text:name}).inject(container);
  1521. if(flag){ //权限
  1522. container.addEvents({
  1523. mouseenter:function(){
  1524. var closeIcon = new Element("div.closeIcon",{styles:closeStyles}).inject(this);
  1525. closeIcon.addEvents({
  1526. click:function(e){
  1527. var index = _self.taskData.participantList.indexOf(identity);
  1528. if(index>-1){
  1529. _self.taskData.participantList.erase(identity)
  1530. }
  1531. _self.actions.updateParticipant(_self.taskData.id,{participantList:_self.taskData.participantList},function(json){
  1532. _self.createParticipateContainer();
  1533. if(json.data.dynamics){
  1534. json.data.dynamics.each(function(dd){
  1535. _self.loadDynamicItem(dd,"bottom")
  1536. })
  1537. }
  1538. _self.dynamicContent.scrollTo(0,_self.dynamicContent.getScrollSize().y);
  1539. });
  1540. e.stopPropagation();
  1541. }
  1542. });
  1543. this.setStyles({"background-color":"#efefef","cursor":"pointer"});
  1544. },
  1545. mouseleave:function(){
  1546. if(this.getElement(".closeIcon"))this.getElement(".closeIcon").destroy();
  1547. this.setStyles({"background-color":""})
  1548. }
  1549. })
  1550. }
  1551. },
  1552. setAuth:function(){
  1553. var _self = this;
  1554. //名称
  1555. },
  1556. reload : function( keepData ){
  1557. // if( keepData ){
  1558. // this.data = this.form.getResult(false, this.options.resultSeparator, false, false, true);
  1559. // }
  1560. this.formTopNode = null;
  1561. if(this.setFormNodeSizeFun && this.app && this.app.removeEvent){
  1562. this.app.removeEvent("resize",this.setFormNodeSizeFun);
  1563. }
  1564. if( this.formMaskNode )this.formMaskNode.destroy();
  1565. if( this.formAreaNode )this.formAreaNode.destroy();
  1566. if( this.isNew ){
  1567. this.create();
  1568. }else if( this.isEdited ){
  1569. this.edit();
  1570. }else{
  1571. this.open();
  1572. }
  1573. },
  1574. selectPerson: function( item, type,types,count,callback ) {
  1575. MWF.xDesktop.requireApp("Selector", "package", null, false);
  1576. this.fireEvent("querySelect", this);
  1577. var value = [];
  1578. var options = {
  1579. "type": type,
  1580. "types":types,
  1581. "title": "选人",
  1582. "count": count,
  1583. "values": value || [],
  1584. "onComplete": function (items) {
  1585. var arr = [];
  1586. items.each(function (item) {
  1587. arr.push(item.data.distinguishedName);
  1588. }.bind(this));
  1589. if(callback)callback(arr);
  1590. }.bind(this)
  1591. };
  1592. var selector = new MWF.O2Selector(this.app.content, options);
  1593. },
  1594. compareWithNow:function(dstr){
  1595. var result = {};
  1596. try{
  1597. var ct = Date.parse(dstr);
  1598. var intervalDay = 0;
  1599. var now = new Date();
  1600. var sep = now.getTime()-ct.getTime();
  1601. sep = sep/1000; //毫秒
  1602. //一分钟内,刚刚,一小时内,多少分钟前,2小时内,显示一小时前,2小时到今天00:00:00 显示 今天几点,本周内,显示本周几,几点几分,其他显示几月几日
  1603. var cttext = "";
  1604. if(sep<60){
  1605. cttext = "刚刚"
  1606. }else if(sep<3600){
  1607. cttext = Math.floor(sep/60)+"分钟前"
  1608. }else if(sep<7200){
  1609. cttext = "1小时前"
  1610. }else if(sep>7200 && ct.getFullYear() == now.getFullYear() && ct.getMonth()==now.getMonth() && ct.getDate() == now.getDate()){
  1611. cttext = "今天"+(ct.getHours()<10?("0"+ct.getHours()):ct.getHours())+":"+(ct.getMinutes()<10?"0"+ct.getMinutes():ct.getMinutes())
  1612. }else if(ct.getFullYear() == now.getFullYear() && ct.getMonth()==now.getMonth() && ct.getDate() == now.getDate()-1){
  1613. cttext = "昨天"+(ct.getHours()<10?("0"+ct.getHours()):ct.getHours())+":"+(ct.getMinutes()<10?"0"+ct.getMinutes():ct.getMinutes());
  1614. }else{
  1615. cttext = (ct.getMonth()+1) + "月"+ct.getDay()+"日"
  1616. }
  1617. var sepd = ct.getTime() - now.getTime();
  1618. sepd = sepd/1000;
  1619. if(sepd<0){
  1620. intervalDay = -1 //超时
  1621. }else if(sepd /(3600*24)<2){
  1622. intervalDay = 0 //一两天内
  1623. }else{
  1624. intervalDay = 1 //正常
  1625. }
  1626. result.intervalDay = intervalDay;
  1627. result.text = cttext;
  1628. }catch(e){
  1629. result.text = dstr;
  1630. }
  1631. //alert(dstr + "##############" + result.intervalDay)
  1632. return result;
  1633. },
  1634. getProject:function(id,callback){
  1635. this.rootActions.ProjectAction.get(id,function(json){
  1636. this.projectData = json.data;
  1637. if(callback)callback(json);
  1638. }.bind(this))
  1639. }
  1640. });
  1641. MWF.xApplication.TeamWork.Task.TaskMore = new Class({
  1642. Extends: MWF.xApplication.TeamWork.Common.ToolTips,
  1643. options : {
  1644. // displayDelay : 300,
  1645. hasArrow:false,
  1646. event:"click"
  1647. },
  1648. _loadCustom : function( callback ){
  1649. this.rootActions = this.app.rootActions;
  1650. var _self = this;
  1651. this.css = this.options.css;
  1652. this.lp = this.options.lp;
  1653. //alert(JSON.stringify(this.data))
  1654. //this.data
  1655. //this.contentNode
  1656. //debugger;
  1657. var topMoreTitle = new Element("div.topMoreTitle",{styles:this.css.topMoreTitle,text:this.lp.taskMenu}).inject(this.contentNode);
  1658. var copyTask = new Element("div.copyTask",{styles:this.css.topMoreItem}).inject(this.contentNode);
  1659. copyTask.addEvents({
  1660. mouseenter:function(){this.setStyles({"background-color":"#F7F7F7"})},
  1661. mouseleave:function(){this.setStyles({"background-color":""})},
  1662. click:function(e){
  1663. _self.app.confirm("warn",e,_self.lp.taskCopy,_self.lp.taskContent,300,120,function(){
  1664. _self.rootActions.TaskAction.copyTask(_self.explorer.data.taskId,function(json){
  1665. if(json.type == "success"){
  1666. _self.explorer.data.taskId = json.data.id;
  1667. _self.explorer._createTableContent();
  1668. _self.explorer.projectObj.reloadTaskGroup(_self.explorer.taskData.taskListId) //ffffffffffffff
  1669. }
  1670. this.close();
  1671. _self.close();
  1672. }.bind(this))
  1673. // _self.rootActions.TaskAction.delete(_self.data.data.id,function(){
  1674. // var rd = {"act":"remove"};
  1675. // _self.close(rd);
  1676. // this.close()
  1677. // }.bind(this))
  1678. },function(){
  1679. this.close();
  1680. });
  1681. }.bind(this)
  1682. });
  1683. var copyTaskIcon = new Element("div.copyTaskIcon",{styles:this.css.topMoreItemIcon}).inject(copyTask);
  1684. copyTaskIcon.setStyles({"background":"url(../x_component_TeamWork/$Task/default/icon/taskcopy.png) no-repeat center"});
  1685. var copyTaskText = new Element("div.copyTaskText",{styles:this.css.topMoreItemText,text:this.lp.taskCopy}).inject(copyTask);
  1686. var moveTask = new Element("div.moveTask",{styles:this.css.topMoreItem}).inject(this.contentNode);
  1687. moveTask.addEvents({
  1688. mouseenter:function(){this.setStyles({"background-color":"#F7F7F7"})},
  1689. mouseleave:function(){this.setStyles({"background-color":""})},
  1690. click:function(){
  1691. var data = this.data;
  1692. var opt = {};
  1693. MWF.xDesktop.requireApp("TeamWork", "TaskMove", function(){
  1694. var taskmove = new MWF.xApplication.TeamWork.TaskMove(this.explorer,data,opt,{projectObj:this.explorer.projectObj});
  1695. taskmove.open();
  1696. var fx = new Fx.Tween(this.node,{duration:200});
  1697. fx.start(["opacity"] ,"1", "0").chain(function(){this.close()}.bind(this));
  1698. }.bind(this));
  1699. }.bind(this)
  1700. });
  1701. var moveTaskIcon = new Element("div.moveTaskIcon",{styles:this.css.topMoreItemIcon}).inject(moveTask);
  1702. moveTaskIcon.setStyles({"background":"url(../x_component_TeamWork/$Task/default/icon/taskmove.png) no-repeat center"});
  1703. var moveTaskText = new Element("div.moveTaskText",{styles:this.css.topMoreItemText,text:this.lp.taskMove}).inject(moveTask);
  1704. // var favTask = new Element("div.favTask",{styles:this.css.topMoreItem}).inject(this.contentNode);
  1705. // favTask.addEvents({
  1706. // mouseenter:function(){this.setStyles({"background-color":"#F7F7F7"})},
  1707. // mouseleave:function(){this.setStyles({"background-color":""})}
  1708. // });
  1709. // var favTaskIcon = new Element("div.favTaskIcon",{styles:this.css.topMoreItemIcon}).inject(favTask);
  1710. // favTaskIcon.setStyles({"background":"url(../x_component_TeamWork/$Task/default/icon/taskfav.png) no-repeat center"});
  1711. // var favTaskText = new Element("div.favTaskText",{styles:this.css.topMoreItemText,text:this.lp.taskFav}).inject(favTask);
  1712. var subTask = new Element("div.subTask",{styles:this.css.topMoreItem}).inject(this.contentNode);
  1713. subTask.addEvents({
  1714. click:function(){
  1715. var data = this.data;
  1716. MWF.xDesktop.requireApp("TeamWork", "TaskSub", function(){
  1717. var opt = {
  1718. "onPostOpen":function(){
  1719. //tasksub.formAreaNode.setStyles({"height":"0px","width":"0px","overflow":"hidden"})
  1720. //tasksub.formAreaNode.setStyles({"top":"10px"});
  1721. var fx = new Fx.Tween(tasksub.formAreaNode,{duration:200});
  1722. fx.start(["top"] ,"10px", "100px");
  1723. }
  1724. };
  1725. var tasksub = new MWF.xApplication.TeamWork.TaskSub(this.explorer,data,opt);
  1726. tasksub.open();
  1727. var fx = new Fx.Tween(this.node,{duration:200});
  1728. fx.start(["opacity"] ,"1", "0").chain(function(){this.close()}.bind(this));
  1729. }.bind(this));
  1730. }.bind(this),
  1731. mouseenter:function(){this.setStyles({"background-color":"#F7F7F7"})},
  1732. mouseleave:function(){this.setStyles({"background-color":""})}
  1733. });
  1734. var subTaskIcon = new Element("div.subTaskIcon",{styles:this.css.topMoreItemIcon}).inject(subTask);
  1735. subTaskIcon.setStyles({"background":"url(../x_component_TeamWork/$Task/default/icon/tasksub.png) no-repeat center"});
  1736. var subTaskText = new Element("div.subTaskText",{styles:this.css.topMoreItemText,text:this.lp.taskSub}).inject(subTask);
  1737. if(this.data.data.control && this.data.data.control.delete){
  1738. var removeTask = new Element("div.removeTask",{styles:this.css.topMoreItem}).inject(this.contentNode);
  1739. removeTask.addEvents({
  1740. click:function(e){
  1741. _self.app.confirm("warn",e,_self.app.lp.common.confirm.removeTitle,_self.app.lp.common.confirm.removeContent,300,120,function(){
  1742. _self.rootActions.TaskAction.delete(_self.data.data.id,function(){
  1743. var rd = {"act":"remove"};
  1744. _self.close(rd);
  1745. this.close()
  1746. }.bind(this))
  1747. },function(){
  1748. this.close();
  1749. });
  1750. },
  1751. mouseenter:function(){this.setStyles({"background-color":"#F7F7F7"})},
  1752. mouseleave:function(){this.setStyles({"background-color":""})}
  1753. });
  1754. var removeTaskIcon = new Element("div.removeTaskIcon",{styles:this.css.topMoreItemIcon}).inject(removeTask);
  1755. removeTaskIcon.setStyles({"background":"url(../x_component_TeamWork/$Task/default/icon/taskremove.png) no-repeat center"});
  1756. var removeTaskText = new Element("div.removeTaskText",{styles:this.css.topMoreItemText,text:this.lp.taskRemove}).inject(removeTask);
  1757. }
  1758. if(callback)callback();
  1759. }
  1760. });
  1761. MWF.xApplication.TeamWork.Task.StatusCheck = new Class({
  1762. Extends: MWF.xApplication.TeamWork.Common.ToolTips,
  1763. options : {
  1764. // displayDelay : 300,
  1765. hasArrow:false,
  1766. event:"click"
  1767. },
  1768. _loadCustom : function( callback ){
  1769. var _self = this;
  1770. this.css = this.options.css;
  1771. this.lp = this.options.lp;
  1772. //this.data
  1773. var container = {
  1774. "cursor":"pointer",
  1775. "height":"40px",
  1776. "width":"100%"
  1777. };
  1778. var text={
  1779. "height":"30px","line-height":"30px","float":"left",
  1780. "padding-left":"10px","padding-right":"10px","margin-left":"6px","margin-top":"5px",
  1781. "font-size":"13px","color":"#666666","border-radius":"2px"
  1782. };
  1783. var icon = {
  1784. "float":"right","width":"24px","height":"24px",
  1785. "margin-top":"6px","margin-right":"8px",
  1786. "background":"url(../x_component_TeamWork/$Task/default/icon/icon_dagou.png) no-repeat center"
  1787. };
  1788. var flowContainer = new Element("div",{styles:container}).inject(this.contentNode);
  1789. var flowText = new Element("div",{styles:text,text:this.lp.status.processing}).inject(flowContainer);
  1790. flowText.setStyles({"background-color":"#f0f0f0"});
  1791. if(this.data.data.workStatus == "processing"){
  1792. var flowIcon = new Element("div",{styles:icon}).inject(flowContainer);
  1793. }
  1794. flowContainer.addEvents({
  1795. click:function(){
  1796. var data = {"status":"processing"};
  1797. this.close(data)
  1798. }.bind(this),
  1799. mouseover:function(){this.setStyles({"background-color":"#f2f5f7"})},
  1800. mouseout:function(){this.setStyles({"background-color":""})}
  1801. });
  1802. var completeContainer = new Element("div",{styles:container}).inject(this.contentNode);
  1803. var completeText = new Element("div",{styles:text,text:this.lp.status.completed}).inject(completeContainer);
  1804. completeText.setStyles({"color":"#69b439","background-color":"#f1f9ec"});
  1805. if(this.data.data.workStatus == "completed"){
  1806. var completeIcon = new Element("div",{styles:icon}).inject(completeContainer);
  1807. }
  1808. completeContainer.addEvents({
  1809. click:function(){
  1810. var data = {"status":"completed"};
  1811. this.close(data)
  1812. }.bind(this),
  1813. mouseover:function(){this.setStyles({"background-color":"#f2f5f7"})},
  1814. mouseout:function(){this.setStyles({"background-color":""})}
  1815. });
  1816. if(callback)callback();
  1817. }
  1818. });
  1819. MWF.xApplication.TeamWork.Task.PriorityCheck = new Class({
  1820. Extends: MWF.xApplication.TeamWork.Common.ToolTips,
  1821. options : {
  1822. // displayDelay : 300,
  1823. hasArrow:false,
  1824. event:"click"
  1825. },
  1826. _loadCustom : function( callback ){
  1827. var _self = this;
  1828. this.css = this.options.css;
  1829. this.lp = this.options.lp;
  1830. this.rootActions = this.app.rootActions;
  1831. //this.data
  1832. //this.contentNode
  1833. var container = {
  1834. "cursor":"pointer",
  1835. "height":"40px",
  1836. "width":"100%"
  1837. };
  1838. var text={
  1839. "height":"25px","line-height":"25px","float":"left","text-align":"center",
  1840. "margin-left":"6px","margin-top":"8px",
  1841. "font-size":"13px","color":"#666666","border-radius":"2px","padding-left":"10px","padding-right":"10px"
  1842. };
  1843. var icon = {
  1844. "float":"right","width":"24px","height":"24px",
  1845. "margin-top":"6px","margin-right":"8px",
  1846. "background":"url(../x_component_TeamWork/$Task/default/icon/icon_dagou.png) no-repeat center"
  1847. };
  1848. if(!this.data.data.priority) return;
  1849. var arr = this.data.data.priority.split("||");
  1850. var priorityName = arr[0];
  1851. var priorityColor = arr[1];
  1852. this.rootActions.GlobalAction.priorityList(function(json){
  1853. json.data.each(function(data){
  1854. var vContainer = new Element("div",{styles:container}).inject(this.contentNode);
  1855. var value = new Element("div",{styles:text,text:data.priority}).inject(vContainer);
  1856. value.setStyles({"color":data.priorityColor,"border":"1px solid "+ data.priorityColor});
  1857. if(priorityName == data.priority && priorityColor.toUpperCase() == data.priorityColor.toUpperCase()){
  1858. new Element("div",{styles:icon}).inject(vContainer);
  1859. }
  1860. vContainer.addEvents({
  1861. click:function(){
  1862. var d = {"value":data.priority+"||"+data.priorityColor};
  1863. this.close(d)
  1864. }.bind(this),
  1865. mouseover:function(){this.setStyles({"background-color":"#f2f5f7"})},
  1866. mouseout:function(){this.setStyles({"background-color":""})}
  1867. });
  1868. }.bind(this))
  1869. }.bind(this));
  1870. if(callback)callback();
  1871. return;
  1872. // var normalContainer = new Element("div",{styles:container}).inject(this.contentNode);
  1873. // var normalText = new Element("div",{styles:text,text:this.lp.priority.normal}).inject(normalContainer);
  1874. // normalText.setStyles({"color":"#999999","border":"1px solid #999999"});
  1875. // if(this.data.data.priority == this.lp.priority.normal){
  1876. // new Element("div",{styles:icon}).inject(normalContainer);
  1877. // }
  1878. // normalContainer.addEvents({
  1879. // click:function(){
  1880. // var data = {"value":this.lp.priority.normal};
  1881. // this.close(data)
  1882. // }.bind(this),
  1883. // mouseover:function(){this.setStyles({"background-color":"#f2f5f7"})},
  1884. // mouseout:function(){this.setStyles({"background-color":""})}
  1885. // });
  1886. //
  1887. // var urgencyContainer = new Element("div",{styles:container}).inject(this.contentNode);
  1888. // var urgencyText = new Element("div",{styles:text,text:this.lp.priority.urgency}).inject(urgencyContainer);
  1889. // urgencyText.setStyles({"color":"#ffaf38","border":"1px solid #ffaf38"});
  1890. // if(this.data.data.priority == this.lp.priority.urgency){
  1891. // new Element("div",{styles:icon}).inject(urgencyContainer);
  1892. // }
  1893. // urgencyContainer.addEvents({
  1894. // click:function(){
  1895. // var data = {"value":this.lp.priority.urgency};
  1896. // this.close(data)
  1897. // }.bind(this),
  1898. // mouseover:function(){this.setStyles({"background-color":"#f2f5f7"})},
  1899. // mouseout:function(){this.setStyles({"background-color":""})}
  1900. // });
  1901. //
  1902. // var emergencyContainer = new Element("div",{styles:container}).inject(this.contentNode);
  1903. // var emergencyText = new Element("div",{styles:text,text:this.lp.priority.emergency}).inject(emergencyContainer);
  1904. // emergencyText.setStyles({"color":"#ff4f3e","border":"1px solid #ff4f3e"});
  1905. // if(this.data.data.priority == this.lp.priority.emergency){
  1906. // new Element("div",{styles:icon}).inject(emergencyContainer);
  1907. // }
  1908. // emergencyContainer.addEvents({
  1909. // click:function(){
  1910. // var data = {"value":this.lp.priority.emergency};
  1911. // this.close(data)
  1912. // }.bind(this),
  1913. // mouseover:function(){this.setStyles({"background-color":"#f2f5f7"})},
  1914. // mouseout:function(){this.setStyles({"background-color":""})}
  1915. // });
  1916. //
  1917. // if(callback)callback();
  1918. }
  1919. });
  1920. MWF.xApplication.TeamWork.Task.DynamicType = new Class({
  1921. Extends: MWF.xApplication.TeamWork.Common.ToolTips,
  1922. options : {
  1923. // displayDelay : 300,
  1924. hasArrow:false,
  1925. event:"click"
  1926. },
  1927. _loadCustom : function( callback ){
  1928. var _self = this;
  1929. this.css = this.options.css;
  1930. this.lp = this.options.lp;
  1931. //this.data
  1932. //this.contentNode
  1933. var container = {
  1934. "cursor":"pointer",
  1935. "height":"40px",
  1936. "width":"100%"
  1937. };
  1938. var text={
  1939. "height":"25px","line-height":"25px","float":"left","width":"100%",
  1940. "margin-left":"6px","margin-top":"8px",
  1941. "font-size":"13px","color":"#666666","border-radius":"2px"
  1942. };
  1943. var icon = {
  1944. "float":"right","width":"24px","height":"24px",
  1945. "margin-top":"6px","margin-right":"8px",
  1946. "background":"url(../x_component_TeamWork/$Task/default/icon/icon_dagou.png) no-repeat center"
  1947. };
  1948. var allContainer = new Element("div",{styles:container}).inject(this.contentNode);
  1949. var allText = new Element("div",{styles:text,text:this.lp.dynamicAll}).inject(allContainer);
  1950. allText.setStyles({"color":"#999999","border":"0px solid #999999"});
  1951. allContainer.addEvents({
  1952. click:function(){
  1953. var data = {"value":"all"};
  1954. this.close(data)
  1955. }.bind(this),
  1956. mouseover:function(){this.setStyles({"background-color":"#f2f5f7"})},
  1957. mouseout:function(){this.setStyles({"background-color":""})}
  1958. });
  1959. var attachmentContainer = new Element("div",{styles:container}).inject(this.contentNode);
  1960. var attachmentText = new Element("div",{styles:text,text:this.lp.dynamicAttachment}).inject(attachmentContainer);
  1961. attachmentText.setStyles({"color":"#999999","border":"0px solid #999999"});
  1962. attachmentContainer.addEvents({
  1963. click:function(){
  1964. var data = {"value":"attachment"};
  1965. this.close(data)
  1966. }.bind(this),
  1967. mouseover:function(){this.setStyles({"background-color":"#f2f5f7"})},
  1968. mouseout:function(){this.setStyles({"background-color":""})}
  1969. });
  1970. var chatContainer = new Element("div",{styles:container}).inject(this.contentNode);
  1971. var chatText = new Element("div",{styles:text,text:this.lp.dynamicChat}).inject(chatContainer);
  1972. chatText.setStyles({"color":"#999999","border":"0px solid #999999"});
  1973. chatContainer.addEvents({
  1974. click:function(){
  1975. var data = {"value":"chat"};
  1976. this.close(data)
  1977. }.bind(this),
  1978. mouseover:function(){this.setStyles({"background-color":"#f2f5f7"})},
  1979. mouseout:function(){this.setStyles({"background-color":""})}
  1980. });
  1981. if(callback)callback();
  1982. }
  1983. });