mailbox.js 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. /**
  2. * 校长信箱
  3. */
  4. Ext.define('school.view.interaction.mailbox.Mailbox', {
  5. extend: 'Ext.grid.Panel',
  6. xtype: 'interaction-mailbox-mailbox',
  7. // dataUrl: '/api/interact/timetable/list',
  8. controller: 'interaction-mailbox-mailbox',
  9. //字段属性
  10. _title: '校长信箱',
  11. _idField: 'id',
  12. _codeField: 'pu_code',
  13. _statusField: 'pu_status',
  14. _statusCodeField: 'pu_statuscode',
  15. _auditmanField: 'pu_auditman',
  16. _auditdateField: 'pu_auditdate',
  17. _relationColumn: 'pd_puid',
  18. _readUrl: '/api/purchase/purchase/read',
  19. _saveUrl: '/api/purchase/purchase/save',
  20. _auditUrl: '/api/purchase/purchase/audit',
  21. _unAuditUrl: '/api/purchase/purchase/unAudit',
  22. _deleteUrl: '/api/purchase/purchase/delete',
  23. _turnInUrl: '/api/purchase/purchase/turnProdin',
  24. initId: 0,
  25. initComponent: function() {
  26. Ext.apply(this, {
  27. // title: '校长信箱',
  28. store: Ext.create('Ext.data.Store', {
  29. fields:['code', 'content', 'Enclosure', 'time', 'name', 'Handle'],
  30. data:[
  31. {code:"U001", content:"孩子作业太少了,回家每天玩王者荣耀,希望学校老师布置作业多一点,让我孩子忙起来", Enclosure:'无', time:"01/10/2004 16:00", name:'张三', Handle:true},
  32. {code:"U002", content:"学校课本费收入明细未公开,希望课本费明细能够向我们家长公开", Enclosure:'有', time:"01/10/2004 16:00", name:'张三', Handle:false},
  33. {code:"U003", content:"觉得十分激烈的交锋了", Enclosure:'无', time:"01/10/2004 16:00", name:'张三', Handle:true},
  34. ]
  35. }),
  36. columns : [
  37. {text: '编号',dataIndex: 'code', flex: 0.1},
  38. {text: '内容',dataIndex: 'content', flex: 0.3},
  39. {text: '附件',dataIndex: 'Enclosure', flex: 0.1},
  40. {text: '日期',dataIndex: 'time',xtype: 'datecolumn',format:'Y-m-d H:i', flex: 0.2},
  41. {text: '提出人',dataIndex: 'name', flex: 0.1},
  42. {text: '处理', flex: 0.2, align:'center', dataIndex: 'Handle',
  43. renderer: function(val,meta,rec) {
  44. // 为元素生成唯一id
  45. var id = Ext.id();
  46. if (!rec.data.Handle) {
  47. return Ext.String.format('<div>已回复</div>');
  48. } else {
  49. Ext.defer(function() {
  50. Ext.widget('button', {
  51. renderTo: id,
  52. text: '回复',
  53. // handler: 'ReplyClick'//点击回复事件
  54. handler: function () {//点击回复事件
  55. Ext.MessageBox.show({
  56. title: '回复处理',
  57. msg: '回复对象:'+rec.data.code,
  58. width:500,
  59. height:600,
  60. buttons: Ext.MessageBox.OKCANCEL,
  61. multiline: true,
  62. scope: this,
  63. fn: function (btn,text) {//回调函数
  64. if (btn == 'ok') {
  65. alert('点击的按钮是:'+btn+'内容是:'+text);
  66. } else {
  67. return
  68. }
  69. },
  70. });
  71. }
  72. });
  73. }, 50);
  74. return Ext.String.format('<div id="{0}"></div>', id);
  75. }
  76. }
  77. },
  78. ],
  79. listeners: {// 每一行添加点击事件
  80. 'rowclick': function(grid, rowIndex, e) {
  81. let data = rowIndex.data//获取点击行的数据
  82. // console.log(data);
  83. },
  84. },
  85. tbar: ['->',{
  86. xtype: 'button',
  87. text: '导出',
  88. handler: 'exportClick'
  89. }, {
  90. xtype: 'button',
  91. text: '删除',
  92. handler: 'deleteClick'
  93. }, {
  94. xtype: 'button',
  95. text: '批量回复',
  96. handler: 'batchClick'
  97. }],
  98. multiSelect:true,//运行多选,默认是单选
  99. dockedItems :[{//分页组件
  100. xtype:'pagingtoolbar',//分页组件
  101. store:Ext.data.StoreManager.lookup('s_user'),//分页组件也需要获取到数据
  102. dock:'bottom',//定位到底部
  103. displayInfo:true//是否展示信息
  104. }],
  105. });
  106. this.callParent();
  107. },
  108. })