Main.js 55 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735
  1. MWF.xApplication.process.workcenter.options.multitask = false;
  2. MWF.xApplication.process.workcenter.Main = new Class({
  3. Extends: MWF.xApplication.Common.Main,
  4. Implements: [Options, Events],
  5. options: {
  6. "style1": "default",
  7. "style": "default",
  8. "name": "process.workcenter",
  9. "mvcStyle": "style.css",
  10. "icon": "icon.png",
  11. "title": MWF.xApplication.process.workcenter.LP.title
  12. },
  13. onQueryLoad: function(){
  14. this.lp = MWF.xApplication.process.workcenter.LP;
  15. this.action = o2.Actions.load("x_processplatform_assemble_surface");
  16. },
  17. loadApplication: function(callback){
  18. var url = this.path+this.options.style+"/view/view.html";
  19. this.content.loadHtml(url, {"bind": {"lp": this.lp}, "module": this}, function(){
  20. this.setLayout();
  21. this.loadCount();
  22. var list = (this.status) ? (this.status.navi || "task") : "task";
  23. this.loadList(list, callback);
  24. // if (callback) callback();
  25. }.bind(this));
  26. },
  27. setLayout: function(){
  28. var items = this.content.getElements(".menuItem");
  29. items.addEvents({
  30. "mouseover": function(){this.addClass("menuItem_over")},
  31. "mouseout": function(){this.removeClass("menuItem_over")},
  32. "click": function(){}
  33. });
  34. },
  35. createCountData: function(){
  36. var _self = this;
  37. if (!this.countData){
  38. this.countData = {"data": {}};
  39. var createDefineObject = function(p){
  40. return {
  41. "get": function(){return this.data[p]},
  42. "set": function(v){
  43. this.data[p] = v;
  44. _self[p+"CountNode"].set("text", v);
  45. }
  46. }
  47. };
  48. var o = {
  49. "task": createDefineObject("task"),
  50. "taskCompleted": createDefineObject("taskCompleted"),
  51. "read": createDefineObject("read"),
  52. "readCompleted": createDefineObject("readCompleted"),
  53. "draft": createDefineObject("draft"),
  54. "review": createDefineObject("review"),
  55. "myCreated": createDefineObject("myCreated"),
  56. };
  57. MWF.defineProperties(this.countData, o);
  58. }
  59. },
  60. loadCount: function(){
  61. this.createCountData();
  62. this.action.WorkAction.countWithPerson(layout.session.user.id).then(function(json){
  63. this.countData.task = json.data.task;
  64. this.countData.taskCompleted = json.data.taskCompleted;
  65. this.countData.read = json.data.read;
  66. this.countData.readCompleted = json.data.readCompleted;
  67. this.countData.review = json.data.review;
  68. // this.pageData = Object.assign(this.pageData, json.data);
  69. // this.taskCountNode.set("text", json.data.task);
  70. // this.taskCompletedCountNode.set("text", json.data.taskCompleted);
  71. // this.readCountNode.set("text", json.data.read);
  72. // this.readCompletedCountNode.set("text", json.data.readCompleted);
  73. }.bind(this));
  74. this.action.DraftAction.listMyPaging(1,1, {}).then(function(json){
  75. this.countData.draft = json.count;
  76. // this.pageData = Object.assign(this.pageData, {"draft": json.size});
  77. // this.draftCountNode.set("text", json.size);
  78. }.bind(this));
  79. this.action.ReviewAction.countWithPerson(layout.session.user.id, {
  80. creatorPersonList: [layout.session.user.id]
  81. }).then(function(json){
  82. this.countData.myCreated = json.data.count;
  83. }.bind(this));
  84. },
  85. loadList: function(type, callback){
  86. if (this.currentMenu) this.setMenuItemStyleDefault(this.currentMenu);
  87. this.setMenuItemStyleCurrent(this[type+"MenuNode"]);
  88. this.currentMenu = this[type+"MenuNode"];
  89. if (this.currentList) this.currentList.hide();
  90. this.showSkeleton();
  91. this._loadListContent(type, callback);
  92. this.loadCount();
  93. //if (this.currentList) this.currentList.loadPage();
  94. },
  95. showSkeleton: function(){
  96. if (this.skeletonNode) this.skeletonNode.inject(this.listContentNode);
  97. },
  98. hideSkeleton: function(){
  99. if (this.skeletonNode) this.skeletonNode.dispose();
  100. },
  101. _loadListContent: function(type, callback){
  102. var list = this[(type+"-list").camelCase()];
  103. if (!list){
  104. console.log('MWF.xApplication.process.workcenter.'+type.capitalize()+"List");
  105. list = new MWF.xApplication.process.workcenter[type.capitalize()+"List"](this, { "onLoadData": this.hideSkeleton.bind(this) });
  106. this[(type+"-list").camelCase()] = list;
  107. }
  108. list.init();
  109. list.load(callback);
  110. this.currentList = list;
  111. },
  112. setMenuItemStyleDefault: function(node){
  113. node.removeClass("mainColor_bg_opacity");
  114. node.getFirst().removeClass("mainColor_color");
  115. node.getLast().removeClass("mainColor_color");
  116. },
  117. setMenuItemStyleCurrent: function(node){
  118. node.addClass("mainColor_bg_opacity");
  119. node.getFirst().addClass("mainColor_color");
  120. node.getLast().addClass("mainColor_color");
  121. },
  122. getApplicationIcon: function(application){
  123. var icon = (this.appIcons) ? this.appIcons[application] : null;
  124. if (!icon) {
  125. return this.action.ApplicationAction.getIcon(application).then(function(json){
  126. if (json.data){
  127. if (!this.appIcons) this.appIcons = {};
  128. this.appIcons[application] = json.data;
  129. return json.data;
  130. }
  131. return this.getDefaultIcon();
  132. }.bind(this), function(){
  133. return this.getDefaultIcon();
  134. });
  135. }else{
  136. return icon;
  137. }
  138. },
  139. getDefaultIcon: function(){
  140. return {
  141. "icon": "iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAAEgElEQVR4Xu1aPXMTSRB9vUaGQqs6iCgi4Bfgq7I2lqWrSwgQMQHyPzAJIeguvOT4BxbBxYjgkquTrFiiCvkXYCKKCFMSFEjs9tWsrEKWvTtfuyvXrTbd6ZnuN69fz842IecP5Tx+rAFYMyDnCKxTYBUE4MrWta9UuLu49hWeHlJveJy1P6kzQAT7eWPzPgN1MFeI6FpckMx8DKIeAe2iP3mVNiipADALuvAIQAOgLbtd5SGAVtGfvkgDjMQB+Fz1ngXgPdlO64IimOGAnhe7/d90bePGJwbAuOY9AqMJwu0kHTwzF+MIhKbb6b9IYh1rAATdxxub+yRyPMOHgbbrT3Zt08IKgHGlvIUN7NvnuSlyPISPXbc3EDph9BgDMPplu4KAXiad67pRhFXD4Qelf1/3dG3FeCMARPDEzoHJgmnZMAU7JiBoAyBozw4OVr3zy0AKJlCAHd100ALgpL4frC7nZfzhYdGf7ugIoxYAo5r3Mmu1l4V8hglAu9TpP1C1UwZgXC03QLSvOvFKxzHvut1BS8UHDQC8t6kfclQ8VhnDOHK7/TsqQ5UAGFW9JhGeqUy4PIZu3AR/eG9iChtbcPDY7b5+LltYCkB40nMKb01U/9Kv93D5yVN8++N3fP/nb5kvp97b2IqJRFVwg+kdmSBKARhXt/dAzp9a3gOYBzC30wHBxvaUnwoskANQK7/RLXvLAeiAYGN7dpN46HYGP8dtXiwAJ5cZH3V2X+Tt1b/akSZxTIgKfj7Zl4d1bT0p+pPrcWkQC4Bp6ZMFch4IJjZKGyMpibEAjGpem4D7SgstDdIJSGesri8MvCp1+pGf6vEAVMsfTdR/7qRKYGKsqBRRj454njeHqAal7uB61PzxKVDzWBfx5fEyEOLmtw1+Prfb6UfGGfnCRACjgjEBIanghU9GACT9za8DQpLBh4eimLuCSAYkDYBwRAWEpINfA3BRGKCy+zonRh1xNkqB3IugQHic5zIoABjVyscE+kmHbotjZbQXgpf6QQj8qdQZRP6QXR+F43Y39x9DJkL4v/ocDoWw6g1BONXNIdMEm0sNG9szfjEO3W4/tj9BfiOU9yux2e/vwpFJNbC52LSxDY+/4E+uP71tfSkalsM8X4vP82pc9URnxi1Z/l+I94x3brev1Kki1YAfAOT819jsZGh+R5gVM2R3gMt+KDMgFBbR/uZs9nTLYlbBg3FYDCYVmfAt+qMFQHguEA0SG+iZVIU0gRCqTz4qqTZIzANI47bIFpzMWmQWQQBTe9VMEDsP4rpJf5CIRTsFFncqbJNzqLUyTWAcIuCGLu2tNGCZqieNki3TP0im1Bdq7/qTho7gnbeWFQNOsUG00IBEq2y6hyXGO4Cbqi0wMoATA+DHgWl7j4maSWtDqPIsApd3fciCTjQFzltsdl641ACchrU+iDxH0CoG31u2dE81BaJQn4FRqDNRXRylZMwIVR3UI+Z2MZi20wg6dQaoUDDsNV54TMuYylpxYxLXAFuHsrZfA5A14hdtvTUDLtqOZO1P7hnwH8CljF98DV13AAAAAElFTkSuQmCC",
  142. "iconHue": "#4e82bd"
  143. };
  144. },
  145. firstPage: function(){
  146. if (this.currentList) this.currentList.firstPage();
  147. },
  148. lastPage: function(){
  149. if (this.currentList) this.currentList.lastPage();
  150. },
  151. prevPage: function(){
  152. if (this.currentList) this.currentList.prevPage();
  153. },
  154. nextPage: function(){
  155. if (this.currentList) this.currentList.nextPage();
  156. },
  157. getFilterData: function(){
  158. var type = this.currentList.options.type.capitalize();
  159. switch (type) {
  160. case "MyCreated":
  161. return this.action.ReviewAction.filterCreateEntry().then(function(json){return json.data});
  162. case "Review":
  163. return this.action.ReviewAction.filterEntry().then(function(json){return json.data});
  164. default:
  165. var action = type+"Action";
  166. return this.action[action].filterAttribute().then(function(json){return json.data});
  167. }
  168. },
  169. showFilter: function(e){
  170. //console.log(this.filterDlg);
  171. if (this.filterDlg) return;
  172. var node = e.target;
  173. var p = node.getPosition(this.content);
  174. var size = node.getSize();
  175. var y = p.y+size.y+10;
  176. var x = p.x-600+size.x;
  177. var fx = p.x+size.x;
  178. var filterContent = new Element("div");
  179. var url = this.path+this.options.style+"/view/dlg/filter.html";
  180. this.getFilterData().then(function(data){
  181. this.currentList.filterAttribute = data;
  182. var filterCategoryList = ['review','myCreated'].contains(this.currentList.options.type) ? this.lp.filterCategoryListReview : this.lp.filterCategoryList;
  183. filterContent.loadHtml(url, {"bind": {"lp": this.lp, "type": this.options.type, "data": data, filter: this.currentList.filterList, filterCategoryList: filterCategoryList}, "module": this})
  184. }.bind(this));
  185. var _self = this;
  186. var closeFilterDlg = function(){
  187. _self.filterDlg.close();
  188. }
  189. this.filterDlg = o2.DL.open({
  190. "container": this.content,
  191. "mask": false,
  192. "title": "",
  193. "style": "user",
  194. "isMove": false,
  195. "isResize": false,
  196. "isTitle": false,
  197. "content": filterContent,
  198. "maskNode": this.content,
  199. "top": y,
  200. "left": x,
  201. "fromTop": y,
  202. "fromLeft": fx,
  203. "width": 600,
  204. "height": 550,
  205. "duration": 100,
  206. // "onQueryClose": function(){
  207. // document.body.removeEvent("mousedown", closeFilterDlg);
  208. // },
  209. "onPostClose": function(){
  210. document.body.removeEvent("mousedown", closeFilterDlg);
  211. _self.filterDlg = null;
  212. },
  213. "buttonList": [
  214. {
  215. "type": "ok",
  216. "text": MWF.LP.process.button.ok,
  217. "action": function (d, e) {
  218. _self.doFilter();
  219. }.bind(this)
  220. },
  221. {
  222. "type": "cancel",
  223. "text": MWF.LP.process.button.reset,
  224. "action": function () {
  225. debugger;
  226. _self.resetFilter();
  227. this.filterDlg.close();
  228. }.bind(this)
  229. }
  230. ],
  231. });
  232. this.filterDlg.node.addEvent("mousedown", function(e){
  233. e.stopPropagation();
  234. });
  235. document.body.addEvent("mousedown", closeFilterDlg);
  236. },
  237. selectFilterItem: function(name, value, category, e){
  238. var node = e.target;
  239. // var value = node.dataset.value;
  240. // var category = node.dataset.category;
  241. if (!this.currentList.filterList) this.currentList.filterList = {};
  242. if (!this.currentList.filterList[category]) this.currentList.filterList[category] = [];
  243. if (!this.currentList.filterNameList) this.currentList.filterNameList = {};
  244. if (!this.currentList.filterNameList[category]) this.currentList.filterNameList[category] = [];
  245. var findedIdx = this.currentList.filterList[category].indexOf(value);
  246. if (findedIdx===-1){
  247. node.addClass("mainColor_bg");
  248. this.currentList.filterList[category].push(value);
  249. this.currentList.filterNameList[category].push(name)
  250. }else{
  251. node.removeClass("mainColor_bg");
  252. this.currentList.filterList[category].splice(findedIdx, 1);
  253. this.currentList.filterNameList[category].splice(findedIdx, 1);
  254. }
  255. },
  256. resetFilter: function(){
  257. this.currentList.page = 1;
  258. this.currentList.filterList = {};
  259. this.currentList.filterNameList = {};
  260. this.currentList.refresh();
  261. },
  262. doFilter: function(){
  263. debugger;
  264. var key = this.filterDlg.content.getElement("input").get("value");
  265. if (key) {
  266. if (!this.currentList.filterList) this.currentList.filterList = {};
  267. if (!this.currentList.filterNameList) this.currentList.filterNameList = {};
  268. this.currentList.filterList.key = key;
  269. this.currentList.filterNameList.key = [key];
  270. }
  271. this.currentList.page = 1;
  272. this.currentList.refresh();
  273. this.filterDlg.close();
  274. },
  275. inputFilter: function(e){
  276. if (e.keyCode==13) this.doFilter();
  277. },
  278. getStartData: function(){
  279. // var p1 = this.action.ApplicationAction.listWithPersonComplex().then(function(json){return json.data});
  280. var p1 = o2.Actions.load("x_processplatform_assemble_surface").ApplicationAction.listWithPersonAndTerminal("client").then(function(json){return json.data;});
  281. var p2 = new Promise(function(resolve){
  282. o2.UD.getDataJson("taskCenter_startTop", function(data){
  283. resolve(data);
  284. });
  285. });
  286. var p3 = o2.Actions.load("x_cms_assemble_control").AppInfoAction.listPublishWithProcess().then(function(json){return json.data;});
  287. return Promise.all([p1, p2, p3]);
  288. },
  289. closeStartProcess: function(e){
  290. e.target.getParent(".st_area").destroy();
  291. this.appNode.show();
  292. },
  293. startProcess: function(){
  294. var startContent = new Element("div.st_area");
  295. var url = this.path+this.options.style+"/view/dlg/start.html";
  296. this.getStartData().then(function(data){
  297. var map = {}, mapById = {};
  298. data[0].each(function (d) {
  299. if (d.processList && d.processList.length){
  300. var type = d.applicationCategory || "未分类";
  301. if( !map[type] )map[type] = [];
  302. map[type].push(d);
  303. d.processList.each(function (process) {
  304. mapById[ process.id ] = process;
  305. });
  306. }
  307. });
  308. data[2].each(function (d) {
  309. var type = d.appType || "未分类";
  310. if( !map[type] )map[type] = [];
  311. map[type].push(d);
  312. });
  313. data[1] = (data[1] || []).filter(function (d) {
  314. if( mapById[ d.id ] ){
  315. d.name = mapById[ d.id ].name;
  316. return true;
  317. }else{
  318. return false;
  319. }
  320. });
  321. var array = [];
  322. Object.each(map, function (list, key) {
  323. array.push({ key: key, appList: list })
  324. });
  325. array.sort(function (a1, b1) {
  326. var a = a1.key, b = b1.key;
  327. if( a === "未分类" )return 1;
  328. if( b === "未分类" )return -1;
  329. var n = !isNaN(a - 0), n2 = !isNaN(b - 0);
  330. if (n && n2) {
  331. return a - b;
  332. } else if (n) {
  333. return -1;
  334. } else if (n2) {
  335. return 1;
  336. }
  337. var e = escape(a).indexOf("%u") === 0, e2 = escape(b).indexOf("%u") === 0;
  338. if (e && e2) {
  339. return a.localeCompare(b);
  340. } else if (e) {
  341. return 1;
  342. } else if (e2) {
  343. return -1;
  344. }
  345. return a.localeCompare(b);
  346. });
  347. startContent.loadHtml(url, {"bind": {"lp": this.lp, "data": {"app": data[0], "topApp": data[1], "column": data[2], "appByType":array}}, "module": this});
  348. }.bind(this));
  349. this.appNode.hide();
  350. startContent.inject(this.content);
  351. },
  352. loadStartProcessList: function(e, data){
  353. var node = e.target;
  354. var url = this.path+this.options.style+"/view/dlg/processList.html";
  355. node.loadHtml(url, {"bind": {"lp": this.lp, "data": data}, "module": this});
  356. },
  357. appCategoryExpandOrCollapse: function(e, data){
  358. var node = e.target;
  359. while (node && !node.hasClass("st_appCategoryWrap")){ node = node.getParent();}
  360. if( node ){
  361. var contentNode = node.getElement(".st_appCategoryContent");
  362. if( contentNode ){
  363. if( contentNode.getStyle("display") === "none" ){
  364. contentNode.show();
  365. e.target.addClass("o2icon-triangle_down2").removeClass("o2icon-triangle_right2");
  366. }else{
  367. contentNode.hide();
  368. e.target.addClass("o2icon-triangle_right2").removeClass("o2icon-triangle_down2");
  369. }
  370. }
  371. }
  372. e.stopPropagation();
  373. },
  374. startAppItemOver: function(e, data){
  375. var node = e.target;
  376. while (node && !node.hasClass("st_appListItem")){ node = node.getParent();}
  377. if (node) node.addClass("menuItem_over");
  378. },
  379. startAppItemOut: function(e, data){
  380. var node = e.target;
  381. while (node && !node.hasClass("st_appListItem")){ node = node.getParent();}
  382. if (node) node.removeClass("menuItem_over");
  383. },
  384. startAppItemClick: function(e, data){
  385. var node = e.target;
  386. this.clearStartAppSelected(e);
  387. while (node && !node.hasClass("st_appListItem")){ node = node.getParent();}
  388. node.addClass("mainColor_bg_opacity");
  389. if( node.hasClass("st_tabItem") ){
  390. node.addClass("mainColor_border");
  391. if( node.hasClass("st_all") ){
  392. this.currentTab = "all";
  393. this.byTypeNode.removeClass("mainColor_border");
  394. this.allContentNode.show();
  395. this.byTypeContentNode.hide();
  396. }else{
  397. this.currentTab = "byType";
  398. this.allNode.removeClass("mainColor_border");
  399. this.allContentNode.hide();
  400. this.byTypeContentNode.show();
  401. }
  402. }
  403. var appData;
  404. if(data.appList) {
  405. appData = {
  406. "app": data.appList.filter(function (d) {
  407. return !d.appName
  408. }),
  409. "column": data.appList.filter(function (d) {
  410. return d.appName
  411. }),
  412. };
  413. }else if(data.app){
  414. appData = data;
  415. }else if( data.appName ) {
  416. appData = {"column": [data]}
  417. }else{
  418. appData = {"app": [data]}
  419. }
  420. this.reloadStartProcessList(node, appData);
  421. },
  422. clearStartAppSelected: function(e){
  423. var node = e.target.getParent(".st_menu").getElement(".mainColor_bg_opacity");
  424. if (node) node.removeClass("mainColor_bg_opacity");
  425. },
  426. reloadStartProcessList: function(node, data){
  427. var processListNode = node.getParent(".st_processContent").getElement(".st_processList").empty();
  428. var url = this.path+this.options.style+"/view/dlg/processList.html";
  429. processListNode.loadHtml(url, {"bind": {"lp": this.lp, "data": data}, "module": this});
  430. },
  431. startProcessSearch: function(e, data){
  432. if (e.keyCode===13){
  433. var key = e.target.get("value");
  434. if (key){
  435. var name = this.lp.searchProcessResault.replace("{key}", key);
  436. var processList = [];
  437. data.app.forEach(function(app){
  438. app.processList.forEach(function(process){
  439. if (process.name.indexOf(key)!==-1){
  440. processList.push(process);
  441. }
  442. });
  443. });
  444. var categoryList = [];
  445. data.column.forEach(function(column){
  446. column.wrapOutCategoryList.forEach(function(category){
  447. if (category.categoryName.indexOf(key)!==-1){
  448. categoryList.push(category);
  449. }
  450. });
  451. });
  452. this.clearStartAppSelected(e);
  453. e.target.getParent(".st_search").addClass("mainColor_bg_opacity");
  454. this.reloadStartProcessList(e.target, {
  455. app: [{ name: name, processList: processList }],
  456. column: [{ wrapOutCategoryList: categoryList }]
  457. });
  458. }else{
  459. this.clearStartProcessSearch(e);
  460. }
  461. }
  462. },
  463. loadColumnItemIcon: function(columnId, e, data){
  464. var node = e.currentTarget;
  465. if (data.appIcon){
  466. node.setStyle("background-image", "url(data:image/png;base64,"+data.appIcon+")");
  467. }else{
  468. node.setStyle("background-image", "url("+"../x_component_process_ApplicationExplorer/$Main/default/icon/application.png)");
  469. }
  470. },
  471. startCategoryItemClick: function(e, data){
  472. if( !data.categoryId ){
  473. data.categoryId = data.id;
  474. data.id = data.workflowFlag;
  475. if( !data.name )data.name = data.categoryName;
  476. }
  477. MWF.xDesktop.requireApp("process.TaskCenter", "ProcessStarter", function(){
  478. var starter = new MWF.xApplication.process.TaskCenter.ProcessStarter(data, this, {
  479. "workData": {
  480. "cmsDocument" : {
  481. "isNewDocument" : true,
  482. "title": this.lp.unnamed,
  483. // "creatorIdentity": data.identity,
  484. // "identity": data.identity,
  485. "appId" : data.appId,
  486. "categoryId" : data.categoryId,
  487. "docStatus" : "draft",
  488. "categoryName" : data.categoryName,
  489. "categoryAlias" : data.categoryAlias,
  490. "createTime": new Date().format("db"),
  491. "attachmentList" : []
  492. }
  493. },
  494. "onBeforeStarted": function(data){
  495. data.data.cmsDocument.creatorIdentity = data.identity;
  496. data.data.cmsDocument.identity = data.identity;
  497. },
  498. "onStarted": function(workdata, title, processName){
  499. this.afterStartProcess(workdata, title, processName, data, true);
  500. this.closeStartProcess(e);
  501. }.bind(this)
  502. });
  503. starter.load();
  504. }.bind(this));
  505. },
  506. clearStartProcessSearch: function(e){
  507. var pnode = e.target.getParent(".st_processContent");
  508. if( this.currentTab === "byType" ){
  509. this.byTypeNode.click();
  510. }else{
  511. this.allNode.click();
  512. }
  513. pnode.getElement("input").set("value", "");
  514. },
  515. loadItemIcon: function(application, e){
  516. var node = e.currentTarget;
  517. Promise.resolve(this.getApplicationIcon(application)).then(function(icon){
  518. if (icon.icon){
  519. node.setStyle("background-image", "url(data:image/png;base64,"+icon.icon+")");
  520. }else{
  521. node.setStyle("background-image", "url("+"../x_component_process_ApplicationExplorer/$Main/default/icon/application.png)");
  522. }
  523. });
  524. },
  525. startProcessItemOver: function(e){
  526. var node = e.target;
  527. while (node && !node.hasClass("st_processItem")){ node = node.getParent();}
  528. if (node){
  529. node.addClass("menuItem_over");
  530. node.removeClass("mainColor_bg");
  531. }
  532. },
  533. startProcessItemOut: function(e){
  534. var node = e.target;
  535. while (node && !node.hasClass("st_processItem")){ node = node.getParent();}
  536. if (node){
  537. node.removeClass("menuItem_over");
  538. node.removeClass("mainColor_bg");
  539. }
  540. },
  541. startProcessItemDown: function(e){
  542. var node = e.target;
  543. while (node && !node.hasClass("st_processItem")){ node = node.getParent();}
  544. if (node){
  545. node.removeClass("menuItem_over");
  546. node.addClass("mainColor_bg");
  547. }
  548. },
  549. startProcessItemUp: function(e){
  550. var node = e.target;
  551. while (node && !node.hasClass("st_processItem")){ node = node.getParent();}
  552. if (node){
  553. node.addClass("menuItem_over");
  554. node.removeClass("mainColor_bg");
  555. }
  556. },
  557. startProcessItemClick: function(e, data){
  558. MWF.xDesktop.requireApp("process.TaskCenter", "ProcessStarter", function(){
  559. var starter = new MWF.xApplication.process.TaskCenter.ProcessStarter(data, this, {
  560. "onStarted": function(workdata, title, processName){
  561. this.afterStartProcess(workdata, title, processName, data);
  562. this.closeStartProcess(e);
  563. }.bind(this)
  564. });
  565. starter.load();
  566. }.bind(this));
  567. },
  568. recordProcessData: function(data){
  569. debugger;
  570. if( data._ )delete data._ ;
  571. MWF.UD.getDataJson("taskCenter_startTop", function(json){
  572. if (!json || !json.length) json = [];
  573. var recordProcess = null;
  574. data.lastStartTime = new Date();
  575. var earlyProcessIdx = 0;
  576. var flag = true;
  577. for (var i=0; i<json.length; i++){
  578. var process = json[i];
  579. if (process.id === data.id) recordProcess = process;
  580. if (flag){
  581. if (!process.lastStartTime){
  582. earlyProcessIdx = i;
  583. flag = false;
  584. }else{
  585. if (new Date(process.lastStartTime)<new Date(json[earlyProcessIdx].lastStartTime)){
  586. earlyProcessIdx = i;
  587. }
  588. }
  589. }
  590. if( o2.typeOf( process.applicationName ) === "object")process.applicationName = process.applicationName.name || "";
  591. }
  592. if (recordProcess) {
  593. recordProcess.lastStartTime = new Date();
  594. recordProcess.count = (recordProcess.count || 0)+1;
  595. recordProcess.applicationName = data.applicationName || "";
  596. }else{
  597. if (json.length<10){
  598. data.count = 1;
  599. //data.applicationName = this.applicationData.name;
  600. json.push(data);
  601. }else{
  602. json.splice(earlyProcessIdx, 1);
  603. data.count = 1;
  604. //data.applicationName = this.applicationData.name;
  605. json.push(data);
  606. }
  607. }
  608. MWF.UD.putData("taskCenter_startTop", json);
  609. }.bind(this));
  610. },
  611. afterStartProcess: function(data, title, processName, processdata, notRecorded){
  612. if( !notRecorded )this.recordProcessData(processdata);
  613. if (data.work){
  614. this.startProcessDraft(data, title, processName);
  615. }else{
  616. this.startProcessInstance(data, title, processName);
  617. }
  618. },
  619. startProcessDraft: function(data, title, processName){
  620. var work = data.work;
  621. var options = {"draft": work, "appId": "process.Work"+(new o2.widget.UUID).toString(), "desktopReload": false,
  622. "onPostClose": function(){
  623. if (this.currentList.refresh) this.currentList.refresh();
  624. }.bind(this)
  625. };
  626. this.desktop.openApplication(null, "process.Work", options);
  627. },
  628. startProcessInstance: function(data, title, processName){
  629. var workInfors = [];
  630. var currentTask = [];
  631. data.each(function(work){
  632. if (work.currentTaskIndex !== -1) currentTask.push(work.taskList[work.currentTaskIndex].work);
  633. workInfors.push(this.getStartWorkInforObj(work));
  634. }.bind(this));
  635. if (currentTask.length===1){
  636. var options = {"workId": currentTask[0], "appId": "process.Work"+currentTask[0],
  637. "onPostClose": function(){
  638. if (this.currentList.refresh) this.currentList.refresh();
  639. }.bind(this)
  640. };
  641. this.desktop.openApplication(null, "process.Work", options);
  642. if (layout.desktop.message) this.createStartWorkResault(workInfors, title, processName, false);
  643. }else{
  644. if (layout.desktop.message) this.createStartWorkResault(workInfors, title, processName, true);
  645. }
  646. },
  647. getStartWorkInforObj: function(work){
  648. var users = [];
  649. var currentTask = "";
  650. work.taskList.each(function(task, idx){
  651. users.push(task.person+"("+task.department + ")");
  652. if (work.currentTaskIndex===idx) currentTask = task.id;
  653. }.bind(this));
  654. return {"activity": work.fromActivityName, "users": users, "currentTask": currentTask};
  655. },
  656. createStartWorkResault: function(workInfors, title, processName, isopen){
  657. var content = "";
  658. workInfors.each(function(infor){
  659. var users = [];
  660. infor.users.each(function(uname){
  661. users.push(MWF.name.cn(uname));
  662. });
  663. content += "<div><b>"+this.lp.nextActivity+"<font style=\"color: #ea621f\">"+infor.activity+"</font>, "+this.lp.nextUser+"<font style=\"color: #ea621f\">"+users.join(", ")+"</font></b>";
  664. if (infor.currentTask && isopen){
  665. content += "&nbsp;&nbsp;&nbsp;&nbsp;<span value=\""+infor.currentTask+"\">"+this.lp.deal+"</span></div>";
  666. }else{
  667. content += "</div>";
  668. }
  669. }.bind(this));
  670. var msg = {
  671. "subject": this.lp.processStarted,
  672. "content": "<div>"+this.lp.processStartedMessage+"“["+processName+"]"+title+"”</div>"+content
  673. };
  674. var tooltip = layout.desktop.message.addTooltip(msg);
  675. var item = layout.desktop.message.addMessage(msg);
  676. this.setStartWorkResaultAction(tooltip);
  677. this.setStartWorkResaultAction(item);
  678. },
  679. setStartWorkResaultAction: function(item){
  680. var node = item.node.getElements("span.dealStartedWorkAction");
  681. var _self = this;
  682. node.addEvent("click", function(e){
  683. var options = {"taskId": this.get("value"), "appId": this.get("value"),
  684. "onPostClose": function(){
  685. if (_self.currentList.refresh) _self.currentList.refresh();
  686. }
  687. };
  688. _self.app.desktop.openApplication(e, "process.Work", options);
  689. });
  690. },
  691. recordStatus: function(){
  692. return {"navi": this.currentList.options.type};
  693. },
  694. });
  695. MWF.xApplication.process.workcenter.List = new Class({
  696. Implements: [Options, Events],
  697. options: {
  698. "itemHeight": 60,
  699. "view": "list.html",
  700. "type": "task"
  701. },
  702. initialize: function (app, options) {
  703. this.setOptions(options);
  704. this.app = app;
  705. this.content = app.listContentNode;
  706. this.bottomNode = app.listBottomNode;
  707. this.pageNode = app.pageNumberAreaNode;
  708. this.filterNode = app.filterItemArea;
  709. this.lp = this.app.lp;
  710. this.action = o2.Actions.load("x_processplatform_assemble_surface");
  711. this.init();
  712. //this.load();
  713. },
  714. init: function(){
  715. this.listHeight = this.content.getSize().y;
  716. this.size = (this.listHeight/this.options.itemHeight).toInt()
  717. this.page = 1;
  718. this.totalCount = this.app.countData.task;
  719. this.filterList = {};
  720. this.filterNameList = {};
  721. },
  722. startProcess: function(){
  723. this.app.startProcess();
  724. },
  725. setLayout: function(){
  726. },
  727. load: function(callback){
  728. this.total = null;
  729. var _self = this;
  730. this.loadFilterFlag();
  731. this.app.filterActionNode.show();
  732. this.selectedTaskList = [];
  733. this.loadData().then(function(data){
  734. _self.hide();
  735. _self.loadPage();
  736. _self.loadItems(data);
  737. if(callback)callback();
  738. });
  739. },
  740. refresh: function(){
  741. this.hide();
  742. this.load();
  743. // this.loadPage();
  744. this.app.loadCount();
  745. },
  746. loadFilterFlag: function(){
  747. this.filterNode.empty();
  748. var filterItemHtml = "<div class='ft_filterItem'>" +
  749. "<div class='ft_filterItemTitle mainColor_color'>{{$.title}}:</div>" +
  750. "<div class='ft_filterItemName'>{{$.name}}</div>"+
  751. "<icon class='o2icon-clear ft_filterItemDel' data-key='{{$.key}}' data-name='{{$.name}}'/>"+
  752. "</div>";
  753. var _self = this;
  754. this.lp.filterCategoryShortList.forEach(function(list){
  755. if (_self.filterNameList && _self.filterNameList[list.key] && _self.filterNameList[list.key].length){
  756. _self.filterNameList[list.key].forEach(function(i){
  757. var html = o2.bindJson(filterItemHtml, {"title": list.name, "name": i, "key": list.key});
  758. _self.filterNode.appendHTML(html);
  759. });
  760. }
  761. });
  762. this.filterNode.getElements(".ft_filterItemDel").addEvent("click", this.clearFilterItem.bind(this));
  763. },
  764. clearFilterItem: function(e){
  765. debugger;
  766. var node = e.target;
  767. var key = node.dataset.key;
  768. var name = node.dataset.name;
  769. if (this.filterNameList && this.filterNameList[key]){
  770. var findedIdx = this.filterNameList[key].indexOf(name);
  771. this.filterNameList[key].splice(findedIdx, 1);
  772. if (this.filterList && this.filterList[key]){
  773. if (this.filterList[key].splice){
  774. this.filterList[key].splice(findedIdx, 1);
  775. }else{
  776. delete this.filterList[key];
  777. }
  778. }
  779. this.page = 1;
  780. this.refresh();
  781. }
  782. },
  783. hide: function(){
  784. if (this.node) this.node.destroy();
  785. },
  786. loadPage: function(){
  787. var totalCount = this.total || this.app.countData[this.options.type];
  788. var pages = totalCount/this.size;
  789. var pageCount = pages.toInt();
  790. if (pages !== pageCount) pageCount = pageCount+1;
  791. this.pageCount = pageCount;
  792. var size = this.bottomNode.getSize();
  793. var maxPageSize = size.x*0.8;
  794. maxPageSize = maxPageSize - 80*2-24*2-10*3;
  795. var maxPageCount = (maxPageSize/34).toInt();
  796. this.loadPageNode(pageCount, maxPageCount);
  797. },
  798. loadPageNode: function(pageCount, maxPageCount){
  799. var pageStart = 1;
  800. var pageEnd = pageCount;
  801. if (pageCount>maxPageCount){
  802. var halfCount = (maxPageCount/2).toInt();
  803. pageStart = Math.max(this.page-halfCount, 1);
  804. pageEnd = pageStart+maxPageCount-1;
  805. pageEnd = Math.min(pageEnd, pageCount);
  806. pageStart = pageEnd - maxPageCount+1;
  807. }
  808. this.pageNode.empty();
  809. var _self = this;
  810. for (var i=pageStart; i<=pageEnd; i++){
  811. var node = new Element("div.pageItem", {
  812. "text": i,
  813. "events": { "click": function(){_self.gotoPage(this.get("text"));} }
  814. }).inject(this.pageNode);
  815. if (i==this.page) node.addClass("mainColor_bg");
  816. }
  817. },
  818. nextPage: function(){
  819. this.page++;
  820. if (this.page>this.pageCount) this.page = this.pageCount;
  821. this.gotoPage(this.page);
  822. },
  823. prevPage: function(){
  824. this.page--;
  825. if (this.page<1) this.page = 1;
  826. this.gotoPage(this.page);
  827. },
  828. firstPage: function(){
  829. this.gotoPage(1);
  830. },
  831. lastPage: function(){
  832. this.gotoPage(this.pageCount);
  833. },
  834. gotoPage: function(page){
  835. this.page = page;
  836. this.hide();
  837. this.app.showSkeleton();
  838. this.load();
  839. //this.loadPage();
  840. },
  841. loadData: function(){
  842. var _self = this;
  843. return this.action.TaskAction.listMyFilterPaging(this.page, this.size, this.filterList||{}).then(function(json){
  844. _self.fireEvent("loadData");
  845. //if (_self.total!==json.size) _self.countNode.set("text", json.size);
  846. _self.total = json.count;
  847. return json.data;
  848. }.bind(this));
  849. },
  850. loadItems: function(data){
  851. var url = this.app.path+this.app.options.style+"/view/"+this.options.view;
  852. this.content.loadHtml(url, {"bind": {"lp": this.lp, "type": this.options.type, "data": data}, "module": this}, function(){
  853. this.node = this.content.getFirst();
  854. }.bind(this));
  855. },
  856. overTaskItem: function(e){
  857. e.currentTarget.addClass("listItem_over");
  858. },
  859. outTaskItem: function(e){
  860. e.currentTarget.removeClass("listItem_over");
  861. },
  862. openTask: function(e, data){
  863. o2.api.form.openWork(data.work, "", data.title, {
  864. "taskId": data.id,
  865. "onPostClose": function(){
  866. if (this.refresh) this.refresh();
  867. }.bind(this)
  868. });
  869. },
  870. loadItemIcon: function(application, e){
  871. this.app.loadItemIcon(application, e);
  872. },
  873. loadItemFlag: function(e, data){
  874. var node = e.currentTarget;
  875. var iconNode = node.getElement(".listItemFlag");
  876. var expireNode = node.getElement(".listItemExpire");
  877. if (data.completed){
  878. iconNode.setStyle("background-image", "url("+"../x_component_process_workcenter/$Main/default/icons/pic_ok.png)");
  879. return true;
  880. }
  881. var start = new Date().parse(data.startTime);
  882. var now = new Date();
  883. if (now.getTime()-start.getTime()<86400000){
  884. iconNode.setStyle("background-image", "url("+"../x_component_process_workcenter/$Main/default/icons/pic_new.png)");
  885. }
  886. if (data.expireTime){
  887. var d1 = Date.parse(data.expireTime);
  888. var d2 = Date.parse(data.createTime);
  889. var time1 = d2.diff(now, "second");
  890. var time2 = now.diff(d1, "second");
  891. var time3 = d2.diff(d1, "second");
  892. var n = time1/time3;
  893. var img = "";
  894. var text = this.lp.expire1;
  895. text = text.replace(/{time}/g, data.expireTime);
  896. if (n<0.5){
  897. img = "1.png";
  898. }else if (n<0.75){
  899. img = "2.png";
  900. }else if (n<1){
  901. text = this.lp.expire2.replace(/{time}/g, data.expireTime);
  902. img = "3.png";
  903. iconNode.setStyle("background-image", "url("+"../x_component_process_workcenter/$Main/default/icons/pic_jichao.png)");
  904. }else if (n<2){
  905. text = this.lp.expire3.replace(/{time}/g, data.expireTime);
  906. img = "4.png";
  907. iconNode.setStyle("background-image", "url("+"../x_component_process_workcenter/$Main/default/icons/pic_yichao.png)");
  908. }else{
  909. text = this.lp.expire3.replace(/{time}/g, data.expireTime);
  910. img = "5.png";
  911. iconNode.setStyle("background-image", "url("+"../x_component_process_workcenter/$Main/default/icons/pic_yanchao.png)");
  912. }
  913. expireNode.setStyle("background-image", "url(../"+this.app.path+this.app.options.style+"/icons/"+img+")");
  914. expireNode.set("title", text);
  915. }
  916. },
  917. getFormData: function(data){
  918. var action = this.action;
  919. var formPromise = action.FormAction[((layout.mobile) ? "V2LookupWorkOrWorkCompletedMobile" : "V2LookupWorkOrWorkCompleted")](data.work).then(function(json){
  920. var formId = json.data.id;
  921. if (json.data.form){
  922. return json.form;
  923. }else{
  924. return action.FormAction[((layout.mobile) ? "V2GetMobile": "V2Get")](formId).then(function(formJson){
  925. return formJson.data.form;
  926. });
  927. }
  928. }).then(function(form){
  929. var formText = (form) ? MWF.decodeJsonString(form.data) : "";
  930. return (formText) ? JSON.decode(formText): null;
  931. });
  932. var taskPromise = action.TaskAction.get(data.id).then(function(json){
  933. return json.data;
  934. });
  935. return Promise.all([formPromise, taskPromise]);
  936. },
  937. editTask: function(e, data, action){
  938. this.getFormData(data).then(function(dataArr){
  939. var form = dataArr[0];
  940. var task = dataArr[1];
  941. if (form.json.submitFormType === "select") {
  942. this.processWork_custom();
  943. } else if (form.json.submitFormType === "script") {
  944. this.processWork_custom();
  945. } else {
  946. if (form.json.mode == "Mobile") {
  947. setTimeout(function () {
  948. this.processWork_mobile();
  949. }.bind(this), 100);
  950. } else {
  951. this.processWork_pc(task, form, action);
  952. }
  953. }
  954. }.bind(this));
  955. },
  956. processWork_pc: function(task, form, action) {
  957. var _self = this;
  958. var setSize = function (notRecenter) {
  959. var dlg = this;
  960. if (!dlg || !dlg.node) return;
  961. dlg.node.setStyle("display", "block");
  962. var size = processNode.getSize();
  963. dlg.content.setStyles({
  964. "height": size.y,
  965. "width": size.x
  966. });
  967. var s = dlg.setContentSize();
  968. if (!notRecenter) dlg.reCenter();
  969. }
  970. var processNode = new Element("div.processNode").inject(this.content);
  971. this.setProcessNode(task, form, processNode, "process", function (processor) {
  972. this.processDlg = o2.DL.open({
  973. "container": this.app.content,
  974. "title": this.lp.process,
  975. "style": form.json.dialogStyle || "user",
  976. "isResize": false,
  977. //"isClose": false,
  978. "content": processNode,
  979. "maskNode": this.app.content,
  980. "positionHeight": 800,
  981. "maxHeight": 800,
  982. "maxHeightPercent": "98%",
  983. "minTop": 5,
  984. "width": "auto", //processNode.retrieve("width") || 1000, //600,
  985. "height": "auto", //processNode.retrieve("height") || 401,
  986. "buttonList": [
  987. {
  988. "type": "ok",
  989. "text": MWF.LP.process.button.ok,
  990. "action": function (d, e) {
  991. if (this.processor) this.processor.okButton.click();
  992. }.bind(this)
  993. },
  994. {
  995. "type": "cancel",
  996. "text": MWF.LP.process.button.cancel,
  997. "action": function () {
  998. this.processDlg.close();
  999. if (this.processor) this.processor.destroy();
  1000. _self.app.content.unmask();
  1001. }.bind(this)
  1002. }
  1003. ],
  1004. "onPostLoad": function () {
  1005. processor.options.mediaNode = this.content;
  1006. setSize.call(this)
  1007. }
  1008. });
  1009. }.bind(this), function () {
  1010. if (this.processDlg) setSize.call(this.processDlg, true)
  1011. }.bind(this), "", action);
  1012. },
  1013. setProcessNode: function (task, form, processNode, style, postLoadFun, resizeFun, defaultRoute, action) {
  1014. var _self = this;
  1015. MWF.xDesktop.requireApp("process.Work", "Processor", function () {
  1016. var mds = [];
  1017. var innerNode;
  1018. if (layout.mobile) {
  1019. innerNode = new Element("div").inject(processNode);
  1020. }
  1021. this.processor = new MWF.xApplication.process.Work.Processor(innerNode || processNode, task, {
  1022. "style": (layout.mobile) ? "mobile" : (style || "default"),
  1023. "tabletWidth": form.json.tabletWidth || 0,
  1024. "tabletHeight": form.json.tabletHeight || 0,
  1025. "onPostLoad": function () {
  1026. if (postLoadFun) postLoadFun(this);
  1027. _self.fireEvent("afterLoadProcessor", [this]);
  1028. },
  1029. "onResize": function () {
  1030. if (resizeFun) resizeFun();
  1031. },
  1032. "onCancel": function () {
  1033. processNode.destroy();
  1034. _self.app.content.unmask();
  1035. delete this;
  1036. },
  1037. "onSubmit": function (routeName, opinion, medias, appendTaskIdentityList, processorOrgList, callbackBeforeSave) {
  1038. if (!medias || !medias.length) {
  1039. medias = mds;
  1040. } else {
  1041. medias = medias.concat(mds)
  1042. }
  1043. var method = action || "submitTask";
  1044. _self[method](routeName, opinion, medias, task);
  1045. }
  1046. });
  1047. }.bind(this));
  1048. },
  1049. submitTask: function(routeName, opinion, medias, task){
  1050. if (!opinion) opinion = routeName;
  1051. task.routeName = routeName;
  1052. task.opinion = opinion;
  1053. var mediaIds = [];
  1054. if (medias.length){
  1055. medias.each(function(file){
  1056. var formData = new FormData();
  1057. formData.append("file", file);
  1058. formData.append("site", "$mediaOpinion");
  1059. this.action.AttachmentAction.upload(task.work, formData, file, function(json){
  1060. mediaIds.push(json.data.id);
  1061. }.bind(this), null, false);
  1062. }.bind(this));
  1063. }
  1064. if (mediaIds.length) task.mediaOpinion = mediaIds.join(",");
  1065. this.action.TaskAction.processing(task.id, task, function(json){
  1066. if (this.processor) this.processor.destroy();
  1067. if (this.processDlg) this.processDlg.close();
  1068. this.app.content.unmask();
  1069. this.refresh();
  1070. this.addMessage(json.data, task);
  1071. }.bind(this));
  1072. },
  1073. getMessageContent: function (data, task, maxLength, titlelp) {
  1074. var content = "";
  1075. var lp = this.lp;
  1076. if (data.completed) {
  1077. content += lp.workCompleted;
  1078. } else {
  1079. if (data.occurSignalStack) {
  1080. if (data.signalStack && data.signalStack.length) {
  1081. var activityUsers = [];
  1082. data.signalStack.each(function (stack) {
  1083. var idList = [];
  1084. if (stack.splitExecute) {
  1085. idList = stack.splitExecute.splitValueList || [];
  1086. }
  1087. if (stack.manualExecute) {
  1088. idList = stack.manualExecute.identities || [];
  1089. }
  1090. var count = 0;
  1091. var ids = [];
  1092. idList.each( function(i){
  1093. var cn = o2.name.cn(i);
  1094. if( !ids.contains( cn ) ){
  1095. ids.push(cn)
  1096. }
  1097. });
  1098. if (ids.length > 8) {
  1099. count = ids.length;
  1100. ids = ids.slice(0, 8);
  1101. }
  1102. ids = o2.name.cns(ids);
  1103. var t = "<b>" + lp.nextActivity + "</b><span style='color: #ea621f'>" + stack.name + "</span>;<b>" + lp.nextUser + "</b><span style='color: #ea621f'>" + ids.join(",") + "</span> <b>" + ((count) ? "," + lp.next_etc.replace("{count}", count) : "") + "</b>";
  1104. activityUsers.push(t);
  1105. }.bind(this));
  1106. content += activityUsers.join("<br>");
  1107. } else {
  1108. content += lp.processTaskCompleted;
  1109. }
  1110. } else {
  1111. if (data.properties.nextManualList && data.properties.nextManualList.length) {
  1112. var activityUsers = [];
  1113. data.properties.nextManualList.each(function (a) {
  1114. var ids = [];
  1115. a.taskIdentityList.each(function (i) {
  1116. var cn = o2.name.cn(i);
  1117. if( !ids.contains( cn ) ){
  1118. ids.push(cn)
  1119. }
  1120. });
  1121. var t = "<b>" + lp.nextActivity + "</b><span style='color: #ea621f'>" + a.activityName + "</span>;<b>" + lp.nextUser + "</b><span style='color: #ea621f'>" + ids.join(",") + "</span>";
  1122. activityUsers.push(t);
  1123. });
  1124. content += activityUsers.join("<br>");
  1125. } else {
  1126. if (data.arrivedActivityName) {
  1127. content += lp.arrivedActivity + data.arrivedActivityName;
  1128. } else {
  1129. content += lp.processTaskCompleted;
  1130. }
  1131. }
  1132. }
  1133. }
  1134. var title = task.title;
  1135. if (maxLength && title.length > maxLength) {
  1136. title = title.substr(0, maxLength) + "...";
  1137. }
  1138. return "<div>" + (titlelp || lp.taskProcessedMessage) + "“" + title + "”</div>" + content;
  1139. },
  1140. addMessage: function (data, task, notShowBrowserDkg) {
  1141. if (layout.desktop.message) {
  1142. var msg = {
  1143. "subject": this.lp.taskProcessed,
  1144. "content": this.getMessageContent(data, task, 0, this.lp.taskProcessedMessage)
  1145. };
  1146. layout.desktop.message.addTooltip(msg);
  1147. return layout.desktop.message.addMessage(msg);
  1148. } else {
  1149. // if (this.app.inBrowser && !notShowBrowserDkg) {
  1150. // this.inBrowserDkg(this.getMessageContent(data, 0, this.lp.taskProcessedMessage));
  1151. // }
  1152. }
  1153. },
  1154. selectTask: function(e, data){
  1155. if (e.currentTarget.get("disabled").toString()!="true"){
  1156. var itemNode = e.currentTarget.getParent(".listItem");
  1157. var iconNode = e.currentTarget.getElement(".selectFlagIcon");
  1158. if (itemNode){
  1159. if (itemNode.hasClass("mainColor_bg_opacity")){
  1160. itemNode.removeClass("mainColor_bg_opacity");
  1161. iconNode.removeClass("o2icon-xuanzhong");
  1162. iconNode.removeClass("selectFlagIcon_select");
  1163. iconNode.removeClass("mainColor_color");
  1164. this.unSelectedTask(data);
  1165. this.showBatchAction();
  1166. }else{
  1167. itemNode.addClass("mainColor_bg_opacity");
  1168. iconNode.addClass("o2icon-xuanzhong");
  1169. iconNode.addClass("selectFlagIcon_select");
  1170. iconNode.addClass("mainColor_color");
  1171. this.selectedTask(data);
  1172. this.showBatchAction(itemNode);
  1173. }
  1174. this.checkSelectTask();
  1175. }
  1176. }
  1177. },
  1178. checkSelectTask: function(){
  1179. var _self = this;
  1180. var nodes = this.app.listContentNode.getElements(".selectFlagArea");
  1181. if (this.selectedTaskList && this.selectedTaskList.length){
  1182. var data = this.selectedTaskList[0];
  1183. nodes.each(function(node){
  1184. var t = node.retrieve("task");
  1185. if (t.activity !== data.activity){
  1186. node.set("disabled", true);
  1187. node.set("title", _self.lp.cannotSelectBatch);
  1188. node.addClass("selectFlagArea_disabled");
  1189. }
  1190. });
  1191. }else{
  1192. nodes.set("disabled", false);
  1193. nodes.set("title", this.lp.selectBatch);
  1194. nodes.removeClass("selectFlagArea_disabled");
  1195. }
  1196. },
  1197. showBatchAction: function(itemNode){
  1198. if (this.selectedTaskList && this.selectedTaskList.length){
  1199. if (!itemNode){
  1200. var nodes = this.app.listContentNode.getElements(".listItem.mainColor_bg_opacity");
  1201. if (nodes && nodes.length){
  1202. itemNode = nodes[nodes.length-1];
  1203. }
  1204. }
  1205. if (itemNode){
  1206. this.batchAction.show();
  1207. this.batchAction.position({
  1208. "relativeTo": itemNode,
  1209. "position": "centerBottom",
  1210. "edge": "centerTop",
  1211. "offset": {"y": 10}
  1212. });
  1213. }else{
  1214. this.batchAction.hide();
  1215. }
  1216. }else{
  1217. this.batchAction.hide();
  1218. }
  1219. },
  1220. selectedTask: function(data){
  1221. delete data._;
  1222. if (!this.selectedTaskList) this.selectedTaskList = [];
  1223. var idx = this.selectedTaskList.findIndex(function(t){
  1224. return t.id == data.id;
  1225. });
  1226. if (idx===-1) this.selectedTaskList.push(data);
  1227. },
  1228. unSelectedTask: function(data){
  1229. delete data._;
  1230. if (!this.selectedTaskList) this.selectedTaskList = [];
  1231. var idx = this.selectedTaskList.findIndex(function(t){
  1232. return t.id == data.id;
  1233. });
  1234. if (idx!==-1) this.selectedTaskList.splice(idx, 1);
  1235. },
  1236. bindSelectData: function(e, data){
  1237. delete data._;
  1238. e.currentTarget.store("task", data);
  1239. },
  1240. batchProcessTask: function(e){
  1241. if (this.selectedTaskList && this.selectedTaskList.length){
  1242. var data = this.selectedTaskList[0];
  1243. this.editTask(e, data, "batchSubmitTask")
  1244. }
  1245. },
  1246. batchSubmitTask: function(routeName, opinion, medias){
  1247. if (this.selectedTaskList && this.selectedTaskList.length){
  1248. var p = [];
  1249. this.selectedTaskList.forEach(function(task){
  1250. if (!opinion) opinion = routeName;
  1251. task.routeName = routeName;
  1252. task.opinion = opinion;
  1253. var mediaIds = [];
  1254. if (medias.length){
  1255. medias.each(function(file){
  1256. var formData = new FormData();
  1257. formData.append("file", file);
  1258. formData.append("site", "$mediaOpinion");
  1259. this.action.AttachmentAction.upload(task.work, formData, file, function(json){
  1260. mediaIds.push(json.data.id);
  1261. }.bind(this), null, false);
  1262. }.bind(this));
  1263. }
  1264. if (mediaIds.length) task.mediaOpinion = mediaIds.join(",");
  1265. p.push(this.action.TaskAction.processing(task.id, task, function(json){
  1266. if (this.processor) this.processor.destroy();
  1267. if (this.processDlg) this.processDlg.close();
  1268. this.addMessage(json.data, task);
  1269. }.bind(this)));
  1270. }.bind(this));
  1271. Promise.all(p).then(function(){
  1272. this.app.content.unmask();
  1273. this.refresh();
  1274. }.bind(this));
  1275. }
  1276. },
  1277. });
  1278. MWF.xApplication.process.workcenter.TaskList = new Class({
  1279. Extends: MWF.xApplication.process.workcenter.List
  1280. });
  1281. MWF.xApplication.process.workcenter.ReadList = new Class({
  1282. Extends: MWF.xApplication.process.workcenter.List,
  1283. options: {
  1284. "itemHeight": 60,
  1285. "type": "read"
  1286. },
  1287. loadData: function(){
  1288. var _self = this;
  1289. return this.action.ReadAction.listMyFilterPaging(this.page, this.size, this.filterList||{}).then(function(json){
  1290. _self.fireEvent("loadData");
  1291. _self.total = json.count;
  1292. return json.data;
  1293. }.bind(this));
  1294. // var _self = this;
  1295. // return this.action.ReadAction.listMyPaging(this.page, this.size).then(function(json){
  1296. // _self.fireEvent("loadData");
  1297. // _self.total = json.size;
  1298. // return json.data;
  1299. // }.bind(this));
  1300. },
  1301. loadItemFlag: function(e, data){
  1302. var node = e.currentTarget;
  1303. var iconNode = node.getElement(".listItemFlag");
  1304. if (data.completed){
  1305. iconNode.setStyle("background-image", "url("+"../x_component_process_workcenter/$Main/default/icons/pic_ok.png)");
  1306. return true;
  1307. }
  1308. var start = new Date().parse(data.startTime);
  1309. var now = new Date();
  1310. if (now.getTime()-start.getTime()<86400000){
  1311. iconNode.setStyle("background-image", "url("+"../x_component_process_workcenter/$Main/default/icons/pic_new.png)");
  1312. }
  1313. },
  1314. setReadCompleted: function(e, data){
  1315. if (data.item) data = data.item;
  1316. var _self = this;
  1317. var text = this.lp.setReadedConfirmContent.replace("{title}", data.title );
  1318. var url = this.app.path+this.app.options.style+"/view/dlg/read.html";
  1319. o2.loadHtml(url, {"bind": {"lp": this.lp, "readedConfirmContent": text}, "module": this}, function(o){
  1320. var html = o2.bindJson(o[0].data, {"lp": this.lp, "readedConfirmContent": text});
  1321. var p = o2.dlgPosition(e, this.app.content, 550, 260)
  1322. var readDlg = o2.DL.open({
  1323. "container": this.app.content,
  1324. "title": this.lp.setReadedConfirmTitle,
  1325. "style": "user",
  1326. "isResize": false,
  1327. "height": "260",
  1328. "width": "550",
  1329. "top": p.y,
  1330. "left": p.x,
  1331. "fromTop": p.fromy,
  1332. "fromLeft": p.fromx,
  1333. "html": html,
  1334. "maskNode": this.app.content,
  1335. "minTop": 5,
  1336. "buttonList": [
  1337. {
  1338. "type": "ok",
  1339. "text": MWF.LP.process.button.ok,
  1340. "action": function () {
  1341. debugger;
  1342. var opinion = this.content.getElement("textarea").get("value");
  1343. _self.setReadAction(data, opinion);
  1344. this.close();
  1345. }
  1346. },
  1347. {
  1348. "type": "cancel",
  1349. "text": MWF.LP.process.button.cancel,
  1350. "action": function () {
  1351. this.close();
  1352. }
  1353. }
  1354. ]
  1355. });
  1356. }.bind(this));
  1357. },
  1358. setReadAction: function(data, opinion){
  1359. this.action.ReadAction.processing(data.id, {"opinion": opinion}, function(){
  1360. if (this.infoDlg) this.infoDlg.close();
  1361. this.refresh();
  1362. }.bind(this));
  1363. },
  1364. getReference: function(data){
  1365. return this.action.ReadAction.reference(data.id).then(function(json){
  1366. json.data.item = json.data.read;
  1367. return json.data;
  1368. });
  1369. },
  1370. openWorkInfo: function(e, data){
  1371. // var p = e.target.getPosition(this.app.content);
  1372. var infoContent = new Element("div");
  1373. var url = this.app.path+this.app.options.style+"/view/dlg/processInfo.html";
  1374. var _self = this;
  1375. this.getReference(data).then(function(data){
  1376. //data.workLog = json.data;
  1377. infoContent.loadHtml(url, {"bind": {"lp": _self.lp, "type": _self.options.type, "data": data}, "module": _self});
  1378. });
  1379. this.infoDlg = o2.DL.open({
  1380. // "top": p.y,
  1381. // "left": p.x,
  1382. "container": this.app.content,
  1383. "title": this.lp.processInfo,
  1384. "style": "user",
  1385. "isResize": true,
  1386. "content": infoContent,
  1387. "maskNode": this.app.content,
  1388. "width": 800,
  1389. "height": 720
  1390. });
  1391. },
  1392. attachShowPersonLog: function(e, data){
  1393. var inforNode = new Element("div.pf_workLogInfor");
  1394. var html = "<div>"+o2.name.cn(data.person)+"</div>";
  1395. if (data.completedTime){
  1396. html += "<div>"+this.lp.opinion+": "+o2.txt(data.opinion || data.routeName)+"</div>";
  1397. html += "<div>"+this.lp.time+": "+data.completedTime.substring(0,16)+"</div>";
  1398. }else{
  1399. html += "<div style='color:red'>"+this.lp.processing+"</div>";
  1400. html += "<div>"+this.lp.starttime+": "+data.startTime.substring(0,16)+"</div>";
  1401. }
  1402. inforNode.set("html", html);
  1403. if (!Browser.Platform.ios){
  1404. // new mBox.Tooltip({
  1405. // content: inforNode,
  1406. // setStyles: {content: {padding: 15, lineHeight: 20}},
  1407. // attach: e.target,
  1408. // transition: 'flyin'
  1409. // });
  1410. this.tooltip = new MWF.xApplication.process.workcenter.List.Tooltip(this.app.content, e.target, this.app, {}, {
  1411. axis : "y",
  1412. hiddenDelay : 300,
  1413. displayDelay : 300
  1414. });
  1415. this.tooltip.inforNode = inforNode;
  1416. }
  1417. },
  1418. openWork: function(e, data){
  1419. o2.api.form.openWork(data.id, "", data.title);
  1420. },
  1421. openJob: function(e, data){
  1422. debugger;
  1423. o2.api.form.openJob(data.item.job);
  1424. },
  1425. closeMoerLogPanel: function(logNode){
  1426. if (logNode){
  1427. logNode.removeClass("mainColor_bg_opacity");
  1428. var workLogPanel = logNode.retrieve("workLogPanel");
  1429. if (workLogPanel) workLogPanel.closePanel();
  1430. logNode.store("workLogPanel", null);
  1431. }
  1432. },
  1433. moreWorkLog: function(e, data){
  1434. var logNode = e.target.getParent(".pf_logItem");
  1435. this.closeMoerLogPanel(this.currentLogNode);
  1436. var _self = this;
  1437. var moreLogNode = new Element("div");
  1438. var url = this.app.path+this.app.options.style+"/view/dlg/moreWorkLog.html";
  1439. moreLogNode.loadHtml(url, {"bind": {"lp": _self.lp, "type": _self.options.type, "data": data}, "module": _self});
  1440. var targetNode = e.target.getParent(".processInfoContent").getElement(".pf_workListArea");
  1441. o2.require("o2.widget.Panel", function(){
  1442. workLogPanel = new o2.widget.Panel(moreLogNode, {
  1443. "style": "flat",
  1444. "title": "",
  1445. "width": 300,
  1446. "height": 540,
  1447. "isMove": false,
  1448. "isClose": true,
  1449. "isMax": false,
  1450. "isExpand": false,
  1451. "isResize": false,
  1452. "target": targetNode,
  1453. "duration": 0,
  1454. "onPostLoad": function(){
  1455. _self.currentLogNode = logNode.addClass("mainColor_bg_opacity");
  1456. },
  1457. "onQueryClose": function(){
  1458. var node = _self.currentLogNode;
  1459. _self.currentLogNode = null;
  1460. if (node) _self.closeMoerLogPanel(node);
  1461. }
  1462. });
  1463. logNode.store("workLogPanel", workLogPanel);
  1464. workLogPanel.logNode = logNode;
  1465. workLogPanel.load();
  1466. });
  1467. }
  1468. });
  1469. MWF.xApplication.process.workcenter.TaskCompletedList = new Class({
  1470. Extends: MWF.xApplication.process.workcenter.ReadList,
  1471. options: {
  1472. "itemHeight": 60,
  1473. "type": "taskCompleted"
  1474. },
  1475. getReference: function(data){
  1476. return this.action.TaskCompletedAction.getReference(data.id).then(function(json){
  1477. json.data.item = json.data.taskCompleted;
  1478. return json.data;
  1479. });
  1480. },
  1481. loadData: function(){
  1482. var _self = this;
  1483. return this.action.TaskCompletedAction.listMyFilterPaging(this.page, this.size, this.filterList||{}).then(function(json){
  1484. _self.fireEvent("loadData");
  1485. _self.total = json.count;
  1486. return json.data;
  1487. }.bind(this));
  1488. // var _self = this;
  1489. // return this.action.TaskCompletedAction.listMyPaging(this.page, this.size).then(function(json){
  1490. // _self.fireEvent("loadData");
  1491. // _self.total = json.size;
  1492. // return json.data;
  1493. // }.bind(this));
  1494. }
  1495. });
  1496. MWF.xApplication.process.workcenter.ReadCompletedList = new Class({
  1497. Extends: MWF.xApplication.process.workcenter.ReadList,
  1498. options: {
  1499. "itemHeight": 60,
  1500. "type": "readCompleted"
  1501. },
  1502. getReference: function(data){
  1503. return this.action.ReadCompletedAction.getReference(data.id).then(function(json){
  1504. json.data.item = json.data.readCompleted;
  1505. return json.data;
  1506. });
  1507. },
  1508. loadData: function(){
  1509. var _self = this;
  1510. return this.action.ReadCompletedAction.listMyFilterPaging(this.page, this.size, this.filterList||{}).then(function(json){
  1511. _self.fireEvent("loadData");
  1512. _self.total = json.count;
  1513. return json.data;
  1514. }.bind(this));
  1515. // var _self = this;
  1516. // return this.action.ReadCompletedAction.listMyPaging(this.page, this.size).then(function(json){
  1517. // _self.fireEvent("loadData");
  1518. // _self.total = json.size;
  1519. // return json.data;
  1520. // }.bind(this));
  1521. }
  1522. });
  1523. MWF.xApplication.process.workcenter.DraftList = new Class({
  1524. Extends: MWF.xApplication.process.workcenter.ReadList,
  1525. options: {
  1526. "itemHeight": 60,
  1527. "type": "draft"
  1528. },
  1529. loadData: function(){
  1530. // var _self = this;
  1531. // return this.action.DraftAction.listMyFilterPaging(this.page, this.size, this.filterList||{}).then(function(json){
  1532. // _self.fireEvent("loadData");
  1533. // _self.total = json.count;
  1534. // return json.data;
  1535. // }.bind(this));
  1536. this.app.filterActionNode.hide();
  1537. var _self = this;
  1538. return this.action.DraftAction.listMyPaging(this.page, this.size, {}).then(function(json){
  1539. _self.fireEvent("loadData");
  1540. _self.total = json.count;
  1541. return json.data;
  1542. }.bind(this));
  1543. },
  1544. openTask: function(e, data){
  1545. var options = {"draftId": data.id, "appId": "process.Work"+data.id,
  1546. "onPostClose": function(){
  1547. if (this.refresh) this.refresh();
  1548. }.bind(this)
  1549. };
  1550. this.app.desktop.openApplication(e, "process.Work", options);
  1551. }
  1552. });
  1553. MWF.xApplication.process.workcenter.ReviewList = new Class({
  1554. Extends: MWF.xApplication.process.workcenter.ReadList,
  1555. options: {
  1556. "itemHeight": 60,
  1557. "type": "review"
  1558. },
  1559. loadData: function(){
  1560. // this.app.filterActionNode.hide();
  1561. var _self = this;
  1562. return this.action.ReviewAction.V2ListPaging(this.page, this.size, this.filterList||{}).then(function(json){
  1563. _self.fireEvent("loadData");
  1564. _self.total = json.count;
  1565. return json.data;
  1566. }.bind(this));
  1567. },
  1568. openTask: function(e, data){
  1569. o2.api.form.openWork(data.work, "", data.title, {
  1570. "onPostClose": function(){
  1571. if (this.refresh) this.refresh();
  1572. }.bind(this)
  1573. });
  1574. },
  1575. loadFilterFlag: function(){
  1576. this.filterNode.empty();
  1577. var filterItemHtml = "<div class='ft_filterItem'>" +
  1578. "<div class='ft_filterItemTitle mainColor_color'>{{$.title}}:</div>" +
  1579. "<div class='ft_filterItemName'>{{$.name}}</div>"+
  1580. "<icon class='o2icon-clear ft_filterItemDel' data-key='{{$.key}}' data-name='{{$.name}}'/>"+
  1581. "</div>";
  1582. var _self = this;
  1583. this.lp.filterCategoryShortListReview.forEach(function(list){
  1584. if (_self.filterNameList && _self.filterNameList[list.key] && _self.filterNameList[list.key].length){
  1585. _self.filterNameList[list.key].forEach(function(i){
  1586. var html = o2.bindJson(filterItemHtml, {"title": list.name, "name": i, "key": list.key});
  1587. _self.filterNode.appendHTML(html);
  1588. });
  1589. }
  1590. });
  1591. this.filterNode.getElements(".ft_filterItemDel").addEvent("click", this.clearFilterItem.bind(this));
  1592. }
  1593. });
  1594. MWF.xApplication.process.workcenter.MyCreatedList = new Class({
  1595. Extends: MWF.xApplication.process.workcenter.ReviewList,
  1596. options: {
  1597. "itemHeight": 60,
  1598. "type": "myCreated"
  1599. },
  1600. loadData: function(){
  1601. // this.app.filterActionNode.hide();
  1602. var _self = this;
  1603. return this.action.ReviewAction.V2ListCreatePaging(this.page, this.size, this.filterList||{}).then(function(json){
  1604. _self.fireEvent("loadData");
  1605. _self.total = json.count;
  1606. return json.data;
  1607. }.bind(this));
  1608. },
  1609. openTask: function(e, data){
  1610. o2.api.form.openWork(data.work, "", data.title, {
  1611. "onPostClose": function(){
  1612. if (this.refresh) this.refresh();
  1613. }.bind(this)
  1614. });
  1615. }
  1616. });
  1617. MWF.xDesktop.requireApp("Template", "MTooltips", null, false);
  1618. MWF.xApplication.process.workcenter.List.Tooltip = new Class({
  1619. Extends: MTooltips,
  1620. options:{
  1621. nodeStyles: {
  1622. "font-size" : "12px",
  1623. "position" : "absolute",
  1624. "max-width" : "500px",
  1625. "min-width" : "180px",
  1626. "z-index" : "1001",
  1627. "background-color" : "#fff",
  1628. "padding" : "10px",
  1629. "border-radius" : "8px",
  1630. "box-shadow": "0 0 18px 0 #999999",
  1631. "-webkit-user-select": "text",
  1632. "-moz-user-select": "text",
  1633. "line-height": "20px"
  1634. },
  1635. priorityOfAuto :{
  1636. x : [ "center", "right", "left" ], //当position x 为 auto 时候的优先级
  1637. y : [ "middle", "top", "bottom" ] //当position y 为 auto 时候的优先级
  1638. },
  1639. isFitToContainer : true,
  1640. overflow : "scroll"
  1641. },
  1642. _loadCustom : function( callback ){
  1643. if(callback)callback();
  1644. },
  1645. _customNode : function( node, contentNode ){
  1646. this.inforNode.inject(contentNode);
  1647. if( this.inforNode.getSize().y > 300 ){
  1648. this.inforNode.setStyle("padding-bottom", "20px");
  1649. }
  1650. this.fireEvent("customContent", [contentNode, node]);
  1651. }
  1652. });