Task.js 104 KB

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