CallPortal.js 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  1. Ext.define('erp.view.common.DeskTop.CallPortal',{
  2. extend: 'erp.view.common.DeskTop.Portlet',
  3. title: '<div class="div-left">客户生日提醒</div>',
  4. iconCls: 'main-notice',
  5. enableTools:true,
  6. alias: 'widget.callportal',
  7. //activeRefresh:true,
  8. //autoRefresh:true,
  9. itemConfig:{
  10. today:'今天',
  11. nearWeek:'近七天',
  12. nearMonth:'30天内',
  13. all:'全部'
  14. },
  15. initComponent : function(){
  16. var me=this;
  17. Ext.apply(this,{
  18. items:[Ext.widget('tabpanel',{
  19. autoShow: true,
  20. tabPosition:'top',
  21. minHeight:200,
  22. frame:true,
  23. bodyBorder: false,
  24. border: false,
  25. items:[me._custbirth()]
  26. })]
  27. });
  28. this.callParent(arguments);
  29. },
  30. _custbirth:function(){
  31. var me=this,items=new Array(),conf=me.itemConfig;
  32. for(var c in conf){
  33. var condition='';
  34. switch(c){
  35. case 'today':
  36. condition+="WHERE DAYS=0";
  37. break;
  38. case 'nearWeek':
  39. condition+="WHERE DAYS>=0 AND DAYS<7";
  40. break;
  41. case 'nearMonth':
  42. condition+="WHERE DAYS>=0 AND DAYS<30";
  43. break;
  44. }
  45. var config={
  46. columnLines:false,
  47. title:conf[c],
  48. listeners:{
  49. 'activate':function(tab){
  50. tab.getStore().load();
  51. }
  52. },
  53. columns:[{
  54. text:'客户',
  55. draggable:false,
  56. fixed:true,
  57. cls:'x-grid-header-simple',
  58. flex:1,
  59. dataIndex:'CU_ID',
  60. renderer: function(val, meta, record){
  61. return Ext.String.format('<a href="javascript:openTable({1},\'Customer!Base\',\'客户\',\'jsps/drp/distribution/customerType.jsp\',\'cu_id\',null,null,null);">{2} {0}</a>',
  62. record.get('CU_NAME'),
  63. record.get('CU_ID'),
  64. record.get('CU_CODE'));
  65. }
  66. },{
  67. text:'联系人',
  68. draggable:false,
  69. cls:'x-grid-header-simple',
  70. width:100,
  71. fixed:true,
  72. dataIndex:'CT_NAME',
  73. renderer: function(val, meta, record){
  74. return Ext.String.format('<a href="javascript:openTable({1},\'Contact\',\'客户联系人\',\'jsps/crm/customermgr/development/contact.jsp\',\'ct_id\',null,null,null);">{0}</a>',
  75. record.get('CT_NAME'),
  76. record.get('CT_ID'));
  77. }
  78. },{
  79. text:'生日',
  80. draggable:false,
  81. cls:'x-grid-header-simple',
  82. width:100,
  83. fixed:true,
  84. xtype:'datecolumn',
  85. renderer:function(value){
  86. return Ext.Date.format(new Date(value),'Y-m-d');
  87. },
  88. dataIndex:'BIRTHDAY'
  89. },{
  90. text:'倒计时/天',
  91. draggable:false,
  92. cls:'x-grid-header-simple',
  93. width:80,
  94. fixed:true,
  95. dataIndex:'DAYS'
  96. }],
  97. store:Ext.create('Ext.data.Store',{
  98. fields:['CU_ID','CU_CODE','CU_NAME','CT_ID','CT_NAME','BIRTHDAY','DAYS'],
  99. proxy: {
  100. type: 'ajax',
  101. url : basePath + 'common/desktop/calls/getCustBirth.action',
  102. method : 'GET',
  103. extraParams:{
  104. count:me.pageCount,
  105. condition:condition
  106. },
  107. reader: {
  108. type: 'json',
  109. root: 'data'
  110. }
  111. },
  112. autoLoad:false
  113. })};
  114. items.push(Ext.create('Ext.grid.Panel',config));
  115. }
  116. return items;
  117. },
  118. getMore:function(){
  119. openTable(null,null,'我的客户联系人',"jsps/common/datalist.jsp?whoami=Contact!Distr&urlcondition=cd_sellercode=session:em_code&_noc=1",null,null);
  120. }/*,
  121. _dorefresh:function(panel){
  122. var activeTab=panel.down('tabpanel').getActiveTab();
  123. if(activeTab) activeTab.fireEvent('activate',activeTab);
  124. }*/
  125. });