InfoPortal.js 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215
  1. Ext.define('erp.view.common.DeskTop.InfoPortal',{
  2. extend: 'erp.view.common.DeskTop.Portlet',
  3. title: '<div class="div-left">消息</div>',
  4. iconCls: 'main-msg',
  5. enableTools:true,
  6. alias: 'widget.infoportal',
  7. activeRefresh:true,
  8. initComponent : function(){
  9. var me=this;
  10. Ext.apply(this,{
  11. items:[Ext.widget('tabpanel',{
  12. autoShow: true,
  13. tabPosition:'top',
  14. minHeight:200,
  15. frame:true,
  16. bodyBorder: false,
  17. border: false,
  18. items:[me._inform(),me._notice(),me._news()]
  19. })]
  20. });
  21. this.callParent(arguments);
  22. },
  23. gridConfig:function(c){
  24. return Ext.apply(c,{
  25. autoScroll:false,
  26. columns:[{
  27. text:'主题',
  28. draggable:false,
  29. fixed:true,
  30. cls:'x-grid-header-simple',
  31. flex:1,
  32. dataIndex:'NO_TITLE',
  33. renderer: function(val, meta, record){
  34. return Ext.String.format('<a href="javascript:openTable({1},\'Note\',\'通知\',\'jsps/oa/info/NoteR.jsp\',\'no_id\',null' + ');" target="_blank">{0}</a>',
  35. record.get('NO_TITLE'),
  36. record.get('NO_ID'));
  37. }
  38. },{
  39. text:'状态',
  40. draggable:false,
  41. cls:'x-grid-header-simple',
  42. width:50,
  43. dataIndex:'STATUS',
  44. fixed:true,
  45. renderer: function readstatus(val,meta,record){
  46. if(val==-1)return '<span style="color:green">已读</span>';
  47. else return '<span style="color:red;">未读</span>';
  48. }
  49. },{
  50. text:'发送人',
  51. cls:'x-grid-header-simple',
  52. draggable:false,
  53. fixed:true,
  54. width:100,
  55. dataIndex:'NO_APPROVER'
  56. },{
  57. text:'发送时间',
  58. cls:'x-grid-header-simple',
  59. draggable:false,
  60. fixed:true,
  61. width:150,
  62. dataIndex:'NO_APPTIME',
  63. xtype:'datecolumn',
  64. renderer:function(value){
  65. return Ext.Date.format(new Date(value),'Y-m-d H:i:s');
  66. }
  67. }]
  68. });
  69. },
  70. _inform:function(config){
  71. var me=this;
  72. return Ext.widget('gridpanel',me.gridConfig({
  73. title:'内部通知',
  74. autoScroll:false,
  75. listeners:{
  76. activate:function(grid){
  77. grid.getStore().load({
  78. params:{
  79. count:grid.ownerCt.pageCount
  80. }
  81. });
  82. }
  83. },
  84. store:Ext.create('Ext.data.Store',{
  85. fields:['NO_ID','NO_TITLE','NO_APPROVER','NO_APPTIME','STATUS'],
  86. proxy: {
  87. type: 'ajax',
  88. url : basePath + 'common/desktop/note/inform.action',
  89. method : 'GET',
  90. extraParams:{
  91. count:me.pageCount
  92. },
  93. reader: {
  94. type: 'json',
  95. root: 'data'
  96. }
  97. },
  98. autoLoad:false
  99. })
  100. }));
  101. },
  102. _notice:function(){
  103. var me=this;
  104. return Ext.widget('gridpanel',me.gridConfig({
  105. title:'行政公告',
  106. autoScroll:false,
  107. listeners:{
  108. activate:function(grid){
  109. grid.getStore().load({
  110. params:{
  111. count:grid.ownerCt.pageCount
  112. }
  113. });
  114. }
  115. },
  116. store:Ext.create('Ext.data.Store',{
  117. fields:['NO_ID','NO_TITLE','NO_APPROVER','NO_APPTIME','STATUS'],
  118. proxy: {
  119. type: 'ajax',
  120. url : basePath + 'common/desktop/note/notice.action',
  121. method : 'GET',
  122. extraParams:{
  123. count:me.pageCount
  124. },
  125. reader: {
  126. type: 'json',
  127. root: 'data'
  128. }
  129. },
  130. autoLoad:false
  131. })
  132. }));
  133. },
  134. _news:function(){
  135. var me=this;
  136. return Ext.widget('gridpanel',{
  137. title:'时事新闻',
  138. autoScroll:false,
  139. columns:[{
  140. text:'主题',
  141. draggable:false,
  142. fixed:true,
  143. cls:'x-grid-header-simple',
  144. flex:1,
  145. dataIndex:'NE_THEME',
  146. renderer: function(val, meta, record){
  147. return Ext.String.format('<a href="javascript:openTable({1},null,\'新闻\',\'oa/news/view.action?ne_id={1}\',\'ne_id\',null' + ');" target="_blank">{0}</a>',
  148. record.get('NE_THEME'),
  149. record.get('NE_ID'));
  150. }
  151. },{
  152. text:'状态',
  153. draggable:false,
  154. cls:'x-grid-header-simple',
  155. width:50,
  156. fixed:true,
  157. dataIndex:'STATUS',
  158. renderer: function readstatus(val,meta,record){
  159. if(val==-1)return '<span style="color:green">已读</span>';
  160. else return '<span style="color:red;">未读</span>';
  161. }
  162. },{
  163. text:'发送人',
  164. draggable:false,
  165. cls:'x-grid-header-simple',
  166. width:100,
  167. fixed:true,
  168. dataIndex:'NE_RELEASER'
  169. },{
  170. text:'发送时间',
  171. draggable:false,
  172. cls:'x-grid-header-simple',
  173. width:150,
  174. fixed:true,
  175. dataIndex:'NE_RELEASEDATE',
  176. xtype:'datecolumn',
  177. renderer:function(value){
  178. return Ext.Date.format(new Date(value),'Y-m-d H:i:s');
  179. }
  180. }],
  181. listeners:{
  182. activate:function(grid){
  183. grid.getStore().load({
  184. params:{
  185. count:grid.ownerCt.pageCount
  186. }
  187. });
  188. }
  189. },
  190. store:Ext.create('Ext.data.Store',{
  191. fields:['NE_THEME','NE_RELEASER','NE_RELEASEDATE','NE_ID','STATUS'],
  192. proxy: {
  193. type: 'ajax',
  194. url : basePath + 'common/desktop/news/getNews.action',
  195. method : 'GET',
  196. extraParams:{
  197. count:me.pageCount
  198. },
  199. reader: {
  200. type: 'json',
  201. root: 'data'
  202. }
  203. },
  204. autoLoad:false
  205. })
  206. });
  207. },
  208. getMore:function(){
  209. openTable(null,null,'更多消息',"jsps/common/moreinfo.jsp",null,null);
  210. },
  211. _dorefresh:function(panel){
  212. var activeTab=panel.down('tabpanel').getActiveTab();
  213. if(activeTab) activeTab.fireEvent('activate',activeTab);
  214. }
  215. });