123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573 |
- Ext.define('erp.view.common.main.Header', {
- extend: 'Ext.panel.Panel',
- alias: 'widget.erpHeader',
- initComponent: function() {
- var me = this;
- Ext.applyIf(this, {
- region: 'north',
- bodyStyle: "background-image: url('" + basePath + "resource/images/header_gray.png')",
- layout: 'hbox',
- layoutConfig: {
- padding: '5',
- align: 'middle'
- },
- defaults: {margins:'3 5 0 0'},
- items: [{
- xtype: 'image',
- width: 85,
- height: 30,
- margins: '0 5 0 0',
- src : basePath + 'resource/images/uas.png'
- },{
- xtype: 'tbtext',
- align: 'stretch',
- text: '<font size="4" color="black">'+$I18N.common.main.sysTitle+'</font>'
- },{
- xtype: 'tbtext',
- flex: 10,
- text: ''
- },{
- xtype: 'button',
- text: '选项',
- height: 24,
- align: 'stretch',
- pack: 'end',
- cls: 'main-btn-underline',
- overCls: 'main-btn-underline-over',
- menu: [{
- iconCls: 'menuitem-lock',
- text: '锁定屏幕',
- id: 'lock'
- },{
- xtype: 'menuseparator'
- },{
- iconCls: 'main-msg',
- text: '系统设置',
- menu: [{
- iconCls: 'main-msg',
- text: '修改密码',
- id: 'set-pwd'
- },{
- iconCls:'main-msg',
- text:'弹出消息',
- checked: true,
- xtype: 'menucheckitem',
- overflow: 'visible',
- labelAlign:'left',
- id:'set-msg',
- listeners:{
- afterrender:function(com){
- Ext.Ajax.request({
- method:'post',
- url:basePath+'common/getMsgSet.action?_noc=1',
- callback : function(options,success,response){
- var res = new Ext.decode(response.responseText);
- if(res.exceptionInfo != null){
- showError(res.exceptionInfo);return;
- }else if(res.success){
- com.setChecked(res.IsRemaind);
- }
- }
- });
- },
- click:function(item,e){
- var msg=item.checked?'确认启用消息提醒吗?':'确认取消消息提醒吗?';
- var remind=item.checked?1:0;
- Ext.MessageBox.show({
- title:'消息设置?',
- msg: msg,
- buttons: Ext.Msg.YESNO,
- icon: Ext.Msg.WARNING,
- fn: function(btn){
- if(btn == 'yes'){
- Ext.Ajax.request({
- url:basePath+'common/setMsgRemaind.action?_noc=1',
- params: {
- remind:remind
- },
- method : 'post',
- callback : function(options,success,response){
- var local=Ext.decode(response.responseText);
- if(local.success) {
- Ext.Msg.alert('提示','设置成功!');
- }else {
- showError(local.exceptionInfo);
- }
- }
- });
- } else if(btn == 'no'){
- //不保存
- e.record.reject();
- } else {
- return;
- }
- }
- });
- }
- }
-
- }]
- },{
- iconCls: 'main-msg',
- text: '开发者工具',
- menu: [{
- xtype: 'menucheckitem',
- text: '显示栈轨迹',
- listeners: {
- afterrender: function(item) {
- Ext.Ajax.request({
- url: basePath + 'common/usersetting/develop.action',
- method: 'GET',
- callback: function(opt, s, res) {
- var r = Ext.decode(res.responseText);
- item.setChecked(r.debug);
- }
- });
- },
- click: function(item) {
- Ext.Ajax.request({
- url: basePath + 'common/usersetting/develop.action',
- method: 'POST',
- params: {
- debug: item.checked
- },
- callback: function(opt, s) {
- if (s) {
- Ext.Msg.alert('提示', '系统错误提示内容将' + (item.checked ? '' : '不再') + '显示栈轨迹!');
- }
- }
- });
- }
- }
- }]
- },{
- iconCls: 'main-msg',
- text: '关于优软',
- handler: function(){
- window.open('http://www.usoftchina.com');
- }
- }]
- },{
- xtype: 'tbtext',
- align: 'end',
- text: '|'
- },{
- xtype: 'button',
- text: '任务',
- height: 24,
- align: 'stretch',
- pack: 'end',
- cls: 'main-btn-underline',
- overCls: 'main-btn-underline-over',
- menu: [{
- iconCls: 'main-task',
- text: '发起任务',
- handler: function(b){
- var win = b.taskwin;
- if(!win) {
- b.taskwin = win = Ext.create('erp.view.core.window.Task');
- }
- win.show();
- }
- },{
- iconCls: 'main-task',
- text: '我的待办任务',
- handler:function(){
- openTable("我的待办任务",'jsps/common/datalist.jsp?whoami=ResourceAssignment!Bill&_noc=1&urlcondition=ra_emid=' + em_uu + ' AND ra_taskpercentdone<100 ','Task');
- }
- },{
- iconCls: 'main-task',
- text: '我的超时任务',
- handler:function(){
- openTable("我的超时任务",'jsps/common/datalist.jsp?whoami=ResourceAssignment!Bill&_noc=1&urlcondition=ra_emid=' + em_uu + ' AND ra_taskpercentdone<100 AND ra_enddate<sysdate','Task');
- }
- },{
- iconCls: 'main-task',
- text: '我的已处理任务',
- handler:function(){
- openTable("我的已处理任务",'jsps/common/datalist.jsp?whoami=ResourceAssignment!Bill&_noc=1&urlcondition=ra_emid=' + em_uu + ' AND ra_taskpercentdone=100','Task');
- }
- },{
- xtype : 'menuseparator'
- },{
- iconCls: 'main-task',
- text: '我发起的待办任务',
- handler:function(){
- openTable("我发起的待办任务",'jsps/common/datalist.jsp?whoami=ProjectTask!Bill&_noc=1&urlcondition=recorder=\'' + em_name + '\' AND handstatuscode=\'DOING\'','ProjectTask');
- }
- },{
- iconCls: 'main-task',
- text: '我发起的超时任务',
- handler:function(){
- openTable("我发起的超时任务",'jsps/common/datalist.jsp?whoami=ProjectTask!Bill&_noc=1&urlcondition=recorder=\'' + em_name + '\' AND handstatuscode=\'DOING\' AND enddate<sysdate','ProjectTask');
- }
- },{
- iconCls: 'main-task',
- text: '我发起的已完成任务',
- handler:function(){
- openTable("我发起的已完成任务",'jsps/common/datalist.jsp?whoami=ProjectTask!Bill&_noc=1&urlcondition=recorder=\'' + em_name + '\' AND handstatuscode=\'FINISHED\'','ProjectTask');
- }
- }]
- },{
- xtype: 'tbtext',
- align: 'end',
- text: '|'
- },{
- xtype: 'button',
- text: '流程',
- height: 24,
- align: 'stretch',
- pack: 'end',
- cls: 'main-btn-underline',
- overCls: 'main-btn-underline-over',
- menu: [{
- iconCls: 'main-msg',
- text: '发起流程',
- handler: function(){
- openTable("发起流程","jsps/common/LaunchProcess.jsp?canAdd=1&_noc=1","LaunchProcess");
- }
- },{
- iconCls: 'main-msg',
- text: '流程催办',
- handler: function(){
- openTable("流程催办","jsps/common/batchDeal.jsp?whoami=Process!Remind&_noc=1","Process!Remind");
- }
- },{
- iconCls: 'main-msg',
- text: '我的待办流程',
- handler:function(){
- openTable("我的待办流程",'jsps/common/datalist.jsp?whoami=JProcess&_noc=1&urlcondition=jp_nodedealman=\'' + em_code + '\' AND jp_status=\'待审批'+'\' ','MyProcess');
- }
- },{
- iconCls: 'main-msg',
- text: '我的超时流程',
- handler:function(){
- openTable("我的超时流程",'jsps/common/datalist.jsp?whoami=JProcess&_noc=1&urlcondition=jp_nodedealman=\'' + em_code + '\' AND jp_status=\'待审批'+'\' ','MyProcess');
- }
- },{
- iconCls: 'main-msg',
- text: '我的待办转移流程',
- handler:function(){
- openTable("我的待办转移流程",'jsps/common/datalist.jsp?whoami=TransferProcess&_noc=1&urlcondition=jt_acceptercode=\'' + em_code + '\' and jp_flag = 1 and jp_status=\'待审批\' ', 'MyProcess');
- }
- },{
- iconCls:'main-msg',
- text:'我的已处理流程',
- handler:function(){
- openTable("我的已处理流程",'jsps/common/datalist.jsp?whoami=JProcess&_noc=1&_do=1&urlcondition=jp_nodedealman=\'' + em_code + '\' and jp_status<>\'待审批\' ', 'MyProcess');
- }
- },{
- iconCls:'main-msg',
- text:'我发起的待办流程',
- handler:function(){
- openTable("我发起的待办流程",'jsps/common/datalist.jsp?whoami=JProcess!Header&_do=1&_noc=1&urlcondition=jp_launcherid=\'' + em_code + '\' AND jp_status=\'待审批'+'\' ','MyProcess');
- }
- },{
- iconCls:'main-msg',
- text:'我发起的超时流程',
- handler:function(){
- openTable("我发起的超时流程",'jsps/common/datalist.jsp?whoami=JProcess!Header&_do=1&_noc=1&urlcondition=jp_launcherid=\'' + em_code + '\' AND jp_status=\'待审批'+'\' ','MyProcess');
- }
- },{
- iconCls:'main-msg',
- text:'我发起已结束流程',
- handler:function(){
- openTable("我发起已结束流程",'jsps/common/datalist.jsp?whoami=JProcess!Header&_noc=1&_do=1&&urlcondition=(jp_launcherid=\'' + em_code + '\' AND jp_status=\'已审批'+'\') or (jp_launcherid=\'' + em_code + '\' AND jp_status=\'已结束'+'\') ','MyProcess');
- }
- }]
-
- },{
- xtype: 'tbtext',
- align: 'end',
- text: '|',
- margins: '3 5 0 0'
- },{
- xtype: 'button',
- align: 'end',
- height: 24,
- text: $I18N.common.main.changeMaster,
- cls: 'main-btn-underline',
- overCls: 'main-btn-underline-over',
- menu: me.getMasterMenu(),
- margins: '3 5 0 0'
- },{
- xtype: 'tbtext',
- align: 'end',
- text: '|'
- },{
- xtype: 'button',
- align: 'end',
- height: 24,
- text: $I18N.common.main.relogin,
- cls: 'main-btn-underline',
- overCls: 'main-btn-underline-over',
- handler: function(){
- main_relogin();
- }
- },{
- xtype: 'tbtext',
- align: 'end',
- text: '|'
- },{
- xtype: 'button',
- height: 24,
- align: 'end',
- text: $I18N.common.main.logout,
- cls: 'main-btn-underline',
- overCls: 'main-btn-underline-over',
- handler: function(){
- logout();
- }
- }],
- height: 35
- });
- this.callParent(arguments);
- },
- prefix: 'uu-',
- addUU: function(p, f, u) {
- if(!Ext.isEmpty(f.value)) {
- var me = this, enval = escape(f.value);
- var tx = '<font size=2 color=blue>' + f.value + '</font>';
- var bt = this.down('button[uumsg=' + enval + ']');
- if(!bt) {
- this.insert(3, {
- text: tx,
- name: this.prefix + u.uu_field,
- xtype: 'button',
- height: 24,
- isuu: true,
- uumsg: enval,
- relative: {
- panel: p,
- field: f,
- uu: u
- },
- cls: 'x-btn-bw',
- iconCls: 'x-btn-uu-medium',
- margins: '3 5 0 0',
- handler: function(btn) {
- var u = btn.relative.uu;
- if(u) {
- me.openUUClient(u, unescape(btn.uumsg));
- }
- }
- });
- }
- }
- },
- clearUU: function() {
- var me = this,
- uu = me.query('button[isuu=true]');
- Ext.each(uu, function(u){
- me.remove(u);
- });
- },
- removeUU: function(p) {
- var me = this,
- uu = me.query('button[isuu=true]');
- Ext.each(uu, function(u){
- var pl = u.relative.panel;
- if(pl.id == p.id)
- me.remove(u);
- });
- },
- refreshUU: function(panel, form, uu) {
- var me = this;
- this.clearUU();
- Ext.each(uu, function(u){
- var f = form.down('#' + u.uu_field);
- if(f) {
- if(!(u.uu_ftype == 1 && f.value == em_code) && !(u.uu_ftype == 2 && f.value == em_name)) {//排除自己
- me.addUU(panel, f, u);
- }
- }
- });
- },
- openUUClient: function(u, val) {
- var ef = 'em_name', tab = 'Employee', uuf = 'em_uu';
- switch(u.uu_ftype) {
- case 0:
- ef = 'em_id';break;
- case 1:
- ef = 'em_code';break;
- case 2:
- ef = 'em_name';break;
- case 3:
- ef = 'em_uu';break;
- case 4:
- ef = 've_id';tab = "Vendor";uuf = "ve_uu";break;
- case 5:
- ef = 've_code';tab = "Vendor";uuf = "ve_uu";break;
- case 6:
- ef = 've_name';tab = "Vendor";uuf = "ve_uu";break;
- case 7:
- ef = 've_uu';tab = "Vendor";uuf = "ve_uu";break;
- case 8:
- ef = 'cu_id';tab = "Customer";uuf = "cu_uu";break;
- case 9:
- ef = 'cu_code';tab = "Customer";uuf = "cu_uu";break;
- case 10:
- ef = 'cu_name';tab = "Customer";uuf = "cu_uu";break;
- case 11:
- ef = 'cu_uu';tab = "Customer";uuf = "cu_uu";break;
- }
- if(ef == uuf) {
- window.location = 'uas:' + val + '@58.61.153.82';
- } else {
- Ext.Ajax.request({
- url : basePath + 'common/getFieldData.action',
- params: {
- caller: tab,
- field: uuf,
- condition: ef + '=\'' + val + '\''
- },
- method : 'post',
- callback : function(options,success,response){
- var rs = new Ext.decode(response.responseText);
- if(rs.exceptionInfo){
- showError(rs.exceptionInfo);
- } else if(rs.success){
- var uu = rs.data;
- if(Ext.isEmpty(uu)){
- showError(val + ' 的关联UU号为空!');
- } else {
- window.location = 'uas:' + uu + '@58.61.153.82';
- }
- }
- }
- });
- }
- },
- getMasterMenu : function() {
- var me = this;
- var menu = Ext.create('Ext.menu.Menu', {
- listeners: {
- buffer: 100,
- beforeshow: function(m) {
- me.getMasters(m);
- },
- afterrender: function( menu ) {
- menu.tip = new Ext.ToolTip({
- target: menu.getEl().getAttribute("id"),
- delegate: ".x-menu-item",
- trackMouse: true,
- renderTo: document.body,
- text: "text",
- title: "",
- width: 160,
- height: 50,
- listeners: {
- beforeshow: function updateTip( tip ) {
- var menuItem = menu.down('#' + tip.triggerElement.id );
- if( !menuItem.initialConfig.qtip ) return false;
- tip.body.dom.innerHTML = menuItem.initialConfig.qtip;
- }
- }
- });
- }
- }
- });
- return menu;
- },
- getMasters : function(m) {
- var me = this;
- if (m.items.items.length == 0 && !m.loaded) {
- // 取账套配置,以及账套权限配置
- Ext.Ajax.request({
- url: basePath + 'common/getMasters.action',
- method: 'GET',
- callback: function(opt, s, r) {
- if (s) {
- var rs = Ext.decode(r.responseText),
- c = rs.currentMaster,
- g = rs.group,
- _t = rs._type,
- _m = rs._master,
- _ma = new Array(),
- items = new Array();
- if(_m != null) {
- _ma = _m.split(',');
- }
- for(var i in rs.masters) {
- var s = rs.masters[i];
- if("true" === g && "admin" !== _t) {
- if(!Ext.Array.contains(_ma, s.ma_name)) {
- if(s.ma_type == 2) {
- if(!s.ma_soncode)
- continue;
- var h = s.ma_soncode.split(','), _b = false;
- for (j in h ) {
- if(Ext.Array.contains(_ma, h[j])) {
- _b = true;break;
- }
- };
- if(!_b) continue;
- } else
- continue;
- }
- }
- var o = {text: s.ma_function, master: s, qtip: s.ma_name,
- listeners: {
- click: function(b) {
- me.changeMaster(b);
- }
- }};
- if (s.ma_name == c) {
- o.iconCls = 'main-todo';
- o.disabled = true;
- }
- items.push(o);
- }
- m.add(items);
- m.show();
- m.loaded = true;
- }
- }
- });
- }
- },
- changeMaster : function(b) {
- var me = this, tab = me.ownerCt.down('tabpanel'), bt = me.ownerCt.down('erpBottom'),tree=me.ownerCt.down('erpTreePanel');
- warnMsg('确定切换到' + b.text + '?', function(t){
- if(t == 'yes' || t == 'ok') {
- Ext.Ajax.request({
- url: basePath + 'common/changeMaster.action',
- params: {
- to: b.qtip
- },
- callback: function(opt, s, r) {
- var rs = Ext.decode(r.responseText);
- if(rs.success) {
- if (tab) {
- var p = tab.plugins[0];
- if (p) {
- p.doClose(true);
- }
- bt.update({sob: b.text});
- window.sob = b.qtip;
- var m = b.ownerCt, items = m.items.items;
- Ext.each(items, function(){
- if(this.id == b.id) {
- this.setIconCls('main-todo');
- this.setDisabled(true);
- } else {
- this.setIconCls(' ');
- this.setDisabled(false);
- }
- });
- var home = tab.down('#HomePage');
- if (home) {
- home.getEl().down('iframe').dom.contentWindow.location.reload();
- }
- } else {
- window.location.reload();
- }
- } else {
- alert('切换失败,请检查您在(' + b.qtip + ')的账号和密码.');
- }
- }
- });
- }
- });
- }
- });
|