ReceivedDocument.js 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  1. Ext.QuickTips.init();
  2. Ext.define('erp.controller.oa.persontask.myDocument.ReceivedDocument', {
  3. extend: 'Ext.app.Controller',
  4. FormUtil: Ext.create('erp.util.FormUtil'),
  5. GridUtil: Ext.create('erp.util.GridUtil'),
  6. BaseUtil: Ext.create('erp.util.BaseUtil'),
  7. views:[
  8. 'oa.persontask.myDocument.Viewport','common.datalist.GridPanel','common.datalist.Toolbar',
  9. 'core.trigger.DbfindTrigger','core.form.ConDateField','core.form.WordSizeField','oa.mail.MailPaging'
  10. ],
  11. init:function(){
  12. var me = this;
  13. this.control({
  14. 'erpDatalistGridPanel': {
  15. afterrender: function(grid){
  16. grid.onGridItemClick = function(){//改为点击button进入详细界面
  17. me.onGridItemClick(grid.selModel.lastSelected);
  18. };
  19. }
  20. },
  21. 'button[id=sod]': {
  22. click: function(){
  23. // var grid = Ext.getCmp('grid');
  24. var orid = 0;
  25. Ext.Ajax.request({//拿到grid的columns
  26. url : basePath + "hr/employee/getHrOrg.action",
  27. params: {
  28. em_id: em_uu
  29. },
  30. method : 'post',
  31. async: false,
  32. callback : function(options, success, response){
  33. parent.Ext.getCmp("content-panel").getActiveTab().setLoading(false);
  34. console.log(response);
  35. var res = new Ext.decode(response.responseText);
  36. if(res.exceptionInfo){
  37. showError(res.exceptionInfo);
  38. }
  39. if(res.hrOrg){
  40. orid = res.hrOrg.or_id;
  41. }
  42. }
  43. });
  44. var condition = 'urlcondition=sod_zs_organ_id=' + orid;// + " OR sod_zs_emp_id like '%" + em_uu + "%'";
  45. var path = window.location.href.toString().split('?');
  46. window.location.href = path[0] + '?whoami=SendOfficialDocument!See&' + condition;
  47. }
  48. },
  49. 'button[id=all]':{
  50. afterrender: function(btn){
  51. var who = getUrlParam('whoami');
  52. if(contains(who, 'Instruction', true)){
  53. btn.setVisible(false);
  54. } else {
  55. btn.setVisible(true);
  56. }
  57. },
  58. click: function(){
  59. var grid = Ext.getCmp('grid');
  60. var orid = 0;
  61. Ext.Ajax.request({//拿到grid的columns
  62. url : basePath + "hr/employee/getHrOrg.action",
  63. params: {
  64. em_id: em_uu
  65. },
  66. method : 'post',
  67. async: false,
  68. callback : function(options, success, response){
  69. parent.Ext.getCmp("content-panel").getActiveTab().setLoading(false);
  70. console.log(response);
  71. var res = new Ext.decode(response.responseText);
  72. if(res.exceptionInfo){
  73. showError(res.exceptionInfo);
  74. }
  75. if(res.hrOrg){
  76. orid = res.hrOrg.or_id;
  77. }
  78. }
  79. });
  80. grid.getCount('SendOfficialDocument!See', '1=1');
  81. grid.filterCondition = 'sod_zs_organ_id=' + orid + " OR sod_zs_emp_id like '%" + em_uu + "%'";
  82. }
  83. },
  84. 'button[id=in]': {
  85. click: function(){
  86. // var grid = Ext.getCmp('grid');
  87. var condition = "urlcondition=in_leader_id='" + em_code + "'";
  88. var path = window.location.href.toString().split('?');
  89. window.location.href = path[0] + '?whoami=Instruction!See&' + condition;
  90. }
  91. }
  92. });
  93. },
  94. onGridItemClick: function(record){//grid行选择
  95. console.log(record);
  96. var me = this;
  97. var who = getUrlParam('whoami');
  98. var path = '';
  99. var id = 0;
  100. var title = '';
  101. if(contains(who, 'Send', true)){
  102. id = record.data.sod_id;
  103. title = '发文:' + record.data.sod_title;
  104. path = 'jsps/oa/officialDocument/sendODManagement/sodDetail.jsp';
  105. } else if(contains(who, 'Instruction', true)){
  106. id = record.data.in_id;
  107. title = '内部请示:' + record.data.in_title;
  108. path = 'jsps/oa/officialDocument/instruction/instructionDetail.jsp';
  109. }
  110. var panel = Ext.getCmp(who + id);
  111. var main = parent.Ext.getCmp("content-panel");
  112. if(!panel){
  113. panel = {
  114. title : title,
  115. tag : 'iframe',
  116. tabConfig:{tooltip: title},
  117. frame : true,
  118. border : false,
  119. layout : 'fit',
  120. iconCls : 'x-tree-icon-tab-tab1',
  121. html : '<iframe id="iframe_' + who + id + '" src="' + basePath + path + "?flag=query&id=" + id + '" height="100%" width="100%" frameborder="0" scrolling="yes"></iframe>',
  122. closable : true,
  123. listeners : {
  124. close : function(){
  125. main.setActiveTab(main.getActiveTab().id);
  126. }
  127. }
  128. };
  129. me.FormUtil.openTab(panel, who + id);
  130. }else{
  131. main.setActiveTab(panel);
  132. }
  133. }
  134. });