workBench.js 51 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477
  1. var workbench = {
  2. width: 1/3,
  3. setWidth: function(width){
  4. this.width = width;
  5. },
  6. height: 1/3,
  7. setHeight: function(height){
  8. this.height = height;
  9. },
  10. bench_task: function(){
  11. var me = this.workbench || this;
  12. var notifycount=getNotifyCount();
  13. return Ext.create('Ext.panel.Panel', {
  14. title:'<div class="div-left">待办事宜</div>' +
  15. '<div class="div-right"><a href="javascript:openTable(null,\'JprocessScan\',\'发起流程列表\',\'jsps/common/datalist.jsp\',null,null,\'jp_launcherid=\\\'' + em_code + '\\\' and jp_status=\\\'待审批\\\' '+'\');">已发起流程</a></div>' +
  16. '<div class="div-right"><a href="javascript:openTable(null,\'JprocessScan\',\'处理流程列表\',\'jsps/common/datalist.jsp\',null,null,\'jp_nodedealman=\\\'' + em_code + '\\\' and jp_status<>\\\'待审批\\\' '+'\' );">已处理流程</a>|</div>'+
  17. '<div class="div-right"><a href="javascript:openTable(null,\'TransferProcess\',\'转移流程列表\',\'jsps/common/datalist.jsp\',null,null,\'jt_acceptercode=\\\'' + em_code + '\\\' and jp_flag = 1 and jp_status=\\\'待审批\\\' '+'\' );">待办转移流程</a>|</div>'+
  18. '<div class="div-right"><a href="javascript:openTable(null,\'JProcess\',\'待办流程列表\',\'jsps/common/datalist.jsp\',null,null,\'jp_nodedealman=\\\'' + em_code + '\\\' and jp_status=\\\'待审批\\\' '+'\' );">更多待办流程</a>|</div>'+
  19. '<div class="div-right"><a href="javascript:openTable(null,\'ResourceAssignment!ALL\',\'提醒任务列表\',\'jsps/common/datalist.jsp\',null,null,\'ra_resourcecode=\\\'' + em_code + '\\\' and ra_statuscode<>\\\'FINISHED\\\' '+'\' );">更多提醒任务</a>|</div>'+
  20. '<div class="div-right"><a href="javascript:openTable(null,\'NotifyJprocess\',\'知会信息\',\'jsps/common/datalist.jsp\',null,null,\'prd_recipientid=session:em_uu\' );"><div id="messagecount">知会('+notifycount+')|</div></a>|</div>'+
  21. '<div class="div-right"><a href="javascript:refreshTask();">刷新</a>|</div>',
  22. id: 'bench_task',
  23. iconCls: 'main-todo',
  24. columnWidth: me.width,
  25. height: me.height,
  26. layout:'anchor',
  27. items:[{
  28. xtype:'gridpanel',
  29. id:'task_grid',
  30. hideHeaders:true,
  31. store: Ext.create('Ext.data.Store', {
  32. fields:['id', 'name','status','type','typecode','CURRENTMASTER','note'],
  33. groupField: 'type'
  34. }),
  35. autoScroll: true,
  36. cls: 'task-grid',
  37. anchor: '100% 100%',
  38. features: [ Ext.create('Ext.grid.feature.Grouping',{
  39. groupHeaderTpl: '{name} (共 {rows.length}项)'
  40. })],
  41. loadNewStore:function(){
  42. me._bench_task();
  43. },
  44. viewConfig :{
  45. stripeRows:false
  46. },
  47. bodyStyle: 'background: #f1f1f1;border: none;',
  48. columns: [{ header: 'ID', dataIndex: 'id', hidden: true},
  49. { header: '事宜名称', dataIndex: 'name', flex:1,renderer:taskItem, id: 'topic'},
  50. { header: '当前状态', dataIndex: 'status',hidden: true},
  51. {header: '事宜类型', dataIndex:'type',hidden: true},
  52. {header:'事宜类型编码', dataIndex:'typecode',hidden: true},
  53. {header:'备注信息', dataIndex:'note',hidden: true},
  54. {header:'Master',dateIndex:'CURRENTMASTER',hidden:true }]
  55. }]
  56. });
  57. },
  58. bench_flow: function(){
  59. var me = this.workbench || this;
  60. return Ext.create('Ext.panel.Panel', {
  61. title:'<div class="div-left">我发起未结束流程</div>' +
  62. '<div class="div-right"><a href="javascript:openTable(null,\'JProcess!Me\',\'流程列表\',\'jsps/common/datalist.jsp\',null,null,\'jp_nodedealman=\'' + em_code + '\');">发布流程</a></div>' +
  63. '<div class="div-right"><a href="javascript:openTable(null,\'JProcess!Me\',\'流程列表\',\'jsps/common/datalist.jsp\',null,null,\'jp_nodedealman=\'' + em_code + '\');">更多流程</a>|</div>',
  64. bodyStyle: 'background: #f1f1f1',
  65. id: 'bench_flow',
  66. contentEl: 'myflow',
  67. iconCls: 'main-todo',
  68. autoScroll: true,
  69. columnWidth: me.width,
  70. height: me.height
  71. });
  72. },
  73. bench_overflow: function(){
  74. var me = this.workbench || this;
  75. return Ext.create('Ext.panel.Panel', {
  76. title:'<div class="div-left">我的超时流程</div>' +
  77. '<div class="div-right"><a href="javascript:openTable(null,\'JProcess!MeOver\',\'流程列表\',\'jsps/common/datalist.jsp\',null,null,\'jp_nodedealman=\'' + em_code + '\');">发布流程</a></div>' +
  78. '<div class="div-right"><a href="javascript:openTable(null,\'JProcess!MeOver\',\'流程列表\',\'jsps/common/datalist.jsp\',null,null,\'jp_nodedealman=\'' + em_code + '\');">更多流程</a>|</div>',
  79. bodyStyle: 'background: #f1f1f1',
  80. id: 'bench_overflow',
  81. contentEl: 'myoverflow',
  82. iconCls: 'main-todo',
  83. autoScroll: true,
  84. columnWidth: me.width,
  85. height: me.height
  86. });
  87. },
  88. bench_schedule: function(){
  89. var me = this.workbench || this;
  90. return Ext.create('Ext.panel.Panel', {
  91. title:'<div class="div-left">我的考勤</div>' +
  92. '<div class="div-right"><a href="javascript:openTable(null,\'Sign\',\'考勤\',\'jsps/common/datalist.jsp\',null,null,\'si_emid=' + em_uu + '\');">我的考勤</a></div>' +
  93. '<div class="div-right"><a href="javascript:alert(\'没有下属\');">下属考勤</a>|</div>',
  94. id: 'bench_schedule',
  95. iconCls: 'main-forget',
  96. layout: 'anchor',
  97. bodyStyle: 'background: #f1f1f1;',
  98. items: [{
  99. xtype: 'button',
  100. id: 'clock',
  101. iconCls: 'x-button-icon-clock',
  102. scale: 'large',
  103. anchor: '100% 33.33%'
  104. },{
  105. xtype: 'button',
  106. iconCls: 'x-button-icon-on',
  107. text: '',
  108. id: 'signin',
  109. signin: false,
  110. intime: null,
  111. tooltip: '',
  112. anchor: '100% 33.33%',
  113. scale: 'large',
  114. handler: function(btn){
  115. if(btn.signin == false){
  116. signin();
  117. }
  118. }
  119. },{
  120. xtype: 'button',
  121. iconCls: 'x-button-icon-off',
  122. hidden: true,
  123. text: '',
  124. signout: false,
  125. outtime: null,
  126. tooltip: '',
  127. id: 'signout',
  128. anchor: '100% 33.33%',
  129. scale: 'large',
  130. handler: function(btn){
  131. if(btn.signout == false){
  132. signout();
  133. }
  134. }
  135. }],
  136. columnWidth: me.width,
  137. height: me.height
  138. });
  139. },
  140. bench_subscription: function(){
  141. var me = this.workbench || this;
  142. return Ext.create('Ext.panel.Panel', {
  143. title: '<div class="div-left">日程安排</div>' +
  144. '<div class="div-right"><a href="' + basePath + 'jsps/plm/calendar/NewMyCalendar.jsp" target="_blank">详细日程</a></div>' +
  145. '<div class="div-right"><a href="' + basePath + 'jsps/plm/calendar/NewMyCalendar.jsp" target="_blank">下属日程</a>|</div>',
  146. id: 'bench_subscription',
  147. layout: 'border',
  148. items: [{
  149. region: 'center',
  150. xtype: 'holidaydatepicker',
  151. autoShow: true
  152. }],
  153. iconCls: 'main-schedule',
  154. columnWidth: me.width,
  155. height: me.height
  156. });
  157. },
  158. bench_notify: function(){
  159. var me = this.workbench || this;
  160. return Ext.create('Ext.panel.Panel', {
  161. title:'<div class="div-left">通知公告</div>' +
  162. '<div class="div-right"><a href="javascript:openTable(0,\'Note\',\'通知\',\'jsps/oa/info/Note.jsp\',\'no_id\',null' + ')">发布通知</a></div>' +
  163. '<div class="div-right"><a href="javascript:openTable(null,\'Note\',\'通知\',\'jsps/common/datalist.jsp\',null,null,null);">更多通知</a>|</div>',
  164. id: 'bench_notify',
  165. iconCls: 'main-msg',
  166. contentEl: 'notify',
  167. columnWidth: me.width,
  168. height: me.height
  169. });
  170. },
  171. bench_news: function(){
  172. var me = this.workbench || this;
  173. return Ext.create('Ext.panel.Panel', {
  174. title:'<div class="div-left">新闻动态</div>' +
  175. '<div class="div-right"><a href="javascript:openTable(0,\'News\',\'新闻\',\'jsps/oa/news/News.jsp\',\'ne_id\',null' + ')">发布新闻</a></div>' +
  176. '<div class="div-right"><a href="javascript:openTable(null,\'News\',\'新闻\',\'jsps/common/datalist.jsp\',null,null,null);">更多新闻</a>|</div>',
  177. id: 'bench_news',
  178. iconCls: 'main-notice',
  179. contentEl: 'news',
  180. columnWidth: me.width,
  181. height: me.height
  182. });
  183. },
  184. bench_link: function(){
  185. var me = this.workbench || this;
  186. return Ext.create('Ext.panel.Panel', {
  187. title: '<div class="div-left">常用模块</div>',
  188. id: 'bench_link',
  189. iconCls: 'main-news',
  190. columnWidth: me.width,
  191. height: me.height,
  192. layout: 'anchor',
  193. items: [{
  194. xtype: 'gridpanel',
  195. id: 'link_grid',
  196. cls: 'custom-grid',
  197. columnLines : true,
  198. autoScroll: true,
  199. anchor: '100% 100%',
  200. store: Ext.create('Ext.data.Store', {
  201. fields:['cu_id', 'cu_description', 'cu_url', 'cu_count'],
  202. data: []
  203. }),
  204. bodyStyle: 'background: #f1f1f1;',
  205. columns: [{
  206. text: 'ID',
  207. dataIndex: 'cu_id',
  208. hidden: true
  209. },{
  210. text: '模块名',
  211. dataIndex: 'cu_description',
  212. flex: 1,
  213. renderer: function(val, meta, record){
  214. var ht = "<a href=\"javascript:openTable("
  215. + record.data['cu_id'] + ",null,\'" + val + "\',\'" + record.data['cu_url'].replace(/\'/g, '\\\'') + "\',null,null,null,null,true)\">" + val + "</a>";
  216. return ht;
  217. }
  218. },{
  219. text: '链接',
  220. dataIndex: 'cu_url',
  221. hidden: true
  222. },{
  223. text: '次数',
  224. dataIndex: 'cu_count',
  225. hidden: true
  226. },{
  227. xtype: 'actioncolumn',
  228. text: '操作',
  229. flex: 0.2,
  230. items: [{
  231. icon: basePath + 'resource/images/16/up.png',
  232. tooltip: '上',
  233. handler: function(view, rowIndex, colIndex) {
  234. var rec = view.getStore().getAt(rowIndex);
  235. view.ownerCt.updateBench(rec.get('cu_id'), 1);
  236. }
  237. },{
  238. icon: basePath + 'resource/images/16/down.png',
  239. tooltip: '下',
  240. handler: function(view, rowIndex, colIndex) {
  241. var rec = view.getStore().getAt(rowIndex);
  242. view.ownerCt.updateBench(rec.get('cu_id'), -1);
  243. }
  244. },{
  245. icon: basePath + 'resource/images/16/delete.png',
  246. tooltip: '删除',
  247. handler: function(view, rowIndex, colIndex) {
  248. var rec = view.getStore().getAt(rowIndex);
  249. _delete_bench_link(rec.get('cu_id'));
  250. }
  251. }]
  252. }],
  253. updateBench : function(id, t) {
  254. var g = this;
  255. g.setLoading(true);
  256. Ext.Ajax.request({
  257. url : basePath + 'common/updateCommonUse.action',
  258. params : {
  259. _noc : 1,
  260. id : id,
  261. type : t
  262. },
  263. callback : function(o, s, r) {
  264. g.setLoading(false);
  265. var rs = Ext.decode(r.responseText);
  266. if (rs.commonuse) {
  267. g.store.loadData(rs.commonuse);
  268. }
  269. }
  270. });
  271. }
  272. }]
  273. });
  274. },
  275. bench_note: function(){
  276. var me = this.workbench || this;
  277. return Ext.create('Ext.panel.Panel', {
  278. title: '<div class="div-left">我的知会</div>',
  279. bodyStyle: 'background: #f1f1f1;',
  280. iconCls: 'main-notice',
  281. id: 'bench_note',
  282. contentEl: 'note2',
  283. columnWidth: me.width,
  284. height: me.height
  285. });
  286. },
  287. bench_mytask: function(){
  288. var me = this.workbench || this;
  289. return Ext.create('Ext.panel.Panel', {
  290. title: '<div class="div-left">我的任务</div>',
  291. bodyStyle: 'background: #f1f1f1',
  292. id: 'bench_mytask',
  293. iconCls: 'main-news',
  294. columnWidth: me.width,
  295. height: me.height
  296. });
  297. },
  298. bench_plan: function(){
  299. var me = this.workbench || this;
  300. return Ext.create('Ext.panel.Panel', {
  301. title:'<div class="div-left">工作计划</div>',
  302. bodyStyle: 'background: #f1f1f1',
  303. id: 'bench_plan',
  304. contentEl: 'plan',
  305. iconCls: 'main-news',
  306. autoScroll: true,
  307. columnWidth: me.width,
  308. height: me.height
  309. });
  310. },
  311. bench_email: function(){
  312. var me = this.workbench || this;
  313. return Ext.create('Ext.panel.Panel', {
  314. title: '<div class="div-left">我的邮箱</div>',
  315. bodyStyle: 'background: #f1f1f1',
  316. id: 'bench_email',
  317. iconCls: 'main-news',
  318. columnWidth: me.width,
  319. height: me.height
  320. });
  321. },
  322. bench_knowledge: function(){
  323. var me = this.workbench || this;
  324. return Ext.create('Ext.panel.Panel', {
  325. title: '<div class="div-left">知识地图</div>',
  326. bodyStyle: 'background: #f1f1f1',
  327. id: 'bench_knowledge',
  328. iconCls: 'main-news',
  329. columnWidth: me.width,
  330. height: me.height
  331. });
  332. },
  333. bench_meeting: function(){
  334. var me = this.workbench || this;
  335. return Ext.create('Ext.panel.Panel', {
  336. title: '<div class="div-left">待开会议</div>',
  337. bodyStyle: 'background: #f1f1f1',
  338. id: 'bench_meeting',
  339. iconCls: 'main-news',
  340. columnWidth: me.width,
  341. height: me.height
  342. });
  343. },
  344. /**
  345. * 我发起的流程
  346. */
  347. _bench_flow: function(){
  348. var me = this.workbench || this;
  349. Ext.Ajax.request({
  350. url : basePath + 'common/datalist.action',
  351. params: {
  352. caller: 'JProcess!Me',
  353. condition: 'jp_launcherid=\'' + em_code + '\'',
  354. page: 1,
  355. pageSize: parseInt(height*0.3/12)
  356. },
  357. method : 'post',
  358. callback : function(options,success,response){
  359. var res = new Ext.decode(response.responseText);
  360. if(res.exception || res.exceptionInfo){
  361. var err = res.exceptionInfo;
  362. if(err.indexOf('ERR_POWER') != -1) {
  363. Ext.get("myflow").insertHtml('afterBegin',
  364. '<div style="color:gray;font-size:26px; line-height: 60px;" align="center">(您无权限查看此信息)</div>');
  365. } else {
  366. showError(err);
  367. }
  368. return;
  369. }
  370. var task = res.data != null ? Ext.decode(res.data.replace(/,}/g, '}').replace(/,]/g, ']')) : new Array();
  371. if(task == [] || task.length == 0){
  372. Ext.get("myflow").insertHtml('afterBegin', '<div style="color:gray;font-size:26px; line-height: 60px;" align="center">(暂无任务流程)</div>');
  373. } else {
  374. Ext.create('Ext.grid.Panel', {
  375. autoScroll: true,
  376. store: Ext.create('Ext.data.Store', {
  377. fields:['jp_id', 'jp_form', 'jp_launchTime','enddate', 'jt_duedate','jp_nodeId'],
  378. data: task
  379. }),
  380. height: me.height*0.76,
  381. bodyStyle: 'background: #f1f1f1;border: none;',
  382. columns: [
  383. { header: 'ID', dataIndex: 'jp_id', hidden: true},
  384. { header: '流程单据', dataIndex: 'jp_form', flex: 1.5 , renderer: flowItem},
  385. { header: '限办时间', dataIndex: 'enddate', flex: 1.5, renderer : getDueDate},
  386. { header: 'nodeId', dataIndex: 'jp_nodeId', hidden: true}
  387. ],
  388. renderTo: Ext.get("myflow")
  389. });
  390. }
  391. }
  392. });
  393. },
  394. /**
  395. * 我的超时流程
  396. */
  397. _bench_overflow: function(){
  398. var me = this.workbench || this;
  399. /*Ext.Ajax.request({
  400. url : basePath + 'common/datalist.action',
  401. params: {
  402. caller: 'JProcess!MeOver',
  403. condition: 'jp_nodedealman=\'' + em_code + '\'',
  404. page: 1,
  405. pageSize: parseInt(height*0.3/12)
  406. },
  407. method : 'post',
  408. callback : function(options,success,response){
  409. var res = new Ext.decode(response.responseText);
  410. if(res.exception || res.exceptionInfo){
  411. var err = res.exceptionInfo;
  412. if(err.indexOf('ERR_POWER') != -1) {
  413. Ext.get("myoverflow").insertHtml('afterBegin',
  414. '<div style="color:gray;font-size:26px; line-height: 60px;" align="center">(您无权限查看此信息)</div>');
  415. } else {
  416. showError(err);
  417. }
  418. return;
  419. }
  420. var task = res.data != null ? Ext.decode(res.data.replace(/,}/g, '}').replace(/,]/g, ']')) : new Array();
  421. if(task == [] || task.length == 0){
  422. Ext.get("myoverflow").insertHtml('afterBegin', '<div style="color:gray;font-size:26px; line-height: 60px;" align="center">(暂无超时流程)</div>');
  423. } else {
  424. Ext.create('Ext.grid.Panel', {
  425. autoScroll: true,
  426. store: Ext.create('Ext.data.Store', {
  427. fields:['jp_id', 'jp_form', 'jp_launchTime','enddate', 'jt_duedate','jp_nodeId'],
  428. data: task
  429. }),
  430. height: me.height*0.76,
  431. bodyStyle: 'background: #f1f1f1;border: none;',
  432. columns: [
  433. { header: 'ID', dataIndex: 'jp_id', hidden: true},
  434. { header: '流程单据', dataIndex: 'jp_form', flex: 1.5 , renderer: flowOverItem},
  435. { header: '限办时间', dataIndex: 'enddate', flex: 1.5, renderer : getDueDate},
  436. { header: 'nodeId', dataIndex: 'jp_nodeId', hidden: true}
  437. ],
  438. renderTo: Ext.get("myoverflow")
  439. });
  440. }
  441. }
  442. });*/
  443. },
  444. /**
  445. * 待办事宜
  446. */
  447. _bench_task: function(){
  448. var grid = Ext.getCmp('bench_task').down('gridpanel');
  449. grid.store.removeAll();
  450. if(em_code==null) em_code=getCookie('em_code');
  451. Ext.Ajax.request({
  452. url : basePath + 'common/datalist.action',
  453. params: {
  454. caller: 'JProCand',
  455. condition: 'jp_candidate=\'' + em_code + '\' AND jp_status=\'待审批'+'\' AND jp_flag=1',
  456. page: 1,
  457. pageSize: 20,
  458. _noc:1
  459. },
  460. method : 'post',
  461. callback : function(options,success,response){
  462. var res = new Ext.decode(response.responseText);
  463. if(res.exception || res.exceptionInfo){
  464. var err = res.exceptionInfo;
  465. showError(err);
  466. return;
  467. }
  468. var task = res.data != null ? Ext.decode(res.data.replace(/,}/g, '}').replace(/,]/g, ']')) : new Array();
  469. if(task.length > 0){
  470. var items = new Array();
  471. Ext.Array.each(task,function(item){
  472. item.id=item.jp_nodeId;
  473. item.name=item.jp_name+" "+item.jp_codevalue;
  474. item.note=item.jp_processnote;
  475. item.note=item.jp_processnote;
  476. item.status=item.jp_status;
  477. item.type='可选流程';
  478. item.typecode='procand';
  479. items.push(item);
  480. });
  481. grid.store.add(items);
  482. }
  483. }
  484. });
  485. Ext.Ajax.request({
  486. url : basePath + 'common/datalist.action',
  487. params: {
  488. caller: 'JProcess!Me',
  489. condition: '(jp_nodedealman=\'' + em_code + '\' AND jp_status=\'待审批'+'\') or (jp_launcherid=\'' + em_code + '\' AND jp_status=\'未通过'+'\') ',
  490. page: 1,
  491. pageSize:20,
  492. _noc:1
  493. },
  494. method : 'post',
  495. callback : function(options,success,response){
  496. var res = new Ext.decode(response.responseText);
  497. if(res.exception || res.exceptionInfo){
  498. var err = res.exceptionInfo;
  499. showError(err);
  500. return;
  501. }
  502. var task = res.data != null ? Ext.decode(res.data.replace(/,}/g, '}').replace(/,]/g, ']')) : new Array();
  503. if(task.length > 0){
  504. var items = new Array();
  505. Ext.Array.each(task,function(item){
  506. item.id=item.jp_nodeId;
  507. item.name=item.jp_name+" "+item.jp_codevalue +"("+item.jp_launcherName+")";
  508. item.note=item.jp_processnote;
  509. item.status=item.jp_status;
  510. if(!item.source || item.source==0){
  511. if(item.jp_status=='未通过'){
  512. item.type='未同意流程';
  513. item.typecode='unprocess';
  514. }else{
  515. item.type='待审批流程';
  516. item.typecode='process';
  517. }
  518. }else {
  519. item.type='待办转移流程';
  520. item.typecode='transferprocess';
  521. }
  522. items.push(item);
  523. });
  524. grid.store.add(items);
  525. }
  526. }
  527. });
  528. Ext.Ajax.request({
  529. url : basePath + 'common/datalist.action',
  530. params: {
  531. caller: 'ResourceAssignment',
  532. condition: 'ra_emid=' + em_uu + ' AND ra_taskpercentdone<100',
  533. page: 1,
  534. pageSize: 20,
  535. _noc:1
  536. },
  537. method : 'post',
  538. callback : function(options,success,response){
  539. var res = new Ext.decode(response.responseText);
  540. if(res.exception || res.exceptionInfo){
  541. var err = res.exceptionInfo;
  542. showError(err);
  543. return;
  544. }
  545. var task = res.data != null ? Ext.decode(res.data.replace(/,}/g, '}').replace(/,]/g, ']')) : new Array();
  546. if(task.length > 0){
  547. var items = new Array();
  548. Ext.Array.each(task,function(item){
  549. item.id=item.ra_id;
  550. item.name=item.ra_taskname + (item.sourcecode || '');
  551. item.status=item.ra_status;
  552. item.type='待办任务';
  553. item.typecode=(item.ra_type || 'worktask');
  554. item.sourcelink=item.sourcelink;
  555. item.taskId=item.ra_taskid;
  556. items.push(item);
  557. });
  558. grid.store.add(items);
  559. }
  560. }
  561. });
  562. },
  563. _bench_news: function(){
  564. var me = this.workbench || this;
  565. me.getCmpNews();
  566. },
  567. /**
  568. * 内部新闻
  569. */
  570. getCmpNews: function(){
  571. Ext.Ajax.request({
  572. url : basePath + 'common/datalist.action',
  573. params: {
  574. caller: 'News',
  575. condition: '',
  576. page: 1,
  577. pageSize: parseInt(height*0.25/23),
  578. _noc:1
  579. },
  580. method : 'post',
  581. callback : function(options,success,response){
  582. var res = new Ext.decode(response.responseText);
  583. if(res.exception || res.exceptionInfo){
  584. var err = res.exceptionInfo;
  585. if(err.indexOf('ERR_POWER') != -1) {
  586. Ext.get("news").insertHtml('afterBegin',
  587. '<div style="color:gray;font-size:26px; line-height: 60px;" align="center">(您无权限查看此信息)</div>');
  588. } else {
  589. showError(err);
  590. }
  591. return;
  592. }
  593. var news = res.data != null ? Ext.decode(res.data.replace(/,}/g, '}').replace(/,]/g, ']')) : [];
  594. /*Ext.Array.sort(news, function(a, b){
  595. return b.ne_releasedate > a.ne_releasedate;
  596. });*/
  597. var html = '<ul class="list-default">';
  598. Ext.each(news, function(n){
  599. var bTime = new Date().getTime();
  600. var eTime = Ext.Date.parse(n.ne_releasedate.substring(0, 10) + ' 23:59:59','Y-m-d H:i:s').getTime();
  601. var allHour = (eTime - bTime)/(60*60*1000);
  602. if(allHour<-72){
  603. html += '<li>' + n.ne_releasedate.substring(0, 10) + '&nbsp;<img src="' + basePath +
  604. 'resource/images/mainpage/new.png"/>&nbsp;<a href="javascript:openTable(null,null,\'新闻\',\'oa/news/view.action?ne_id=' + n.ne_id + '\',\'ne_id\',null' + ')">'
  605. + n.ne_theme + '</a></li>';
  606. } else{html += '<li>' + n.ne_releasedate.substring(0, 10) + '&nbsp;<img src="' + basePath +
  607. 'resource/images/mainpage/new.png"/>&nbsp;<a href="javascript:openTable(null,null,\'新闻\',\'oa/news/view.action?ne_id=' + n.ne_id + '\',\'ne_id\',null' + ')">'
  608. + n.ne_theme + '</a><img src="' + basePath +
  609. 'resource/images/newitem.gif" /></li>';}
  610. });
  611. html += '</ul>';
  612. Ext.get("news").insertHtml('afterBegin', html);
  613. }
  614. });
  615. },
  616. _bench_note:function(){
  617. Ext.Ajax.request({
  618. url : basePath + 'common/datalist.action',
  619. params: {
  620. caller: 'NotifyJprocess',
  621. condition: 'prd_recipientid='+em_uu,
  622. page: 1,
  623. pageSize: parseInt(height*0.25/23),
  624. _noc:1
  625. },
  626. method : 'post',
  627. callback : function(options,success,response){
  628. Ext.get('note2').dom.innerHTML='';
  629. var res = new Ext.decode(response.responseText);
  630. if(res.exception || res.exceptionInfo){
  631. var err = res.exceptionInfo;
  632. if(err.indexOf('ERR_POWER') != -1) {
  633. Ext.get("note2").insertHtml('afterBegin',
  634. '<div style="color:gray;font-size:26px; line-height: 60px;" align="center">(您无权限查看此信息)</div>');
  635. } else {
  636. showError(err);
  637. }
  638. return;
  639. }
  640. var notes = res.data!=null?Ext.decode(res.data):[];
  641. var html = '<ul>';
  642. Ext.each(notes, function(n,index){
  643. if(index<3){
  644. html += '<li>' +formatNote(n.PR_CONTEXT)+'<img src="' + basePath + 'resource/images/newitem.gif" /></li>';
  645. } else{html += '<li>' +formatNote(n.PR_CONTEXT)+'</li>';}
  646. });
  647. html += '</ul>';
  648. Ext.get("note2").insertHtml('afterBegin', html);
  649. }
  650. });
  651. },
  652. /**
  653. * 通知公告
  654. */
  655. _bench_notify: function(){
  656. Ext.Ajax.request({
  657. url : basePath + 'common/datalist.action',
  658. params: {
  659. caller: 'Note',
  660. condition: '',
  661. page: 1,
  662. pageSize:10,
  663. _noc:1
  664. },
  665. method : 'post',
  666. callback : function(options,success,response){
  667. var res = new Ext.decode(response.responseText);
  668. if(res.exception || res.exceptionInfo){
  669. var err = res.exceptionInfo;
  670. if(err.indexOf('ERR_POWER') != -1) {
  671. Ext.get("notify").insertHtml('afterBegin',
  672. '<div style="color:gray;font-size:26px; line-height: 60px;" align="center">(您无权限查看此信息)</div>');
  673. } else {
  674. showError(err);
  675. }
  676. return;
  677. }
  678. var notes = res.data != null ? Ext.decode(res.data.replace(/,}/g, '}').replace(/,]/g, ']')) : [];
  679. /*Ext.Array.sort(notes, function(a, b){
  680. return b.no_apptime > a.no_apptime;
  681. });*/
  682. var height=Ext.getCmp('bench_notify').height;
  683. var html = '<div id="notifydata" style="font-size:12px;height:'+(height-45)+'px;overflow:hidden;"><ul class="list-default">';
  684. var count=0;
  685. Ext.each(notes, function(n){
  686. if(n.CURRENTMASTER&&n.CURRENTMASTER!='DataCenter'){
  687. html += '<li style="height:24px;line-height:24px;">&nbsp;<img src="' + basePath +
  688. 'resource/images/mainpage/blogs.png"/>&nbsp;<a href="javascript:openTable('
  689. + n.no_id + ',\'Note\',\'通知\',\'jsps/oa/info/NoteR.jsp\',\'no_id\',null,null,' +'\''+n.CURRENTMASTER+'\''+ ')">'
  690. + Ext.String.charEllipsis(n.CURRENTMASTER+"-"+n.no_title, 80) + '</a>';
  691. }else html += '<li style="height:24px;line-height:24px;">&nbsp;<img src="' + basePath +
  692. 'resource/images/mainpage/blogs.png"/>&nbsp;<a href="javascript:openTable('
  693. + n.no_id + ',\'Note\',\'通知\',\'jsps/oa/info/NoteR.jsp\',\'no_id\',null'+ ')">'
  694. + Ext.String.charEllipsis(n.no_title, 50) + '</a>';
  695. if(count<4){
  696. html +='&nbsp;<img src="' + basePath + 'resource/images/mainpage/new.png"/></li>';
  697. }else html +='</li>';
  698. count++;
  699. });
  700. if(notes.length == 0){
  701. html = '<ul style="text-align:center;padding-top: 30px;color:#888">没有记录';
  702. }
  703. html += '</ul></div>';
  704. Ext.get("notify").insertHtml('afterBegin', html);
  705. /*var $=function $(element){
  706. if(arguments.length>1){
  707. for(var i=0,length=arguments.length,elements=[];i<length;i++){
  708. elements.push($(arguments[i]));
  709. }
  710. return elements;
  711. }
  712. if(typeof element=="string"){
  713. return document.getElementById(element);
  714. }else{
  715. return element;
  716. }
  717. };
  718. var Class={
  719. create:function(){
  720. return function(){
  721. this.initialize.apply(this,arguments);
  722. };
  723. }
  724. };
  725. Function.prototype.bind=function(object){
  726. var method=this;
  727. return function(){
  728. method.apply(object,arguments);
  729. };
  730. };
  731. var Scroll=Class.create();
  732. Scroll.prototype={
  733. initialize:function(element,height){
  734. this.element=$(element);
  735. this.element.innerHTML+=this.element.innerHTML;
  736. this.height=height;
  737. this.maxHeight=this.element.scrollHeight/2;
  738. this.counter=0;
  739. this.scroll();
  740. this.timer="";
  741. this.element.onmouseover=this.stop.bind(this);
  742. this.element.onmouseout=function(){this.timer=setTimeout(this.scroll.bind(this),1000);}.bind(this);
  743. },
  744. scroll:function(){
  745. if(this.element.scrollTop<this.maxHeight){
  746. this.element.scrollTop++;
  747. this.counter++;
  748. }else{
  749. this.element.scrollTop=0;
  750. this.counter=0;
  751. }
  752. if(this.counter<this.height){
  753. this.timer=setTimeout(this.scroll.bind(this),20);
  754. }else{
  755. this.counter=0;
  756. this.timer=setTimeout(this.scroll.bind(this),3000);
  757. }
  758. },
  759. stop:function(){
  760. clearTimeout(this.timer);
  761. }
  762. };
  763. if(count*24>(height-45)) {setTimeout(function scroll(){
  764. new Scroll("notifydata",24);
  765. },8000);
  766. }*/
  767. }
  768. });
  769. },
  770. /**
  771. * 常用模块
  772. */
  773. _bench_link: function(){
  774. var me = this.workbench || this;
  775. Ext.Ajax.request({
  776. url : basePath + 'common/getCommonUse.action',
  777. method : 'get',
  778. callback : function(options,success,response){
  779. var res = new Ext.decode(response.responseText);
  780. if(res.exception || res.exceptionInfo){
  781. showError(res.exceptionInfo);
  782. return;
  783. }
  784. window._delete_bench_link = me._delete_bench_link;
  785. Ext.getCmp('bench_link').down('gridpanel').store.loadData(res.commonuse);
  786. }
  787. });
  788. },
  789. /**
  790. * 设置常用模块
  791. */
  792. _set_bench_link: function(snid){
  793. Ext.Ajax.request({
  794. url : basePath + 'common/setCommonUse.action',
  795. params: {
  796. snid: snid
  797. },
  798. method : 'post',
  799. callback : function(options,success,response){
  800. var res = new Ext.decode(response.responseText);
  801. if(res.exception || res.exceptionInfo){
  802. showError(res.exceptionInfo);
  803. return;
  804. }
  805. if(Ext.isIE) {
  806. setTimeout(function(){
  807. Ext.getCmp('link_grid').store.loadData(res.commonuse);
  808. }, 8000);
  809. } else {
  810. Ext.getCmp('link_grid').store.loadData(res.commonuse);
  811. }
  812. }
  813. });
  814. },
  815. _delete_bench_link: function(id){
  816. Ext.Ajax.request({
  817. url : basePath + 'common/deleteCommonUse.action',
  818. params: {
  819. id: id
  820. },
  821. method : 'post',
  822. callback : function(options,success,response){
  823. var res = new Ext.decode(response.responseText);
  824. if(res.exception || res.exceptionInfo){
  825. showError(res.exceptionInfo);
  826. return;
  827. }
  828. var grid = Ext.getCmp('link_grid');
  829. Ext.each(grid.store.data.items, function(item){
  830. if(item.data['cu_id'] == id){
  831. grid.store.remove(item);
  832. }
  833. });
  834. }
  835. });
  836. },
  837. /**
  838. * 查看我的考勤
  839. */
  840. _bench_schedule: function(){
  841. Ext.Ajax.request({
  842. url : basePath + 'oa/getMySign.action',
  843. async: false,
  844. method : 'post',
  845. callback : function(options,success,response){
  846. var res = new Ext.decode(response.responseText);
  847. if(res.exception || res.exceptionInfo){
  848. showError(res.exceptionInfo);
  849. return;
  850. }
  851. if(res.sign != null){
  852. Ext.getCmp('signin').signin = true;
  853. var d = new Date(res.sign.si_in);
  854. Ext.getCmp('signin').intime = res.sign.si_in;
  855. var sin = Ext.Date.parse(Ext.Date.toString(new Date()) + ' 09:00:00', 'Y-m-d H:i:s').getTime();
  856. if(d > sin){
  857. Ext.getCmp('signin').tooltip = "签到时间:<font color=red>" + Ext.Date.format(d, 'H:i:s') +
  858. "&nbsp;&nbsp;迟到" + Math.floor((d - sin)/(60*60*1000)) + "小时" + Math.floor(((d - sin)%(60*60*1000))/(60*1000)) + "分钟" + "</font>";
  859. } else {
  860. Ext.getCmp('signin').tooltip = "签到时间:" + Ext.Date.format(d, 'H:i:s');
  861. Ext.getCmp('signin').setIconCls('x-button-icon-working');
  862. }
  863. if(res.sign.si_out) {
  864. d = new Date(res.sign.si_out);
  865. sin = Ext.Date.parse(Ext.Date.toString(new Date()) + ' 18:00:00', 'Y-m-d H:i:s').getTime();
  866. Ext.getCmp('signout').signout = true;
  867. if(d < sin) {
  868. Ext.getCmp('signout').setText("签退时间:<font color=red>" + Ext.Date.format(d, 'H:i:s') +
  869. "&nbsp;&nbsp;早退" + Math.floor((sin - d)/(60*60*1000)) + "小时" + Math.floor(((sin - d)%(60*60*1000))/(60*1000)) + "分钟" + "</font>");
  870. } else {
  871. Ext.getCmp('signout').setText("签退时间:" + Ext.Date.format(d, 'H:i:s'));
  872. }
  873. }
  874. Ext.getCmp('signout').show();
  875. }
  876. }
  877. });
  878. showClock();
  879. },
  880. refreshTask:refreshTask
  881. };
  882. /**
  883. * 刷新待办事宜
  884. * */
  885. function refreshTask(onlyProcess){
  886. var grid = Ext.getCmp('bench_task').down('gridpanel');
  887. grid.store.removeAll();
  888. Ext.Ajax.request({
  889. url : basePath + 'common/datalist.action',
  890. params: {
  891. caller: 'JProCand',
  892. condition: 'jp_candidate=\'' + em_code + '\' AND jp_status=\'待审批'+'\' AND jp_flag=1',
  893. page: 1,
  894. pageSize: 20,
  895. _noc:1
  896. },
  897. method : 'post',
  898. callback : function(options,success,response){
  899. var res = new Ext.decode(response.responseText);
  900. if(res.exception || res.exceptionInfo){
  901. var err = res.exceptionInfo;
  902. showError(err);
  903. return;
  904. }
  905. var task = res.data != null ? Ext.decode(res.data.replace(/,}/g, '}').replace(/,]/g, ']')) : new Array();
  906. if(task.length > 0){
  907. var items = new Array();
  908. Ext.Array.each(task,function(item){
  909. item.id=item.jp_nodeId;
  910. item.name=item.jp_name+" "+item.jp_codevalue;
  911. item.note=item.jp_processnote;
  912. item.status=item.jp_status;
  913. item.type='可选流程';
  914. item.typecode='procand';
  915. items.push(item);
  916. });
  917. grid.store.add(items);
  918. }
  919. }
  920. });
  921. Ext.Ajax.request({
  922. url : basePath + 'common/datalist.action',
  923. params: {
  924. caller: 'JProcess!Me',
  925. condition: '(jp_nodedealman=\'' + em_code + '\' AND jp_status=\'待审批'+'\') or (jp_launcherid=\'' + em_code + '\' AND jp_status=\'未通过'+'\') ',
  926. page: 1,
  927. pageSize:20,
  928. _noc:1
  929. },
  930. method : 'post',
  931. callback : function(options,success,response){
  932. var res = new Ext.decode(response.responseText);
  933. if(res.exception || res.exceptionInfo){
  934. var err = res.exceptionInfo;
  935. showError(err);
  936. return;
  937. }
  938. var task = res.data != null ? Ext.decode(res.data.replace(/,}/g, '}').replace(/,]/g, ']')) : new Array();
  939. if(task.length > 0){
  940. var items = new Array();
  941. Ext.Array.each(task,function(item){
  942. item.id=item.jp_nodeId;
  943. item.name=item.jp_name+" "+item.jp_codevalue +"("+item.jp_launcherName+")";
  944. item.note=item.jp_processnote;
  945. item.status=item.jp_status;
  946. if(!item.source || item.source==0){
  947. if(item.jp_status=='未通过'){
  948. item.type='未同意流程';
  949. item.typecode='unprocess';
  950. }else{
  951. item.type='待审批流程';
  952. item.typecode='process';
  953. }
  954. }else {
  955. item.type='待办转移流程';
  956. item.typecode='transferprocess';
  957. }
  958. items.push(item);
  959. });
  960. grid.store.add(items);
  961. }
  962. }
  963. });
  964. if(!onlyProcess){
  965. Ext.Ajax.request({
  966. url : basePath + 'common/datalist.action',
  967. params: {
  968. caller: 'ResourceAssignment',
  969. condition: 'ra_emid=' + em_uu + ' AND ra_taskpercentdone<100',
  970. page: 1,
  971. pageSize: 20,
  972. _noc:1
  973. },
  974. method : 'post',
  975. callback : function(options,success,response){
  976. var res = new Ext.decode(response.responseText);
  977. if(res.exception || res.exceptionInfo){
  978. var err = res.exceptionInfo;
  979. showError(err);
  980. return;
  981. }
  982. var task = res.data != null ? Ext.decode(res.data.replace(/,}/g, '}').replace(/,]/g, ']')) : new Array();
  983. if(task.length > 0){
  984. var items = new Array();
  985. Ext.Array.each(task,function(item){
  986. item.id=item.ra_id;
  987. item.name=item.ra_taskname + (item.sourcecode || '');
  988. item.status=item.ra_status;
  989. item.type='待办任务';
  990. item.typecode=(item.ra_type || 'worktask');
  991. item.sourcelink=item.sourcelink;
  992. item.taskId=item.ra_taskid;
  993. items.push(item);
  994. });
  995. grid.store.add(items);
  996. }
  997. }
  998. });
  999. }
  1000. getNotifyCount();
  1001. }
  1002. function getNotifyCount(){
  1003. var count=0;
  1004. Ext.Ajax.request({
  1005. url : basePath + 'common/getCountByTable.action',
  1006. params: {
  1007. tablename: 'pagingrelease left join pagingreleasedetail on pr_id=prd_prid',
  1008. condition: "prd_recipientid=" + em_uu+" and prd_readstatus=0 and nvl(pr_from,' ')='jprocess'",
  1009. _noc:1
  1010. },
  1011. method : 'post',
  1012. async:false,
  1013. callback : function(options,success,response){
  1014. var res = new Ext.decode(response.responseText);
  1015. if(res.exception || res.exceptionInfo){
  1016. var err = res.exceptionInfo;
  1017. showError(err);
  1018. return;
  1019. }
  1020. count=res.count;
  1021. }
  1022. });
  1023. var countinfo=document.getElementById('messagecount');
  1024. if(countinfo){
  1025. countinfo.innerHTML='知会('+count+")";
  1026. }
  1027. return count;
  1028. }
  1029. /**
  1030. * 打开一个tab
  1031. * @param id 当前record的ID
  1032. * @param caller
  1033. * @param title 标题
  1034. * @param link 链接
  1035. * @param key 主表ID字段
  1036. * @param detailKey 从表关联主表ID的字段
  1037. * @param condition 附加条件
  1038. */
  1039. function openTable(id, caller, title, link, key, detailKey, condition,relateMaster,limit){
  1040. var main = parent.Ext.getCmp("content-panel");
  1041. var item=main.items.items[0];
  1042. item.firstGrid=Ext.getCmp('task_grid');
  1043. var panel = Ext.getCmp('' + id);
  1044. var url = parseUrl(link);
  1045. if(caller){
  1046. panel = Ext.getCmp(caller);
  1047. url = link + '?whoami=' + caller;
  1048. }
  1049. if(id){
  1050. if(caller){
  1051. panel = Ext.getCmp(caller + id);
  1052. url = link + '?whoami=' + caller + '&formCondition=' + key + '=' + id + '&gridCondition=' + detailKey + '=' + id;
  1053. }
  1054. } else {
  1055. if(condition != null){
  1056. url += '&urlcondition=' + parseUrl(condition);
  1057. }
  1058. }
  1059. if(!limit){
  1060. if(url.indexOf('?') > 0)
  1061. url += '&_noc=1';
  1062. else
  1063. url += '?_noc=1';
  1064. }
  1065. if(relateMaster){
  1066. url+='&newMaster='+relateMaster;
  1067. }
  1068. if( relateMaster ){
  1069. var currentMaster = parent.window.sob;
  1070. if ( currentMaster && currentMaster != relateMaster) {// 与当前账套不一致
  1071. if (parent.Ext) {
  1072. Ext.Ajax.request({
  1073. url: basePath + 'common/changeMaster.action',
  1074. params: {
  1075. to: relateMaster
  1076. },
  1077. callback: function(opt, s, r) {
  1078. if (s) {
  1079. var win = parent.Ext.create('Ext.Window', {
  1080. width: '100%',
  1081. height: '100%',
  1082. draggable: false,
  1083. closable: false,
  1084. modal: true,
  1085. title: '创建到账套' + relateMaster + '的临时会话',
  1086. id:'modalwindow',
  1087. historyMaster:currentMaster,
  1088. html : '<iframe src="' + url + '" height="100%" width="100%" frameborder="0" style="border-width: 0px;padding: 0px;" scrolling="auto"></iframe>',
  1089. buttonAlign: 'center',
  1090. buttons: [{
  1091. text: $I18N.common.button.erpCloseButton,
  1092. cls: 'x-btn-blue',
  1093. id: 'close',
  1094. handler: function(b) {
  1095. Ext.Ajax.request({
  1096. url: basePath + 'common/changeMaster.action',
  1097. params: {
  1098. to: currentMaster
  1099. },
  1100. callback: function(opt, s, r) {
  1101. if (s) {
  1102. b.up('window').close();
  1103. } else {
  1104. alert('切换到原账套失败!');
  1105. }
  1106. }
  1107. });
  1108. }
  1109. }]
  1110. });
  1111. win.show();
  1112. } else {
  1113. alert('无法创建到账套' + relateMaster + '的临时会话!');
  1114. }
  1115. }
  1116. });
  1117. }
  1118. return;
  1119. }
  1120. }
  1121. if(!panel){
  1122. panel = {
  1123. title : title.substring(0, title.toString().length > 5 ? 5 : title.toString().length),
  1124. tag : 'iframe',
  1125. tabConfig:{tooltip: title},
  1126. border : false,
  1127. layout : 'fit',
  1128. iconCls : 'x-tree-icon-tab-tab',
  1129. html : '<iframe id="iframe" src="' + basePath + url + '" height="100%" width="100%" frameborder="0" scrolling="auto"></iframe>',
  1130. closable : true,
  1131. listeners : {
  1132. close : function(){
  1133. main.setActiveTab(main.getActiveTab().id);
  1134. }
  1135. }
  1136. };
  1137. openTab(panel, panel.id);
  1138. }else{
  1139. main.setActiveTab(panel);
  1140. }
  1141. }
  1142. function parseUrl(url) {
  1143. var id = url.substring(url.lastIndexOf('?')+1);
  1144. if (id == null) {
  1145. id = url.substring(0,url.lastIndexOf('.'));
  1146. }
  1147. if(contains(url, 'session:em_uu', true)){
  1148. url = url.replace(/session:em_uu/,em_uu);
  1149. }
  1150. if(contains(url, 'session:em_code', true)){
  1151. url = url.replace(/session:em_code/, "'" + em_code + "'");
  1152. }
  1153. if(contains(url, 'sysdate', true)){
  1154. url = url.replace(/sysdate/, "to_date('" + Ext.Date.toString(new Date()) + "','yyyy-mm-dd')");
  1155. }
  1156. if(contains(url, 'session:em_name', true)){
  1157. url = url.replace(/session:em_name/,"'"+em_name+"'" );
  1158. }
  1159. return url;
  1160. }
  1161. function openTab(panel, id){
  1162. var o = (typeof panel == "string" ? panel : id || panel.id);
  1163. var main = parent.Ext.getCmp("content-panel");
  1164. var tab = main.getComponent(o);
  1165. if (tab) {
  1166. main.setActiveTab(tab);
  1167. } else if(typeof panel!="string"){
  1168. panel.id = o;
  1169. var p = main.add(panel);
  1170. main.setActiveTab(p);
  1171. }
  1172. }
  1173. function taskItem(val, meta, record){
  1174. var rendermsg='';
  1175. if(record.data.CURRENTMASTER){
  1176. if(record.data.typecode=='worktask' || record.data.typecode=='projecttask'){
  1177. rendermsg='<a href="javascript:openTable(' + record.data['id'] + ',\'ResourceAssignment\',\'任务\',\'jsps/plm/record/workrecord.jsp\',\'ra_id\',\'wr_raid\',null,' +'\''+record.data.CURRENTMASTER+'\''+ ');">' + val + '</a>';
  1178. } else if(record.data.typecode=='billtask' || record.data.typecode=='mrptask'){
  1179. rendermsg='<a href="javascript:openTable(' + record.data['id'] + ',\'ResourceAssignment!Bill\',\'任务\',\'jsps/plm/record/billrecord.jsp\',\'ra_id\',null,null,\''+record.data.CURRENTMASTER+'\');">' + val + '</a>';
  1180. } else if(record.data.typecode=='kbitask' || record.data.typecode=='mrptask'){
  1181. rendermsg='<a href="javascript:openUrl(' +'\''+record.data['sourcelink'] + '\',\''+record.data.CURRENTMASTER+'\');">' + val + '</a>';
  1182. }else if(record.data.typecode=='process'||record.data.typecode=='unprocess' || record.data.typecode=='transferprocess') return '<a href="javascript:openTable(' + record.data['id'] + ',\'JProcess!Me\',\'任务流程\',\'jsps/common/jprocessDeal.jsp\',\'jp_nodeId\',null,null,' +'\''+record.data.CURRENTMASTER+'\'' +');">' + val + '</a>';
  1183. else rendermsg='<a href="javascript:openTable(' + record.data['id'] + ',\'JProCand\',\'任务流程\',\'jsps/common/jtaketask.jsp\',\'jp_nodeId\',jp_flag=1,null,' +'\''+record.data.CURRENTMASTER+'\''+');">' + val + '</a>';
  1184. } else {
  1185. if(record.data.typecode=='worktask' || record.data.typecode=='projecttask'){
  1186. rendermsg='<a href="javascript:openTable(' + record.data['id'] + ',\'ResourceAssignment\',\'任务\',\'jsps/plm/record/workrecord.jsp\',\'ra_id\',\'wr_raid\'' + ');">' + val + '</a>';
  1187. } else if(record.data.typecode=='billtask' || record.data.typecode=='mrptask'){
  1188. rendermsg='<a href="javascript:openTable(' + record.data['id'] + ',\'ResourceAssignment!Bill\',\'任务\',\'jsps/plm/record/billrecord.jsp\',\'ra_id\',null);">' + val + '</a>';
  1189. } else if(record.data.typecode=='communicatetask'){
  1190. rendermsg='<a href="javascript:openTable(' + record.data['taskId'] + ',\'ResourceAssignment!Bill\',\'沟通任务\',\'jsps/common/JprocessCommunicate.jsp\',\'id\',null);">' + val + '</a>';
  1191. } else if(record.data.typecode=='kbitask' ){
  1192. rendermsg='<a href="javascript:openUrl(' +'\''+record.data['sourcelink'] + '\',\''+record.data.CURRENTMASTER+'\');">' + val + '</a>';
  1193. }else if(record.data.typecode=='process'||record.data.typecode=='unprocess' || record.data.typecode=='transferprocess') {
  1194. rendermsg='<a href="javascript:openTable(' + record.data['id'] + ',\'JProcess!Me\',\'任务流程\',\'jsps/common/jprocessDeal.jsp\',\'jp_nodeId\',null' + ');" target="_blank">' + val + '</a>';
  1195. if(record.data.note && record.data.note!=null && record.data.note !='null' ){
  1196. rendermsg+='</br><font color="#669933" >'+record.data.note+'</font>';
  1197. }
  1198. }
  1199. else rendermsg='<a href="javascript:openTable(' + record.data['id'] + ',\'JProCand\',\'任务流程\',\'jsps/common/jtaketask.jsp\',\'jp_nodeId\',jp_flag=1' + ');">' + val + '</a>';
  1200. }
  1201. if(record.data.RN && record.data.RN==1){
  1202. return rendermsg+'&nbsp;<img src="' + basePath + 'resource/images/mainpage/new.png"/>';
  1203. }else return rendermsg;
  1204. }
  1205. function showMaster(val,meta,record){
  1206. if(record.data.CURRENTMASTER){
  1207. return val+'-<span style="color:red;">' + record.data.CURRENTMASTER + '</span>';
  1208. }else return val;
  1209. }
  1210. function flowItem(val, meta, record){
  1211. return '<a href="javascript:openTable(' + record.data['jp_nodeId'] + ',\'JProcess!Me\',\'任务流程\',\'jsps/common/jprocessDeal.jsp\',\'jp_nodeId\',null' + ');">' + val + '</a>';
  1212. }
  1213. function flowOverItem(val, meta, record){
  1214. return '<a href="javascript:openTable(' + record.data['jp_nodeId'] + ',\'JProcess!MeOver\',\'任务流程\',\'jsps/common/jprocessDeal.jsp\',\'jp_nodeId\',null' + ');">' + val + '</a>';
  1215. }
  1216. function getSurPlus(val, meta, record){
  1217. if(Ext.isEmpty(val))
  1218. return '--';
  1219. if(record.data.ra_taskpercentdone == 100){
  1220. return '<img src="' + basePath + 'resource/images/renderer/award2.png">' + '<span style="color:green;padding-left:2px">已完成</span>';
  1221. } else {
  1222. var bTime = new Date().getTime();
  1223. var eTime = Ext.Date.parse(record.data['ra_enddate'].substring(0, 10) + ' 23:59:59','Y-m-d H:i:s').getTime();
  1224. var allHour = (eTime - bTime)/(60*60*1000);
  1225. if(allHour < 0){
  1226. if(allHour < -24){
  1227. val = "<font color =red>过期" + Math.floor(Math.abs(allHour)/24) + "天" + Math.floor(Math.abs(allHour)%24) + "小时";
  1228. } else {
  1229. val = "<font color =red>过期" + Math.floor(Math.abs(allHour)) + "小时";
  1230. }
  1231. } else {
  1232. val = "<font color =blue>剩余" + Math.floor(allHour/24) + "天" + Math.floor(allHour%24) + "小时";
  1233. }
  1234. return val;
  1235. }
  1236. }
  1237. function percentdone(val, meta, record){
  1238. val == null || 0;
  1239. if(val < 30)
  1240. return '<img src="' + basePath + 'resource/images/renderer/remind2.png">'+'<span style="color:#436EEE;padding-left:2px">' + val + '</span>';
  1241. else if(val > 30 && val < 50)
  1242. return '<img src="' + basePath + 'resource/images/renderer/remind.png">'+'<span style="color:#5F9EA0;padding-left:2px">' + val + '</span>';
  1243. else if(val == 100){
  1244. return '<img src="' + basePath + 'resource/images/renderer/award1.png">'+'<span style="color:blue;padding-left:2px">' + val + '</span>';
  1245. }else if(val > 80){
  1246. return '<img src="' + basePath + 'resource/images/renderer/award2.png">'+'<span style="color:green;padding-left:2px">' + val + '</span>';
  1247. }
  1248. else
  1249. return val;
  1250. }
  1251. function showClock(){
  1252. var now = new Date();
  1253. var html = '';
  1254. var hours = now.getHours();
  1255. var minutes = now.getMinutes();
  1256. var seconds = now.getSeconds();
  1257. if(hours < 9 && Ext.getCmp('signin').signin == false){
  1258. Ext.getCmp('signin').setText("签到&nbsp;&nbsp;剩余" + (8 - hours) + "小时" + (60 - minutes) + "分钟" + (60 - seconds) + "秒");
  1259. } else {
  1260. if (Ext.getCmp('signin').signin == true) {
  1261. var intime = Number(Ext.getCmp('signin').intime);
  1262. if(intime && intime > 0) {
  1263. var time = now.getTime();
  1264. var h = Math.floor((time - intime)/(60*60*1000));
  1265. var m = Math.floor(((time - intime)%(60*60*1000))/(60*1000));
  1266. var s = Math.floor(((time - intime)%(60*1000))/(1000));
  1267. Ext.getCmp('signin').setText(Ext.getCmp('signin').tooltip + "<br/>&nbsp;<font color=blue>已工作" + (h) + "小时" + (m) + "分钟" + (s) + "秒</font>");
  1268. } else {
  1269. Ext.getCmp('signin').setText(Ext.getCmp('signin').tooltip);
  1270. }
  1271. if(Ext.getCmp('signout').signout == false) {
  1272. if(hours < 18){
  1273. Ext.getCmp('signout').setText("签退<br/>&nbsp;<font color=blue>距离下班" + (18 - hours) + "小时" + (60 - minutes) + "分钟" + (60 - seconds) + "秒</font>");
  1274. } else {
  1275. Ext.getCmp('signout').setText("签退<br/>&nbsp;<font color=blue>下班时间已到</font>");
  1276. }
  1277. }
  1278. } else {//还没签到
  1279. Ext.getCmp('signin').setText("签到&nbsp;&nbsp;<font color=red>迟到" + (hours - 9) + "小时" + (minutes) + "分钟" + (seconds) + "秒</font>");
  1280. }
  1281. }
  1282. if(hours <= 9){
  1283. hours = '0' + hours;
  1284. }
  1285. if(minutes <= 9){
  1286. minutes = '0' + minutes;
  1287. }
  1288. if(seconds < 10){
  1289. seconds = '0' + seconds;
  1290. }
  1291. var array = Ext.Array.toArray('' + hours + '-' + minutes + '-' + seconds);
  1292. Ext.each(array, function(n){
  1293. if (n == '-') {
  1294. html += '<a class="number" style="background-position: -' + 24*10 + 'px -0px"></a>';
  1295. } else {
  1296. html += '<a class="number" style="background-position: -' + 24*n + 'px -0px"></a>';
  1297. }
  1298. });
  1299. Ext.getCmp('clock').setText(html);
  1300. setTimeout("showClock();", 1000);
  1301. }
  1302. function signin(){
  1303. var hours = new Date().getHours();
  1304. if(hours >= 9){
  1305. Ext.MessageBox.prompt("原因", "请如实填写迟到原因", function (btn, text) {
  1306. if(btn == 'ok'){
  1307. _signin(text);
  1308. }
  1309. }, this, true, '睡觉睡过头了!');
  1310. } else {
  1311. _signin(null);
  1312. }
  1313. }
  1314. function _signin(reason){
  1315. Ext.Ajax.request({
  1316. url : basePath + 'oa/signin.action',
  1317. method : 'post',
  1318. async: false,
  1319. params: {
  1320. reason: reason
  1321. },
  1322. callback : function(options,success,response){
  1323. var res = new Ext.decode(response.responseText);
  1324. if(res.exception || res.exceptionInfo){
  1325. showError(res.exceptionInfo);
  1326. return;
  1327. }
  1328. if(res.success){
  1329. Ext.getCmp('signin').signin = true;
  1330. Ext.getCmp('signout').show();
  1331. var d = new Date();
  1332. Ext.getCmp('signin').intime = new Date().getTime();
  1333. var sin = Ext.Date.parse(Ext.Date.toString(new Date()) + ' 09:00:00', 'Y-m-d H:i:s').getTime();
  1334. if(d > sin) {
  1335. Ext.getCmp('signin').setText("签到时间:<font color=red>" + Ext.Date.format(d, 'H:i:s') +
  1336. "&nbsp;&nbsp;迟到" + Math.floor((d - sin)/(60*60*1000)) + "小时" + Math.floor(((d - sin)%(60*60*1000))/(60*1000)) + "分钟" + "</font>");
  1337. Ext.getCmp('signin').tooltip = "签到时间:<font color=red>" + Ext.Date.format(d, 'H:i:s') +
  1338. "&nbsp;&nbsp;迟到" + Math.floor((d - sin)/(60*60*1000)) + "小时" + Math.floor(((d - sin)%(60*60*1000))/(60*1000)) + "分钟" + "</font>";
  1339. } else {
  1340. Ext.getCmp('signin').setText("签到时间:" + Ext.Date.format(d, 'H:i:s'));
  1341. Ext.getCmp('signin').tooltip = "签到时间:" + Ext.Date.format(d, 'H:i:s');
  1342. }
  1343. Ext.getCmp('signin').setIconCls('x-button-icon-working');
  1344. alert("签到时间:" + Ext.Date.format(d, 'Y-m-d H:i:s'));
  1345. }
  1346. }
  1347. });
  1348. }
  1349. function signout(){
  1350. var sout = Ext.Date.parse(Ext.Date.toString(new Date()) + ' 18:00:00', 'Y-m-d H:i:s');
  1351. if(sout > new Date()){
  1352. Ext.MessageBox.prompt("原因", "请如实填写早退原因", function (btn, text) {
  1353. if(btn == 'ok'){
  1354. _signout(text);
  1355. }
  1356. }, this, true, '太累了!');
  1357. } else {
  1358. _signout(null);
  1359. }
  1360. }
  1361. function _signout(reason) {
  1362. Ext.Ajax.request({
  1363. url : basePath + 'oa/signout.action',
  1364. method : 'post',
  1365. params: {
  1366. reason: reason
  1367. },
  1368. callback : function(options,success,response){
  1369. var res = new Ext.decode(response.responseText);
  1370. if(res.exception || res.exceptionInfo){
  1371. showError(res.exceptionInfo);
  1372. return;
  1373. }
  1374. if(res.success){
  1375. Ext.getCmp('signout').signout = true;
  1376. var d = new Date();
  1377. var sin = Ext.Date.parse(Ext.Date.toString(new Date()) + ' 18:00:00', 'Y-m-d H:i:s').getTime();
  1378. if(d < sin) {
  1379. Ext.getCmp('signout').setText("签退时间:<font color=red>" + Ext.Date.format(d, 'Y-m-d H:i:s') +
  1380. "&nbsp;&nbsp;早退" + Math.floor((sin - d)/(60*60*1000)) + "小时" + Math.floor(((sin - d)%(60*60*1000))/(60*1000)) + "分钟" + "</font>");
  1381. } else {
  1382. Ext.getCmp('signout').setText("签退时间:" + Ext.Date.format(d, 'Y-m-d H:i:s'));
  1383. }
  1384. alert("签退时间:" + Ext.Date.format(d, 'Y-m-d H:i:s'));
  1385. }
  1386. }
  1387. });
  1388. }
  1389. function getMyBench(){
  1390. Ext.Ajax.request({
  1391. url : basePath + 'common/getWorkBench.action',
  1392. method : 'get',
  1393. callback : function(options,success,response){
  1394. var res = new Ext.decode(response.responseText);
  1395. if(res.exceptionInfo) {
  1396. showError(res.exceptionInfo);
  1397. } else {
  1398. var bench = res.benchs;
  1399. if(bench.length == 0){
  1400. bench = getDefaultBench();
  1401. }
  1402. var e = Ext.getCmp('bench').getEl().dom,
  1403. h = parseInt(Number(e.style.height.replace('px', ''))/3) - 1;
  1404. Ext.each(bench, function(b){
  1405. workbench.setWidth(b.wb_width);
  1406. if(b.wb_height > 0.6) {
  1407. workbench.setHeight(h*2);
  1408. } else {
  1409. workbench.setHeight(h);
  1410. }
  1411. var panel = workbench[b.wb_name].apply();
  1412. Ext.getCmp('bench').add(panel);
  1413. });
  1414. Ext.each(bench, function(b){
  1415. if(workbench["_" + b.wb_name]){
  1416. workbench["_" + b.wb_name].apply();
  1417. }
  1418. });
  1419. }
  1420. }
  1421. });
  1422. }
  1423. function getDefaultBench(){
  1424. return [{
  1425. wb_name: 'bench_task',
  1426. wb_width: 2/3,
  1427. wb_height: 2/3
  1428. },{
  1429. wb_name: 'bench_link',
  1430. wb_width: 1/3,
  1431. wb_height: 2/3
  1432. },{
  1433. wb_name: 'bench_notify',
  1434. wb_width: 1/3,
  1435. wb_height: 1/3
  1436. },{
  1437. wb_name: 'bench_news',
  1438. wb_width: 1/3,
  1439. wb_height: 1/3
  1440. },{
  1441. wb_name:'bench_subscription',
  1442. wb_width: 1/3,
  1443. wb_height: 1/3
  1444. }];
  1445. }
  1446. function getDueDate(val, meta, record){
  1447. var endDate = '';
  1448. if(record.data['jt_duedate'] == 0){
  1449. return "无限时";
  1450. } else{
  1451. endDate = Ext.Date.format(new Date(Ext.Date.parse(record.data['jp_launchTime'], 'Y-m-d H:i:s')
  1452. .getTime() + record.data['jt_duedate']*3600), 'Y-m-d H:i:s');
  1453. }
  1454. return endDate;
  1455. }
  1456. function formatNote(context){
  1457. context=context.replace(/<\s*\/?br>/g, " ");
  1458. context=context.replace('你有新流程需处理!'," ");
  1459. context=context.replace(/&nbsp;&nbsp;&nbsp;&nbsp;/g," ");
  1460. return context;
  1461. }
  1462. function getDefaultShort(){
  1463. return [{
  1464. sc_name: 'short_setting'
  1465. },{
  1466. sc_name: 'short_news'
  1467. },{
  1468. sc_name: 'short_address'
  1469. },{
  1470. sc_name: 'short_calendar'
  1471. },{
  1472. sc_name: 'short_email'
  1473. },{
  1474. sc_name: 'short_bbs'
  1475. }];
  1476. }