var workbench = { width: 1/3, setWidth: function(width){ this.width = width; }, height: 1/3, setHeight: function(height){ this.height = height; }, bench_task: function(){ var me = this.workbench || this; var notifycount=getNotifyCount(); return Ext.create('Ext.panel.Panel', { title:'
待办事宜
' + '
已发起流程
' + '
已处理流程|
'+ '
待办转移流程|
'+ '
更多待办流程|
'+ '
更多提醒任务|
'+ '
知会('+notifycount+')|
|
'+ '
刷新|
', id: 'bench_task', iconCls: 'main-todo', columnWidth: me.width, height: me.height, layout:'anchor', items:[{ xtype:'gridpanel', id:'task_grid', hideHeaders:true, store: Ext.create('Ext.data.Store', { fields:['id', 'name','status','type','typecode','CURRENTMASTER','note'], groupField: 'type' }), autoScroll: true, cls: 'task-grid', anchor: '100% 100%', features: [ Ext.create('Ext.grid.feature.Grouping',{ groupHeaderTpl: '{name} (共 {rows.length}项)' })], loadNewStore:function(){ me._bench_task(); }, viewConfig :{ stripeRows:false }, bodyStyle: 'background: #f1f1f1;border: none;', columns: [{ header: 'ID', dataIndex: 'id', hidden: true}, { header: '事宜名称', dataIndex: 'name', flex:1,renderer:taskItem, id: 'topic'}, { header: '当前状态', dataIndex: 'status',hidden: true}, {header: '事宜类型', dataIndex:'type',hidden: true}, {header:'事宜类型编码', dataIndex:'typecode',hidden: true}, {header:'备注信息', dataIndex:'note',hidden: true}, {header:'Master',dateIndex:'CURRENTMASTER',hidden:true }] }] }); }, bench_flow: function(){ var me = this.workbench || this; return Ext.create('Ext.panel.Panel', { title:'
我发起未结束流程
' + '
发布流程
' + '
更多流程|
', bodyStyle: 'background: #f1f1f1', id: 'bench_flow', contentEl: 'myflow', iconCls: 'main-todo', autoScroll: true, columnWidth: me.width, height: me.height }); }, bench_overflow: function(){ var me = this.workbench || this; return Ext.create('Ext.panel.Panel', { title:'
我的超时流程
' + '
发布流程
' + '
更多流程|
', bodyStyle: 'background: #f1f1f1', id: 'bench_overflow', contentEl: 'myoverflow', iconCls: 'main-todo', autoScroll: true, columnWidth: me.width, height: me.height }); }, bench_schedule: function(){ var me = this.workbench || this; return Ext.create('Ext.panel.Panel', { title:'
我的考勤
' + '
我的考勤
' + '
下属考勤|
', id: 'bench_schedule', iconCls: 'main-forget', layout: 'anchor', bodyStyle: 'background: #f1f1f1;', items: [{ xtype: 'button', id: 'clock', iconCls: 'x-button-icon-clock', scale: 'large', anchor: '100% 33.33%' },{ xtype: 'button', iconCls: 'x-button-icon-on', text: '', id: 'signin', signin: false, intime: null, tooltip: '', anchor: '100% 33.33%', scale: 'large', handler: function(btn){ if(btn.signin == false){ signin(); } } },{ xtype: 'button', iconCls: 'x-button-icon-off', hidden: true, text: '', signout: false, outtime: null, tooltip: '', id: 'signout', anchor: '100% 33.33%', scale: 'large', handler: function(btn){ if(btn.signout == false){ signout(); } } }], columnWidth: me.width, height: me.height }); }, bench_subscription: function(){ var me = this.workbench || this; return Ext.create('Ext.panel.Panel', { title: '
日程安排
' + '
详细日程
' + '
下属日程|
', id: 'bench_subscription', layout: 'border', items: [{ region: 'center', xtype: 'holidaydatepicker', autoShow: true }], iconCls: 'main-schedule', columnWidth: me.width, height: me.height }); }, bench_notify: function(){ var me = this.workbench || this; return Ext.create('Ext.panel.Panel', { title:'
通知公告
' + '
发布通知
' + '
更多通知|
', id: 'bench_notify', iconCls: 'main-msg', contentEl: 'notify', columnWidth: me.width, height: me.height }); }, bench_news: function(){ var me = this.workbench || this; return Ext.create('Ext.panel.Panel', { title:'
新闻动态
' + '
发布新闻
' + '
更多新闻|
', id: 'bench_news', iconCls: 'main-notice', contentEl: 'news', columnWidth: me.width, height: me.height }); }, bench_link: function(){ var me = this.workbench || this; return Ext.create('Ext.panel.Panel', { title: '
常用模块
', id: 'bench_link', iconCls: 'main-news', columnWidth: me.width, height: me.height, layout: 'anchor', items: [{ xtype: 'gridpanel', id: 'link_grid', cls: 'custom-grid', columnLines : true, autoScroll: true, anchor: '100% 100%', store: Ext.create('Ext.data.Store', { fields:['cu_id', 'cu_description', 'cu_url', 'cu_count'], data: [] }), bodyStyle: 'background: #f1f1f1;', columns: [{ text: 'ID', dataIndex: 'cu_id', hidden: true },{ text: '模块名', dataIndex: 'cu_description', flex: 1, renderer: function(val, meta, record){ var ht = "" + val + ""; return ht; } },{ text: '链接', dataIndex: 'cu_url', hidden: true },{ text: '次数', dataIndex: 'cu_count', hidden: true },{ xtype: 'actioncolumn', text: '操作', flex: 0.2, items: [{ icon: basePath + 'resource/images/16/up.png', tooltip: '上', handler: function(view, rowIndex, colIndex) { var rec = view.getStore().getAt(rowIndex); view.ownerCt.updateBench(rec.get('cu_id'), 1); } },{ icon: basePath + 'resource/images/16/down.png', tooltip: '下', handler: function(view, rowIndex, colIndex) { var rec = view.getStore().getAt(rowIndex); view.ownerCt.updateBench(rec.get('cu_id'), -1); } },{ icon: basePath + 'resource/images/16/delete.png', tooltip: '删除', handler: function(view, rowIndex, colIndex) { var rec = view.getStore().getAt(rowIndex); _delete_bench_link(rec.get('cu_id')); } }] }], updateBench : function(id, t) { var g = this; g.setLoading(true); Ext.Ajax.request({ url : basePath + 'common/updateCommonUse.action', params : { _noc : 1, id : id, type : t }, callback : function(o, s, r) { g.setLoading(false); var rs = Ext.decode(r.responseText); if (rs.commonuse) { g.store.loadData(rs.commonuse); } } }); } }] }); }, bench_note: function(){ var me = this.workbench || this; return Ext.create('Ext.panel.Panel', { title: '
我的知会
', bodyStyle: 'background: #f1f1f1;', iconCls: 'main-notice', id: 'bench_note', contentEl: 'note2', columnWidth: me.width, height: me.height }); }, bench_mytask: function(){ var me = this.workbench || this; return Ext.create('Ext.panel.Panel', { title: '
我的任务
', bodyStyle: 'background: #f1f1f1', id: 'bench_mytask', iconCls: 'main-news', columnWidth: me.width, height: me.height }); }, bench_plan: function(){ var me = this.workbench || this; return Ext.create('Ext.panel.Panel', { title:'
工作计划
', bodyStyle: 'background: #f1f1f1', id: 'bench_plan', contentEl: 'plan', iconCls: 'main-news', autoScroll: true, columnWidth: me.width, height: me.height }); }, bench_email: function(){ var me = this.workbench || this; return Ext.create('Ext.panel.Panel', { title: '
我的邮箱
', bodyStyle: 'background: #f1f1f1', id: 'bench_email', iconCls: 'main-news', columnWidth: me.width, height: me.height }); }, bench_knowledge: function(){ var me = this.workbench || this; return Ext.create('Ext.panel.Panel', { title: '
知识地图
', bodyStyle: 'background: #f1f1f1', id: 'bench_knowledge', iconCls: 'main-news', columnWidth: me.width, height: me.height }); }, bench_meeting: function(){ var me = this.workbench || this; return Ext.create('Ext.panel.Panel', { title: '
待开会议
', bodyStyle: 'background: #f1f1f1', id: 'bench_meeting', iconCls: 'main-news', columnWidth: me.width, height: me.height }); }, /** * 我发起的流程 */ _bench_flow: function(){ var me = this.workbench || this; Ext.Ajax.request({ url : basePath + 'common/datalist.action', params: { caller: 'JProcess!Me', condition: 'jp_launcherid=\'' + em_code + '\'', page: 1, pageSize: parseInt(height*0.3/12) }, method : 'post', callback : function(options,success,response){ var res = new Ext.decode(response.responseText); if(res.exception || res.exceptionInfo){ var err = res.exceptionInfo; if(err.indexOf('ERR_POWER') != -1) { Ext.get("myflow").insertHtml('afterBegin', '
(您无权限查看此信息)
'); } else { showError(err); } return; } var task = res.data != null ? Ext.decode(res.data.replace(/,}/g, '}').replace(/,]/g, ']')) : new Array(); if(task == [] || task.length == 0){ Ext.get("myflow").insertHtml('afterBegin', '
(暂无任务流程)
'); } else { Ext.create('Ext.grid.Panel', { autoScroll: true, store: Ext.create('Ext.data.Store', { fields:['jp_id', 'jp_form', 'jp_launchTime','enddate', 'jt_duedate','jp_nodeId'], data: task }), height: me.height*0.76, bodyStyle: 'background: #f1f1f1;border: none;', columns: [ { header: 'ID', dataIndex: 'jp_id', hidden: true}, { header: '流程单据', dataIndex: 'jp_form', flex: 1.5 , renderer: flowItem}, { header: '限办时间', dataIndex: 'enddate', flex: 1.5, renderer : getDueDate}, { header: 'nodeId', dataIndex: 'jp_nodeId', hidden: true} ], renderTo: Ext.get("myflow") }); } } }); }, /** * 我的超时流程 */ _bench_overflow: function(){ var me = this.workbench || this; /*Ext.Ajax.request({ url : basePath + 'common/datalist.action', params: { caller: 'JProcess!MeOver', condition: 'jp_nodedealman=\'' + em_code + '\'', page: 1, pageSize: parseInt(height*0.3/12) }, method : 'post', callback : function(options,success,response){ var res = new Ext.decode(response.responseText); if(res.exception || res.exceptionInfo){ var err = res.exceptionInfo; if(err.indexOf('ERR_POWER') != -1) { Ext.get("myoverflow").insertHtml('afterBegin', '
(您无权限查看此信息)
'); } else { showError(err); } return; } var task = res.data != null ? Ext.decode(res.data.replace(/,}/g, '}').replace(/,]/g, ']')) : new Array(); if(task == [] || task.length == 0){ Ext.get("myoverflow").insertHtml('afterBegin', '
(暂无超时流程)
'); } else { Ext.create('Ext.grid.Panel', { autoScroll: true, store: Ext.create('Ext.data.Store', { fields:['jp_id', 'jp_form', 'jp_launchTime','enddate', 'jt_duedate','jp_nodeId'], data: task }), height: me.height*0.76, bodyStyle: 'background: #f1f1f1;border: none;', columns: [ { header: 'ID', dataIndex: 'jp_id', hidden: true}, { header: '流程单据', dataIndex: 'jp_form', flex: 1.5 , renderer: flowOverItem}, { header: '限办时间', dataIndex: 'enddate', flex: 1.5, renderer : getDueDate}, { header: 'nodeId', dataIndex: 'jp_nodeId', hidden: true} ], renderTo: Ext.get("myoverflow") }); } } });*/ }, /** * 待办事宜 */ _bench_task: function(){ var grid = Ext.getCmp('bench_task').down('gridpanel'); grid.store.removeAll(); if(em_code==null) em_code=getCookie('em_code'); Ext.Ajax.request({ url : basePath + 'common/datalist.action', params: { caller: 'JProCand', condition: 'jp_candidate=\'' + em_code + '\' AND jp_status=\'待审批'+'\' AND jp_flag=1', page: 1, pageSize: 20, _noc:1 }, method : 'post', callback : function(options,success,response){ var res = new Ext.decode(response.responseText); if(res.exception || res.exceptionInfo){ var err = res.exceptionInfo; showError(err); return; } var task = res.data != null ? Ext.decode(res.data.replace(/,}/g, '}').replace(/,]/g, ']')) : new Array(); if(task.length > 0){ var items = new Array(); Ext.Array.each(task,function(item){ item.id=item.jp_nodeId; item.name=item.jp_name+" "+item.jp_codevalue; item.note=item.jp_processnote; item.note=item.jp_processnote; item.status=item.jp_status; item.type='可选流程'; item.typecode='procand'; items.push(item); }); grid.store.add(items); } } }); Ext.Ajax.request({ url : basePath + 'common/datalist.action', params: { caller: 'JProcess!Me', condition: '(jp_nodedealman=\'' + em_code + '\' AND jp_status=\'待审批'+'\') or (jp_launcherid=\'' + em_code + '\' AND jp_status=\'未通过'+'\') ', page: 1, pageSize:20, _noc:1 }, method : 'post', callback : function(options,success,response){ var res = new Ext.decode(response.responseText); if(res.exception || res.exceptionInfo){ var err = res.exceptionInfo; showError(err); return; } var task = res.data != null ? Ext.decode(res.data.replace(/,}/g, '}').replace(/,]/g, ']')) : new Array(); if(task.length > 0){ var items = new Array(); Ext.Array.each(task,function(item){ item.id=item.jp_nodeId; item.name=item.jp_name+" "+item.jp_codevalue +"("+item.jp_launcherName+")"; item.note=item.jp_processnote; item.status=item.jp_status; if(!item.source || item.source==0){ if(item.jp_status=='未通过'){ item.type='未同意流程'; item.typecode='unprocess'; }else{ item.type='待审批流程'; item.typecode='process'; } }else { item.type='待办转移流程'; item.typecode='transferprocess'; } items.push(item); }); grid.store.add(items); } } }); Ext.Ajax.request({ url : basePath + 'common/datalist.action', params: { caller: 'ResourceAssignment', condition: 'ra_emid=' + em_uu + ' AND ra_taskpercentdone<100', page: 1, pageSize: 20, _noc:1 }, method : 'post', callback : function(options,success,response){ var res = new Ext.decode(response.responseText); if(res.exception || res.exceptionInfo){ var err = res.exceptionInfo; showError(err); return; } var task = res.data != null ? Ext.decode(res.data.replace(/,}/g, '}').replace(/,]/g, ']')) : new Array(); if(task.length > 0){ var items = new Array(); Ext.Array.each(task,function(item){ item.id=item.ra_id; item.name=item.ra_taskname + (item.sourcecode || ''); item.status=item.ra_status; item.type='待办任务'; item.typecode=(item.ra_type || 'worktask'); item.sourcelink=item.sourcelink; item.taskId=item.ra_taskid; items.push(item); }); grid.store.add(items); } } }); }, _bench_news: function(){ var me = this.workbench || this; me.getCmpNews(); }, /** * 内部新闻 */ getCmpNews: function(){ Ext.Ajax.request({ url : basePath + 'common/datalist.action', params: { caller: 'News', condition: '', page: 1, pageSize: parseInt(height*0.25/23), _noc:1 }, method : 'post', callback : function(options,success,response){ var res = new Ext.decode(response.responseText); if(res.exception || res.exceptionInfo){ var err = res.exceptionInfo; if(err.indexOf('ERR_POWER') != -1) { Ext.get("news").insertHtml('afterBegin', '
(您无权限查看此信息)
'); } else { showError(err); } return; } var news = res.data != null ? Ext.decode(res.data.replace(/,}/g, '}').replace(/,]/g, ']')) : []; /*Ext.Array.sort(news, function(a, b){ return b.ne_releasedate > a.ne_releasedate; });*/ var html = ''; Ext.get("news").insertHtml('afterBegin', html); } }); }, _bench_note:function(){ Ext.Ajax.request({ url : basePath + 'common/datalist.action', params: { caller: 'NotifyJprocess', condition: 'prd_recipientid='+em_uu, page: 1, pageSize: parseInt(height*0.25/23), _noc:1 }, method : 'post', callback : function(options,success,response){ Ext.get('note2').dom.innerHTML=''; var res = new Ext.decode(response.responseText); if(res.exception || res.exceptionInfo){ var err = res.exceptionInfo; if(err.indexOf('ERR_POWER') != -1) { Ext.get("note2").insertHtml('afterBegin', '
(您无权限查看此信息)
'); } else { showError(err); } return; } var notes = res.data!=null?Ext.decode(res.data):[]; var html = ''; Ext.get("note2").insertHtml('afterBegin', html); } }); }, /** * 通知公告 */ _bench_notify: function(){ Ext.Ajax.request({ url : basePath + 'common/datalist.action', params: { caller: 'Note', condition: '', page: 1, pageSize:10, _noc:1 }, method : 'post', callback : function(options,success,response){ var res = new Ext.decode(response.responseText); if(res.exception || res.exceptionInfo){ var err = res.exceptionInfo; if(err.indexOf('ERR_POWER') != -1) { Ext.get("notify").insertHtml('afterBegin', '
(您无权限查看此信息)
'); } else { showError(err); } return; } var notes = res.data != null ? Ext.decode(res.data.replace(/,}/g, '}').replace(/,]/g, ']')) : []; /*Ext.Array.sort(notes, function(a, b){ return b.no_apptime > a.no_apptime; });*/ var height=Ext.getCmp('bench_notify').height; var html = '
'; Ext.get("notify").insertHtml('afterBegin', html); /*var $=function $(element){ if(arguments.length>1){ for(var i=0,length=arguments.length,elements=[];i(height-45)) {setTimeout(function scroll(){ new Scroll("notifydata",24); },8000); }*/ } }); }, /** * 常用模块 */ _bench_link: function(){ var me = this.workbench || this; Ext.Ajax.request({ url : basePath + 'common/getCommonUse.action', method : 'get', callback : function(options,success,response){ var res = new Ext.decode(response.responseText); if(res.exception || res.exceptionInfo){ showError(res.exceptionInfo); return; } window._delete_bench_link = me._delete_bench_link; Ext.getCmp('bench_link').down('gridpanel').store.loadData(res.commonuse); } }); }, /** * 设置常用模块 */ _set_bench_link: function(snid){ Ext.Ajax.request({ url : basePath + 'common/setCommonUse.action', params: { snid: snid }, method : 'post', callback : function(options,success,response){ var res = new Ext.decode(response.responseText); if(res.exception || res.exceptionInfo){ showError(res.exceptionInfo); return; } if(Ext.isIE) { setTimeout(function(){ Ext.getCmp('link_grid').store.loadData(res.commonuse); }, 8000); } else { Ext.getCmp('link_grid').store.loadData(res.commonuse); } } }); }, _delete_bench_link: function(id){ Ext.Ajax.request({ url : basePath + 'common/deleteCommonUse.action', params: { id: id }, method : 'post', callback : function(options,success,response){ var res = new Ext.decode(response.responseText); if(res.exception || res.exceptionInfo){ showError(res.exceptionInfo); return; } var grid = Ext.getCmp('link_grid'); Ext.each(grid.store.data.items, function(item){ if(item.data['cu_id'] == id){ grid.store.remove(item); } }); } }); }, /** * 查看我的考勤 */ _bench_schedule: function(){ Ext.Ajax.request({ url : basePath + 'oa/getMySign.action', async: false, method : 'post', callback : function(options,success,response){ var res = new Ext.decode(response.responseText); if(res.exception || res.exceptionInfo){ showError(res.exceptionInfo); return; } if(res.sign != null){ Ext.getCmp('signin').signin = true; var d = new Date(res.sign.si_in); Ext.getCmp('signin').intime = res.sign.si_in; var sin = Ext.Date.parse(Ext.Date.toString(new Date()) + ' 09:00:00', 'Y-m-d H:i:s').getTime(); if(d > sin){ Ext.getCmp('signin').tooltip = "签到时间:" + Ext.Date.format(d, 'H:i:s') + "  迟到" + Math.floor((d - sin)/(60*60*1000)) + "小时" + Math.floor(((d - sin)%(60*60*1000))/(60*1000)) + "分钟" + ""; } else { Ext.getCmp('signin').tooltip = "签到时间:" + Ext.Date.format(d, 'H:i:s'); Ext.getCmp('signin').setIconCls('x-button-icon-working'); } if(res.sign.si_out) { d = new Date(res.sign.si_out); sin = Ext.Date.parse(Ext.Date.toString(new Date()) + ' 18:00:00', 'Y-m-d H:i:s').getTime(); Ext.getCmp('signout').signout = true; if(d < sin) { Ext.getCmp('signout').setText("签退时间:" + Ext.Date.format(d, 'H:i:s') + "  早退" + Math.floor((sin - d)/(60*60*1000)) + "小时" + Math.floor(((sin - d)%(60*60*1000))/(60*1000)) + "分钟" + ""); } else { Ext.getCmp('signout').setText("签退时间:" + Ext.Date.format(d, 'H:i:s')); } } Ext.getCmp('signout').show(); } } }); showClock(); }, refreshTask:refreshTask }; /** * 刷新待办事宜 * */ function refreshTask(onlyProcess){ var grid = Ext.getCmp('bench_task').down('gridpanel'); grid.store.removeAll(); Ext.Ajax.request({ url : basePath + 'common/datalist.action', params: { caller: 'JProCand', condition: 'jp_candidate=\'' + em_code + '\' AND jp_status=\'待审批'+'\' AND jp_flag=1', page: 1, pageSize: 20, _noc:1 }, method : 'post', callback : function(options,success,response){ var res = new Ext.decode(response.responseText); if(res.exception || res.exceptionInfo){ var err = res.exceptionInfo; showError(err); return; } var task = res.data != null ? Ext.decode(res.data.replace(/,}/g, '}').replace(/,]/g, ']')) : new Array(); if(task.length > 0){ var items = new Array(); Ext.Array.each(task,function(item){ item.id=item.jp_nodeId; item.name=item.jp_name+" "+item.jp_codevalue; item.note=item.jp_processnote; item.status=item.jp_status; item.type='可选流程'; item.typecode='procand'; items.push(item); }); grid.store.add(items); } } }); Ext.Ajax.request({ url : basePath + 'common/datalist.action', params: { caller: 'JProcess!Me', condition: '(jp_nodedealman=\'' + em_code + '\' AND jp_status=\'待审批'+'\') or (jp_launcherid=\'' + em_code + '\' AND jp_status=\'未通过'+'\') ', page: 1, pageSize:20, _noc:1 }, method : 'post', callback : function(options,success,response){ var res = new Ext.decode(response.responseText); if(res.exception || res.exceptionInfo){ var err = res.exceptionInfo; showError(err); return; } var task = res.data != null ? Ext.decode(res.data.replace(/,}/g, '}').replace(/,]/g, ']')) : new Array(); if(task.length > 0){ var items = new Array(); Ext.Array.each(task,function(item){ item.id=item.jp_nodeId; item.name=item.jp_name+" "+item.jp_codevalue +"("+item.jp_launcherName+")"; item.note=item.jp_processnote; item.status=item.jp_status; if(!item.source || item.source==0){ if(item.jp_status=='未通过'){ item.type='未同意流程'; item.typecode='unprocess'; }else{ item.type='待审批流程'; item.typecode='process'; } }else { item.type='待办转移流程'; item.typecode='transferprocess'; } items.push(item); }); grid.store.add(items); } } }); if(!onlyProcess){ Ext.Ajax.request({ url : basePath + 'common/datalist.action', params: { caller: 'ResourceAssignment', condition: 'ra_emid=' + em_uu + ' AND ra_taskpercentdone<100', page: 1, pageSize: 20, _noc:1 }, method : 'post', callback : function(options,success,response){ var res = new Ext.decode(response.responseText); if(res.exception || res.exceptionInfo){ var err = res.exceptionInfo; showError(err); return; } var task = res.data != null ? Ext.decode(res.data.replace(/,}/g, '}').replace(/,]/g, ']')) : new Array(); if(task.length > 0){ var items = new Array(); Ext.Array.each(task,function(item){ item.id=item.ra_id; item.name=item.ra_taskname + (item.sourcecode || ''); item.status=item.ra_status; item.type='待办任务'; item.typecode=(item.ra_type || 'worktask'); item.sourcelink=item.sourcelink; item.taskId=item.ra_taskid; items.push(item); }); grid.store.add(items); } } }); } getNotifyCount(); } function getNotifyCount(){ var count=0; Ext.Ajax.request({ url : basePath + 'common/getCountByTable.action', params: { tablename: 'pagingrelease left join pagingreleasedetail on pr_id=prd_prid', condition: "prd_recipientid=" + em_uu+" and prd_readstatus=0 and nvl(pr_from,' ')='jprocess'", _noc:1 }, method : 'post', async:false, callback : function(options,success,response){ var res = new Ext.decode(response.responseText); if(res.exception || res.exceptionInfo){ var err = res.exceptionInfo; showError(err); return; } count=res.count; } }); var countinfo=document.getElementById('messagecount'); if(countinfo){ countinfo.innerHTML='知会('+count+")"; } return count; } /** * 打开一个tab * @param id 当前record的ID * @param caller * @param title 标题 * @param link 链接 * @param key 主表ID字段 * @param detailKey 从表关联主表ID的字段 * @param condition 附加条件 */ function openTable(id, caller, title, link, key, detailKey, condition,relateMaster,limit){ var main = parent.Ext.getCmp("content-panel"); var item=main.items.items[0]; item.firstGrid=Ext.getCmp('task_grid'); var panel = Ext.getCmp('' + id); var url = parseUrl(link); if(caller){ panel = Ext.getCmp(caller); url = link + '?whoami=' + caller; } if(id){ if(caller){ panel = Ext.getCmp(caller + id); url = link + '?whoami=' + caller + '&formCondition=' + key + '=' + id + '&gridCondition=' + detailKey + '=' + id; } } else { if(condition != null){ url += '&urlcondition=' + parseUrl(condition); } } if(!limit){ if(url.indexOf('?') > 0) url += '&_noc=1'; else url += '?_noc=1'; } if(relateMaster){ url+='&newMaster='+relateMaster; } if( relateMaster ){ var currentMaster = parent.window.sob; if ( currentMaster && currentMaster != relateMaster) {// 与当前账套不一致 if (parent.Ext) { Ext.Ajax.request({ url: basePath + 'common/changeMaster.action', params: { to: relateMaster }, callback: function(opt, s, r) { if (s) { var win = parent.Ext.create('Ext.Window', { width: '100%', height: '100%', draggable: false, closable: false, modal: true, title: '创建到账套' + relateMaster + '的临时会话', id:'modalwindow', historyMaster:currentMaster, html : '', buttonAlign: 'center', buttons: [{ text: $I18N.common.button.erpCloseButton, cls: 'x-btn-blue', id: 'close', handler: function(b) { Ext.Ajax.request({ url: basePath + 'common/changeMaster.action', params: { to: currentMaster }, callback: function(opt, s, r) { if (s) { b.up('window').close(); } else { alert('切换到原账套失败!'); } } }); } }] }); win.show(); } else { alert('无法创建到账套' + relateMaster + '的临时会话!'); } } }); } return; } } if(!panel){ panel = { title : title.substring(0, title.toString().length > 5 ? 5 : title.toString().length), tag : 'iframe', tabConfig:{tooltip: title}, border : false, layout : 'fit', iconCls : 'x-tree-icon-tab-tab', html : '', closable : true, listeners : { close : function(){ main.setActiveTab(main.getActiveTab().id); } } }; openTab(panel, panel.id); }else{ main.setActiveTab(panel); } } function parseUrl(url) { var id = url.substring(url.lastIndexOf('?')+1); if (id == null) { id = url.substring(0,url.lastIndexOf('.')); } if(contains(url, 'session:em_uu', true)){ url = url.replace(/session:em_uu/,em_uu); } if(contains(url, 'session:em_code', true)){ url = url.replace(/session:em_code/, "'" + em_code + "'"); } if(contains(url, 'sysdate', true)){ url = url.replace(/sysdate/, "to_date('" + Ext.Date.toString(new Date()) + "','yyyy-mm-dd')"); } if(contains(url, 'session:em_name', true)){ url = url.replace(/session:em_name/,"'"+em_name+"'" ); } return url; } function openTab(panel, id){ var o = (typeof panel == "string" ? panel : id || panel.id); var main = parent.Ext.getCmp("content-panel"); var tab = main.getComponent(o); if (tab) { main.setActiveTab(tab); } else if(typeof panel!="string"){ panel.id = o; var p = main.add(panel); main.setActiveTab(p); } } function taskItem(val, meta, record){ var rendermsg=''; if(record.data.CURRENTMASTER){ if(record.data.typecode=='worktask' || record.data.typecode=='projecttask'){ rendermsg='' + val + ''; } else if(record.data.typecode=='billtask' || record.data.typecode=='mrptask'){ rendermsg='' + val + ''; } else if(record.data.typecode=='kbitask' || record.data.typecode=='mrptask'){ rendermsg='' + val + ''; }else if(record.data.typecode=='process'||record.data.typecode=='unprocess' || record.data.typecode=='transferprocess') return '' + val + ''; else rendermsg='' + val + ''; } else { if(record.data.typecode=='worktask' || record.data.typecode=='projecttask'){ rendermsg='' + val + ''; } else if(record.data.typecode=='billtask' || record.data.typecode=='mrptask'){ rendermsg='' + val + ''; } else if(record.data.typecode=='communicatetask'){ rendermsg='' + val + ''; } else if(record.data.typecode=='kbitask' ){ rendermsg='' + val + ''; }else if(record.data.typecode=='process'||record.data.typecode=='unprocess' || record.data.typecode=='transferprocess') { rendermsg='' + val + ''; if(record.data.note && record.data.note!=null && record.data.note !='null' ){ rendermsg+='
'+record.data.note+''; } } else rendermsg='' + val + ''; } if(record.data.RN && record.data.RN==1){ return rendermsg+' '; }else return rendermsg; } function showMaster(val,meta,record){ if(record.data.CURRENTMASTER){ return val+'-' + record.data.CURRENTMASTER + ''; }else return val; } function flowItem(val, meta, record){ return '' + val + ''; } function flowOverItem(val, meta, record){ return '' + val + ''; } function getSurPlus(val, meta, record){ if(Ext.isEmpty(val)) return '--'; if(record.data.ra_taskpercentdone == 100){ return '' + '已完成'; } else { var bTime = new Date().getTime(); var eTime = Ext.Date.parse(record.data['ra_enddate'].substring(0, 10) + ' 23:59:59','Y-m-d H:i:s').getTime(); var allHour = (eTime - bTime)/(60*60*1000); if(allHour < 0){ if(allHour < -24){ val = "过期" + Math.floor(Math.abs(allHour)/24) + "天" + Math.floor(Math.abs(allHour)%24) + "小时"; } else { val = "过期" + Math.floor(Math.abs(allHour)) + "小时"; } } else { val = "剩余" + Math.floor(allHour/24) + "天" + Math.floor(allHour%24) + "小时"; } return val; } } function percentdone(val, meta, record){ val == null || 0; if(val < 30) return ''+'' + val + ''; else if(val > 30 && val < 50) return ''+'' + val + ''; else if(val == 100){ return ''+'' + val + ''; }else if(val > 80){ return ''+'' + val + ''; } else return val; } function showClock(){ var now = new Date(); var html = ''; var hours = now.getHours(); var minutes = now.getMinutes(); var seconds = now.getSeconds(); if(hours < 9 && Ext.getCmp('signin').signin == false){ Ext.getCmp('signin').setText("签到  剩余" + (8 - hours) + "小时" + (60 - minutes) + "分钟" + (60 - seconds) + "秒"); } else { if (Ext.getCmp('signin').signin == true) { var intime = Number(Ext.getCmp('signin').intime); if(intime && intime > 0) { var time = now.getTime(); var h = Math.floor((time - intime)/(60*60*1000)); var m = Math.floor(((time - intime)%(60*60*1000))/(60*1000)); var s = Math.floor(((time - intime)%(60*1000))/(1000)); Ext.getCmp('signin').setText(Ext.getCmp('signin').tooltip + "
 已工作" + (h) + "小时" + (m) + "分钟" + (s) + "秒"); } else { Ext.getCmp('signin').setText(Ext.getCmp('signin').tooltip); } if(Ext.getCmp('signout').signout == false) { if(hours < 18){ Ext.getCmp('signout').setText("签退
 距离下班" + (18 - hours) + "小时" + (60 - minutes) + "分钟" + (60 - seconds) + "秒"); } else { Ext.getCmp('signout').setText("签退
 下班时间已到"); } } } else {//还没签到 Ext.getCmp('signin').setText("签到  迟到" + (hours - 9) + "小时" + (minutes) + "分钟" + (seconds) + "秒"); } } if(hours <= 9){ hours = '0' + hours; } if(minutes <= 9){ minutes = '0' + minutes; } if(seconds < 10){ seconds = '0' + seconds; } var array = Ext.Array.toArray('' + hours + '-' + minutes + '-' + seconds); Ext.each(array, function(n){ if (n == '-') { html += ''; } else { html += ''; } }); Ext.getCmp('clock').setText(html); setTimeout("showClock();", 1000); } function signin(){ var hours = new Date().getHours(); if(hours >= 9){ Ext.MessageBox.prompt("原因", "请如实填写迟到原因", function (btn, text) { if(btn == 'ok'){ _signin(text); } }, this, true, '睡觉睡过头了!'); } else { _signin(null); } } function _signin(reason){ Ext.Ajax.request({ url : basePath + 'oa/signin.action', method : 'post', async: false, params: { reason: reason }, callback : function(options,success,response){ var res = new Ext.decode(response.responseText); if(res.exception || res.exceptionInfo){ showError(res.exceptionInfo); return; } if(res.success){ Ext.getCmp('signin').signin = true; Ext.getCmp('signout').show(); var d = new Date(); Ext.getCmp('signin').intime = new Date().getTime(); var sin = Ext.Date.parse(Ext.Date.toString(new Date()) + ' 09:00:00', 'Y-m-d H:i:s').getTime(); if(d > sin) { Ext.getCmp('signin').setText("签到时间:" + Ext.Date.format(d, 'H:i:s') + "  迟到" + Math.floor((d - sin)/(60*60*1000)) + "小时" + Math.floor(((d - sin)%(60*60*1000))/(60*1000)) + "分钟" + ""); Ext.getCmp('signin').tooltip = "签到时间:" + Ext.Date.format(d, 'H:i:s') + "  迟到" + Math.floor((d - sin)/(60*60*1000)) + "小时" + Math.floor(((d - sin)%(60*60*1000))/(60*1000)) + "分钟" + ""; } else { Ext.getCmp('signin').setText("签到时间:" + Ext.Date.format(d, 'H:i:s')); Ext.getCmp('signin').tooltip = "签到时间:" + Ext.Date.format(d, 'H:i:s'); } Ext.getCmp('signin').setIconCls('x-button-icon-working'); alert("签到时间:" + Ext.Date.format(d, 'Y-m-d H:i:s')); } } }); } function signout(){ var sout = Ext.Date.parse(Ext.Date.toString(new Date()) + ' 18:00:00', 'Y-m-d H:i:s'); if(sout > new Date()){ Ext.MessageBox.prompt("原因", "请如实填写早退原因", function (btn, text) { if(btn == 'ok'){ _signout(text); } }, this, true, '太累了!'); } else { _signout(null); } } function _signout(reason) { Ext.Ajax.request({ url : basePath + 'oa/signout.action', method : 'post', params: { reason: reason }, callback : function(options,success,response){ var res = new Ext.decode(response.responseText); if(res.exception || res.exceptionInfo){ showError(res.exceptionInfo); return; } if(res.success){ Ext.getCmp('signout').signout = true; var d = new Date(); var sin = Ext.Date.parse(Ext.Date.toString(new Date()) + ' 18:00:00', 'Y-m-d H:i:s').getTime(); if(d < sin) { Ext.getCmp('signout').setText("签退时间:" + Ext.Date.format(d, 'Y-m-d H:i:s') + "  早退" + Math.floor((sin - d)/(60*60*1000)) + "小时" + Math.floor(((sin - d)%(60*60*1000))/(60*1000)) + "分钟" + ""); } else { Ext.getCmp('signout').setText("签退时间:" + Ext.Date.format(d, 'Y-m-d H:i:s')); } alert("签退时间:" + Ext.Date.format(d, 'Y-m-d H:i:s')); } } }); } function getMyBench(){ Ext.Ajax.request({ url : basePath + 'common/getWorkBench.action', method : 'get', callback : function(options,success,response){ var res = new Ext.decode(response.responseText); if(res.exceptionInfo) { showError(res.exceptionInfo); } else { var bench = res.benchs; if(bench.length == 0){ bench = getDefaultBench(); } var e = Ext.getCmp('bench').getEl().dom, h = parseInt(Number(e.style.height.replace('px', ''))/3) - 1; Ext.each(bench, function(b){ workbench.setWidth(b.wb_width); if(b.wb_height > 0.6) { workbench.setHeight(h*2); } else { workbench.setHeight(h); } var panel = workbench[b.wb_name].apply(); Ext.getCmp('bench').add(panel); }); Ext.each(bench, function(b){ if(workbench["_" + b.wb_name]){ workbench["_" + b.wb_name].apply(); } }); } } }); } function getDefaultBench(){ return [{ wb_name: 'bench_task', wb_width: 2/3, wb_height: 2/3 },{ wb_name: 'bench_link', wb_width: 1/3, wb_height: 2/3 },{ wb_name: 'bench_notify', wb_width: 1/3, wb_height: 1/3 },{ wb_name: 'bench_news', wb_width: 1/3, wb_height: 1/3 },{ wb_name:'bench_subscription', wb_width: 1/3, wb_height: 1/3 }]; } function getDueDate(val, meta, record){ var endDate = ''; if(record.data['jt_duedate'] == 0){ return "无限时"; } else{ endDate = Ext.Date.format(new Date(Ext.Date.parse(record.data['jp_launchTime'], 'Y-m-d H:i:s') .getTime() + record.data['jt_duedate']*3600), 'Y-m-d H:i:s'); } return endDate; } function formatNote(context){ context=context.replace(/<\s*\/?br>/g, " "); context=context.replace('你有新流程需处理!'," "); context=context.replace(/    /g," "); return context; } function getDefaultShort(){ return [{ sc_name: 'short_setting' },{ sc_name: 'short_news' },{ sc_name: 'short_address' },{ sc_name: 'short_calendar' },{ sc_name: 'short_email' },{ sc_name: 'short_bbs' }]; }